|
|
|
@ -59,6 +59,7 @@ public class AdapterNavMenu extends RecyclerView.Adapter<AdapterNavMenu.ViewHold
|
|
|
|
|
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener {
|
|
|
|
|
private View view;
|
|
|
|
|
private ImageView ivItem;
|
|
|
|
|
private ImageView ivBadge;
|
|
|
|
|
private TextView tvItem;
|
|
|
|
|
private TextView tvItemExtra;
|
|
|
|
|
private ImageView ivExtra;
|
|
|
|
@ -69,6 +70,7 @@ public class AdapterNavMenu extends RecyclerView.Adapter<AdapterNavMenu.ViewHold
|
|
|
|
|
|
|
|
|
|
view = itemView.findViewById(R.id.clItem);
|
|
|
|
|
ivItem = itemView.findViewById(R.id.ivItem);
|
|
|
|
|
ivBadge = itemView.findViewById(R.id.ivBadge);
|
|
|
|
|
tvItem = itemView.findViewById(R.id.tvItem);
|
|
|
|
|
tvItemExtra = itemView.findViewById(R.id.tvItemExtra);
|
|
|
|
|
ivExtra = itemView.findViewById(R.id.ivExtra);
|
|
|
|
@ -91,14 +93,17 @@ public class AdapterNavMenu extends RecyclerView.Adapter<AdapterNavMenu.ViewHold
|
|
|
|
|
Integer color = menu.getColor();
|
|
|
|
|
ivItem.setImageTintList(ColorStateList.valueOf(color == null ? colorControlNormal : color));
|
|
|
|
|
|
|
|
|
|
if (menu.getCount() == null)
|
|
|
|
|
Integer count = menu.getCount();
|
|
|
|
|
ivBadge.setVisibility(count == null || count == 0 || expanded ? View.GONE : View.VISIBLE);
|
|
|
|
|
|
|
|
|
|
if (count == null)
|
|
|
|
|
tvItem.setText(menu.getTitle());
|
|
|
|
|
else
|
|
|
|
|
tvItem.setText(context.getString(R.string.title_name_count,
|
|
|
|
|
context.getString(menu.getTitle()), NF.format(menu.getCount())));
|
|
|
|
|
context.getString(menu.getTitle()), NF.format(count)));
|
|
|
|
|
|
|
|
|
|
tvItem.setTextColor(menu.getCount() == null ? (color == null ? textColorSecondary : color) : colorUnread);
|
|
|
|
|
tvItem.setTypeface(menu.getCount() == null ? Typeface.DEFAULT : Typeface.DEFAULT_BOLD);
|
|
|
|
|
tvItem.setTextColor(count == null ? (color == null ? textColorSecondary : color) : colorUnread);
|
|
|
|
|
tvItem.setTypeface(count == null ? Typeface.DEFAULT : Typeface.DEFAULT_BOLD);
|
|
|
|
|
tvItem.setVisibility(expanded ? View.VISIBLE : View.GONE);
|
|
|
|
|
|
|
|
|
|
tvItemExtra.setText(menu.getSubtitle());
|
|
|
|
|