[app] Show a warning in app details, if no compatible versions available

This commit is contained in:
Torsten Grote
2024-06-06 11:05:13 -03:00
parent de643551e3
commit 73ce4443b0
3 changed files with 15 additions and 3 deletions

View File

@@ -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());

View File

@@ -29,7 +29,8 @@
<color name="fdroid_blue_dark">#ff004ba0</color>
<color name="fdroid_green_light">#ffbee247</color>
<color name="fdroid_green">#ff8ab000</color>
<color name="fdroid_error">#ffb00020</color>
<color name="fdroid_red">#ffb00020</color>
<color name="fdroid_error">@color/fdroid_red</color>
<color name="fdroid_caption">#ff757575</color>
<color name="shadow">#cc222222</color>

View File

@@ -748,6 +748,7 @@ This often occurs with apps installed via Google Play or other sources, if they
<string name="details_last_updated_today">Updated today</string>
<string name="warning_scaning_qr_code">Your camera doesn\'t seem to have an autofocus. It might be difficult to scan the code.</string>
<string name="warning_target_sdk">This app was built for an older version of Android and cannot be updated automatically.</string>
<string name="warning_no_compat_versions">The selected repository has no compatible app versions. To receive updates, prefer a repository with compatible versions.</string>
<string name="undo">Undo</string>
<string name="app_list__dismiss_installing_app">Installation cancelled</string>
<string name="turn_on_wifi">Turn on wifi</string>