use of com.emilsjolander.components.stickylistheaders.StickyListHeadersListView in project little-bear-dictionary by daimajia.
the class WordsFragment method onViewCreated.
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
StickyListHeadersListView stickyList = (StickyListHeadersListView) view.findViewById(R.id.list);
stickyList.setDivider(new ColorDrawable(0xffffffff));
stickyList.setDividerHeight(1);
stickyList.setOnScrollListener(this);
stickyList.setOnItemClickListener(this);
stickyList.setOnHeaderClickListener(this);
if (savedInstanceState != null) {
firstVisible = savedInstanceState.getInt(KEY_LIST_POSITION);
}
DictionaryDB dictionaryDB = new DictionaryDB(getActivity(), DictionaryDB.DB_NAME, null, DictionaryDB.DB_VERSION);
SQLiteDatabase sqLiteDatabase = dictionaryDB.getReadableDatabase();
Cursor cursor = sqLiteDatabase.rawQuery("select * from word order by word", null);
WordAdapter wordAdapter = new WordAdapter(getActivity(), cursor);
stickyList.setAdapter(wordAdapter);
stickyList.setSelection(firstVisible);
}
Aggregations