@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); uiThreadHandler = new Handler(); mAdapter = new DictionaryArrayAdapter(getActivity(), android.R.id.list); availableDictionaries = AvailableDictionaries.getInstance(this.getActivity()); availableDictionaries.subscribeSettingsFragment(this); dictsListListener = createDictsListListener(); dictsToDelete = new ArrayList<Integer>(); }
@Override public void onListItemClick(ListView l, View view, int position, long id) { Dictionary dict = mAdapter.getItem(position); TextView dictStatusText = (TextView) view.findViewById(R.id.dict_status); DictionaryStatus dictStatus = new DictionaryStatus(getActivity(), dictStatusText); if (dict.isActive()) { availableDictionaries.setDictionaryActive(dict, false); } else { availableDictionaries.setDictionaryActive(dict, true); } dictStatus.toggle(); }
public void onDictionariesRefresh() { dicts = availableDictionaries.getList(); uiThreadHandler.post(refreshDictsList()); }
private void deleteDictionaries() { for (Integer i : dictsToDelete) availableDictionaries.deleteDictionary(mAdapter.getItem(i)); }