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.fragment.app.DialogFragment;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import org.yuzu.yuzu_emu.activities.EmulationActivity;
import org.yuzu.yuzu_emu.utils.DocumentsTree;
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 message = Objects.requireNonNull(Objects.requireNonNull(getArguments()).getString("message"));
return new AlertDialog.Builder(emulationActivity)
return new MaterialAlertDialogBuilder(emulationActivity)
.setTitle(title)
.setMessage(message)
.setPositiveButton(R.string.continue_button, (dialog, which) -> {
@ -369,7 +371,7 @@ public final class NativeLibrary {
} else {
// Create object used for waiting.
final Object lock = new Object();
AlertDialog.Builder builder = new AlertDialog.Builder(emulationActivity)
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(emulationActivity)
.setTitle(caption)
.setMessage(text);
@ -451,7 +453,7 @@ public final class NativeLibrary {
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();
alertPromptResult = "";
alertPromptButton = 0;
@ -468,7 +470,7 @@ public final class NativeLibrary {
FrameLayout container = new FrameLayout(emulationActivity);
container.addView(alertPromptEditText);
AlertDialog.Builder builder = new AlertDialog.Builder(emulationActivity)
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(emulationActivity)
.setTitle(caption)
.setView(container)
.setPositiveButton(android.R.string.ok, (dialogInterface, i) ->
@ -536,7 +538,7 @@ public final class NativeLibrary {
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(emulationActivity)
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(emulationActivity)
.setTitle(captionId)
.setMessage(Html.fromHtml(emulationActivity.getString(descriptionId), Html.FROM_HTML_MODE_LEGACY))
.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.MenuFragment
import org.yuzu.yuzu_emu.utils.ControllerMappingHelper
import org.yuzu.yuzu_emu.utils.ThemeHelper
import kotlin.math.roundToInt
open class EmulationActivity : AppCompatActivity() {
@ -50,6 +51,8 @@ open class EmulationActivity : AppCompatActivity() {
}
override fun onCreate(savedInstanceState: Bundle?) {
ThemeHelper.setTheme(this)
super.onCreate(savedInstanceState)
if (savedInstanceState == null) {
// Get params we were passed

View File

@ -8,9 +8,9 @@ import android.database.DataSetObserver
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.content.ContextCompat
import androidx.fragment.app.FragmentActivity
import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.color.MaterialColors
import org.yuzu.yuzu_emu.R
import org.yuzu.yuzu_emu.activities.EmulationActivity.Companion.launch
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.company = cursor!!.getString(GameDatabase.GAME_COLUMN_CAPTION)
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
itemView.setBackgroundColor(
ContextCompat.getColor(
itemView.context,
MaterialColors.getColor(
itemView,
backgroundColorId
)
)

View File

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

View File

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

View File

@ -51,7 +51,7 @@ class SettingsAdapter(
HeaderViewHolder(view, this)
}
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)
}
SettingsItem.TYPE_SINGLE_CHOICE, SettingsItem.TYPE_STRING_SINGLE_CHOICE -> {
@ -105,7 +105,6 @@ class SettingsAdapter(
fun onBooleanClick(item: CheckBoxSetting, position: Int, checked: Boolean) {
val setting = item.setChecked(checked)
notifyItemChanged(position)
if (setting != null) {
fragmentView.putSetting(setting)
}

View File

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

View File

@ -27,6 +27,8 @@ class MainActivity : AppCompatActivity(), MainView {
private val presenter = MainPresenter(this)
override fun onCreate(savedInstanceState: Bundle?) {
ThemeHelper.setTheme(this)
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
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_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
android:id="@+id/games_platform_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
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>

View File

@ -1,5 +1,27 @@
<?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"
android:id="@+id/frame_content" />
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_height="match_parent"
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"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:foreground="?attr/selectableItemBackground"
android:clickable="true"
android:clipToPadding="false"
android:focusable="true"
@ -15,7 +15,8 @@
android:paddingBottom="8dp"
android:transitionName="card_game">
<androidx.cardview.widget.CardView
<com.google.android.material.card.MaterialCardView
style="?attr/materialCardViewElevatedStyle"
android:id="@+id/card_game_art"
android:layout_width="150dp"
android:layout_height="150dp"
@ -32,24 +33,24 @@
<TextView
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_height="match_parent"
android:ellipsize="end"
android:gravity="center|top"
android:gravity="center"
android:maxLines="2"
android:paddingLeft="2dp"
android:paddingRight="2dp"
android:paddingTop="8dp"
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
android:id="@+id/text_game_title"
style="@android:style/TextAppearance.Material.Subhead"
android:layout_width="150dp"
style="@style/TextAppearance.Material3.BodyLarge"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
@ -57,12 +58,12 @@
app:layout_constraintEnd_toEndOf="@+id/card_game_art"
app:layout_constraintStart_toStartOf="@+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
android:id="@+id/text_game_caption"
style="@android:style/TextAppearance.Material.Caption"
android:layout_width="150dp"
style="@style/TextAppearance.Material3.BodyMedium"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:ellipsize="end"
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"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical">
<ProgressBar
<com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/progress_bar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/spacing_large"
android:layout_marginRight="@dimen/spacing_large"
android:layout_alignParentEnd="true"
android:layout_below="@+id/progress_text"
android:layout_alignParentStart="true"/>
android:layout_margin="24dp"
app:trackCornerRadius="4dp" />
<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>

View File

@ -6,6 +6,17 @@
tools:context="org.yuzu.yuzu_emu.fragments.EmulationFragment">
<!-- 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
android:id="@+id/surface_emulation"
android:layout_width="match_parent"
@ -13,20 +24,12 @@
android:focusable="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
android:id="@+id/show_fps_text"
android:layout_marginStart="18dp"
android:layout_marginTop="2dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="18dp"
android:layout_marginTop="2dp"
android:clickable="false"
android:linksClickable="false"
android:longClickable="false"
@ -34,15 +37,11 @@
android:textColor="@android:color/white"
android:textSize="12sp" />
<Button
android:id="@+id/done_control_config"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="@dimen/spacing_small"
android:background="@color/citra_orange"
android:text="@string/emulation_done"
android:visibility="gone" />
<org.yuzu.yuzu_emu.overlay.InputOverlay
android:id="@+id/surface_input_overlay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusable="true"
android:focusableInTouchMode="true" />
</FrameLayout>
t>

View File

@ -1,5 +1,6 @@
<?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_height="match_parent">
@ -7,6 +8,6 @@
android:id="@+id/list_settings"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/view_background" />
android:background="?attr/colorSurface" />
</org.yuzu.yuzu_emu.features.settings.ui.SettingsFrameLayout>

View File

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

View File

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

View File

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

View File

@ -8,20 +8,20 @@
android:focusable="true"
android:gravity="center_vertical"
android:minHeight="72dp"
android:paddingTop="@dimen/spacing_large"
android:paddingBottom="@dimen/spacing_large">
android:paddingBottom="@dimen/spacing_large"
android:paddingTop="@dimen/spacing_large">
<TextView
style="@style/TextAppearance.Material3.HeadlineMedium"
android:id="@+id/text_setting_name"
style="@style/TextAppearance.AppCompat.Headline"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_marginStart="@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"
tools:text="Setting Name" />
@ -29,15 +29,14 @@
android:id="@+id/text_setting_description"
android:layout_width="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_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_marginTop="@dimen/spacing_small"
android:layout_marginEnd="@dimen/spacing_large"
android:visibility="visible"
tools:text="@string/app_disclaimer"
android:textColor="@color/header_subtext" />
tools:text="@string/app_disclaimer" />
</RelativeLayout>

View File

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