Skip to content

Commit

Permalink
modified : row eng item
Browse files Browse the repository at this point in the history
  • Loading branch information
yasinhajilou committed Jul 2, 2020
1 parent 614ea4c commit 69548d7
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,9 @@ public Flowable<Integer> getTodayListSize() {

public Single<Integer> getTodayListSizeSingle() {
return mLeitnerDao.getAllCards()
.map(new Function<List<Leitner>, Integer>() {
@Override
public Integer apply(List<Leitner> leitners) throws Exception {
int todaySize = LeitnerUtils.getPreparedLeitnerItems(leitners).size();
return Math.max(todaySize, 0);
}
.map(leitners -> {
int todaySize = LeitnerUtils.getPreparedLeitnerItems(leitners).size();
return Math.max(todaySize, 0);
})
.subscribeOn(Schedulers.io());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,33 @@ public int getItemCount() {
}

class ViewHolder extends RecyclerView.ViewHolder {
TextView cat, def, syn, exam;
TextView cat, def, syn, exam, labelExam, labelSyn;

ViewHolder(@NonNull View itemView) {
super(itemView);
cat = itemView.findViewById(R.id.tv_cat_item_eng);
def = itemView.findViewById(R.id.tv_def_item_eng);
syn = itemView.findViewById(R.id.tv_syn_item_eng);
exam = itemView.findViewById(R.id.tv_example_item_eng);
labelExam = itemView.findViewById(R.id.tv_label_example);
labelSyn = itemView.findViewById(R.id.tv_label_synony);

}

void bindData(EnglishDef englishDef) {
def.setText(englishDef.getDefinition());
cat.setText(englishDef.getCat());
syn.setText(englishDef.getSynonyms());
exam.setText(englishDef.getExamples());

cat.setText("(" + englishDef.getCat() + ")");

if (englishDef.getSynonyms() != null)
syn.setText(englishDef.getSynonyms());
else
labelSyn.setVisibility(View.GONE);

if (englishDef.getExamples() != null)
exam.setText(englishDef.getExamples());
else
labelExam.setVisibility(View.GONE);
}
}
}
12 changes: 9 additions & 3 deletions app/src/main/res/layout/row_item_english_translation.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,34 +18,40 @@
android:id="@+id/tv_cat_item_eng"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="18sp" />
android:textSize="20sp" />
<TextView
android:textColor="@android:color/black"
android:fontFamily="@font/productsansregular"
android:textSize="20sp"
android:id="@+id/tv_def_item_eng"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<TextView
android:textSize="18sp"
android:id="@+id/tv_label_synony"
android:textSize="19sp"
android:fontFamily="@font/productsansregular"
android:textStyle="bold"
android:text="Synonymos:"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<TextView
android:textColor="@color/colorSecondary"
android:textSize="18sp"
android:fontFamily="@font/productsansregular"
android:id="@+id/tv_syn_item_eng"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/tv_label_example"
android:textStyle="bold"
android:textSize="18sp"
android:textSize="19sp"
android:fontFamily="@font/productsansregular"
android:text="Examples:"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<TextView
android:textColor="@color/colorPrimary"
android:textSize="17sp"
android:id="@+id/tv_example_item_eng"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
Expand Down

0 comments on commit 69548d7

Please sign in to comment.