Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ArrayList<ContactItem> numberResults = new ArrayList<ContactItem>();
- Set<ContactItem> allResults = new LinkedHashSet<ContactItem>();
- static ArrayList<ContactItem> contacts = new ArrayList<ContactItem>();
- + static String input;
- public T9Search(Context context) {
- mContext = context;
- @@ -126,17 +127,20 @@ class T9Search {
- public T9SearchResult search(String number) {
- nameResults.clear();
- numberResults.clear();
- - allResults.clear();
- number=number.replaceAll( "[^\\d]", "" );
- + if (input== null || number.length() < input.length()) {
- + allResults.clear();
- + }
- + input = number;
- int pos = 0;
- mSortMode = Integer.parseInt(PreferenceManager.getDefaultSharedPreferences(mContext).getString("t9_sort", "1"));
- //Go through each contact
- - for (ContactItem item : contacts) {
- - if (item.normalNumber.contains(number)) {
- - item.matchId = item.normalNumber.indexOf(number);
- + for (ContactItem item : (number.length() < input.length() ? contacts : allResults)) {
Add Comment
Please, Sign In to add comment