use of pri.weiqiang.liyujapanese.mvp.bean.gojuon.GojuonMemory in project MyJapanese by 54wall.
the class DBManager method getGojuonChengyu.
public synchronized List<GojuonMemory> getGojuonChengyu() {
if (gojuonMemoryChengyu == null) {
SQLiteDatabase db = DatabaseHelper.getInstance(BaseApplication.getInstance()).getReadableDatabase();
// Cursor cursor = db.rawQuery("select * from " + DatabaseHelper.DB_TABLE_GOJUON, null);
Cursor cursor = db.query(DatabaseHelper.DB_TABLE_GOJUON, null, null, null, null, null, null);
gojuonMemoryChengyu = new ArrayList<>();
GojuonMemory item;
while (cursor.moveToNext()) {
int id = cursor.getInt(cursor.getColumnIndex("id"));
String chengyu = cursor.getString(cursor.getColumnIndex("chengyu"));
if (chengyu != null) {
String hiragana = cursor.getString(cursor.getColumnIndex("hiragana"));
String katakana = cursor.getString(cursor.getColumnIndex("katakana"));
String rome = cursor.getString(cursor.getColumnIndex("rome"));
String memory = cursor.getString(cursor.getColumnIndex("memory"));
item = new GojuonMemory(id, hiragana, katakana, rome, memory, chengyu);
gojuonMemoryChengyu.add(item);
}
}
cursor.close();
db.close();
}
return gojuonMemoryChengyu;
}
use of pri.weiqiang.liyujapanese.mvp.bean.gojuon.GojuonMemory in project MyJapanese by 54wall.
the class GojuonMemoryFragment method setData.
@Override
public void setData(List<GojuonMemory> data) {
Log.e(TAG, "setData!!");
adapter = new GojuonMemoryRecyclerAdapter(category_gojuon_memory, data);
adapter.setOnItemClickListener(new GojuonMemoryRecyclerAdapter.OnItemClickListener() {
@Override
public void onClick(GojuonMemory bean) {
Log.e(TAG, "onItemClick bean:" + bean.getRome() + ":" + bean.getKatakana());
SoundPoolManager.getInstance().play(bean.getRome());
}
});
adapter.setOnItemLongClickListener(new GojuonMemoryRecyclerAdapter.OnItemLongClickListener() {
@Override
public void onLongClick(GojuonMemory item) {
Log.e(TAG, "onLongClick item:" + item.getRome() + ":" + item.getKatakana());
GojuonGif gif = GifManager.getInstance().getJPGif(item.getRome());
if (gif != null) {
if (BaseApplication.TYPE_MING == Constants.TYPE_HIRAGANA) {
new ImageDialog.Builder(getContext()).setResId(gif.getHiragana()).override((int) ResourceUtils.getDimension(getContext(), R.dimen.dialog_width), (int) ResourceUtils.getDimension(getContext(), R.dimen.dialog_height)).create().show();
} else {
new ImageDialog.Builder(getContext()).setResId(gif.getKatakana()).override((int) ResourceUtils.getDimension(getContext(), R.dimen.dialog_width), (int) ResourceUtils.getDimension(getContext(), R.dimen.dialog_height)).create().show();
}
}
}
});
mRecyclerView.setAdapter(adapter);
}
use of pri.weiqiang.liyujapanese.mvp.bean.gojuon.GojuonMemory in project LiYuJapanese by 54wall.
the class GojuonMemoryFragment method setData.
@Override
public void setData(List<GojuonMemory> data) {
Log.e(TAG, "setData!!");
adapter = new GojuonMemoryRecyclerAdapter(category_gojuon_memory, data);
adapter.setOnItemClickListener(new GojuonMemoryRecyclerAdapter.OnItemClickListener() {
@Override
public void onClick(GojuonMemory bean) {
Log.e(TAG, "onItemClick bean:" + bean.getRome() + ":" + bean.getKatakana());
SoundPoolManager.getInstance().play(bean.getRome());
}
});
adapter.setOnItemLongClickListener(new GojuonMemoryRecyclerAdapter.OnItemLongClickListener() {
@Override
public void onLongClick(GojuonMemory item) {
Log.e(TAG, "onLongClick item:" + item.getRome() + ":" + item.getKatakana());
GojuonGif gif = GifManager.getInstance().getJPGif(item.getRome());
if (gif != null) {
if (BaseApplication.TYPE_MING == Constants.TYPE_HIRAGANA) {
new ImageDialog.Builder(getContext()).setResId(gif.getHiragana()).override((int) ResourceUtils.getDimension(getContext(), R.dimen.dialog_width), (int) ResourceUtils.getDimension(getContext(), R.dimen.dialog_height)).create().show();
} else {
new ImageDialog.Builder(getContext()).setResId(gif.getKatakana()).override((int) ResourceUtils.getDimension(getContext(), R.dimen.dialog_width), (int) ResourceUtils.getDimension(getContext(), R.dimen.dialog_height)).create().show();
}
}
}
});
mRecyclerView.setAdapter(adapter);
}
Aggregations