use of com.google.samples.apps.topeka.model.Theme in project android-topeka by googlesamples.
the class QuizFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
// Create a themed Context and custom LayoutInflater
// to get nicely themed views in this Fragment.
final Theme theme = mCategory.getTheme();
final ContextThemeWrapper context = new ContextThemeWrapper(getActivity(), theme.getStyleId());
final LayoutInflater themedInflater = LayoutInflater.from(context);
return themedInflater.inflate(R.layout.fragment_quiz, container, false);
}
use of com.google.samples.apps.topeka.model.Theme in project android-topeka by googlesamples.
the class TopekaDatabaseHelper method getCategory.
/**
* Gets a category from the given position of the cursor provided.
*
* @param cursor The Cursor containing the data.
* @param readableDatabase The database that contains the quizzes.
* @return The found category.
*/
private static Category getCategory(Cursor cursor, SQLiteDatabase readableDatabase) {
// "magic numbers" based on CategoryTable#PROJECTION
final String id = cursor.getString(0);
final String name = cursor.getString(1);
final String themeName = cursor.getString(2);
final Theme theme = Theme.valueOf(themeName);
final String isSolved = cursor.getString(3);
final boolean solved = getBooleanFromDatabase(isSolved);
final int[] scores = JsonHelper.jsonArrayToIntArray(cursor.getString(4));
final List<Quiz> quizzes = getQuizzes(id, readableDatabase);
return new Category(name, id, theme, quizzes, scores, solved);
}
Aggregations