mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-05 08:33:37 +02:00
Debug: extra count
This commit is contained in:
@@ -673,7 +673,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
||||
drawerLayout.closeDrawer(drawerContainer);
|
||||
onMenuOperations();
|
||||
}
|
||||
});
|
||||
}).setExtraCount(BuildConfig.DEBUG);
|
||||
|
||||
menus.add(navOperations);
|
||||
|
||||
|
||||
@@ -78,6 +78,7 @@ public class AdapterNavAccountFolder extends RecyclerView.Adapter<AdapterNavAcco
|
||||
private View view;
|
||||
private ImageView ivItem;
|
||||
private ImageView ivBadge;
|
||||
private TextView tvCount;
|
||||
private TextView tvItem;
|
||||
private TextView tvItemExtra;
|
||||
private ImageView ivExtra;
|
||||
@@ -89,6 +90,7 @@ public class AdapterNavAccountFolder extends RecyclerView.Adapter<AdapterNavAcco
|
||||
view = itemView.findViewById(R.id.clItem);
|
||||
ivItem = itemView.findViewById(R.id.ivItem);
|
||||
ivBadge = itemView.findViewById(R.id.ivBadge);
|
||||
tvCount = itemView.findViewById(R.id.tvCount);
|
||||
tvItem = itemView.findViewById(R.id.tvItem);
|
||||
tvItemExtra = itemView.findViewById(R.id.tvItemExtra);
|
||||
ivExtra = itemView.findViewById(R.id.ivExtra);
|
||||
@@ -139,12 +141,14 @@ public class AdapterNavAccountFolder extends RecyclerView.Adapter<AdapterNavAcco
|
||||
else
|
||||
count = account.unseen;
|
||||
|
||||
ivBadge.setVisibility(count == 0 || expanded ? View.GONE : View.VISIBLE);
|
||||
tvCount.setVisibility(View.GONE);
|
||||
|
||||
Integer color = (account.folderName == null ? account.color : account.folderColor);
|
||||
if (color == null || !ActivityBilling.isPro(context))
|
||||
ivItem.clearColorFilter();
|
||||
else
|
||||
ivItem.setColorFilter(color);
|
||||
ivBadge.setVisibility(count == 0 || expanded ? View.GONE : View.VISIBLE);
|
||||
|
||||
String name = account.getName(context);
|
||||
if (count == 0)
|
||||
|
||||
@@ -61,6 +61,7 @@ public class AdapterNavMenu extends RecyclerView.Adapter<AdapterNavMenu.ViewHold
|
||||
private View view;
|
||||
private ImageView ivItem;
|
||||
private ImageView ivBadge;
|
||||
private TextView tvCount;
|
||||
private TextView tvItem;
|
||||
private TextView tvItemExtra;
|
||||
private ImageView ivExtra;
|
||||
@@ -72,6 +73,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);
|
||||
tvCount = itemView.findViewById(R.id.tvCount);
|
||||
tvItem = itemView.findViewById(R.id.tvItem);
|
||||
tvItemExtra = itemView.findViewById(R.id.tvItemExtra);
|
||||
ivExtra = itemView.findViewById(R.id.ivExtra);
|
||||
@@ -92,10 +94,16 @@ public class AdapterNavMenu extends RecyclerView.Adapter<AdapterNavMenu.ViewHold
|
||||
ivItem.setImageResource(menu.getIcon());
|
||||
|
||||
Integer color = menu.getColor();
|
||||
ivItem.setImageTintList(ColorStateList.valueOf(color == null ? colorControlNormal : color));
|
||||
ivItem.setImageTintList(ColorStateList.valueOf(color == null
|
||||
? colorControlNormal : color));
|
||||
|
||||
Integer count = menu.getCount();
|
||||
ivBadge.setVisibility(count == null || count == 0 || expanded ? View.GONE : View.VISIBLE);
|
||||
ivBadge.setVisibility(count == null || count == 0 || expanded
|
||||
? View.GONE : View.VISIBLE);
|
||||
|
||||
tvCount.setText(count == null ? null : Integer.toString(count));
|
||||
tvCount.setVisibility(count == null || count == 0 || expanded || !menu.getExtraCount()
|
||||
? View.GONE : View.VISIBLE);
|
||||
|
||||
if (count == null)
|
||||
tvItem.setText(menu.getTitle());
|
||||
|
||||
@@ -54,6 +54,7 @@ public class AdapterNavSearch extends RecyclerView.Adapter<AdapterNavSearch.View
|
||||
private View view;
|
||||
private ImageView ivItem;
|
||||
private ImageView ivBadge;
|
||||
private TextView tvCount;
|
||||
private TextView tvItem;
|
||||
private TextView tvItemExtra;
|
||||
private ImageView ivExtra;
|
||||
@@ -65,6 +66,7 @@ public class AdapterNavSearch extends RecyclerView.Adapter<AdapterNavSearch.View
|
||||
view = itemView.findViewById(R.id.clItem);
|
||||
ivItem = itemView.findViewById(R.id.ivItem);
|
||||
ivBadge = itemView.findViewById(R.id.ivBadge);
|
||||
tvCount = itemView.findViewById(R.id.tvCount);
|
||||
tvItem = itemView.findViewById(R.id.tvItem);
|
||||
tvItemExtra = itemView.findViewById(R.id.tvItemExtra);
|
||||
ivExtra = itemView.findViewById(R.id.ivExtra);
|
||||
@@ -87,6 +89,7 @@ public class AdapterNavSearch extends RecyclerView.Adapter<AdapterNavSearch.View
|
||||
ivItem.setColorFilter(search.color);
|
||||
|
||||
ivBadge.setVisibility(View.GONE);
|
||||
tvCount.setVisibility(View.GONE);
|
||||
tvItem.setText(search.name);
|
||||
|
||||
tvItemExtra.setVisibility(View.GONE);
|
||||
|
||||
@@ -62,6 +62,7 @@ public class AdapterNavUnified extends RecyclerView.Adapter<AdapterNavUnified.Vi
|
||||
private View view;
|
||||
private ImageView ivItem;
|
||||
private ImageView ivBadge;
|
||||
private TextView tvCount;
|
||||
private TextView tvItem;
|
||||
private TextView tvItemExtra;
|
||||
private ImageView ivExtra;
|
||||
@@ -73,6 +74,7 @@ public class AdapterNavUnified extends RecyclerView.Adapter<AdapterNavUnified.Vi
|
||||
view = itemView.findViewById(R.id.clItem);
|
||||
ivItem = itemView.findViewById(R.id.ivItem);
|
||||
ivBadge = itemView.findViewById(R.id.ivBadge);
|
||||
tvCount = itemView.findViewById(R.id.tvCount);
|
||||
tvItem = itemView.findViewById(R.id.tvItem);
|
||||
tvItemExtra = itemView.findViewById(R.id.tvItemExtra);
|
||||
ivExtra = itemView.findViewById(R.id.ivExtra);
|
||||
@@ -111,6 +113,7 @@ public class AdapterNavUnified extends RecyclerView.Adapter<AdapterNavUnified.Vi
|
||||
count = folder.unseen;
|
||||
|
||||
ivBadge.setVisibility(count == 0 || expanded ? View.GONE : View.VISIBLE);
|
||||
tvCount.setVisibility(View.GONE);
|
||||
|
||||
if (count == 0)
|
||||
tvItem.setText(EntityFolder.localizeType(context, folder.type));
|
||||
|
||||
@@ -26,8 +26,9 @@ public class NavMenuItem {
|
||||
private Integer color;
|
||||
private int title;
|
||||
private String subtitle = null;
|
||||
private int extraicon;
|
||||
private int extra_icon;
|
||||
private Integer count = null;
|
||||
private boolean extra_count = false;
|
||||
private boolean warning = false;
|
||||
private boolean separated = false;
|
||||
private Runnable click;
|
||||
@@ -57,7 +58,7 @@ public class NavMenuItem {
|
||||
}
|
||||
|
||||
NavMenuItem setExtraIcon(int icon) {
|
||||
this.extraicon = icon;
|
||||
this.extra_icon = icon;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -67,6 +68,11 @@ public class NavMenuItem {
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
NavMenuItem setExtraCount(boolean value) {
|
||||
this.extra_count = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
NavMenuItem setExternal(boolean external) {
|
||||
setExtraIcon(external ? R.drawable.twotone_open_in_new_24 : 0);
|
||||
return this;
|
||||
@@ -99,13 +105,17 @@ public class NavMenuItem {
|
||||
}
|
||||
|
||||
int getExtraIcon() {
|
||||
return this.extraicon;
|
||||
return this.extra_icon;
|
||||
}
|
||||
|
||||
Integer getCount() {
|
||||
return this.count;
|
||||
}
|
||||
|
||||
boolean getExtraCount() {
|
||||
return this.extra_count;
|
||||
}
|
||||
|
||||
boolean isSeparated() {
|
||||
return this.separated;
|
||||
}
|
||||
@@ -141,8 +151,9 @@ public class NavMenuItem {
|
||||
Objects.equals(this.color, other.color) &&
|
||||
this.title == other.title &&
|
||||
Objects.equals(this.subtitle, other.subtitle) &&
|
||||
this.extraicon == other.extraicon &&
|
||||
this.extra_icon == other.extra_icon &&
|
||||
Objects.equals(this.count, other.count) &&
|
||||
this.extra_count == other.extra_count &&
|
||||
this.warning == other.warning &&
|
||||
this.separated == other.separated);
|
||||
} else
|
||||
@@ -151,6 +162,6 @@ public class NavMenuItem {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(icon, color, title, subtitle, extraicon, count, warning, separated);
|
||||
return Objects.hash(icon, color, title, subtitle, extra_icon, count, extra_count, warning, separated);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user