Android: Display game code in list
This commit is contained in:
parent
0cb4ac02ca
commit
0ea5c870e7
|
@ -90,12 +90,22 @@ public class GameListEntry {
|
||||||
return mCompatibilityRating;
|
return mCompatibilityRating;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getSubTitle() {
|
||||||
|
String sizeString = String.format("%.2f MB", (double) mSize / 1048576.0);
|
||||||
|
String fileName;
|
||||||
|
int lastSlash = mPath.lastIndexOf('/');
|
||||||
|
if (lastSlash > 0 && lastSlash < mPath.length() - 1)
|
||||||
|
fileName = mPath.substring(lastSlash + 1);
|
||||||
|
else
|
||||||
|
fileName = mPath;
|
||||||
|
|
||||||
|
return String.format("%s (%s)", fileName, sizeString);
|
||||||
|
}
|
||||||
|
|
||||||
public void fillView(View view) {
|
public void fillView(View view) {
|
||||||
((TextView) view.findViewById(R.id.game_list_view_entry_title)).setText(mTitle);
|
((TextView) view.findViewById(R.id.game_list_view_entry_title)).setText(mTitle);
|
||||||
((TextView) view.findViewById(R.id.game_list_view_entry_path)).setText(mPath);
|
((TextView) view.findViewById(R.id.game_list_view_entry_subtitle)).setText(getSubTitle());
|
||||||
|
((TextView) view.findViewById(R.id.game_list_view_entry_code)).setText(mCode);
|
||||||
String sizeString = String.format("%.2f MB", (double) mSize / 1048576.0);
|
|
||||||
((TextView) view.findViewById(R.id.game_list_view_entry_size)).setText(sizeString);
|
|
||||||
|
|
||||||
int regionDrawableId;
|
int regionDrawableId;
|
||||||
switch (mRegion) {
|
switch (mRegion) {
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/game_list_view_entry_path"
|
android:id="@+id/game_list_view_entry_subtitle"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="10dp"
|
android:layout_marginLeft="10dp"
|
||||||
|
@ -47,7 +47,7 @@
|
||||||
app:layout_constraintTop_toBottomOf="@+id/game_list_view_entry_title" />
|
app:layout_constraintTop_toBottomOf="@+id/game_list_view_entry_title" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/game_list_view_entry_size"
|
android:id="@+id/game_list_view_entry_code"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
|
@ -70,7 +70,7 @@
|
||||||
android:focusableInTouchMode="false"
|
android:focusableInTouchMode="false"
|
||||||
android:paddingBottom="8px"
|
android:paddingBottom="8px"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/game_list_view_entry_size"
|
app:layout_constraintTop_toBottomOf="@+id/game_list_view_entry_code"
|
||||||
app:srcCompat="@drawable/flag_jp" />
|
app:srcCompat="@drawable/flag_jp" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
Loading…
Reference in New Issue