From 1a55487a0095041c31c664537b5e3cf0259a1258 Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 28 Jun 2019 21:22:20 +0200 Subject: [PATCH] Link pro --- .../java/eu/faircode/email/FragmentAccount.java | 8 ++++++++ .../java/eu/faircode/email/FragmentIdentity.java | 4 ++++ .../java/eu/faircode/email/FragmentOptionsMisc.java | 4 ++++ .../email/FragmentOptionsNotifications.java | 5 +++++ .../faircode/email/FragmentOptionsSynchronize.java | 4 ++++ app/src/main/java/eu/faircode/email/Helper.java | 13 +++++++++++++ app/src/main/res/layout/fragment_account.xml | 6 ++++-- app/src/main/res/layout/fragment_identity.xml | 3 ++- app/src/main/res/layout/fragment_options_misc.xml | 4 +++- .../res/layout/fragment_options_notifications.xml | 2 +- .../res/layout/fragment_options_synchronize.xml | 2 +- 11 files changed, 49 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentAccount.java b/app/src/main/java/eu/faircode/email/FragmentAccount.java index e47ef7e338..7c691b7908 100644 --- a/app/src/main/java/eu/faircode/email/FragmentAccount.java +++ b/app/src/main/java/eu/faircode/email/FragmentAccount.java @@ -99,11 +99,13 @@ public class FragmentAccount extends FragmentBase { private Button btnColor; private View vwColor; private ImageButton ibColorDefault; + private TextView tvColorPro; private Button btnAdvanced; private CheckBox cbSynchronize; private CheckBox cbPrimary; private CheckBox cbNotify; + private TextView tvNotifyPro; private CheckBox cbBrowse; private EditText etInterval; private CheckBox cbPartialFetch; @@ -176,11 +178,13 @@ public class FragmentAccount extends FragmentBase { btnColor = view.findViewById(R.id.btnColor); vwColor = view.findViewById(R.id.vwColor); ibColorDefault = view.findViewById(R.id.ibColorDefault); + tvColorPro = view.findViewById(R.id.tvColorPro); btnAdvanced = view.findViewById(R.id.btnAdvanced); cbSynchronize = view.findViewById(R.id.cbSynchronize); cbPrimary = view.findViewById(R.id.cbPrimary); cbNotify = view.findViewById(R.id.cbNotify); + tvNotifyPro = view.findViewById(R.id.tvNotifyPro); cbBrowse = view.findViewById(R.id.cbBrowse); etInterval = view.findViewById(R.id.etInterval); cbPartialFetch = view.findViewById(R.id.cbPartialFetch); @@ -312,6 +316,8 @@ public class FragmentAccount extends FragmentBase { } }); + Helper.linkPro(tvColorPro); + btnAdvanced.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -339,6 +345,8 @@ public class FragmentAccount extends FragmentBase { Helper.hide(view.findViewById(R.id.tvNotifyPro)); } + Helper.linkPro(tvNotifyPro); + btnCheck.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { diff --git a/app/src/main/java/eu/faircode/email/FragmentIdentity.java b/app/src/main/java/eu/faircode/email/FragmentIdentity.java index f98dee5bab..b46e35bd8d 100644 --- a/app/src/main/java/eu/faircode/email/FragmentIdentity.java +++ b/app/src/main/java/eu/faircode/email/FragmentIdentity.java @@ -89,6 +89,7 @@ public class FragmentIdentity extends FragmentBase { private Button btnColor; private View vwColor; private ImageButton ibColorDefault; + private TextView tvColorPro; private EditText etSignature; private Button btnHtml; @@ -157,6 +158,7 @@ public class FragmentIdentity extends FragmentBase { btnColor = view.findViewById(R.id.btnColor); vwColor = view.findViewById(R.id.vwColor); ibColorDefault = view.findViewById(R.id.ibColorDefault); + tvColorPro = view.findViewById(R.id.tvColorPro); etSignature = view.findViewById(R.id.etSignature); btnHtml = view.findViewById(R.id.btnHtml); @@ -285,6 +287,8 @@ public class FragmentIdentity extends FragmentBase { } }); + Helper.linkPro(tvColorPro); + etSignature.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java index 81655f1f97..12a7d8a61a 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java @@ -48,6 +48,7 @@ import java.text.SimpleDateFormat; public class FragmentOptionsMisc extends FragmentBase implements SharedPreferences.OnSharedPreferenceChangeListener { private SwitchCompat swBadge; private SwitchCompat swSubscriptions; + private TextView tvSubscriptionPro; private SwitchCompat swSubscribedOnly; private SwitchCompat swEnglish; private SwitchCompat swAuthentication; @@ -85,6 +86,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc swBadge = view.findViewById(R.id.swBadge); swSubscriptions = view.findViewById(R.id.swSubscriptions); + tvSubscriptionPro = view.findViewById(R.id.tvSubscriptionPro); swSubscribedOnly = view.findViewById(R.id.swSubscribedOnly); swEnglish = view.findViewById(R.id.swEnglish); swAuthentication = view.findViewById(R.id.swAuthentication); @@ -123,6 +125,8 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc } }); + Helper.linkPro(tvSubscriptionPro); + swSubscribedOnly.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsNotifications.java b/app/src/main/java/eu/faircode/email/FragmentOptionsNotifications.java index 3ab0774b28..7625478199 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsNotifications.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsNotifications.java @@ -38,6 +38,7 @@ import android.widget.Button; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.ImageButton; +import android.widget.TextView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -54,6 +55,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared private CheckBox cbNotifyActionReply; private CheckBox cbNotifyActionFlag; private CheckBox cbNotifyActionSeen; + private TextView tvNotifyActionsPro; private Button btnManage; private ImageButton ibManage; private SwitchCompat swLight; @@ -81,6 +83,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared cbNotifyActionReply = view.findViewById(R.id.cbNotifyActionReply); cbNotifyActionFlag = view.findViewById(R.id.cbNotifyActionFlag); cbNotifyActionSeen = view.findViewById(R.id.cbNotifyActionSeen); + tvNotifyActionsPro = view.findViewById(R.id.tvNotifyActionsPro); btnManage = view.findViewById(R.id.btnManage); ibManage = view.findViewById(R.id.ibManage); swLight = view.findViewById(R.id.swLight); @@ -137,6 +140,8 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared } }); + Helper.linkPro(tvNotifyActionsPro); + final Intent manage = getIntentNotifications(getContext()); btnManage.setVisibility(manage.resolveActivity(pm) == null ? View.GONE : View.VISIBLE); btnManage.setOnClickListener(new View.OnClickListener() { diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsSynchronize.java b/app/src/main/java/eu/faircode/email/FragmentOptionsSynchronize.java index 3d6bdd289a..0b90465e52 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsSynchronize.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsSynchronize.java @@ -52,6 +52,7 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr private SwitchCompat swSchedule; private TextView tvScheduleStart; private TextView tvScheduleEnd; + private TextView tvSchedulePro; private SwitchCompat swUnseen; private SwitchCompat swFlagged; private SwitchCompat swSyncKept; @@ -76,6 +77,7 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr swSchedule = view.findViewById(R.id.swSchedule); tvScheduleStart = view.findViewById(R.id.tvScheduleStart); tvScheduleEnd = view.findViewById(R.id.tvScheduleEnd); + tvSchedulePro = view.findViewById(R.id.tvSchedulePro); swUnseen = view.findViewById(R.id.swUnseen); swFlagged = view.findViewById(R.id.swFlagged); swSyncKept = view.findViewById(R.id.swSyncKept); @@ -148,6 +150,8 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr } }); + Helper.linkPro(tvSchedulePro); + swUnseen.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { diff --git a/app/src/main/java/eu/faircode/email/Helper.java b/app/src/main/java/eu/faircode/email/Helper.java index fc69fcf342..7baf79a6b9 100644 --- a/app/src/main/java/eu/faircode/email/Helper.java +++ b/app/src/main/java/eu/faircode/email/Helper.java @@ -47,6 +47,7 @@ import android.widget.CheckBox; import android.widget.EditText; import android.widget.ImageView; import android.widget.Spinner; +import android.widget.TextView; import android.widget.Toast; import androidx.annotation.NonNull; @@ -56,6 +57,7 @@ import androidx.core.content.ContextCompat; import androidx.exifinterface.media.ExifInterface; import androidx.lifecycle.Lifecycle; import androidx.lifecycle.LifecycleOwner; +import androidx.localbroadcastmanager.content.LocalBroadcastManager; import androidx.preference.PreferenceManager; import com.google.android.material.bottomnavigation.BottomNavigationView; @@ -661,6 +663,17 @@ public class Helper { return PreferenceManager.getDefaultSharedPreferences(context).getBoolean("pro", false); } + static void linkPro(TextView tv) { + tv.getPaint().setUnderlineText(true); + tv.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(view.getContext()); + lbm.sendBroadcast(new Intent(ActivitySetup.ACTION_SHOW_PRO)); + } + }); + } + public static List> chunkList(List list, int size) { List> result = new ArrayList<>(list.size() / size); for (int i = 0; i < list.size(); i += size) diff --git a/app/src/main/res/layout/fragment_account.xml b/app/src/main/res/layout/fragment_account.xml index a0504da527..e95debb087 100644 --- a/app/src/main/res/layout/fragment_account.xml +++ b/app/src/main/res/layout/fragment_account.xml @@ -327,9 +327,10 @@ android:id="@+id/tvColorPro" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_marginTop="6dp" android:text="@string/title_pro_feature" android:textAppearance="@style/TextAppearance.AppCompat.Small" - android:textStyle="italic" + android:textColor="@color/colorAccent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/btnColor" /> @@ -376,9 +377,10 @@ android:id="@+id/tvNotifyPro" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_marginTop="6dp" android:text="@string/title_pro_feature" android:textAppearance="@style/TextAppearance.AppCompat.Small" - android:textStyle="italic" + android:textColor="@color/colorAccent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/cbNotify" /> diff --git a/app/src/main/res/layout/fragment_identity.xml b/app/src/main/res/layout/fragment_identity.xml index 27308d63db..9ac34a6064 100644 --- a/app/src/main/res/layout/fragment_identity.xml +++ b/app/src/main/res/layout/fragment_identity.xml @@ -145,9 +145,10 @@ android:id="@+id/tvColorPro" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_marginTop="6dp" android:text="@string/title_pro_feature" android:textAppearance="@style/TextAppearance.AppCompat.Small" - android:textStyle="italic" + android:textColor="@color/colorAccent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/btnColor" /> diff --git a/app/src/main/res/layout/fragment_options_misc.xml b/app/src/main/res/layout/fragment_options_misc.xml index 19a4849257..7052d51c86 100644 --- a/app/src/main/res/layout/fragment_options_misc.xml +++ b/app/src/main/res/layout/fragment_options_misc.xml @@ -53,10 +53,11 @@ android:id="@+id/tvSubscriptionPro" android:layout_width="0dp" android:layout_height="wrap_content" + android:layout_marginTop="6dp" android:layout_marginEnd="48dp" android:text="@string/title_pro_feature" android:textAppearance="@style/TextAppearance.AppCompat.Small" - android:textStyle="italic" + android:textColor="@color/colorAccent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/swSubscriptions" /> @@ -129,6 +130,7 @@ android:id="@+id/tvParanoidHint" android:layout_width="0dp" android:layout_height="wrap_content" + android:layout_marginTop="6dp" android:layout_marginEnd="48dp" android:text="@string/title_advanced_paranoid_hint" android:textAppearance="@style/TextAppearance.AppCompat.Small" diff --git a/app/src/main/res/layout/fragment_options_notifications.xml b/app/src/main/res/layout/fragment_options_notifications.xml index d5bfdf68eb..0ce61e2514 100644 --- a/app/src/main/res/layout/fragment_options_notifications.xml +++ b/app/src/main/res/layout/fragment_options_notifications.xml @@ -117,7 +117,7 @@ android:layout_marginEnd="48dp" android:text="@string/title_pro_feature" android:textAppearance="@style/TextAppearance.AppCompat.Small" - android:textStyle="italic" + android:textColor="@color/colorAccent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/tvNotifyActionsHint" /> diff --git a/app/src/main/res/layout/fragment_options_synchronize.xml b/app/src/main/res/layout/fragment_options_synchronize.xml index 0ac2076ef3..f8367b6e1c 100644 --- a/app/src/main/res/layout/fragment_options_synchronize.xml +++ b/app/src/main/res/layout/fragment_options_synchronize.xml @@ -149,7 +149,7 @@ android:layout_height="wrap_content" android:text="@string/title_pro_feature" android:textAppearance="@style/TextAppearance.AppCompat.Small" - android:textStyle="italic" + android:textColor="@color/colorAccent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/tvScheduleHint" />