Merge branch 'fix-1326' into 'master'

display versionCode in expanded Versions list entries

Closes #1326

See merge request fdroid/fdroidclient!770
This commit is contained in:
Hans-Christoph Steiner 2018-12-20 21:41:16 +00:00
commit a2addd22a6
2 changed files with 18 additions and 1 deletions

View File

@ -1010,6 +1010,7 @@ public class AppDetailsRecyclerViewAdapter
final TextView statusInstalled;
final TextView statusSuggested;
final TextView statusIncompatible;
final TextView versionCode;
final TextView added;
final ImageView expandArrow;
final View expandedLayout;
@ -1031,6 +1032,7 @@ public class AppDetailsRecyclerViewAdapter
statusInstalled = (TextView) view.findViewById(R.id.status_installed);
statusSuggested = (TextView) view.findViewById(R.id.status_suggested);
statusIncompatible = (TextView) view.findViewById(R.id.status_incompatible);
versionCode = view.findViewById(R.id.versionCode);
added = (TextView) view.findViewById(R.id.added);
expandArrow = (ImageView) view.findViewById(R.id.expand_arrow);
expandedLayout = (View) view.findViewById(R.id.expanded_layout);
@ -1121,6 +1123,7 @@ public class AppDetailsRecyclerViewAdapter
// Display when the expert mode is enabled
if (Preferences.get().expertMode()) {
versionCode.setText(String.format(Locale.ENGLISH, " (%d) ", apk.versionCode));
// Display incompatible reasons when the app isn't compatible
if (!apk.compatible) {
String incompatibleReasonsText = getIncompatibleReasonsText(apk);
@ -1143,6 +1146,7 @@ public class AppDetailsRecyclerViewAdapter
incompatibleReasons.setVisibility(View.GONE);
}
} else {
versionCode.setText("");
incompatibleReasons.setVisibility(View.GONE);
targetArch.setVisibility(View.GONE);
}
@ -1244,6 +1248,7 @@ public class AppDetailsRecyclerViewAdapter
private void expand(boolean expand) {
versionsExpandTracker.put(apk.apkName, expand);
expandedLayout.setVisibility(expand ? View.VISIBLE : View.GONE);
versionCode.setVisibility(expand ? View.VISIBLE : View.GONE);
expandArrow.setImageDrawable(ContextCompat.getDrawable(context, expand ?
R.drawable.ic_expand_less_grey600 : R.drawable.ic_expand_more_grey600));

View File

@ -27,6 +27,10 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent">
<TextView android:id="@+id/version"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -36,6 +40,15 @@
android:textSize="18sp"
tools:text="1.2.3"/>
<TextView android:id="@+id/versionCode"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center"
android:singleLine="true"
android:textSize="14sp"
android:visibility="gone" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
@ -58,7 +71,6 @@
android:text="@string/app_incompatible" />
</LinearLayout>
</LinearLayout>
<TextView android:id="@+id/added"
android:layout_height="wrap_content"
android:layout_width="wrap_content"