yuzu-emu
/
yuzu-mainline
Archived
1
0
Fork 0

android: Use Material 3 components

This commit is contained in:
Charles Lombardo 2023-03-13 23:15:52 -04:00 committed by bunnei
parent 18f4ef436d
commit 5840d60724
23 changed files with 271 additions and 177 deletions

View File

@ -24,6 +24,8 @@ import androidx.appcompat.app.AlertDialog;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.fragment.app.DialogFragment; import androidx.fragment.app.DialogFragment;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import org.yuzu.yuzu_emu.activities.EmulationActivity; import org.yuzu.yuzu_emu.activities.EmulationActivity;
import org.yuzu.yuzu_emu.utils.DocumentsTree; import org.yuzu.yuzu_emu.utils.DocumentsTree;
import org.yuzu.yuzu_emu.utils.EmulationMenuSettings; import org.yuzu.yuzu_emu.utils.EmulationMenuSettings;
@ -268,7 +270,7 @@ public final class NativeLibrary {
final String title = Objects.requireNonNull(Objects.requireNonNull(getArguments()).getString("title")); final String title = Objects.requireNonNull(Objects.requireNonNull(getArguments()).getString("title"));
final String message = Objects.requireNonNull(Objects.requireNonNull(getArguments()).getString("message")); final String message = Objects.requireNonNull(Objects.requireNonNull(getArguments()).getString("message"));
return new AlertDialog.Builder(emulationActivity) return new MaterialAlertDialogBuilder(emulationActivity)
.setTitle(title) .setTitle(title)
.setMessage(message) .setMessage(message)
.setPositiveButton(R.string.continue_button, (dialog, which) -> { .setPositiveButton(R.string.continue_button, (dialog, which) -> {
@ -369,7 +371,7 @@ public final class NativeLibrary {
} else { } else {
// Create object used for waiting. // Create object used for waiting.
final Object lock = new Object(); final Object lock = new Object();
AlertDialog.Builder builder = new AlertDialog.Builder(emulationActivity) MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(emulationActivity)
.setTitle(caption) .setTitle(caption)
.setMessage(text); .setMessage(text);
@ -451,7 +453,7 @@ public final class NativeLibrary {
return alertPromptResult; return alertPromptResult;
} }
public static AlertDialog.Builder displayAlertPromptImpl(String caption, String text, int buttonConfig) { public static MaterialAlertDialogBuilder displayAlertPromptImpl(String caption, String text, int buttonConfig) {
final EmulationActivity emulationActivity = sEmulationActivity.get(); final EmulationActivity emulationActivity = sEmulationActivity.get();
alertPromptResult = ""; alertPromptResult = "";
alertPromptButton = 0; alertPromptButton = 0;
@ -468,7 +470,7 @@ public final class NativeLibrary {
FrameLayout container = new FrameLayout(emulationActivity); FrameLayout container = new FrameLayout(emulationActivity);
container.addView(alertPromptEditText); container.addView(alertPromptEditText);
AlertDialog.Builder builder = new AlertDialog.Builder(emulationActivity) MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(emulationActivity)
.setTitle(caption) .setTitle(caption)
.setView(container) .setView(container)
.setPositiveButton(android.R.string.ok, (dialogInterface, i) -> .setPositiveButton(android.R.string.ok, (dialogInterface, i) ->
@ -536,7 +538,7 @@ public final class NativeLibrary {
return; return;
} }
AlertDialog.Builder builder = new AlertDialog.Builder(emulationActivity) MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(emulationActivity)
.setTitle(captionId) .setTitle(captionId)
.setMessage(Html.fromHtml(emulationActivity.getString(descriptionId), Html.FROM_HTML_MODE_LEGACY)) .setMessage(Html.fromHtml(emulationActivity.getString(descriptionId), Html.FROM_HTML_MODE_LEGACY))
.setPositiveButton(android.R.string.ok, (dialog, whichButton) -> emulationActivity.finish()) .setPositiveButton(android.R.string.ok, (dialog, whichButton) -> emulationActivity.finish())

View File

@ -29,6 +29,7 @@ import org.yuzu.yuzu_emu.features.settings.model.Settings
import org.yuzu.yuzu_emu.fragments.EmulationFragment import org.yuzu.yuzu_emu.fragments.EmulationFragment
import org.yuzu.yuzu_emu.fragments.MenuFragment import org.yuzu.yuzu_emu.fragments.MenuFragment
import org.yuzu.yuzu_emu.utils.ControllerMappingHelper import org.yuzu.yuzu_emu.utils.ControllerMappingHelper
import org.yuzu.yuzu_emu.utils.ThemeHelper
import kotlin.math.roundToInt import kotlin.math.roundToInt
open class EmulationActivity : AppCompatActivity() { open class EmulationActivity : AppCompatActivity() {
@ -50,6 +51,8 @@ open class EmulationActivity : AppCompatActivity() {
} }
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
ThemeHelper.setTheme(this)
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
if (savedInstanceState == null) { if (savedInstanceState == null) {
// Get params we were passed // Get params we were passed

View File

@ -8,9 +8,9 @@ import android.database.DataSetObserver
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.core.content.ContextCompat
import androidx.fragment.app.FragmentActivity import androidx.fragment.app.FragmentActivity
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.color.MaterialColors
import org.yuzu.yuzu_emu.R import org.yuzu.yuzu_emu.R
import org.yuzu.yuzu_emu.activities.EmulationActivity.Companion.launch import org.yuzu.yuzu_emu.activities.EmulationActivity.Companion.launch
import org.yuzu.yuzu_emu.model.GameDatabase import org.yuzu.yuzu_emu.model.GameDatabase
@ -68,11 +68,11 @@ class GameAdapter : RecyclerView.Adapter<GameViewHolder>(), View.OnClickListener
holder.regions = cursor!!.getString(GameDatabase.GAME_COLUMN_REGIONS) holder.regions = cursor!!.getString(GameDatabase.GAME_COLUMN_REGIONS)
holder.company = cursor!!.getString(GameDatabase.GAME_COLUMN_CAPTION) holder.company = cursor!!.getString(GameDatabase.GAME_COLUMN_CAPTION)
val backgroundColorId = val backgroundColorId =
if (isValidGame(holder.path!!)) R.color.view_background else R.color.view_disabled if (isValidGame(holder.path!!)) R.attr.colorSurface else R.attr.colorErrorContainer
val itemView = holder.itemView val itemView = holder.itemView
itemView.setBackgroundColor( itemView.setBackgroundColor(
ContextCompat.getColor( MaterialColors.getColor(
itemView.context, itemView,
backgroundColorId backgroundColorId
) )
) )

View File

@ -19,6 +19,8 @@ import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.DialogFragment; import androidx.fragment.app.DialogFragment;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import org.yuzu.yuzu_emu.YuzuApplication; import org.yuzu.yuzu_emu.YuzuApplication;
import org.yuzu.yuzu_emu.NativeLibrary; import org.yuzu.yuzu_emu.NativeLibrary;
import org.yuzu.yuzu_emu.R; import org.yuzu.yuzu_emu.R;
@ -124,7 +126,7 @@ public final class SoftwareKeyboard {
FrameLayout container = new FrameLayout(emulationActivity); FrameLayout container = new FrameLayout(emulationActivity);
container.addView(editText); container.addView(editText);
AlertDialog.Builder builder = new AlertDialog.Builder(emulationActivity) MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(emulationActivity)
.setTitle(R.string.software_keyboard) .setTitle(R.string.software_keyboard)
.setView(container); .setView(container);
setCancelable(false); setCancelable(false);
@ -227,7 +229,7 @@ public final class SoftwareKeyboard {
break; break;
} }
new AlertDialog.Builder(emulationActivity) new MaterialAlertDialogBuilder(emulationActivity)
.setTitle(R.string.software_keyboard) .setTitle(R.string.software_keyboard)
.setMessage(message) .setMessage(message)
.setPositiveButton(android.R.string.ok, null) .setPositiveButton(android.R.string.ok, null)

View File

@ -3,15 +3,17 @@
package org.yuzu.yuzu_emu.features.settings.ui package org.yuzu.yuzu_emu.features.settings.ui
import android.app.ProgressDialog
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.content.IntentFilter import android.content.IntentFilter
import android.os.Bundle import android.os.Bundle
import android.view.Menu import android.view.Menu
import android.widget.Toast import android.widget.Toast
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.localbroadcastmanager.content.LocalBroadcastManager import androidx.localbroadcastmanager.content.LocalBroadcastManager
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.progressindicator.LinearProgressIndicator
import org.yuzu.yuzu_emu.NativeLibrary import org.yuzu.yuzu_emu.NativeLibrary
import org.yuzu.yuzu_emu.R import org.yuzu.yuzu_emu.R
import org.yuzu.yuzu_emu.features.settings.model.Settings import org.yuzu.yuzu_emu.features.settings.model.Settings
@ -19,12 +21,15 @@ import org.yuzu.yuzu_emu.features.settings.ui.SettingsFragment.Companion.newInst
import org.yuzu.yuzu_emu.utils.DirectoryInitialization import org.yuzu.yuzu_emu.utils.DirectoryInitialization
import org.yuzu.yuzu_emu.utils.DirectoryStateReceiver import org.yuzu.yuzu_emu.utils.DirectoryStateReceiver
import org.yuzu.yuzu_emu.utils.EmulationMenuSettings import org.yuzu.yuzu_emu.utils.EmulationMenuSettings
import org.yuzu.yuzu_emu.utils.ThemeHelper
class SettingsActivity : AppCompatActivity(), SettingsActivityView { class SettingsActivity : AppCompatActivity(), SettingsActivityView {
private val presenter = SettingsActivityPresenter(this) private val presenter = SettingsActivityPresenter(this)
private var dialog: ProgressDialog? = null private var dialog: AlertDialog? = null
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
ThemeHelper.setTheme(this)
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_settings) setContentView(R.layout.activity_settings)
val launcher = intent val launcher = intent
@ -33,6 +38,7 @@ class SettingsActivity : AppCompatActivity(), SettingsActivityView {
presenter.onCreate(savedInstanceState, menuTag!!, gameID!!) presenter.onCreate(savedInstanceState, menuTag!!, gameID!!)
// Show "Back" button in the action bar for navigation // Show "Back" button in the action bar for navigation
setSupportActionBar(findViewById(R.id.toolbar_settings))
supportActionBar!!.setDisplayHomeAsUpEnabled(true) supportActionBar!!.setDisplayHomeAsUpEnabled(true)
} }
@ -123,9 +129,15 @@ class SettingsActivity : AppCompatActivity(), SettingsActivityView {
override fun showLoading() { override fun showLoading() {
if (dialog == null) { if (dialog == null) {
dialog = ProgressDialog(this) val root = layoutInflater.inflate(R.layout.dialog_progress_bar, null)
dialog!!.setMessage(getString(R.string.load_settings)) val progressBar = root.findViewById<LinearProgressIndicator>(R.id.progress_bar)
dialog!!.isIndeterminate = true progressBar.isIndeterminate = true
dialog = MaterialAlertDialogBuilder(this)
.setTitle(R.string.load_settings)
.setView(root)
.setCancelable(false)
.create()
} }
dialog!!.show() dialog!!.show()
} }

View File

@ -51,7 +51,7 @@ class SettingsAdapter(
HeaderViewHolder(view, this) HeaderViewHolder(view, this)
} }
SettingsItem.TYPE_CHECKBOX -> { SettingsItem.TYPE_CHECKBOX -> {
view = inflater.inflate(R.layout.list_item_setting_checkbox, parent, false) view = inflater.inflate(R.layout.list_item_setting_switch, parent, false)
CheckBoxSettingViewHolder(view, this) CheckBoxSettingViewHolder(view, this)
} }
SettingsItem.TYPE_SINGLE_CHOICE, SettingsItem.TYPE_STRING_SINGLE_CHOICE -> { SettingsItem.TYPE_SINGLE_CHOICE, SettingsItem.TYPE_STRING_SINGLE_CHOICE -> {
@ -105,7 +105,6 @@ class SettingsAdapter(
fun onBooleanClick(item: CheckBoxSetting, position: Int, checked: Boolean) { fun onBooleanClick(item: CheckBoxSetting, position: Int, checked: Boolean) {
val setting = item.setChecked(checked) val setting = item.setChecked(checked)
notifyItemChanged(position)
if (setting != null) { if (setting != null) {
fragmentView.putSetting(setting) fragmentView.putSetting(setting)
} }

View File

@ -4,8 +4,9 @@
package org.yuzu.yuzu_emu.features.settings.ui.viewholder package org.yuzu.yuzu_emu.features.settings.ui.viewholder
import android.view.View import android.view.View
import android.widget.CheckBox import android.widget.CompoundButton
import android.widget.TextView import android.widget.TextView
import com.google.android.material.materialswitch.MaterialSwitch
import org.yuzu.yuzu_emu.R import org.yuzu.yuzu_emu.R
import org.yuzu.yuzu_emu.features.settings.model.view.CheckBoxSetting import org.yuzu.yuzu_emu.features.settings.model.view.CheckBoxSetting
import org.yuzu.yuzu_emu.features.settings.model.view.SettingsItem import org.yuzu.yuzu_emu.features.settings.model.view.SettingsItem
@ -16,12 +17,12 @@ class CheckBoxSettingViewHolder(itemView: View, adapter: SettingsAdapter) :
private lateinit var item: CheckBoxSetting private lateinit var item: CheckBoxSetting
private lateinit var textSettingName: TextView private lateinit var textSettingName: TextView
private lateinit var textSettingDescription: TextView private lateinit var textSettingDescription: TextView
private lateinit var checkbox: CheckBox private lateinit var switch: MaterialSwitch
override fun findViews(root: View) { override fun findViews(root: View) {
textSettingName = root.findViewById(R.id.text_setting_name) textSettingName = root.findViewById(R.id.text_setting_name)
textSettingDescription = root.findViewById(R.id.text_setting_description) textSettingDescription = root.findViewById(R.id.text_setting_description)
checkbox = root.findViewById(R.id.checkbox) switch = root.findViewById(R.id.switch_widget)
} }
override fun bind(item: SettingsItem) { override fun bind(item: SettingsItem) {
@ -34,11 +35,13 @@ class CheckBoxSettingViewHolder(itemView: View, adapter: SettingsAdapter) :
textSettingDescription.text = "" textSettingDescription.text = ""
textSettingDescription.visibility = View.GONE textSettingDescription.visibility = View.GONE
} }
checkbox.isChecked = this.item.isChecked switch.isChecked = this.item.isChecked
switch.setOnCheckedChangeListener { _: CompoundButton, _: Boolean ->
adapter.onBooleanClick(item, bindingAdapterPosition, switch.isChecked)
}
} }
override fun onClick(clicked: View) { override fun onClick(clicked: View) {
checkbox.toggle() switch.toggle()
adapter.onBooleanClick(item, bindingAdapterPosition, checkbox.isChecked)
} }
} }

View File

@ -27,6 +27,8 @@ class MainActivity : AppCompatActivity(), MainView {
private val presenter = MainPresenter(this) private val presenter = MainPresenter(this)
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
ThemeHelper.setTheme(this)
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main) setContentView(R.layout.activity_main)
findViews() findViews()

View File

@ -0,0 +1,18 @@
package org.yuzu.yuzu_emu.utils
import android.content.Context
object InsetsHelper {
const val THREE_BUTTON_NAVIGATION = 0
const val TWO_BUTTON_NAVIGATION = 1
const val GESTURE_NAVIGATION = 2
fun getSystemGestureType(context: Context): Int {
val resources = context.resources
val resourceId =
resources.getIdentifier("config_navBarInteractionMode", "integer", "android")
return if (resourceId != 0) {
resources.getInteger(resourceId)
} else 0
}
}

View File

@ -0,0 +1,67 @@
// SPDX-FileCopyrightText: 2023 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
package org.yuzu.yuzu_emu.utils
import android.app.Activity
import android.content.res.Configuration
import android.graphics.Color
import androidx.annotation.ColorInt
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import androidx.core.view.WindowCompat
import com.google.android.material.color.MaterialColors
import org.yuzu.yuzu_emu.R
import kotlin.math.roundToInt
object ThemeHelper {
private const val NAV_BAR_ALPHA = 0.9f
@JvmStatic
fun setTheme(activity: AppCompatActivity) {
val windowController = WindowCompat.getInsetsController(
activity.window,
activity.window.decorView
)
val isLightMode =
(activity.resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_NO
windowController.isAppearanceLightStatusBars = isLightMode
windowController.isAppearanceLightNavigationBars = isLightMode
activity.window.statusBarColor = ContextCompat.getColor(activity, android.R.color.transparent)
val navigationBarColor =
MaterialColors.getColor(activity.window.decorView, R.attr.colorSurface)
setNavigationBarColor(activity, navigationBarColor)
}
@JvmStatic
fun setNavigationBarColor(activity: Activity, @ColorInt color: Int) {
val gestureType = InsetsHelper.getSystemGestureType(activity.applicationContext)
val orientation = activity.resources.configuration.orientation
if ((gestureType == InsetsHelper.THREE_BUTTON_NAVIGATION ||
gestureType == InsetsHelper.TWO_BUTTON_NAVIGATION) &&
orientation == Configuration.ORIENTATION_LANDSCAPE
) {
activity.window.navigationBarColor = color
} else if (gestureType == InsetsHelper.THREE_BUTTON_NAVIGATION ||
gestureType == InsetsHelper.TWO_BUTTON_NAVIGATION
) {
activity.window.navigationBarColor = getColorWithOpacity(color, NAV_BAR_ALPHA)
} else {
activity.window.navigationBarColor = ContextCompat.getColor(
activity.applicationContext,
android.R.color.transparent
)
}
}
@ColorInt
private fun getColorWithOpacity(@ColorInt color: Int, alphaFactor: Float): Int {
return Color.argb(
(alphaFactor * Color.alpha(color)).roundToInt(), Color.red(color),
Color.green(color), Color.blue(color)
)
}
}

View File

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<size
android:width="1dp"
android:height="1dp" />
<solid android:color="@color/gamelist_divider" />
</shape>

View File

@ -5,23 +5,23 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar_main"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:liftOnScrollTargetViewId="@id/grid_games">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar_main"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" />
</com.google.android.material.appbar.AppBarLayout>
<FrameLayout <FrameLayout
android:id="@+id/games_platform_frame" android:id="@+id/games_platform_frame"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" /> app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar_main"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?colorPrimary"/>
</com.google.android.material.appbar.AppBarLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -1,5 +1,27 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="@+id/coordinator_main"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar_settings"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar_settings"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" />
</com.google.android.material.appbar.AppBarLayout>
<FrameLayout
android:id="@+id/frame_content"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:id="@+id/frame_content" /> app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -5,7 +5,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground" android:foreground="?attr/selectableItemBackground"
android:clickable="true" android:clickable="true"
android:clipToPadding="false" android:clipToPadding="false"
android:focusable="true" android:focusable="true"
@ -15,7 +15,8 @@
android:paddingBottom="8dp" android:paddingBottom="8dp"
android:transitionName="card_game"> android:transitionName="card_game">
<androidx.cardview.widget.CardView <com.google.android.material.card.MaterialCardView
style="?attr/materialCardViewElevatedStyle"
android:id="@+id/card_game_art" android:id="@+id/card_game_art"
android:layout_width="150dp" android:layout_width="150dp"
android:layout_height="150dp" android:layout_height="150dp"
@ -32,24 +33,24 @@
<TextView <TextView
android:id="@+id/text_game_title_inner" android:id="@+id/text_game_title_inner"
style="@android:style/TextAppearance.Material.Subhead" style="@style/TextAppearance.Material3.BodyLarge"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:ellipsize="end" android:ellipsize="end"
android:gravity="center|top" android:gravity="center"
android:maxLines="2" android:maxLines="2"
android:paddingLeft="2dp" android:paddingLeft="2dp"
android:paddingRight="2dp" android:paddingRight="2dp"
android:paddingTop="8dp" android:paddingTop="8dp"
android:visibility="visible" android:visibility="visible"
tools:text="The Legend of Zelda: The Wind Waker" /> tools:text="Super Mario Odyssey" />
</androidx.cardview.widget.CardView> </com.google.android.material.card.MaterialCardView>
<TextView <TextView
android:id="@+id/text_game_title" android:id="@+id/text_game_title"
style="@android:style/TextAppearance.Material.Subhead" style="@style/TextAppearance.Material3.BodyLarge"
android:layout_width="150dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="2" android:maxLines="2"
@ -57,12 +58,12 @@
app:layout_constraintEnd_toEndOf="@+id/card_game_art" app:layout_constraintEnd_toEndOf="@+id/card_game_art"
app:layout_constraintStart_toStartOf="@+id/card_game_art" app:layout_constraintStart_toStartOf="@+id/card_game_art"
app:layout_constraintTop_toBottomOf="@+id/card_game_art" app:layout_constraintTop_toBottomOf="@+id/card_game_art"
tools:text="The Legend of Zelda: The Wind Waker" /> tools:text="Super Mario Odyssey" />
<TextView <TextView
android:id="@+id/text_game_caption" android:id="@+id/text_game_caption"
style="@android:style/TextAppearance.Material.Caption" style="@style/TextAppearance.Material3.BodyMedium"
android:layout_width="150dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:ellipsize="end" android:ellipsize="end"
android:lines="1" android:lines="1"

View File

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:paddingTop="5dp"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:paddingBottom="0dp"
android:layout_width="match_parent"
android:layout_height="match_parent">
<CheckBox
android:id="@+id/checkBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/do_not_show_this_again" />
</LinearLayout>

View File

@ -1,26 +1,15 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"> android:orientation="vertical">
<ProgressBar <com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/progress_bar" android:id="@+id/progress_bar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/spacing_large" android:layout_margin="24dp"
android:layout_marginRight="@dimen/spacing_large" app:trackCornerRadius="4dp" />
android:layout_alignParentEnd="true"
android:layout_below="@+id/progress_text"
android:layout_alignParentStart="true"/>
<TextView
android:id="@+id/progress_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/spacing_large"
android:layout_marginRight="@dimen/spacing_large"
android:gravity="right"
android:text="1/100" />
</LinearLayout> </LinearLayout>

View File

@ -6,6 +6,17 @@
tools:context="org.yuzu.yuzu_emu.fragments.EmulationFragment"> tools:context="org.yuzu.yuzu_emu.fragments.EmulationFragment">
<!-- This is what everything is rendered to during emulation --> <!-- This is what everything is rendered to during emulation -->
<Button
android:id="@+id/done_control_config"
style="@style/Widget.Material3.Button.Icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="@dimen/spacing_small"
android:text="@string/emulation_done"
android:visibility="gone" />
<!-- This is the onscreen input overlay -->
<SurfaceView <SurfaceView
android:id="@+id/surface_emulation" android:id="@+id/surface_emulation"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -13,20 +24,12 @@
android:focusable="false" android:focusable="false"
android:focusableInTouchMode="false" /> android:focusableInTouchMode="false" />
<!-- This is the onscreen input overlay -->
<org.yuzu.yuzu_emu.overlay.InputOverlay
android:id="@+id/surface_input_overlay"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:focusable="true"
android:focusableInTouchMode="true" />
<TextView <TextView
android:id="@+id/show_fps_text" android:id="@+id/show_fps_text"
android:layout_marginStart="18dp"
android:layout_marginTop="2dp"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="18dp"
android:layout_marginTop="2dp"
android:clickable="false" android:clickable="false"
android:linksClickable="false" android:linksClickable="false"
android:longClickable="false" android:longClickable="false"
@ -34,15 +37,11 @@
android:textColor="@android:color/white" android:textColor="@android:color/white"
android:textSize="12sp" /> android:textSize="12sp" />
<Button <org.yuzu.yuzu_emu.overlay.InputOverlay
android:id="@+id/done_control_config" android:id="@+id/surface_input_overlay"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_gravity="center" android:focusable="true"
android:padding="@dimen/spacing_small" android:focusableInTouchMode="true" />
android:background="@color/citra_orange"
android:text="@string/emulation_done"
android:visibility="gone" />
</FrameLayout> </FrameLayout>
t>

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<org.yuzu.yuzu_emu.features.settings.ui.SettingsFrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <org.yuzu.yuzu_emu.features.settings.ui.SettingsFrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
@ -7,6 +8,6 @@
android:id="@+id/list_settings" android:id="@+id/list_settings"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/view_background" /> android:background="?attr/colorSurface" />
</org.yuzu.yuzu_emu.features.settings.ui.SettingsFrameLayout> </org.yuzu.yuzu_emu.features.settings.ui.SettingsFrameLayout>

View File

@ -8,20 +8,19 @@
android:focusable="true" android:focusable="true"
android:gravity="center_vertical" android:gravity="center_vertical"
android:minHeight="72dp" android:minHeight="72dp"
android:paddingTop="@dimen/spacing_large" android:paddingBottom="@dimen/spacing_large"
android:paddingBottom="@dimen/spacing_large"> android:paddingTop="@dimen/spacing_large">
<TextView <TextView
android:id="@+id/text_setting_name" android:id="@+id/text_setting_name"
style="@style/TextAppearance.AppCompat.Headline" style="@style/TextAppearance.Material3.HeadlineMedium"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_marginStart="@dimen/spacing_large"
android:layout_marginEnd="@dimen/spacing_large" android:layout_marginEnd="@dimen/spacing_large"
android:textColor="@color/header_text" android:layout_marginStart="@dimen/spacing_large"
android:textSize="16sp" android:textSize="16sp"
tools:text="Setting Name" /> tools:text="Setting Name" />
@ -29,15 +28,14 @@
android:id="@+id/text_setting_description" android:id="@+id/text_setting_description"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/text_setting_name"
android:layout_alignStart="@+id/text_setting_name"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_alignParentStart="true"
android:layout_alignStart="@+id/text_setting_name"
android:layout_below="@+id/text_setting_name"
android:layout_marginEnd="@dimen/spacing_large"
android:layout_marginStart="@dimen/spacing_large" android:layout_marginStart="@dimen/spacing_large"
android:layout_marginTop="@dimen/spacing_small" android:layout_marginTop="@dimen/spacing_small"
android:layout_marginEnd="@dimen/spacing_large"
android:visibility="visible" android:visibility="visible"
tools:text="@string/app_disclaimer" tools:text="@string/app_disclaimer" />
android:textColor="@color/header_subtext" />
</RelativeLayout> </RelativeLayout>

View File

@ -3,25 +3,18 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:minHeight="72dp"
android:background="?android:attr/selectableItemBackground" android:background="?android:attr/selectableItemBackground"
android:clickable="true"
android:focusable="true" android:focusable="true"
android:clickable="true"> android:minHeight="72dp">
<TextView <com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/text_setting_name" android:id="@+id/switch_widget"
style="@style/TextAppearance.AppCompat.Headline" android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentStart="true" android:layout_alignParentEnd="true"
android:layout_alignParentTop="true" android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/spacing_large" android:layout_marginEnd="24dp" />
android:layout_marginStart="@dimen/spacing_large"
android:layout_marginTop="@dimen/spacing_large"
android:layout_toStartOf="@+id/checkbox"
android:textColor="@color/header_text"
android:textSize="16sp"
tools:text="@string/frame_limit_enable" />
<TextView <TextView
android:id="@+id/text_setting_description" android:id="@+id/text_setting_description"
@ -34,19 +27,22 @@
android:layout_marginEnd="@dimen/spacing_large" android:layout_marginEnd="@dimen/spacing_large"
android:layout_marginStart="@dimen/spacing_large" android:layout_marginStart="@dimen/spacing_large"
android:layout_marginTop="@dimen/spacing_small" android:layout_marginTop="@dimen/spacing_small"
android:layout_toStartOf="@+id/checkbox" android:layout_toStartOf="@+id/switch_widget"
android:textAlignment="textStart" android:textAlignment="textStart"
android:textColor="@color/header_subtext"
tools:text="@string/frame_limit_enable_description" /> tools:text="@string/frame_limit_enable_description" />
<CheckBox <TextView
android:id="@+id/checkbox" style="@style/TextAppearance.Material3.HeadlineMedium"
android:layout_width="wrap_content" android:id="@+id/text_setting_name"
android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentEnd="true" android:layout_alignParentStart="true"
android:layout_centerVertical="true" android:layout_alignParentTop="true"
android:layout_marginEnd="@dimen/spacing_large" android:layout_marginEnd="@dimen/spacing_large"
android:focusable="false" android:layout_marginStart="@dimen/spacing_large"
android:clickable="false" /> android:layout_marginTop="@dimen/spacing_large"
android:layout_toStartOf="@+id/switch_widget"
android:textSize="16sp"
tools:text="@string/frame_limit_enable" />
</RelativeLayout> </RelativeLayout>

View File

@ -6,13 +6,14 @@
<TextView <TextView
android:id="@+id/text_header_name" android:id="@+id/text_header_name"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="start|center_vertical"
android:layout_marginStart="@dimen/spacing_large" android:layout_marginHorizontal="@dimen/spacing_large"
android:layout_marginBottom="@dimen/spacing_small" android:layout_marginBottom="@dimen/spacing_small"
android:layout_marginTop="@dimen/spacing_small" android:layout_marginTop="@dimen/spacing_small"
android:textColor="?android:colorAccent" android:textColor="?attr/colorPrimary"
android:textAlignment="viewStart"
android:textStyle="bold" android:textStyle="bold"
tools:text="CPU Settings" /> tools:text="CPU Settings" />

View File

@ -8,20 +8,20 @@
android:focusable="true" android:focusable="true"
android:gravity="center_vertical" android:gravity="center_vertical"
android:minHeight="72dp" android:minHeight="72dp"
android:paddingTop="@dimen/spacing_large" android:paddingBottom="@dimen/spacing_large"
android:paddingBottom="@dimen/spacing_large"> android:paddingTop="@dimen/spacing_large">
<TextView <TextView
style="@style/TextAppearance.Material3.HeadlineMedium"
android:id="@+id/text_setting_name" android:id="@+id/text_setting_name"
style="@style/TextAppearance.AppCompat.Headline"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_marginStart="@dimen/spacing_large"
android:layout_marginEnd="@dimen/spacing_large" android:layout_marginEnd="@dimen/spacing_large"
android:textColor="?android:colorAccent" android:layout_marginStart="@dimen/spacing_large"
android:textColor="?attr/colorPrimary"
android:textStyle="bold" android:textStyle="bold"
tools:text="Setting Name" /> tools:text="Setting Name" />
@ -29,15 +29,14 @@
android:id="@+id/text_setting_description" android:id="@+id/text_setting_description"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/text_setting_name"
android:layout_alignStart="@+id/text_setting_name"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_alignParentStart="true"
android:layout_alignStart="@+id/text_setting_name"
android:layout_below="@+id/text_setting_name"
android:layout_marginEnd="@dimen/spacing_large"
android:layout_marginStart="@dimen/spacing_large" android:layout_marginStart="@dimen/spacing_large"
android:layout_marginTop="@dimen/spacing_small" android:layout_marginTop="@dimen/spacing_small"
android:layout_marginEnd="@dimen/spacing_large"
android:visibility="visible" android:visibility="visible"
tools:text="@string/app_disclaimer" tools:text="@string/app_disclaimer" />
android:textColor="@color/header_subtext" />
</RelativeLayout> </RelativeLayout>

View File

@ -7,27 +7,34 @@
android:icon="@drawable/ic_folder" android:icon="@drawable/ic_folder"
android:title="@string/select_game_folder" android:title="@string/select_game_folder"
app:showAsAction="ifRoom"> app:showAsAction="ifRoom">
<menu> <menu>
<item <item
android:id="@+id/button_add_directory" android:id="@+id/button_add_directory"
android:icon="@drawable/ic_folder" android:icon="@drawable/ic_folder"
android:title="@string/select_game_folder" android:title="@string/select_game_folder"
app:showAsAction="ifRoom" /> app:showAsAction="ifRoom" />
<item <item
android:id="@+id/button_install_keys" android:id="@+id/button_install_keys"
android:icon="@drawable/ic_install" android:icon="@drawable/ic_install"
android:title="@string/install_keys" android:title="@string/install_keys"
app:showAsAction="ifRoom" /> app:showAsAction="ifRoom" />
<item <item
android:id="@+id/button_select_gpu_driver" android:id="@+id/button_select_gpu_driver"
android:icon="@drawable/ic_settings_core" android:icon="@drawable/ic_settings"
android:title="@string/select_gpu_driver" android:title="@string/select_gpu_driver"
app:showAsAction="ifRoom" /> app:showAsAction="ifRoom" />
</menu> </menu>
</item> </item>
<item <item
android:id="@+id/menu_settings_core" android:id="@+id/menu_settings_core"
android:icon="@drawable/ic_settings_core" android:icon="@drawable/ic_settings"
android:title="@string/grid_menu_core_settings" android:title="@string/grid_menu_core_settings"
app:showAsAction="ifRoom" /> app:showAsAction="ifRoom" />