diff --git a/app/src/main/java/eu/faircode/email/ActivityView.java b/app/src/main/java/eu/faircode/email/ActivityView.java index a36c43acd8..11acc3e1ee 100644 --- a/app/src/main/java/eu/faircode/email/ActivityView.java +++ b/app/src/main/java/eu/faircode/email/ActivityView.java @@ -1176,11 +1176,6 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB } private void onColor(final Intent intent) { - if (!Helper.isPro(this)) { - onShowPro(null); - return; - } - int color = intent.getIntExtra("color", -1); int[] colors = getResources().getIntArray(R.array.colorPicker); ColorPickerDialog colorPickerDialog = new ColorPickerDialog(); @@ -1188,6 +1183,11 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB colorPickerDialog.setOnColorSelectedListener(new ColorPickerSwatch.OnColorSelectedListener() { @Override public void onColorSelected(int color) { + if (!Helper.isPro(ActivityView.this)) { + onShowPro(null); + return; + } + Bundle args = new Bundle(); args.putLong("id", intent.getLongExtra("id", -1)); args.putInt("color", color); @@ -1292,25 +1292,27 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB } private void onDecrypt(Intent intent) { - if (Helper.isPro(this)) { - if (pgpService.isBound()) { - Intent data = new Intent(); - data.setAction(OpenPgpApi.ACTION_DECRYPT_VERIFY); - - decrypt(data, intent.getLongExtra("id", -1)); - } else { - Snackbar snackbar = Snackbar.make(getVisibleView(), R.string.title_no_openpgp, Snackbar.LENGTH_LONG); - if (Helper.getIntentOpenKeychain().resolveActivity(getPackageManager()) != null) - snackbar.setAction(R.string.title_fix, new View.OnClickListener() { - @Override - public void onClick(View v) { - startActivity(Helper.getIntentOpenKeychain()); - } - }); - snackbar.show(); - } - } else + if (!Helper.isPro(this)) { onShowPro(intent); + return; + } + + if (pgpService.isBound()) { + Intent data = new Intent(); + data.setAction(OpenPgpApi.ACTION_DECRYPT_VERIFY); + + decrypt(data, intent.getLongExtra("id", -1)); + } else { + Snackbar snackbar = Snackbar.make(getVisibleView(), R.string.title_no_openpgp, Snackbar.LENGTH_LONG); + if (Helper.getIntentOpenKeychain().resolveActivity(getPackageManager()) != null) + snackbar.setAction(R.string.title_fix, new View.OnClickListener() { + @Override + public void onClick(View v) { + startActivity(Helper.getIntentOpenKeychain()); + } + }); + snackbar.show(); + } } private void onShowPro(Intent intent) { diff --git a/app/src/main/java/eu/faircode/email/AdapterMessage.java b/app/src/main/java/eu/faircode/email/AdapterMessage.java index d06377df06..bb55dbb386 100644 --- a/app/src/main/java/eu/faircode/email/AdapterMessage.java +++ b/app/src/main/java/eu/faircode/email/AdapterMessage.java @@ -2463,12 +2463,6 @@ public class AdapterMessage extends RecyclerView.Adapter()); if (!groupNotifying.containsKey(group)) @@ -1828,8 +1829,8 @@ class Core { boolean notify_preview = prefs.getBoolean("notify_preview", true); boolean notify_trash = prefs.getBoolean("notify_trash", true); boolean notify_archive = prefs.getBoolean("notify_archive", true); - boolean notify_reply = prefs.getBoolean("notify_reply", false); - boolean notify_flag = prefs.getBoolean("notify_flag", false); + boolean notify_reply = prefs.getBoolean("notify_reply", false) && pro; + boolean notify_flag = prefs.getBoolean("notify_flag", false) && pro; boolean notify_seen = prefs.getBoolean("notify_seen", true); NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); @@ -1931,7 +1932,8 @@ class Core { channelName = channel.getId(); } if (channelName == null) - channelName = EntityAccount.getNotificationChannelId(message.accountNotify ? message.account : 0); + channelName = EntityAccount.getNotificationChannelId( + pro && message.accountNotify ? message.account : 0); // Get folder name String folderName = message.folderDisplay == null diff --git a/app/src/main/java/eu/faircode/email/FragmentAccount.java b/app/src/main/java/eu/faircode/email/FragmentAccount.java index 76c69b9b1c..eac7d4c1cd 100644 --- a/app/src/main/java/eu/faircode/email/FragmentAccount.java +++ b/app/src/main/java/eu/faircode/email/FragmentAccount.java @@ -324,18 +324,18 @@ public class FragmentAccount extends FragmentBase { btnColor.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - if (!Helper.isPro(getContext())) { - LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(getContext()); - lbm.sendBroadcast(new Intent(ActivitySetup.ACTION_SHOW_PRO)); - return; - } - int[] colors = getContext().getResources().getIntArray(R.array.colorPicker); ColorPickerDialog colorPickerDialog = new ColorPickerDialog(); colorPickerDialog.initialize(R.string.title_account_color, colors, color, 4, colors.length); colorPickerDialog.setOnColorSelectedListener(new ColorPickerSwatch.OnColorSelectedListener() { @Override public void onColorSelected(int color) { + if (!Helper.isPro(getContext())) { + LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(getContext()); + lbm.sendBroadcast(new Intent(ActivitySetup.ACTION_SHOW_PRO)); + return; + } + setColor(color); } }); diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index 13c3192610..2e460621df 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -184,8 +184,6 @@ public class FragmentCompose extends FragmentBase { private ContentResolver resolver; private AdapterAttachment adapter; - private boolean pro; - private boolean prefix_once = false; private boolean monospaced = false; private boolean style = true; @@ -212,7 +210,6 @@ public class FragmentCompose extends FragmentBase { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - pro = Helper.isPro(getContext()); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); prefix_once = prefs.getBoolean("prefix_once", false); @@ -3082,19 +3079,17 @@ public class FragmentCompose extends FragmentBase { grpExtra.setVisibility(identity != null && identity.sender_extra ? View.VISIBLE : View.GONE); Spanned signature = null; - if (pro) { - if (identity != null && !TextUtils.isEmpty(identity.signature)) - signature = HtmlHelper.fromHtml(identity.signature, new Html.ImageGetter() { - @Override - public Drawable getDrawable(String source) { - int px = Helper.dp2pixels(getContext(), 24); - Drawable d = getContext().getResources() - .getDrawable(R.drawable.baseline_image_24, getContext().getTheme()); - d.setBounds(0, 0, px, px); - return d; - } - }, null); - } + if (identity != null && !TextUtils.isEmpty(identity.signature)) + signature = HtmlHelper.fromHtml(identity.signature, new Html.ImageGetter() { + @Override + public Drawable getDrawable(String source) { + int px = Helper.dp2pixels(getContext(), 24); + Drawable d = getContext().getResources() + .getDrawable(R.drawable.baseline_image_24, getContext().getTheme()); + d.setBounds(0, 0, px, px); + return d; + } + }, null); tvSignature.setText(signature); grpSignature.setVisibility(signature == null ? View.GONE : View.VISIBLE); } diff --git a/app/src/main/java/eu/faircode/email/FragmentIdentity.java b/app/src/main/java/eu/faircode/email/FragmentIdentity.java index a6904aec15..38839c3fdb 100644 --- a/app/src/main/java/eu/faircode/email/FragmentIdentity.java +++ b/app/src/main/java/eu/faircode/email/FragmentIdentity.java @@ -277,18 +277,18 @@ public class FragmentIdentity extends FragmentBase { btnColor.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - if (!Helper.isPro(getContext())) { - LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(getContext()); - lbm.sendBroadcast(new Intent(ActivitySetup.ACTION_SHOW_PRO)); - return; - } - int[] colors = getContext().getResources().getIntArray(R.array.colorPicker); ColorPickerDialog colorPickerDialog = new ColorPickerDialog(); colorPickerDialog.initialize(R.string.title_account_color, colors, color, 4, colors.length); colorPickerDialog.setOnColorSelectedListener(new ColorPickerSwatch.OnColorSelectedListener() { @Override public void onColorSelected(int color) { + if (!Helper.isPro(getContext())) { + LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(getContext()); + lbm.sendBroadcast(new Intent(ActivitySetup.ACTION_SHOW_PRO)); + return; + } + setColor(color); } }); @@ -608,7 +608,7 @@ public class FragmentIdentity extends FragmentBase { if (TextUtils.isEmpty(bcc)) bcc = null; - if (Color.TRANSPARENT == color) + if (color == Color.TRANSPARENT || !Helper.isPro(context)) color = null; if (TextUtils.isEmpty(signature)) signature = null; diff --git a/app/src/main/java/eu/faircode/email/FragmentMessages.java b/app/src/main/java/eu/faircode/email/FragmentMessages.java index 04057cb4c8..4554cc4aa9 100644 --- a/app/src/main/java/eu/faircode/email/FragmentMessages.java +++ b/app/src/main/java/eu/faircode/email/FragmentMessages.java @@ -1627,18 +1627,18 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences. } private void onActionFlagColorSelection() { - if (!Helper.isPro(getContext())) { - LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(getContext()); - lbm.sendBroadcast(new Intent(ActivityView.ACTION_SHOW_PRO)); - return; - } - int[] colors = getResources().getIntArray(R.array.colorPicker); ColorPickerDialog colorPickerDialog = new ColorPickerDialog(); colorPickerDialog.initialize(R.string.title_flag_color, colors, Color.TRANSPARENT, 4, colors.length); colorPickerDialog.setOnColorSelectedListener(new ColorPickerSwatch.OnColorSelectedListener() { @Override public void onColorSelected(int color) { + if (!Helper.isPro(getContext())) { + LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(getContext()); + lbm.sendBroadcast(new Intent(ActivityView.ACTION_SHOW_PRO)); + return; + } + onActionFlagSelection(true, color); } }); diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsNotifications.java b/app/src/main/java/eu/faircode/email/FragmentOptionsNotifications.java index 0e15f849e0..9ac2487786 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsNotifications.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsNotifications.java @@ -201,16 +201,19 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared } private void setOptions() { + boolean pro = Helper.isPro(getContext()); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); swNotifyGroup.setChecked(prefs.getBoolean("notify_group", true)); swNotifyGroup.setVisibility(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N ? View.VISIBLE : View.GONE); swNotifyPreview.setChecked(prefs.getBoolean("notify_preview", true)); + cbNotifyActionTrash.setChecked(prefs.getBoolean("notify_trash", true)); cbNotifyActionArchive.setChecked(prefs.getBoolean("notify_archive", true)); - cbNotifyActionReply.setChecked(prefs.getBoolean("notify_reply", false)); - cbNotifyActionFlag.setChecked(prefs.getBoolean("notify_flag", false)); + cbNotifyActionReply.setChecked(prefs.getBoolean("notify_reply", false) && pro); + cbNotifyActionFlag.setChecked(prefs.getBoolean("notify_flag", false) && pro); cbNotifyActionSeen.setChecked(prefs.getBoolean("notify_seen", true)); + swLight.setChecked(prefs.getBoolean("light", false)); grpNotification.setVisibility(Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.O ? View.VISIBLE : View.GONE);