From 7f306d3af33c6be796496f78eee827a78284fb05 Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 12 Sep 2018 19:19:42 +0000 Subject: [PATCH] Made account colors pro featue --- README.md | 1 + .../eu/faircode/email/FragmentAccount.java | 30 ++++++++++--------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 838ec628..90df93eb 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ Pro features ------------ * Signatures +* Account colors * Standard replies * Progressive search (first local, then server) * Preview sender/subject in new messages status bar notification diff --git a/app/src/main/java/eu/faircode/email/FragmentAccount.java b/app/src/main/java/eu/faircode/email/FragmentAccount.java index f3b60d86..12edba2c 100644 --- a/app/src/main/java/eu/faircode/email/FragmentAccount.java +++ b/app/src/main/java/eu/faircode/email/FragmentAccount.java @@ -282,20 +282,22 @@ public class FragmentAccount extends FragmentEx { btnColor.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - 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) { - setColor(color); - } - }); - - colorPickerDialog.show(getFragmentManager(), "colorpicker"); + if (PreferenceManager.getDefaultSharedPreferences(getContext()).getBoolean("pro", false)) { + 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) { + setColor(color); + } + }); + colorPickerDialog.show(getFragmentManager(), "colorpicker"); + } else { + FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction(); + fragmentTransaction.replace(R.id.content_frame, new FragmentPro()).addToBackStack("pro"); + fragmentTransaction.commit(); + } } });