use of com.zhan_dui.dictionary.cursoradapters.OfflineListCursorAdapter in project little-bear-dictionary by daimajia.
the class DictionaryManageFragment method onDestroyView.
@Override
public void onDestroyView() {
super.onDestroyView();
QueryProcessor.updateCacheDictionaryList(getActivity().getApplicationContext());
if (mDictionaryManageFragment.mOfflineDictionaryManageView == null) {
return;
}
DragSortListView dragSortListView = (DragSortListView) mDictionaryManageFragment.mOfflineDictionaryManageView.findViewById(android.R.id.list);
OfflineListCursorAdapter dragSortCursorAdapter = (OfflineListCursorAdapter) dragSortListView.getInputAdapter();
ArrayList<Integer> SortedResult = dragSortCursorAdapter.getCursorPositions();
if (SortedResult == null || SortedResult.size() == 0) {
return;
}
Cursor cursor = dragSortCursorAdapter.getCursor();
cursor.moveToPosition(-1);
int i = 0;
DictionaryDB dictionaryDB = new DictionaryDB(getActivity(), DictionaryDB.DB_NAME, null, DictionaryDB.DB_VERSION);
SQLiteDatabase sqLiteDatabase = dictionaryDB.getWritableDatabase();
while (cursor.moveToNext()) {
String[] args = { SortedResult.get(i).toString(), cursor.getString(cursor.getColumnIndex("_id")) };
sqLiteDatabase.execSQL("update `dictionary_list` set `dictionary_order`= ? where `_id`= ?", args);
i++;
}
}
use of com.zhan_dui.dictionary.cursoradapters.OfflineListCursorAdapter in project little-bear-dictionary by daimajia.
the class GetOfflineAsyncTask method onPostExecute.
@Override
protected void onPostExecute(Cursor result) {
super.onPostExecute(result);
mWaittingView.setVisibility(View.GONE);
mCursorAdapter = new OfflineListCursorAdapter(mContext, result, true);
mOfflineDragSortListView.setAdapter(mCursorAdapter);
mSqLiteDatabase.close();
}
Aggregations