pull/203/head
M66B 4 years ago
parent a6930e9e5b
commit d2a0ebd0b6

@ -68,6 +68,7 @@ public class AdapterNavAccount extends RecyclerView.Adapter<AdapterNavAccount.Vi
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;
@ -78,6 +79,7 @@ public class AdapterNavAccount extends RecyclerView.Adapter<AdapterNavAccount.Vi
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);
@ -110,6 +112,7 @@ public class AdapterNavAccount extends RecyclerView.Adapter<AdapterNavAccount.Vi
ivItem.clearColorFilter();
else
ivItem.setColorFilter(account.color);
ivBadge.setVisibility(account.unseen == 0 || expanded ? View.GONE : View.VISIBLE);
if (account.unseen == 0)
tvItem.setText(account.name);

@ -64,6 +64,7 @@ public class AdapterNavFolder extends RecyclerView.Adapter<AdapterNavFolder.View
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
private View view;
private ImageView ivItem;
private ImageView ivBadge;
private TextView tvItem;
private TextView tvItemExtra;
private ImageView ivExtra;
@ -74,6 +75,7 @@ public class AdapterNavFolder extends RecyclerView.Adapter<AdapterNavFolder.View
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);
@ -121,6 +123,8 @@ public class AdapterNavFolder extends RecyclerView.Adapter<AdapterNavFolder.View
else
count = folder.unseen;
ivBadge.setVisibility(count == 0 || expanded ? View.GONE : View.VISIBLE);
if (count == 0)
tvItem.setText(folder.getDisplayName(context));
else
@ -169,6 +173,7 @@ public class AdapterNavFolder extends RecyclerView.Adapter<AdapterNavFolder.View
int colorHighlight = prefs.getInt("highlight_color", Helper.resolveColor(context, R.attr.colorUnreadHighlight));
this.colorUnread = (highlight_unread ? colorHighlight : Helper.resolveColor(context, R.attr.colorUnread));
this.textColorSecondary = Helper.resolveColor(context, android.R.attr.textColorSecondary);
this.colorWarning = Helper.resolveColor(context, R.attr.colorWarning);
this.TF = Helper.getTimeInstance(context, SimpleDateFormat.SHORT);

@ -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());

@ -60,6 +60,7 @@ public class AdapterNavUnified extends RecyclerView.Adapter<AdapterNavUnified.Vi
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
private View view;
private ImageView ivItem;
private ImageView ivBadge;
private TextView tvItem;
private TextView tvItemExtra;
private ImageView ivExtra;
@ -70,6 +71,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);
tvItem = itemView.findViewById(R.id.tvItem);
tvItemExtra = itemView.findViewById(R.id.tvItemExtra);
ivExtra = itemView.findViewById(R.id.ivExtra);
@ -96,6 +98,8 @@ public class AdapterNavUnified extends RecyclerView.Adapter<AdapterNavUnified.Vi
else
count = folder.unseen;
ivBadge.setVisibility(count == 0 || expanded ? View.GONE : View.VISIBLE);
if (count == 0)
tvItem.setText(EntityFolder.localizeType(context, folder.type));
else

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="?attr/colorAccent" />
<size
android:width="12dp"
android:height="12dp" />
</shape>

@ -8,7 +8,8 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/clItem"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:minHeight="42dp">
<ImageView
android:id="@+id/ivItem"
@ -16,11 +17,18 @@
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:gravity="center_vertical"
android:minHeight="42dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/twotone_mail_outline_24" />
app:srcCompat="@drawable/twotone_folder_special_24" />
<ImageView
android:id="@+id/ivBadge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="@+id/ivItem"
app:layout_constraintStart_toStartOf="@+id/ivItem"
app:srcCompat="@drawable/badge" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvItem"
@ -30,7 +38,6 @@
android:layout_marginEnd="12dp"
android:ellipsize="middle"
android:gravity="center_vertical"
android:minHeight="42dp"
android:singleLine="true"
android:text="Nav item"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"

Loading…
Cancel
Save