From 4eb91ca061d674da1aeb88b6dbc18b0c3275d3b4 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 21 Feb 2021 11:32:45 +0100 Subject: [PATCH] Added check for updates button in about --- .../java/eu/faircode/email/FragmentAbout.java | 15 ++++++++++++ .../main/res/drawable/twotone_cached_24.xml | 10 ++++++++ app/src/main/res/layout/fragment_about.xml | 24 ++++++++++++++++--- 3 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 app/src/main/res/drawable/twotone_cached_24.xml diff --git a/app/src/main/java/eu/faircode/email/FragmentAbout.java b/app/src/main/java/eu/faircode/email/FragmentAbout.java index 9a98a2662a..69b6447dbd 100644 --- a/app/src/main/java/eu/faircode/email/FragmentAbout.java +++ b/app/src/main/java/eu/faircode/email/FragmentAbout.java @@ -31,6 +31,7 @@ import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; +import android.widget.ImageButton; import android.widget.LinearLayout; import android.widget.TextView; @@ -51,12 +52,26 @@ public class FragmentAbout extends FragmentBase { TextView tvVersion = view.findViewById(R.id.tvVersion); TextView tvRelease = view.findViewById(R.id.tvRelease); + ImageButton ibUpdate = view.findViewById(R.id.ibUpdate); TextView tvGplV3 = view.findViewById(R.id.tvGplV3); LinearLayout llContributors = view.findViewById(R.id.llContributors); tvVersion.setText(getString(R.string.title_version, BuildConfig.VERSION_NAME)); tvRelease.setText(BuildConfig.RELEASE_NAME); + ibUpdate.setVisibility( + Helper.hasValidFingerprint(getContext()) || BuildConfig.DEBUG + ? View.VISIBLE : View.GONE); + ibUpdate.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (BuildConfig.PLAY_STORE_RELEASE) + Helper.view(v.getContext(), Helper.getIntentRate(v.getContext())); + else + onMenuChangelog(); + } + }); + tvGplV3.setPaintFlags(tvGplV3.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); tvGplV3.setOnClickListener(new View.OnClickListener() { @Override diff --git a/app/src/main/res/drawable/twotone_cached_24.xml b/app/src/main/res/drawable/twotone_cached_24.xml new file mode 100644 index 0000000000..e4d5311340 --- /dev/null +++ b/app/src/main/res/drawable/twotone_cached_24.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/layout/fragment_about.xml b/app/src/main/res/layout/fragment_about.xml index b47b339678..a3c8215c24 100644 --- a/app/src/main/res/layout/fragment_about.xml +++ b/app/src/main/res/layout/fragment_about.xml @@ -13,6 +13,7 @@ android:layout_marginStart="12dp" android:layout_marginTop="12dp" android:layout_marginEnd="12dp" + android:lines="1" android:text="Version 1.234" android:textAppearance="@style/TextAppearance.AppCompat.Medium" android:textIsSelectable="true" @@ -21,26 +22,43 @@ + +