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 {
externalNativeBuild {
cmake {
arguments "-DCMAKE_BUILD_TYPE=Release"
abiFilters "arm64-v8a", "armeabi-v7a"
arguments "-DCMAKE_BUILD_TYPE=RelWithDebInfo"
abiFilters "x86_64" // "arm64-v8a", "armeabi-v7a"
}
}
}

View file

@ -110,20 +110,19 @@ public class GameListEntry {
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_subtitle)).setText(getSubTitle());
((TextView) view.findViewById(R.id.game_list_view_entry_code)).setText(mCode);
int regionDrawableId;
switch (mRegion) {
case NTSC_J:
regionDrawableId = R.drawable.flag_jp;
break;
case PAL:
regionDrawableId = R.drawable.flag_eu;
break;
case NTSC_U:
default:
regionDrawableId = R.drawable.flag_us;
break;
case PAL:
regionDrawableId = R.drawable.flag_eu;
break;
}
((ImageView) view.findViewById(R.id.game_list_view_entry_region_icon))
@ -131,11 +130,6 @@ public class GameListEntry {
int typeDrawableId;
switch (mType) {
case Disc:
default:
typeDrawableId = R.drawable.ic_media_cdrom;
break;
case PSExe:
typeDrawableId = R.drawable.ic_emblem_system;
break;
@ -143,9 +137,41 @@ public class GameListEntry {
case Playlist:
typeDrawableId = R.drawable.ic_baseline_playlist_play_24;
break;
case Disc:
default:
typeDrawableId = R.drawable.ic_media_cdrom;
break;
}
((ImageView) view.findViewById(R.id.game_list_view_entry_type_icon))
.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_marginLeft="10dp"
android:layout_marginTop="8dp"
android:layout_marginRight="64dp"
android:layout_marginRight="80dp"
android:focusable="false"
android:focusableInTouchMode="false"
android:text="Game Title"
@ -36,7 +36,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="64dp"
android:layout_marginRight="80dp"
android:focusable="false"
android:focusableInTouchMode="false"
android:paddingBottom="8px"
@ -46,17 +46,16 @@
app:layout_constraintStart_toEndOf="@+id/game_list_view_entry_type_icon"
app:layout_constraintTop_toBottomOf="@+id/game_list_view_entry_title" />
<TextView
android:id="@+id/game_list_view_entry_code"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
<ImageView
android:id="@+id/game_list_view_compatibility_icon"
android:layout_width="64dp"
android:layout_height="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:focusable="false"
android:focusableInTouchMode="false"
android:text="123.4 MB"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textSize="12sp"
app:srcCompat="@drawable/ic_star_5"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
@ -64,13 +63,13 @@
android:id="@+id/game_list_view_entry_region_icon"
android:layout_width="32dp"
android:layout_height="28dp"
android:layout_marginTop="8px"
android:layout_marginEnd="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="24dp"
android:focusable="false"
android:focusableInTouchMode="false"
android:paddingBottom="8px"
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" />
</androidx.constraintlayout.widget.ConstraintLayout>