From 73ce4443b04d3a6f7da4cd5af131637deb2ef11b Mon Sep 17 00:00:00 2001 From: Torsten Grote Date: Thu, 6 Jun 2024 11:05:13 -0300 Subject: [PATCH] [app] Show a warning in app details, if no compatible versions available --- .../views/AppDetailsRecyclerViewAdapter.java | 14 ++++++++++++-- app/src/main/res/values/colors.xml | 3 ++- app/src/main/res/values/strings.xml | 1 + 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/fdroid/fdroid/views/AppDetailsRecyclerViewAdapter.java b/app/src/main/java/org/fdroid/fdroid/views/AppDetailsRecyclerViewAdapter.java index e6402189a..1f0965f50 100644 --- a/app/src/main/java/org/fdroid/fdroid/views/AppDetailsRecyclerViewAdapter.java +++ b/app/src/main/java/org/fdroid/fdroid/views/AppDetailsRecyclerViewAdapter.java @@ -574,8 +574,18 @@ public class AppDetailsRecyclerViewAdapter repoChooserView.setVisibility(View.GONE); } - if (SessionInstallManager.canBeUsed(context) && suggestedApk != null + if (suggestedApk == null && repos.size() > 1 && app.installedSigner != null && preferredRepoId != null + && preferredRepoId == app.repoId && !versionsLoading) { + // current repo is preferred, app is installed, but has no suggested version from this repo + int color = ContextCompat.getColor(context, R.color.fdroid_red); + warningView.setBackgroundColor(color); + warningView.setText(R.string.warning_no_compat_versions); + warningView.setVisibility(View.VISIBLE); + } else if (SessionInstallManager.canBeUsed(context) && suggestedApk != null && !SessionInstallManager.isTargetSdkSupported(suggestedApk.targetSdkVersion)) { + int color = ContextCompat.getColor(context, R.color.warning); + warningView.setBackgroundColor(color); + warningView.setText(R.string.warning_target_sdk); warningView.setVisibility(View.VISIBLE); } else { warningView.setVisibility(View.GONE); @@ -637,7 +647,7 @@ public class AppDetailsRecyclerViewAdapter updateAntiFeaturesWarning(); buttonPrimaryView.setText(R.string.menu_install); - buttonPrimaryView.setVisibility(versions.isEmpty() ? View.GONE : View.VISIBLE); + buttonPrimaryView.setVisibility(versionsLoading ? View.GONE : View.VISIBLE); buttonSecondaryView.setText(R.string.menu_uninstall); buttonSecondaryView.setVisibility(app.isUninstallable(context) ? View.VISIBLE : View.GONE); buttonSecondaryView.setOnClickListener(v -> callbacks.uninstallApk()); diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 765f3ca09..b8a12adc2 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -29,7 +29,8 @@ #ff004ba0 #ffbee247 #ff8ab000 - #ffb00020 + #ffb00020 + @color/fdroid_red #ff757575 #cc222222 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 0c3bc3645..079d3c3fc 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -748,6 +748,7 @@ This often occurs with apps installed via Google Play or other sources, if they Updated today Your camera doesn\'t seem to have an autofocus. It might be difficult to scan the code. This app was built for an older version of Android and cannot be updated automatically. + The selected repository has no compatible app versions. To receive updates, prefer a repository with compatible versions. Undo Installation cancelled Turn on wifi