mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-21 05:37:07 +00:00
Nav icon extra
This commit is contained in:
parent
b0059f35e4
commit
bb9c5eb5f4
7 changed files with 29 additions and 24 deletions
|
@ -612,7 +612,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
drawerLayout.closeDrawer(drawerContainer);
|
||||
startActivity(new Intent(ActivityView.this, ActivityBilling.class));
|
||||
}
|
||||
}));
|
||||
}).setExtraIcon(ActivityBilling.isPro(this) ? R.drawable.twotone_check_24 : 0));
|
||||
|
||||
if ((Helper.isPlayStoreInstall() || BuildConfig.DEBUG))
|
||||
extra.add(new NavMenuItem(R.drawable.twotone_star_24, R.string.menu_rate, new Runnable() {
|
||||
|
|
|
@ -67,7 +67,7 @@ public class AdapterNavAccount extends RecyclerView.Adapter<AdapterNavAccount.Vi
|
|||
private ImageView ivItem;
|
||||
private TextView tvItem;
|
||||
private TextView tvItemExtra;
|
||||
private ImageView ivExternal;
|
||||
private ImageView ivExtra;
|
||||
private ImageView ivWarning;
|
||||
|
||||
ViewHolder(View itemView) {
|
||||
|
@ -77,7 +77,7 @@ public class AdapterNavAccount extends RecyclerView.Adapter<AdapterNavAccount.Vi
|
|||
ivItem = itemView.findViewById(R.id.ivItem);
|
||||
tvItem = itemView.findViewById(R.id.tvItem);
|
||||
tvItemExtra = itemView.findViewById(R.id.tvItemExtra);
|
||||
ivExternal = itemView.findViewById(R.id.ivExternal);
|
||||
ivExtra = itemView.findViewById(R.id.ivExtra);
|
||||
ivWarning = itemView.findViewById(R.id.ivWarning);
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ public class AdapterNavAccount extends RecyclerView.Adapter<AdapterNavAccount.Vi
|
|||
|
||||
tvItemExtra.setText(account.last_connected == null ? null : TF.format(account.last_connected));
|
||||
|
||||
ivExternal.setVisibility(View.GONE);
|
||||
ivExtra.setVisibility(View.GONE);
|
||||
|
||||
Integer percent = account.getQuotaPercentage();
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ public class AdapterNavFolder extends RecyclerView.Adapter<AdapterNavFolder.View
|
|||
private ImageView ivItem;
|
||||
private TextView tvItem;
|
||||
private TextView tvItemExtra;
|
||||
private ImageView ivExternal;
|
||||
private ImageView ivExtra;
|
||||
private ImageView ivWarning;
|
||||
|
||||
ViewHolder(View itemView) {
|
||||
|
@ -73,7 +73,7 @@ public class AdapterNavFolder extends RecyclerView.Adapter<AdapterNavFolder.View
|
|||
ivItem = itemView.findViewById(R.id.ivItem);
|
||||
tvItem = itemView.findViewById(R.id.tvItem);
|
||||
tvItemExtra = itemView.findViewById(R.id.tvItemExtra);
|
||||
ivExternal = itemView.findViewById(R.id.ivExternal);
|
||||
ivExtra = itemView.findViewById(R.id.ivExtra);
|
||||
ivWarning = itemView.findViewById(R.id.ivWarning);
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,7 @@ public class AdapterNavFolder extends RecyclerView.Adapter<AdapterNavFolder.View
|
|||
tvItemExtra.setText(NF.format(folder.messages));
|
||||
tvItemExtra.setVisibility(nav_count ? View.VISIBLE : View.GONE);
|
||||
|
||||
ivExternal.setVisibility(View.GONE);
|
||||
ivExtra.setVisibility(View.GONE);
|
||||
ivWarning.setVisibility(folder.error == null ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,6 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||
import java.text.NumberFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class AdapterNavMenu extends RecyclerView.Adapter<AdapterNavMenu.ViewHolder> {
|
||||
private Context context;
|
||||
|
@ -59,7 +58,7 @@ public class AdapterNavMenu extends RecyclerView.Adapter<AdapterNavMenu.ViewHold
|
|||
private ImageView ivItem;
|
||||
private TextView tvItem;
|
||||
private TextView tvItemExtra;
|
||||
private ImageView ivExternal;
|
||||
private ImageView ivExtra;
|
||||
private ImageView ivWarning;
|
||||
|
||||
ViewHolder(View itemView) {
|
||||
|
@ -69,7 +68,7 @@ public class AdapterNavMenu extends RecyclerView.Adapter<AdapterNavMenu.ViewHold
|
|||
ivItem = itemView.findViewById(R.id.ivItem);
|
||||
tvItem = itemView.findViewById(R.id.tvItem);
|
||||
tvItemExtra = itemView.findViewById(R.id.tvItemExtra);
|
||||
ivExternal = itemView.findViewById(R.id.ivExternal);
|
||||
ivExtra = itemView.findViewById(R.id.ivExtra);
|
||||
ivWarning = itemView.findViewById(R.id.ivWarning);
|
||||
}
|
||||
|
||||
|
@ -101,7 +100,8 @@ public class AdapterNavMenu extends RecyclerView.Adapter<AdapterNavMenu.ViewHold
|
|||
tvItemExtra.setText(menu.getSubtitle());
|
||||
tvItemExtra.setVisibility(menu.getSubtitle() == null ? View.GONE : View.VISIBLE);
|
||||
|
||||
ivExternal.setVisibility(menu.isExternal() ? View.VISIBLE : View.GONE);
|
||||
ivExtra.setImageResource(menu.getExtraIcon());
|
||||
ivExtra.setVisibility(menu.getExtraIcon() == 0 ? View.GONE : View.VISIBLE);
|
||||
ivWarning.setVisibility(menu.hasWarning() ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ public class AdapterNavUnified extends RecyclerView.Adapter<AdapterNavUnified.Vi
|
|||
private ImageView ivItem;
|
||||
private TextView tvItem;
|
||||
private TextView tvItemExtra;
|
||||
private ImageView ivExternal;
|
||||
private ImageView ivExtra;
|
||||
private ImageView ivWarning;
|
||||
|
||||
ViewHolder(View itemView) {
|
||||
|
@ -71,7 +71,7 @@ public class AdapterNavUnified extends RecyclerView.Adapter<AdapterNavUnified.Vi
|
|||
ivItem = itemView.findViewById(R.id.ivItem);
|
||||
tvItem = itemView.findViewById(R.id.tvItem);
|
||||
tvItemExtra = itemView.findViewById(R.id.tvItemExtra);
|
||||
ivExternal = itemView.findViewById(R.id.ivExternal);
|
||||
ivExtra = itemView.findViewById(R.id.ivExtra);
|
||||
ivWarning = itemView.findViewById(R.id.ivWarning);
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ public class AdapterNavUnified extends RecyclerView.Adapter<AdapterNavUnified.Vi
|
|||
tvItemExtra.setText(NF.format(folder.messages));
|
||||
tvItemExtra.setVisibility(nav_count ? View.VISIBLE : View.GONE);
|
||||
|
||||
ivExternal.setVisibility(View.GONE);
|
||||
ivExtra.setVisibility(View.GONE);
|
||||
ivWarning.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,8 +26,8 @@ public class NavMenuItem {
|
|||
private Integer color;
|
||||
private int title;
|
||||
private String subtitle = null;
|
||||
private int extraicon;
|
||||
private Integer count = null;
|
||||
private boolean external = false;
|
||||
private boolean warning = false;
|
||||
private boolean separated = false;
|
||||
private Runnable click;
|
||||
|
@ -56,6 +56,11 @@ public class NavMenuItem {
|
|||
return this;
|
||||
}
|
||||
|
||||
NavMenuItem setExtraIcon(int icon) {
|
||||
this.extraicon = icon;
|
||||
return this;
|
||||
}
|
||||
|
||||
void setCount(Integer count) {
|
||||
if (count != null && count == 0)
|
||||
count = null;
|
||||
|
@ -63,7 +68,7 @@ public class NavMenuItem {
|
|||
}
|
||||
|
||||
NavMenuItem setExternal(boolean external) {
|
||||
this.external = external;
|
||||
setExtraIcon(external ? R.drawable.twotone_open_in_new_24 : 0);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -92,6 +97,10 @@ public class NavMenuItem {
|
|||
return this.subtitle;
|
||||
}
|
||||
|
||||
int getExtraIcon() {
|
||||
return this.extraicon;
|
||||
}
|
||||
|
||||
Integer getCount() {
|
||||
return this.count;
|
||||
}
|
||||
|
@ -100,10 +109,6 @@ public class NavMenuItem {
|
|||
return this.separated;
|
||||
}
|
||||
|
||||
boolean isExternal() {
|
||||
return this.external;
|
||||
}
|
||||
|
||||
boolean hasWarning() {
|
||||
return this.warning;
|
||||
}
|
||||
|
@ -135,8 +140,8 @@ public class NavMenuItem {
|
|||
Objects.equals(this.color, other.color) &&
|
||||
this.title == other.title &&
|
||||
Objects.equals(this.subtitle, other.subtitle) &&
|
||||
this.extraicon == other.extraicon &&
|
||||
Objects.equals(this.count, other.count) &&
|
||||
this.external == other.external &&
|
||||
this.warning == other.warning &&
|
||||
this.separated == other.separated);
|
||||
} else
|
||||
|
@ -145,6 +150,6 @@ public class NavMenuItem {
|
|||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(icon, color, title, subtitle, count, external, warning, separated);
|
||||
return Objects.hash(icon, color, title, subtitle, extraicon, count, warning, separated);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,11 +49,11 @@
|
|||
android:text="Extra"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/ivExternal"
|
||||
app:layout_constraintEnd_toStartOf="@+id/ivExtra"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivExternal"
|
||||
android:id="@+id/ivExtra"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="12dp"
|
||||
|
|
Loading…
Reference in a new issue