1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-21 23:32:51 +00:00

Account avatars is a pro feature

This commit is contained in:
M66B 2024-06-25 08:28:40 +02:00
parent 5d82358663
commit 3dc30e1727
5 changed files with 25 additions and 10 deletions

View file

@ -78,7 +78,7 @@ This app starts a foreground service with a low-priority status bar notification
All pro features are convenience or advanced features.
* Account/identity/folder colors
* Account/identity/folder colors/avatars
* Colored stars
* Notification settings (sounds) per account/folder/sender (requires Android 8 Oreo)
* Configurable notification actions

View file

@ -89,7 +89,7 @@ This app starts a foreground service with a low-priority status bar notification
All pro features are convenience or advanced features.
* Account/identity/folder colors
* Account/identity/folder colors/avatars
* Colored stars ([instructions](https://m66b.github.io/FairEmail/#faq107))
* Notification settings (sounds) per account/folder/sender (requires Android 8 Oreo) ([instructions](https://m66b.github.io/FairEmail/#faq145))
* Configurable notification actions

View file

@ -89,6 +89,7 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
private LifecycleOwner owner;
private LayoutInflater inflater;
private boolean pro;
private int dp24;
private int colorStripeWidth;
private int colorWarning;
@ -217,7 +218,7 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
vwColor.setBackgroundColor(account.color == null ? Color.TRANSPARENT : account.color);
vwColor.setVisibility(ActivityBilling.isPro(context) ? View.VISIBLE : View.INVISIBLE);
if (account.avatar == null)
if (account.avatar == null || !pro)
ivAvatar.setVisibility(hasAvatars ? View.INVISIBLE : View.GONE);
else {
Bundle args = new Bundle();
@ -962,6 +963,7 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
this.owner = parentFragment.getViewLifecycleOwner();
this.inflater = LayoutInflater.from(context);
this.pro = ActivityBilling.isPro(context);
this.dp24 = Helper.dp2pixels(context, 24);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
@ -1011,11 +1013,12 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
DiffUtil.DiffResult diff = DiffUtil.calculateDiff(new DiffCallback(items, filtered), false);
hasAvatars = false;
for (TupleAccountFolder account : accounts)
if (account.avatar != null) {
hasAvatars = true;
break;
}
if (pro)
for (TupleAccountFolder account : accounts)
if (account.avatar != null) {
hasAvatars = true;
break;
}
items = filtered;

View file

@ -2057,8 +2057,14 @@ public class FragmentAccount extends FragmentBase {
}
private void onImageSelected(Uri uri) {
final Context context = getContext();
if (!ActivityBilling.isPro(context)) {
startActivity(new Intent(context, ActivityBilling.class));
return;
}
try {
final Context context = getContext();
NoStreamException.check(uri, context);
context.getContentResolver().takePersistableUriPermission(uri, Intent.FLAG_GRANT_READ_URI_PERMISSION);

View file

@ -1094,8 +1094,14 @@ public class FragmentPop extends FragmentBase {
}
private void onImageSelected(Uri uri) {
final Context context = getContext();
if (!ActivityBilling.isPro(context)) {
startActivity(new Intent(context, ActivityBilling.class));
return;
}
try {
final Context context = getContext();
NoStreamException.check(uri, context);
context.getContentResolver().takePersistableUriPermission(uri, Intent.FLAG_GRANT_READ_URI_PERMISSION);