summaryrefslogtreecommitdiff
path: root/src/android
diff options
context:
space:
mode:
Diffstat (limited to 'src/android')
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/GameAdapter.kt16
-rw-r--r--src/android/app/src/main/res/layout/card_game.xml104
-rw-r--r--src/android/app/src/main/res/values/dimens.xml2
3 files changed, 64 insertions, 58 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/GameAdapter.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/GameAdapter.kt
index 77288b6d8..eca84a694 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/GameAdapter.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/GameAdapter.kt
@@ -6,6 +6,7 @@ package org.yuzu.yuzu_emu.adapters
6import android.annotation.SuppressLint 6import android.annotation.SuppressLint
7import android.graphics.Bitmap 7import android.graphics.Bitmap
8import android.graphics.BitmapFactory 8import android.graphics.BitmapFactory
9import android.text.TextUtils
9import android.view.LayoutInflater 10import android.view.LayoutInflater
10import android.view.View 11import android.view.View
11import android.view.ViewGroup 12import android.view.ViewGroup
@@ -31,7 +32,7 @@ class GameAdapter(private val activity: AppCompatActivity) :
31 override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): GameViewHolder { 32 override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): GameViewHolder {
32 // Create a new view. 33 // Create a new view.
33 val binding = CardGameBinding.inflate(LayoutInflater.from(parent.context), parent, false) 34 val binding = CardGameBinding.inflate(LayoutInflater.from(parent.context), parent, false)
34 binding.root.setOnClickListener(this) 35 binding.cardGame.setOnClickListener(this)
35 36
36 // Use that view to create a ViewHolder. 37 // Use that view to create a ViewHolder.
37 return GameViewHolder(binding) 38 return GameViewHolder(binding)
@@ -58,7 +59,7 @@ class GameAdapter(private val activity: AppCompatActivity) :
58 lateinit var game: Game 59 lateinit var game: Game
59 60
60 init { 61 init {
61 itemView.tag = this 62 binding.cardGame.tag = this
62 } 63 }
63 64
64 fun bind(game: Game) { 65 fun bind(game: Game) {
@@ -73,11 +74,14 @@ class GameAdapter(private val activity: AppCompatActivity) :
73 } 74 }
74 75
75 binding.textGameTitle.text = game.title.replace("[\\t\\n\\r]+".toRegex(), " ") 76 binding.textGameTitle.text = game.title.replace("[\\t\\n\\r]+".toRegex(), " ")
76 binding.textGameCaption.text = game.company
77 77
78 if (game.company.isEmpty()) { 78 binding.textGameTitle.postDelayed(
79 binding.textGameCaption.visibility = View.GONE 79 {
80 } 80 binding.textGameTitle.ellipsize = TextUtils.TruncateAt.MARQUEE
81 binding.textGameTitle.isSelected = true
82 },
83 3000
84 )
81 } 85 }
82 } 86 }
83 87
diff --git a/src/android/app/src/main/res/layout/card_game.xml b/src/android/app/src/main/res/layout/card_game.xml
index 4b7d2b3cc..469ad9edf 100644
--- a/src/android/app/src/main/res/layout/card_game.xml
+++ b/src/android/app/src/main/res/layout/card_game.xml
@@ -1,64 +1,66 @@
1<?xml version="1.0" encoding="utf-8"?> 1<?xml version="1.0" encoding="utf-8"?>
2<androidx.constraintlayout.widget.ConstraintLayout 2<FrameLayout
3 xmlns:android="http://schemas.android.com/apk/res/android" 3 xmlns:android="http://schemas.android.com/apk/res/android"
4 xmlns:app="http://schemas.android.com/apk/res-auto" 4 xmlns:app="http://schemas.android.com/apk/res-auto"
5 xmlns:tools="http://schemas.android.com/tools" 5 xmlns:tools="http://schemas.android.com/tools"
6 android:layout_width="match_parent" 6 android:layout_width="match_parent"
7 android:layout_height="wrap_content" 7 android:layout_height="wrap_content">
8 android:foreground="?attr/selectableItemBackground"
9 android:clickable="true"
10 android:clipToPadding="false"
11 android:focusable="true"
12 android:paddingStart="4dp"
13 android:paddingTop="8dp"
14 android:paddingEnd="4dp"
15 android:paddingBottom="8dp"
16 android:transitionName="card_game">
17 8
18 <com.google.android.material.card.MaterialCardView 9 <com.google.android.material.card.MaterialCardView
19 style="?attr/materialCardViewElevatedStyle" 10 style="?attr/materialCardViewElevatedStyle"
20 android:id="@+id/card_game_art" 11 android:id="@+id/card_game"
21 android:layout_width="140dp" 12 android:layout_width="wrap_content"
22 android:layout_height="140dp" 13 android:layout_height="wrap_content"
23 app:cardCornerRadius="4dp" 14 android:background="?attr/selectableItemBackground"
24 app:layout_constraintEnd_toEndOf="parent" 15 android:clickable="true"
25 app:layout_constraintStart_toStartOf="parent" 16 android:clipToPadding="false"
26 app:layout_constraintTop_toTopOf="parent"> 17 android:focusable="true"
18 android:transitionName="card_game"
19 android:layout_gravity="center"
20 app:cardElevation="0dp"
21 app:cardCornerRadius="12dp">
27 22
28 <ImageView 23 <androidx.constraintlayout.widget.ConstraintLayout
29 android:id="@+id/image_game_screen" 24 android:layout_width="wrap_content"
30 android:layout_width="match_parent" 25 android:layout_height="wrap_content"
31 android:layout_height="match_parent" /> 26 android:padding="6dp">
32 27
33 </com.google.android.material.card.MaterialCardView> 28 <com.google.android.material.card.MaterialCardView
29 style="?attr/materialCardViewElevatedStyle"
30 android:id="@+id/card_game_art"
31 android:layout_width="150dp"
32 android:layout_height="150dp"
33 app:cardCornerRadius="4dp"
34 app:layout_constraintEnd_toEndOf="parent"
35 app:layout_constraintStart_toStartOf="parent"
36 app:layout_constraintTop_toTopOf="parent">
34 37
35 <com.google.android.material.textview.MaterialTextView 38 <ImageView
36 style="@style/TextAppearance.Material3.BodyLarge" 39 android:id="@+id/image_game_screen"
37 android:id="@+id/text_game_title" 40 android:layout_width="match_parent"
38 android:layout_width="0dp" 41 android:layout_height="match_parent" />
39 android:layout_height="wrap_content"
40 android:ellipsize="end"
41 android:maxLines="2"
42 android:paddingTop="8dp"
43 android:textAlignment="viewStart"
44 app:layout_constraintEnd_toEndOf="@+id/card_game_art"
45 app:layout_constraintStart_toStartOf="@+id/card_game_art"
46 app:layout_constraintTop_toBottomOf="@+id/card_game_art"
47 tools:text="Super Mario Odyssey" />
48 42
49 <com.google.android.material.textview.MaterialTextView 43 </com.google.android.material.card.MaterialCardView>
50 style="@style/TextAppearance.Material3.BodyMedium" 44
51 android:id="@+id/text_game_caption" 45 <com.google.android.material.textview.MaterialTextView
52 android:layout_width="0dp" 46 style="@style/TextAppearance.Material3.TitleMedium"
53 android:layout_height="wrap_content" 47 android:id="@+id/text_game_title"
54 android:ellipsize="end" 48 android:layout_width="0dp"
55 android:lines="1" 49 android:layout_height="wrap_content"
56 android:maxLines="1" 50 android:layout_marginTop="8dp"
57 android:paddingTop="8dp" 51 android:textAlignment="center"
58 android:textAlignment="viewStart" 52 android:textSize="14sp"
59 app:layout_constraintEnd_toEndOf="@+id/card_game_art" 53 android:singleLine="true"
60 app:layout_constraintStart_toStartOf="@+id/card_game_art" 54 android:marqueeRepeatLimit="marquee_forever"
61 app:layout_constraintTop_toBottomOf="@+id/text_game_title" 55 android:ellipsize="none"
62 tools:text="Nintendo" /> 56 android:requiresFadingEdge="horizontal"
57 app:layout_constraintEnd_toEndOf="@+id/card_game_art"
58 app:layout_constraintStart_toStartOf="@+id/card_game_art"
59 app:layout_constraintTop_toBottomOf="@+id/card_game_art"
60 tools:text="The Legend of Zelda: Skyward Sword" />
61
62 </androidx.constraintlayout.widget.ConstraintLayout>
63
64 </com.google.android.material.card.MaterialCardView>
63 65
64</androidx.constraintlayout.widget.ConstraintLayout> 66</FrameLayout>
diff --git a/src/android/app/src/main/res/values/dimens.xml b/src/android/app/src/main/res/values/dimens.xml
index 23977c9f1..ab2583938 100644
--- a/src/android/app/src/main/res/values/dimens.xml
+++ b/src/android/app/src/main/res/values/dimens.xml
@@ -11,7 +11,7 @@
11 <dimen name="spacing_refresh_start">32dp</dimen> 11 <dimen name="spacing_refresh_start">32dp</dimen>
12 <dimen name="spacing_refresh_end">96dp</dimen> 12 <dimen name="spacing_refresh_end">96dp</dimen>
13 <dimen name="menu_width">256dp</dimen> 13 <dimen name="menu_width">256dp</dimen>
14 <dimen name="card_width">160dp</dimen> 14 <dimen name="card_width">165dp</dimen>
15 15
16 <dimen name="dialog_margin">20dp</dimen> 16 <dimen name="dialog_margin">20dp</dimen>
17 <dimen name="elevated_app_bar">3dp</dimen> 17 <dimen name="elevated_app_bar">3dp</dimen>