@SuppressLint("DefaultLocale")
    @Override
    public void notifyDataSetInvalidated() {
      alphaIndexer.clear();
      for (int i = filteredAppList.size() - 1; i >= 0; i--) {
        ApplicationInfo app = filteredAppList.get(i);
        String appName = app.name;
        String firstChar;
        if (appName == null || appName.length() < 1) {
          firstChar = "@";
        } else {
          firstChar = appName.substring(0, 1).toUpperCase();
          if (firstChar.charAt(0) > 'Z' || firstChar.charAt(0) < 'A') firstChar = "@";
        }
        alphaIndexer.put(firstChar, i);
      }

      Set<String> keys = alphaIndexer.keySet();
      Iterator<String> it = keys.iterator();
      ArrayList<String> keyList = new ArrayList<String>();
      while (it.hasNext()) {
        keyList.add(it.next());
      }

      Collections.sort(keyList);
      sections = new String[keyList.size()];
      keyList.toArray(sections);

      super.notifyDataSetInvalidated();
    }
Example #2
0
 public void addTodoItem(View v) {
   EditText etNewItem = (EditText) findViewById(R.id.etNewItem);
   String item = etNewItem.getText().toString();
   if (item != null && item.trim().length() > 0) {
     items.add(item);
     itemsAdapter.notifyDataSetInvalidated();
     etNewItem.setText("");
     saveItems();
   }
 }
Example #3
0
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   if (resultCode == RESULT_OK && requestCode == REQUEST_CODE) {
     String item = data.getStringExtra("item");
     int position = data.getIntExtra("position", -1);
     if (position >= 0 && position < items.size()) {
       items.set(position, item);
       itemsAdapter.notifyDataSetInvalidated();
       saveItems();
     }
   }
 }
 @SuppressWarnings("unchecked")
 @Override
 public void notifyDataSetInvalidated() {
   ((AppFilter) getFilter()).setSourceObjects(this.originalObjects);
   super.notifyDataSetInvalidated();
 }
Example #5
0
 public void notifyDataSetInvalidated() {
   super.notifyDataSetInvalidated();
 }