blob: cf2e75094e0e56e6d41fb8f7759047030d7859cd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
/*package com.example.mylauncher;
import android.text.Editable;
import android.text.TextWatcher;
public class SearchTextWatcher implements TextWatcher {
private MainActivity activity;
public SearchTextWatcher(MainActivity activity) {
this.activity = activity;
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
activity.filterList(s.toString().toLowerCase());
}
@Override
public void afterTextChanged(Editable s) {}
}*/
package com.example.mylauncher;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.widget.EditText;
public class SearchTextWatcher implements TextWatcher {
private MainActivity activity;
public SearchTextWatcher(MainActivity activity) {
this.activity = activity;
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {}
@Override
public void afterTextChanged(Editable s) {
// Move filtering here to ensure it happens after the text is fully updated
activity.filterList(s.toString().toLowerCase());
}
}
|