use of com.mindorks.framework.mvp.data.db.model.Option in project android-mvp-architecture by MindorksOpenSource.
the class QuestionCard method showCorrectOptions.
private void showCorrectOptions() {
for (int i = 0; i < 3; i++) {
Option option = mQuestion.getOptionList().get(i);
Button button = null;
switch(i) {
case 0:
button = mOption1Button;
break;
case 1:
button = mOption2Button;
break;
case 2:
button = mOption3Button;
break;
}
if (button != null) {
if (option.isCorrect()) {
button.setBackgroundColor(Color.GREEN);
} else {
button.setBackgroundColor(Color.RED);
}
}
}
}
use of com.mindorks.framework.mvp.data.db.model.Option in project android-mvp-architecture by MindorksOpenSource.
the class AppDataManager method seedDatabaseOptions.
@Override
public Observable<Boolean> seedDatabaseOptions() {
GsonBuilder builder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation();
final Gson gson = builder.create();
return mDbHelper.isOptionEmpty().concatMap(new Function<Boolean, ObservableSource<? extends Boolean>>() {
@Override
public ObservableSource<? extends Boolean> apply(Boolean isEmpty) throws Exception {
if (isEmpty) {
Type type = new TypeToken<List<Option>>() {
}.getType();
List<Option> optionList = gson.fromJson(CommonUtils.loadJSONFromAsset(mContext, AppConstants.SEED_DATABASE_OPTIONS), type);
return saveOptionList(optionList);
}
return Observable.just(false);
}
});
}
Aggregations