use of com.alphago.alphago.model.CollectCategory in project Alphago by Onedelay.
the class DbHelper method categoryAllSelect.
public List<CollectCategory> categoryAllSelect() {
SQLiteDatabase db = getReadableDatabase();
String[] projection = { "*" };
Cursor c = db.query(CategoryEntry.TABLE_NAME, projection, null, null, null, null, null);
String selection = CardBookEntry.COLUMN_NAME_CATEGORY + " = ?";
List<CollectCategory> categoryList = new ArrayList<>();
while (c.moveToNext()) {
long categoryId = c.getLong(c.getColumnIndexOrThrow(CategoryEntry._ID));
String category = c.getString(c.getColumnIndexOrThrow(CategoryEntry.COLUMN_NAME_LABEL));
String filePath = c.getString(c.getColumnIndexOrThrow(CategoryEntry.COLUMN_NAME_PATH));
String[] selectionArgs = { String.valueOf(categoryId) };
Cursor cards = db.query(CardBookEntry.TABLE_NAME, projection, selection, selectionArgs, null, null, null);
categoryList.add(new CollectCategory(categoryId, category, filePath, getAchievementRate(categoryId)));
cards.close();
}
c.close();
return categoryList;
}
use of com.alphago.alphago.model.CollectCategory in project Alphago by Onedelay.
the class CollectionActivity method onCategoryClick.
@Override
public void onCategoryClick(Object data) {
if (data instanceof CollectCategory) {
long catId = ((CollectCategory) data).getId();
Intent intent = new Intent(getBaseContext(), CollectionListActivity.class);
intent.putExtra("categoryId", catId);
startActivity(intent);
}
}
Aggregations