Show download source

This commit is contained in:
M66B
2022-01-30 11:46:08 +01:00
parent bc42e826ad
commit 0115333611
3 changed files with 41 additions and 25 deletions

View File

@@ -43,6 +43,7 @@ import androidx.core.widget.TextViewCompat;
import java.text.DateFormat;
import java.util.List;
import java.util.Objects;
public class FragmentAbout extends FragmentBase {
@Override
@@ -57,8 +58,8 @@ public class FragmentAbout extends FragmentBase {
TextView tvVersion = view.findViewById(R.id.tvVersion);
TextView tvRelease = view.findViewById(R.id.tvRelease);
TextView tvDownloaded = view.findViewById(R.id.tvDownloaded);
TextView tvUpdated = view.findViewById(R.id.tvUpdated);
ImageButton ibUpdate = view.findViewById(R.id.ibUpdate);
TextView tvGplV3 = view.findViewById(R.id.tvGplV3);
LinearLayout llContributors = view.findViewById(R.id.llContributors);
@@ -66,6 +67,21 @@ public class FragmentAbout extends FragmentBase {
tvVersion.setText(getString(R.string.title_version, version));
tvRelease.setText(BuildConfig.RELEASE_NAME);
String fingerprint = Helper.getFingerprint(context);
boolean play = Objects.equals(fingerprint, getString(R.string.fingerprint));
boolean fdroid = Objects.equals(fingerprint, getString(R.string.fingerprint_fdroid));
String source;
if (play)
source = (BuildConfig.PLAY_STORE_RELEASE ? "Play store" : "GitHub");
else if (fdroid)
source = "F-Droid";
else if (BuildConfig.DEBUG)
source = "Debug";
else
source = "?";
tvDownloaded.setText(getString(R.string.app_download, source));
long last = 0;
try {
PackageManager pm = context.getPackageManager();
@@ -78,10 +94,7 @@ public class FragmentAbout extends FragmentBase {
DateFormat DF = Helper.getDateTimeInstance(context, DateFormat.SHORT, DateFormat.SHORT);
tvUpdated.setText(getString(R.string.app_updated, last == 0 ? "-" : DF.format(last)));
ibUpdate.setVisibility(
Helper.hasValidFingerprint(context) || BuildConfig.DEBUG
? View.VISIBLE : View.GONE);
ibUpdate.setOnClickListener(new View.OnClickListener() {
tvUpdated.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (BuildConfig.PLAY_STORE_RELEASE)