Refactoring

pull/198/head
M66B 4 years ago
parent c87cf45e23
commit 6693060e54

@ -57,7 +57,7 @@ public class AdapterNavAccount extends RecyclerView.Adapter<AdapterNavAccount.Vi
private List<TupleAccountEx> items = new ArrayList<>(); private List<TupleAccountEx> items = new ArrayList<>();
private NumberFormat NF = NumberFormat.getNumberInstance(); private NumberFormat NF = NumberFormat.getNumberInstance();
private DateFormat DTF; private DateFormat TF;
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener { public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener {
private View view; private View view;
@ -112,7 +112,7 @@ public class AdapterNavAccount extends RecyclerView.Adapter<AdapterNavAccount.Vi
tvItem.setTextColor(account.unseen == 0 ? textColorSecondary : colorUnread); tvItem.setTextColor(account.unseen == 0 ? textColorSecondary : colorUnread);
tvItem.setTypeface(account.unseen == 0 ? Typeface.DEFAULT : Typeface.DEFAULT_BOLD); tvItem.setTypeface(account.unseen == 0 ? Typeface.DEFAULT : Typeface.DEFAULT_BOLD);
tvItemExtra.setText(account.last_connected == null ? null : DTF.format(account.last_connected)); tvItemExtra.setText(account.last_connected == null ? null : TF.format(account.last_connected));
ivExternal.setVisibility(View.GONE); ivExternal.setVisibility(View.GONE);
ivWarning.setVisibility(account.error == null ? View.GONE : View.VISIBLE); ivWarning.setVisibility(account.error == null ? View.GONE : View.VISIBLE);
@ -190,7 +190,7 @@ public class AdapterNavAccount extends RecyclerView.Adapter<AdapterNavAccount.Vi
this.colorUnread = (highlight_unread ? colorHighlight : Helper.resolveColor(context, R.attr.colorUnread)); this.colorUnread = (highlight_unread ? colorHighlight : Helper.resolveColor(context, R.attr.colorUnread));
this.textColorSecondary = Helper.resolveColor(context, android.R.attr.textColorSecondary); this.textColorSecondary = Helper.resolveColor(context, android.R.attr.textColorSecondary);
this.DTF = Helper.getTimeInstance(context, SimpleDateFormat.SHORT); this.TF = Helper.getTimeInstance(context, SimpleDateFormat.SHORT);
setHasStableIds(true); setHasStableIds(true);
} }

@ -56,7 +56,7 @@ public class AdapterNavFolder extends RecyclerView.Adapter<AdapterNavFolder.View
private List<TupleFolderNav> items = new ArrayList<>(); private List<TupleFolderNav> items = new ArrayList<>();
private NumberFormat NF = NumberFormat.getNumberInstance(); private NumberFormat NF = NumberFormat.getNumberInstance();
private DateFormat DTF; private DateFormat TF;
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
private View view; private View view;
@ -127,7 +127,7 @@ public class AdapterNavFolder extends RecyclerView.Adapter<AdapterNavFolder.View
tvItem.setTextColor(count == 0 ? textColorSecondary : colorUnread); tvItem.setTextColor(count == 0 ? textColorSecondary : colorUnread);
tvItem.setTypeface(count == 0 ? Typeface.DEFAULT : Typeface.DEFAULT_BOLD); tvItem.setTypeface(count == 0 ? Typeface.DEFAULT : Typeface.DEFAULT_BOLD);
tvItemExtra.setText(folder.last_sync == null ? null : DTF.format(folder.last_sync)); tvItemExtra.setText(folder.last_sync == null ? null : TF.format(folder.last_sync));
tvItemExtra.setVisibility(debug ? View.VISIBLE : View.GONE); tvItemExtra.setVisibility(debug ? View.VISIBLE : View.GONE);
ivExternal.setVisibility(View.GONE); ivExternal.setVisibility(View.GONE);
@ -165,7 +165,7 @@ public class AdapterNavFolder extends RecyclerView.Adapter<AdapterNavFolder.View
this.colorUnread = (highlight_unread ? colorHighlight : Helper.resolveColor(context, R.attr.colorUnread)); this.colorUnread = (highlight_unread ? colorHighlight : Helper.resolveColor(context, R.attr.colorUnread));
this.textColorSecondary = Helper.resolveColor(context, android.R.attr.textColorSecondary); this.textColorSecondary = Helper.resolveColor(context, android.R.attr.textColorSecondary);
this.DTF = Helper.getTimeInstance(context, SimpleDateFormat.SHORT); this.TF = Helper.getTimeInstance(context, SimpleDateFormat.SHORT);
setHasStableIds(true); setHasStableIds(true);
} }

Loading…
Cancel
Save