mirror of
https://github.com/f-droid/fdroidclient.git
synced 2026-05-18 13:43:05 -04:00
Merge branch 'fix-incompatible-install' into 'master'
Fix visibility of install/update button when no compatible versions are available Closes #2847 See merge request fdroid/fdroidclient!1414
This commit is contained in:
@@ -646,8 +646,17 @@ public class AppDetailsRecyclerViewAdapter
|
||||
antiFeaturesListingView.setApp(app);
|
||||
updateAntiFeaturesWarning();
|
||||
|
||||
boolean hasCompatibleVersion = false;
|
||||
for (Apk apk : versions) {
|
||||
if (apk.compatible) {
|
||||
hasCompatibleVersion = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
boolean showPrimaryButton = hasCompatibleVersion || app.isInstalled(context);
|
||||
|
||||
buttonPrimaryView.setText(R.string.menu_install);
|
||||
buttonPrimaryView.setVisibility(versionsLoading ? View.GONE : View.VISIBLE);
|
||||
buttonPrimaryView.setVisibility(showPrimaryButton ? View.VISIBLE : View.GONE);
|
||||
buttonSecondaryView.setText(R.string.menu_uninstall);
|
||||
buttonSecondaryView.setVisibility(app.isUninstallable(context) ? View.VISIBLE : View.GONE);
|
||||
buttonSecondaryView.setOnClickListener(v -> callbacks.uninstallApk());
|
||||
@@ -665,7 +674,7 @@ public class AppDetailsRecyclerViewAdapter
|
||||
buttonPrimaryView.setEnabled(true);
|
||||
buttonPrimaryView.setOnClickListener(v -> callbacks.installApk(suggestedApk));
|
||||
} else if (app.isInstalled(context)) {
|
||||
if (app.canAndWantToUpdate(suggestedApk) && suggestedApk != null) {
|
||||
if (app.canAndWantToUpdate(suggestedApk)) {
|
||||
buttonPrimaryView.setText(R.string.menu_upgrade);
|
||||
buttonPrimaryView.setOnClickListener(v -> callbacks.installApk(suggestedApk));
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user