use of pri.weiqiang.liyujapanese.mvp.bean.dic.Word in project MyJapanese by 54wall.
the class WordsFragment method setData.
@Override
public void setData(List<Word> data) {
adapter = new WordsRecyclerAdapter(getContext(), data, isExpandable);
mRecyclerView.setAdapter(adapter);
LayoutAnimationHelper.getInstance().playLayoutAnimation(mRecyclerView, LayoutAnimationHelper.getInstance().getAnimationSetFromBottom(), LayoutAnimationController.ORDER_NORMAL);
adapter.setOnItemClickListener(new WordsRecyclerAdapter.OnItemClickListener() {
@Override
public void onItemClick(Word bean) {
}
});
}
use of pri.weiqiang.liyujapanese.mvp.bean.dic.Word in project LiYuJapanese by 54wall.
the class FavWordsFragment method setData.
@Override
public void setData(List<Word> data) {
adapter = new FavWordsRecyclerAdapter(getContext(), data, isExpandable);
mRecyclerView.setAdapter(adapter);
LayoutAnimationHelper.getInstance().playLayoutAnimation(mRecyclerView, LayoutAnimationHelper.getInstance().getAnimationSetFromBottom(), LayoutAnimationController.ORDER_NORMAL);
adapter.setOnItemClickListener(new FavWordsRecyclerAdapter.OnItemClickListener() {
@Override
public void onItemClick(Word bean) {
}
});
}
use of pri.weiqiang.liyujapanese.mvp.bean.dic.Word in project LiYuJapanese by 54wall.
the class DBManager method getAllFav.
public synchronized List<Word> getAllFav() {
Log.e(TAG, "getAllFav!!!!");
// 收藏这个表,因为经常更新,所以即使mFavList不为null也不能直接使用
if (isTableExist(DatabaseHelper.DB_TABLE_FAV)) {
SQLiteDatabase db = DatabaseHelper.getInstance(BaseApplication.getInstance()).getReadableDatabase();
// Cursor cursor = db.rawQuery("select * from " + DatabaseHelper.DB_TABLE_FAV, null);
Cursor cursor = db.query(DatabaseHelper.DB_TABLE_FAV, null, null, null, null, null, null);
mFavList = new ArrayList<>();
Word item;
while (cursor.moveToNext()) {
int id = cursor.getInt(cursor.getColumnIndex("_id"));
String book_id = cursor.getString(cursor.getColumnIndex("book_id"));
String lesson_id = cursor.getString(cursor.getColumnIndex("lesson_id"));
String word = cursor.getString(cursor.getColumnIndex("word"));
String phonetic = cursor.getString(cursor.getColumnIndex("phonetic"));
String translation = cursor.getString(cursor.getColumnIndex("translation"));
int fav = cursor.getInt(cursor.getColumnIndex("fav"));
int cache = cursor.getInt(cursor.getColumnIndex("cache"));
item = new Word(id, book_id, lesson_id, word, phonetic, translation, fav, cache);
Log.e(TAG, "getAllFav word:" + item.toString());
mFavList.add(item);
}
cursor.close();
db.close();
}
return mFavList;
}
use of pri.weiqiang.liyujapanese.mvp.bean.dic.Word in project LiYuJapanese by 54wall.
the class DBManager method getFav.
public synchronized List<Word> getFav(String lessonId) {
Log.e(TAG, "getAllFav!!!!");
// 收藏这个表,因为经常更新,所以即使mFavList不为null也不能直接使用
if (isTableExist(DatabaseHelper.DB_TABLE_FAV)) {
SQLiteDatabase db = DatabaseHelper.getInstance(BaseApplication.getInstance()).getReadableDatabase();
// Cursor cursor = db.rawQuery("select * from " + DatabaseHelper.DB_TABLE_FAV, null);
Cursor cursor = db.query(DatabaseHelper.DB_TABLE_FAV, null, null, null, null, null, null);
mFavList = new ArrayList<>();
Word item;
while (cursor.moveToNext()) {
String lesson_id = cursor.getString(cursor.getColumnIndex("lesson_id"));
if (lesson_id.equals(lessonId)) {
int id = cursor.getInt(cursor.getColumnIndex("_id"));
String book_id = cursor.getString(cursor.getColumnIndex("book_id"));
String word = cursor.getString(cursor.getColumnIndex("word"));
String phonetic = cursor.getString(cursor.getColumnIndex("phonetic"));
String translation = cursor.getString(cursor.getColumnIndex("translation"));
int fav = cursor.getInt(cursor.getColumnIndex("fav"));
int cache = cursor.getInt(cursor.getColumnIndex("cache"));
item = new Word(id, book_id, lesson_id, word, phonetic, translation, fav, cache);
Log.e(TAG, "getAllFav word:" + item.toString());
mFavList.add(item);
}
}
cursor.close();
db.close();
}
return mFavList;
}
Aggregations