Account avatars is a pro feature

pull/215/head
M66B 6 months ago
parent 5d82358663
commit 3dc30e1727

@ -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. All pro features are convenience or advanced features.
* Account/identity/folder colors * Account/identity/folder colors/avatars
* Colored stars * Colored stars
* Notification settings (sounds) per account/folder/sender (requires Android 8 Oreo) * Notification settings (sounds) per account/folder/sender (requires Android 8 Oreo)
* Configurable notification actions * Configurable notification actions

@ -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. 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)) * 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)) * Notification settings (sounds) per account/folder/sender (requires Android 8 Oreo) ([instructions](https://m66b.github.io/FairEmail/#faq145))
* Configurable notification actions * Configurable notification actions

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

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

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

Loading…
Cancel
Save