Android: Display compatibility rating in game list

This commit is contained in:
Connor McLaughlin 2020-11-27 23:30:14 +10:00
parent 5fd5d89b23
commit 38e3b2a28a
9 changed files with 47 additions and 22 deletions

View file

@ -30,8 +30,8 @@ android {
defaultConfig { defaultConfig {
externalNativeBuild { externalNativeBuild {
cmake { cmake {
arguments "-DCMAKE_BUILD_TYPE=Release" arguments "-DCMAKE_BUILD_TYPE=RelWithDebInfo"
abiFilters "arm64-v8a", "armeabi-v7a" abiFilters "x86_64" // "arm64-v8a", "armeabi-v7a"
} }
} }
} }

View file

@ -110,20 +110,19 @@ public class GameListEntry {
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_subtitle)).setText(getSubTitle()); ((TextView) view.findViewById(R.id.game_list_view_entry_subtitle)).setText(getSubTitle());
((TextView) view.findViewById(R.id.game_list_view_entry_code)).setText(mCode);
int regionDrawableId; int regionDrawableId;
switch (mRegion) { switch (mRegion) {
case NTSC_J: case NTSC_J:
regionDrawableId = R.drawable.flag_jp; regionDrawableId = R.drawable.flag_jp;
break; break;
case PAL:
regionDrawableId = R.drawable.flag_eu;
break;
case NTSC_U: case NTSC_U:
default: default:
regionDrawableId = R.drawable.flag_us; regionDrawableId = R.drawable.flag_us;
break; break;
case PAL:
regionDrawableId = R.drawable.flag_eu;
break;
} }
((ImageView) view.findViewById(R.id.game_list_view_entry_region_icon)) ((ImageView) view.findViewById(R.id.game_list_view_entry_region_icon))
@ -131,11 +130,6 @@ public class GameListEntry {
int typeDrawableId; int typeDrawableId;
switch (mType) { switch (mType) {
case Disc:
default:
typeDrawableId = R.drawable.ic_media_cdrom;
break;
case PSExe: case PSExe:
typeDrawableId = R.drawable.ic_emblem_system; typeDrawableId = R.drawable.ic_emblem_system;
break; break;
@ -143,9 +137,41 @@ public class GameListEntry {
case Playlist: case Playlist:
typeDrawableId = R.drawable.ic_baseline_playlist_play_24; typeDrawableId = R.drawable.ic_baseline_playlist_play_24;
break; break;
case Disc:
default:
typeDrawableId = R.drawable.ic_media_cdrom;
break;
} }
((ImageView) view.findViewById(R.id.game_list_view_entry_type_icon)) ((ImageView) view.findViewById(R.id.game_list_view_entry_type_icon))
.setImageDrawable(ContextCompat.getDrawable(view.getContext(), typeDrawableId)); .setImageDrawable(ContextCompat.getDrawable(view.getContext(), typeDrawableId));
int compatibilityDrawableId;
switch (mCompatibilityRating)
{
case DoesntBoot:
compatibilityDrawableId = R.drawable.ic_star_1;
break;
case CrashesInIntro:
compatibilityDrawableId = R.drawable.ic_star_2;
break;
case CrashesInGame:
compatibilityDrawableId = R.drawable.ic_star_3;
break;
case GraphicalAudioIssues:
compatibilityDrawableId = R.drawable.ic_star_4;
break;
case NoIssues:
compatibilityDrawableId = R.drawable.ic_star_5;
break;
case Unknown:
default:
compatibilityDrawableId = R.drawable.ic_star_0;
break;
}
((ImageView) view.findViewById(R.id.game_list_view_compatibility_icon))
.setImageDrawable(ContextCompat.getDrawable(view.getContext(), compatibilityDrawableId));
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

View file

@ -22,7 +22,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="10dp" android:layout_marginLeft="10dp"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_marginRight="64dp" android:layout_marginRight="80dp"
android:focusable="false" android:focusable="false"
android:focusableInTouchMode="false" android:focusableInTouchMode="false"
android:text="Game Title" android:text="Game Title"
@ -36,7 +36,7 @@
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"
android:layout_marginRight="64dp" android:layout_marginRight="80dp"
android:focusable="false" android:focusable="false"
android:focusableInTouchMode="false" android:focusableInTouchMode="false"
android:paddingBottom="8px" android:paddingBottom="8px"
@ -46,17 +46,16 @@
app:layout_constraintStart_toEndOf="@+id/game_list_view_entry_type_icon" app:layout_constraintStart_toEndOf="@+id/game_list_view_entry_type_icon"
app:layout_constraintTop_toBottomOf="@+id/game_list_view_entry_title" /> app:layout_constraintTop_toBottomOf="@+id/game_list_view_entry_title" />
<TextView <ImageView
android:id="@+id/game_list_view_entry_code" android:id="@+id/game_list_view_compatibility_icon"
android:layout_width="wrap_content" android:layout_width="64dp"
android:layout_height="wrap_content" android:layout_height="16dp"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:focusable="false" android:focusable="false"
android:focusableInTouchMode="false" android:focusableInTouchMode="false"
android:text="123.4 MB"
android:textAppearance="@style/TextAppearance.AppCompat.Small" android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textSize="12sp" app:srcCompat="@drawable/ic_star_5"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
@ -64,13 +63,13 @@
android:id="@+id/game_list_view_entry_region_icon" android:id="@+id/game_list_view_entry_region_icon"
android:layout_width="32dp" android:layout_width="32dp"
android:layout_height="28dp" android:layout_height="28dp"
android:layout_marginTop="8px" android:layout_marginTop="8dp"
android:layout_marginEnd="8dp" android:layout_marginEnd="24dp"
android:focusable="false" android:focusable="false"
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_code" app:layout_constraintTop_toBottomOf="@+id/game_list_view_compatibility_icon"
app:srcCompat="@drawable/flag_jp" /> app:srcCompat="@drawable/flag_jp" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>