Display required arch also for compatible app versions
This commit is contained in:
parent
9ddd5bb1a7
commit
c937cbf297
@ -1005,6 +1005,7 @@ public class AppDetailsRecyclerViewAdapter
|
||||
Button buttonAction;
|
||||
final View busyIndicator;
|
||||
final TextView incompatibleReasons;
|
||||
final TextView targetArch;
|
||||
|
||||
private Apk apk;
|
||||
|
||||
@ -1024,6 +1025,7 @@ public class AppDetailsRecyclerViewAdapter
|
||||
buttonDowngrade = (Button) view.findViewById(R.id.button_downgrade);
|
||||
busyIndicator = (View) view.findViewById(R.id.busy_indicator);
|
||||
incompatibleReasons = (TextView) view.findViewById(R.id.incompatible_reasons);
|
||||
targetArch = (TextView) view.findViewById(R.id.target_arch);
|
||||
|
||||
int margin = context.getResources().getDimensionPixelSize(R.dimen.layout_horizontal_margin);
|
||||
int padding = context.getResources().getDimensionPixelSize(R.dimen.details_activity_padding);
|
||||
@ -1088,9 +1090,10 @@ public class AppDetailsRecyclerViewAdapter
|
||||
// Show busy indicator when the APK is being downloaded
|
||||
busyIndicator.setVisibility(isApkDownloading ? View.VISIBLE : View.GONE);
|
||||
|
||||
// Display incompatible reasons when the app
|
||||
// isn't compatible and the expert mode is enabled
|
||||
if (Preferences.get().expertMode() && !apk.compatible) {
|
||||
// Display when the expert mode is enabled
|
||||
if (Preferences.get().expertMode()) {
|
||||
// Display incompatible reasons when the app isn't compatible
|
||||
if (!apk.compatible) {
|
||||
String incompatibleReasonsText = getIncompatibleReasonsText(apk);
|
||||
if (incompatibleReasonsText != null) {
|
||||
incompatibleReasons.setVisibility(View.VISIBLE);
|
||||
@ -1098,8 +1101,21 @@ public class AppDetailsRecyclerViewAdapter
|
||||
} else {
|
||||
incompatibleReasons.setVisibility(View.GONE);
|
||||
}
|
||||
targetArch.setVisibility(View.GONE);
|
||||
} else {
|
||||
// Display target architecture when the app is compatible
|
||||
String targetArchText = getTargetArchText(apk);
|
||||
if (targetArchText != null) {
|
||||
targetArch.setVisibility(View.VISIBLE);
|
||||
targetArch.setText(targetArchText);
|
||||
} else {
|
||||
targetArch.setVisibility(View.GONE);
|
||||
}
|
||||
incompatibleReasons.setVisibility(View.GONE);
|
||||
}
|
||||
} else {
|
||||
incompatibleReasons.setVisibility(View.GONE);
|
||||
targetArch.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
// Expand the view if it was previously expanded or when downloading
|
||||
@ -1144,6 +1160,26 @@ public class AppDetailsRecyclerViewAdapter
|
||||
return null;
|
||||
}
|
||||
|
||||
private String getTargetArchText(final Apk apk) {
|
||||
if (apk.nativecode == null) {
|
||||
return null;
|
||||
}
|
||||
String currentArch = System.getProperty("os.arch");
|
||||
List<String> customArchs = new ArrayList<>();
|
||||
for (String arch : apk.nativecode) {
|
||||
// Gather only archs different than current arch
|
||||
if (!TextUtils.equals(arch, currentArch)) {
|
||||
customArchs.add(arch);
|
||||
}
|
||||
}
|
||||
String archs = TextUtils.join(", ", customArchs);
|
||||
if (!archs.isEmpty()) {
|
||||
// Reuse "Requires: ..." string to display this
|
||||
return context.getResources().getString(R.string.requires_features, archs);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void showActionButton(Button button, boolean isApkInstalled, boolean isApkDownloading) {
|
||||
buttonAction = button;
|
||||
if (isApkDownloading) {
|
||||
|
@ -167,5 +167,12 @@
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
tools:text="Requires: armeabi-v7a" />
|
||||
|
||||
<TextView android:id="@+id/target_arch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?attr/lightGrayTextColor"
|
||||
android:textSize="12sp"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
Loading…
x
Reference in New Issue
Block a user