Show mismatching sig apks when incompatible versions enabled.
This is in the spirit of the setting, where users can see which apks are available even though they are not installable. Adds a message explaining why it is incompatible (i.e. because the signature doesn't match the installed version).
This commit is contained in:
parent
ef717437a9
commit
dd93df9ef2
@ -116,9 +116,10 @@ public class AppDetailsRecyclerViewAdapter
|
||||
versions = new ArrayList<>();
|
||||
compatibleVersionsDifferentSig = new ArrayList<>();
|
||||
final List<Apk> apks = ApkProvider.Helper.findByPackageName(context, this.app.packageName);
|
||||
boolean showIncompatibleVersions = Preferences.get().showIncompatibleVersions();
|
||||
for (final Apk apk : apks) {
|
||||
boolean allowByCompatability = apk.compatible || Preferences.get().showIncompatibleVersions();
|
||||
boolean allowBySig = this.app.installedSig == null || TextUtils.equals(this.app.installedSig, apk.sig);
|
||||
boolean allowByCompatability = apk.compatible || showIncompatibleVersions;
|
||||
boolean allowBySig = this.app.installedSig == null || showIncompatibleVersions || TextUtils.equals(this.app.installedSig, apk.sig);
|
||||
if (allowByCompatability) {
|
||||
compatibleVersionsDifferentSig.add(apk);
|
||||
if (allowBySig) {
|
||||
@ -951,12 +952,18 @@ public class AppDetailsRecyclerViewAdapter
|
||||
nativecode.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
boolean mismatchedSig = app.installedSig != null && !TextUtils.equals(app.installedSig, apk.sig);
|
||||
|
||||
if (apk.incompatibleReasons != null) {
|
||||
incompatibleReasons.setText(
|
||||
context.getResources().getString(
|
||||
R.string.requires_features,
|
||||
TextUtils.join(", ", apk.incompatibleReasons)));
|
||||
incompatibleReasons.setVisibility(View.VISIBLE);
|
||||
} else if (mismatchedSig) {
|
||||
incompatibleReasons.setText(
|
||||
context.getString(R.string.app_details__incompatible_mismatched_signature));
|
||||
incompatibleReasons.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
incompatibleReasons.setVisibility(View.GONE);
|
||||
}
|
||||
@ -974,7 +981,7 @@ public class AppDetailsRecyclerViewAdapter
|
||||
nativecode,
|
||||
};
|
||||
for (final View v : views) {
|
||||
v.setEnabled(apk.compatible);
|
||||
v.setEnabled(apk.compatible && !mismatchedSig);
|
||||
}
|
||||
itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -54,6 +54,7 @@
|
||||
<string name="app_details_donate_prompt_unknown_author">Buy the developers of %1$s a coffee!</string>
|
||||
<string name="app_details_donate_prompt">%1$s is created by %2$s. Buy them a coffee!</string>
|
||||
|
||||
<string name="app_details__incompatible_mismatched_signature">Different signature to installed version</string>
|
||||
<string name="app_details__no_versions__show_incompat_versions">To show incompatible versions here anyway, enable the \"%1$s\" setting.</string>
|
||||
<string name="app_details__no_versions__no_compatible_signatures">No versions with compatible signature</string>
|
||||
<string name="app_details__no_versions__none_compatible_with_device">No versions compatible with device</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user