/* update app into */ private void updateAppList(boolean bool) { ApplicationListAdapter adapter = (ApplicationListAdapter) mAppInfoList.getAdapter(); for (int i = 0; i < adapter.getCount(); i++) { AppListInfo tempAppListInfo = (AppListInfo) adapter.getItem(i); tempAppListInfo.checked = bool; } mAppInfoAdapter.updateList(); }
@Override protected void onListItemClick(ListView l, View v, int position, long id) { ApplicationListAdapter adapter = (ApplicationListAdapter) mAppInfoList.getAdapter(); AppListInfo tempAppInfo = (AppListInfo) adapter.getItem(position); /* change check of list item */ tempAppInfo.checked = !tempAppInfo.checked; mAppInfoAdapter.updateList(); return; }
/* * Method implementing functionality of buttons clicked * * @see android.view.View.OnClickListener#onClick(android.view.View) */ public void onClick(View v) { if (v == mOkButton) { SharedPreferences curAppGrp = mCatalogue.getPreferences(); if (curAppGrp == null) return; // should not go here. SharedPreferences.Editor editor = curAppGrp.edit(); // editor.clear(); ApplicationListAdapter adapter = (ApplicationListAdapter) mAppInfoList.getAdapter(); for (int i = 0; i < adapter.getCount(); i++) { AppListInfo tempAppListInfo = (AppListInfo) adapter.getItem(i); boolean checked = tempAppListInfo.checked; // ADW: Change to only store hidden apps if (checked) editor.putBoolean(tempAppListInfo.className, true); else editor.remove(tempAppListInfo.className); if (DBG && checked) Log.v("-----", tempAppListInfo.className); } editor.commit(); setResult(RESULT_OK); finish(); } }