use of pri.weiqiang.liyujapanese.mvp.bean.gojuon.GojuonItem in project MyJapanese by 54wall.
the class DBManager method getZhuoYinWithoutHeader.
public List<GojuonItem> getZhuoYinWithoutHeader() {
if (zhuoYinWithoutHeader == null) {
zhuoYinWithoutHeader = new ArrayList<>();
List<GojuonItem> query = getZhuoYin();
for (GojuonItem item : query) {
if (item.getRow() != 0 && item.getColumn() != 0 && item.isExisted()) {
zhuoYinWithoutHeader.add(item);
}
}
}
return zhuoYinWithoutHeader;
}
use of pri.weiqiang.liyujapanese.mvp.bean.gojuon.GojuonItem in project MyJapanese by 54wall.
the class DBManager method query.
public synchronized List<GojuonItem> query() {
if (query == 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);
query = new ArrayList<>();
GojuonItem item;
while (cursor.moveToNext()) {
int id = cursor.getInt(cursor.getColumnIndex("id"));
int row = cursor.getInt(cursor.getColumnIndex("row"));
int column = cursor.getInt(cursor.getColumnIndex("column"));
String hiragana = cursor.getString(cursor.getColumnIndex("hiragana"));
String katakana = cursor.getString(cursor.getColumnIndex("katakana"));
String rome = cursor.getString(cursor.getColumnIndex("rome"));
int category = cursor.getInt(cursor.getColumnIndex("category"));
int type = cursor.getInt(cursor.getColumnIndex("type"));
boolean existed = cursor.getInt(cursor.getColumnIndex("existed")) == 1;
item = new GojuonItem(id, row, column, hiragana, katakana, rome, category, type, existed);
query.add(item);
}
cursor.close();
db.close();
}
return query;
}
use of pri.weiqiang.liyujapanese.mvp.bean.gojuon.GojuonItem in project MyJapanese by 54wall.
the class DBManager method getQingYinWithoutHeader.
public List<GojuonItem> getQingYinWithoutHeader() {
if (qingYinWithoutHeader == null) {
qingYinWithoutHeader = new ArrayList<>();
List<GojuonItem> query = getQingYin();
for (GojuonItem item : query) {
if (item.getRow() != 0 && item.getColumn() != 0 && item.isExisted()) {
qingYinWithoutHeader.add(item);
}
}
}
return qingYinWithoutHeader;
}
use of pri.weiqiang.liyujapanese.mvp.bean.gojuon.GojuonItem in project MyJapanese by 54wall.
the class DBManager method getAoYin.
public List<GojuonItem> getAoYin() {
if (aoYin == null) {
aoYin = new ArrayList<>();
List<GojuonItem> query = query();
for (GojuonItem item : query) {
if (item.getCategory() == Constants.CATEGORY_AOYIN) {
aoYin.add(item);
}
}
Collections.sort(aoYin, new GojuonItemComporator());
}
return aoYin;
}
use of pri.weiqiang.liyujapanese.mvp.bean.gojuon.GojuonItem in project MyJapanese by 54wall.
the class DBManager method getZhuoYin.
public List<GojuonItem> getZhuoYin() {
if (zhuoYin == null) {
zhuoYin = new ArrayList<>();
List<GojuonItem> query = query();
for (GojuonItem item : query) {
if (item.getCategory() == Constants.CATEGORY_ZHUOYIN) {
zhuoYin.add(item);
}
}
Collections.sort(zhuoYin, new GojuonItemComporator());
}
return zhuoYin;
}
Aggregations