diff options
| author | 2023-03-13 23:15:52 -0400 | |
|---|---|---|
| committer | 2023-06-03 00:05:42 -0700 | |
| commit | 5840d607243b04bd403041ae9047a569f3c5252e (patch) | |
| tree | e2ebab1757d4e6ced27b4e6719e551cf468ceb30 /src/android | |
| parent | android: Modernize theme system (diff) | |
| download | yuzu-5840d607243b04bd403041ae9047a569f3c5252e.tar.gz yuzu-5840d607243b04bd403041ae9047a569f3c5252e.tar.xz yuzu-5840d607243b04bd403041ae9047a569f3c5252e.zip | |
android: Use Material 3 components
Diffstat (limited to 'src/android')
23 files changed, 268 insertions, 174 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.java index 067e9938d..c7c616a50 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.java | |||
| @@ -24,6 +24,8 @@ import androidx.appcompat.app.AlertDialog; | |||
| 24 | import androidx.core.content.ContextCompat; | 24 | import androidx.core.content.ContextCompat; |
| 25 | import androidx.fragment.app.DialogFragment; | 25 | import androidx.fragment.app.DialogFragment; |
| 26 | 26 | ||
| 27 | import com.google.android.material.dialog.MaterialAlertDialogBuilder; | ||
| 28 | |||
| 27 | import org.yuzu.yuzu_emu.activities.EmulationActivity; | 29 | import org.yuzu.yuzu_emu.activities.EmulationActivity; |
| 28 | import org.yuzu.yuzu_emu.utils.DocumentsTree; | 30 | import org.yuzu.yuzu_emu.utils.DocumentsTree; |
| 29 | import org.yuzu.yuzu_emu.utils.EmulationMenuSettings; | 31 | import org.yuzu.yuzu_emu.utils.EmulationMenuSettings; |
| @@ -268,7 +270,7 @@ public final class NativeLibrary { | |||
| 268 | final String title = Objects.requireNonNull(Objects.requireNonNull(getArguments()).getString("title")); | 270 | final String title = Objects.requireNonNull(Objects.requireNonNull(getArguments()).getString("title")); |
| 269 | final String message = Objects.requireNonNull(Objects.requireNonNull(getArguments()).getString("message")); | 271 | final String message = Objects.requireNonNull(Objects.requireNonNull(getArguments()).getString("message")); |
| 270 | 272 | ||
| 271 | return new AlertDialog.Builder(emulationActivity) | 273 | return new MaterialAlertDialogBuilder(emulationActivity) |
| 272 | .setTitle(title) | 274 | .setTitle(title) |
| 273 | .setMessage(message) | 275 | .setMessage(message) |
| 274 | .setPositiveButton(R.string.continue_button, (dialog, which) -> { | 276 | .setPositiveButton(R.string.continue_button, (dialog, which) -> { |
| @@ -369,7 +371,7 @@ public final class NativeLibrary { | |||
| 369 | } else { | 371 | } else { |
| 370 | // Create object used for waiting. | 372 | // Create object used for waiting. |
| 371 | final Object lock = new Object(); | 373 | final Object lock = new Object(); |
| 372 | AlertDialog.Builder builder = new AlertDialog.Builder(emulationActivity) | 374 | MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(emulationActivity) |
| 373 | .setTitle(caption) | 375 | .setTitle(caption) |
| 374 | .setMessage(text); | 376 | .setMessage(text); |
| 375 | 377 | ||
| @@ -451,7 +453,7 @@ public final class NativeLibrary { | |||
| 451 | return alertPromptResult; | 453 | return alertPromptResult; |
| 452 | } | 454 | } |
| 453 | 455 | ||
| 454 | public static AlertDialog.Builder displayAlertPromptImpl(String caption, String text, int buttonConfig) { | 456 | public static MaterialAlertDialogBuilder displayAlertPromptImpl(String caption, String text, int buttonConfig) { |
| 455 | final EmulationActivity emulationActivity = sEmulationActivity.get(); | 457 | final EmulationActivity emulationActivity = sEmulationActivity.get(); |
| 456 | alertPromptResult = ""; | 458 | alertPromptResult = ""; |
| 457 | alertPromptButton = 0; | 459 | alertPromptButton = 0; |
| @@ -468,7 +470,7 @@ public final class NativeLibrary { | |||
| 468 | FrameLayout container = new FrameLayout(emulationActivity); | 470 | FrameLayout container = new FrameLayout(emulationActivity); |
| 469 | container.addView(alertPromptEditText); | 471 | container.addView(alertPromptEditText); |
| 470 | 472 | ||
| 471 | AlertDialog.Builder builder = new AlertDialog.Builder(emulationActivity) | 473 | MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(emulationActivity) |
| 472 | .setTitle(caption) | 474 | .setTitle(caption) |
| 473 | .setView(container) | 475 | .setView(container) |
| 474 | .setPositiveButton(android.R.string.ok, (dialogInterface, i) -> | 476 | .setPositiveButton(android.R.string.ok, (dialogInterface, i) -> |
| @@ -536,7 +538,7 @@ public final class NativeLibrary { | |||
| 536 | return; | 538 | return; |
| 537 | } | 539 | } |
| 538 | 540 | ||
| 539 | AlertDialog.Builder builder = new AlertDialog.Builder(emulationActivity) | 541 | MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(emulationActivity) |
| 540 | .setTitle(captionId) | 542 | .setTitle(captionId) |
| 541 | .setMessage(Html.fromHtml(emulationActivity.getString(descriptionId), Html.FROM_HTML_MODE_LEGACY)) | 543 | .setMessage(Html.fromHtml(emulationActivity.getString(descriptionId), Html.FROM_HTML_MODE_LEGACY)) |
| 542 | .setPositiveButton(android.R.string.ok, (dialog, whichButton) -> emulationActivity.finish()) | 544 | .setPositiveButton(android.R.string.ok, (dialog, whichButton) -> emulationActivity.finish()) |
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/EmulationActivity.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/EmulationActivity.kt index 9b567cc4d..cbec4836b 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/EmulationActivity.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/EmulationActivity.kt | |||
| @@ -29,6 +29,7 @@ import org.yuzu.yuzu_emu.features.settings.model.Settings | |||
| 29 | import org.yuzu.yuzu_emu.fragments.EmulationFragment | 29 | import org.yuzu.yuzu_emu.fragments.EmulationFragment |
| 30 | import org.yuzu.yuzu_emu.fragments.MenuFragment | 30 | import org.yuzu.yuzu_emu.fragments.MenuFragment |
| 31 | import org.yuzu.yuzu_emu.utils.ControllerMappingHelper | 31 | import org.yuzu.yuzu_emu.utils.ControllerMappingHelper |
| 32 | import org.yuzu.yuzu_emu.utils.ThemeHelper | ||
| 32 | import kotlin.math.roundToInt | 33 | import kotlin.math.roundToInt |
| 33 | 34 | ||
| 34 | open class EmulationActivity : AppCompatActivity() { | 35 | open class EmulationActivity : AppCompatActivity() { |
| @@ -50,6 +51,8 @@ open class EmulationActivity : AppCompatActivity() { | |||
| 50 | } | 51 | } |
| 51 | 52 | ||
| 52 | override fun onCreate(savedInstanceState: Bundle?) { | 53 | override fun onCreate(savedInstanceState: Bundle?) { |
| 54 | ThemeHelper.setTheme(this) | ||
| 55 | |||
| 53 | super.onCreate(savedInstanceState) | 56 | super.onCreate(savedInstanceState) |
| 54 | if (savedInstanceState == null) { | 57 | if (savedInstanceState == null) { |
| 55 | // Get params we were passed | 58 | // Get params we were passed |
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 aa50cecfa..af4ec63f2 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 | |||
| @@ -8,9 +8,9 @@ import android.database.DataSetObserver | |||
| 8 | import android.view.LayoutInflater | 8 | import android.view.LayoutInflater |
| 9 | import android.view.View | 9 | import android.view.View |
| 10 | import android.view.ViewGroup | 10 | import android.view.ViewGroup |
| 11 | import androidx.core.content.ContextCompat | ||
| 12 | import androidx.fragment.app.FragmentActivity | 11 | import androidx.fragment.app.FragmentActivity |
| 13 | import androidx.recyclerview.widget.RecyclerView | 12 | import androidx.recyclerview.widget.RecyclerView |
| 13 | import com.google.android.material.color.MaterialColors | ||
| 14 | import org.yuzu.yuzu_emu.R | 14 | import org.yuzu.yuzu_emu.R |
| 15 | import org.yuzu.yuzu_emu.activities.EmulationActivity.Companion.launch | 15 | import org.yuzu.yuzu_emu.activities.EmulationActivity.Companion.launch |
| 16 | import org.yuzu.yuzu_emu.model.GameDatabase | 16 | import org.yuzu.yuzu_emu.model.GameDatabase |
| @@ -68,11 +68,11 @@ class GameAdapter : RecyclerView.Adapter<GameViewHolder>(), View.OnClickListener | |||
| 68 | holder.regions = cursor!!.getString(GameDatabase.GAME_COLUMN_REGIONS) | 68 | holder.regions = cursor!!.getString(GameDatabase.GAME_COLUMN_REGIONS) |
| 69 | holder.company = cursor!!.getString(GameDatabase.GAME_COLUMN_CAPTION) | 69 | holder.company = cursor!!.getString(GameDatabase.GAME_COLUMN_CAPTION) |
| 70 | val backgroundColorId = | 70 | val backgroundColorId = |
| 71 | if (isValidGame(holder.path!!)) R.color.view_background else R.color.view_disabled | 71 | if (isValidGame(holder.path!!)) R.attr.colorSurface else R.attr.colorErrorContainer |
| 72 | val itemView = holder.itemView | 72 | val itemView = holder.itemView |
| 73 | itemView.setBackgroundColor( | 73 | itemView.setBackgroundColor( |
| 74 | ContextCompat.getColor( | 74 | MaterialColors.getColor( |
| 75 | itemView.context, | 75 | itemView, |
| 76 | backgroundColorId | 76 | backgroundColorId |
| 77 | ) | 77 | ) |
| 78 | ) | 78 | ) |
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/applets/SoftwareKeyboard.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/applets/SoftwareKeyboard.java index 4aeb41472..894da8801 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/applets/SoftwareKeyboard.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/applets/SoftwareKeyboard.java | |||
| @@ -19,6 +19,8 @@ import androidx.annotation.Nullable; | |||
| 19 | import androidx.appcompat.app.AlertDialog; | 19 | import androidx.appcompat.app.AlertDialog; |
| 20 | import androidx.fragment.app.DialogFragment; | 20 | import androidx.fragment.app.DialogFragment; |
| 21 | 21 | ||
| 22 | import com.google.android.material.dialog.MaterialAlertDialogBuilder; | ||
| 23 | |||
| 22 | import org.yuzu.yuzu_emu.YuzuApplication; | 24 | import org.yuzu.yuzu_emu.YuzuApplication; |
| 23 | import org.yuzu.yuzu_emu.NativeLibrary; | 25 | import org.yuzu.yuzu_emu.NativeLibrary; |
| 24 | import org.yuzu.yuzu_emu.R; | 26 | import org.yuzu.yuzu_emu.R; |
| @@ -124,7 +126,7 @@ public final class SoftwareKeyboard { | |||
| 124 | FrameLayout container = new FrameLayout(emulationActivity); | 126 | FrameLayout container = new FrameLayout(emulationActivity); |
| 125 | container.addView(editText); | 127 | container.addView(editText); |
| 126 | 128 | ||
| 127 | AlertDialog.Builder builder = new AlertDialog.Builder(emulationActivity) | 129 | MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(emulationActivity) |
| 128 | .setTitle(R.string.software_keyboard) | 130 | .setTitle(R.string.software_keyboard) |
| 129 | .setView(container); | 131 | .setView(container); |
| 130 | setCancelable(false); | 132 | setCancelable(false); |
| @@ -227,7 +229,7 @@ public final class SoftwareKeyboard { | |||
| 227 | break; | 229 | break; |
| 228 | } | 230 | } |
| 229 | 231 | ||
| 230 | new AlertDialog.Builder(emulationActivity) | 232 | new MaterialAlertDialogBuilder(emulationActivity) |
| 231 | .setTitle(R.string.software_keyboard) | 233 | .setTitle(R.string.software_keyboard) |
| 232 | .setMessage(message) | 234 | .setMessage(message) |
| 233 | .setPositiveButton(android.R.string.ok, null) | 235 | .setPositiveButton(android.R.string.ok, null) |
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsActivity.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsActivity.kt index e0f067448..1705a72e8 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsActivity.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsActivity.kt | |||
| @@ -3,15 +3,17 @@ | |||
| 3 | 3 | ||
| 4 | package org.yuzu.yuzu_emu.features.settings.ui | 4 | package org.yuzu.yuzu_emu.features.settings.ui |
| 5 | 5 | ||
| 6 | import android.app.ProgressDialog | ||
| 7 | import android.content.Context | 6 | import android.content.Context |
| 8 | import android.content.Intent | 7 | import android.content.Intent |
| 9 | import android.content.IntentFilter | 8 | import android.content.IntentFilter |
| 10 | import android.os.Bundle | 9 | import android.os.Bundle |
| 11 | import android.view.Menu | 10 | import android.view.Menu |
| 12 | import android.widget.Toast | 11 | import android.widget.Toast |
| 12 | import androidx.appcompat.app.AlertDialog | ||
| 13 | import androidx.appcompat.app.AppCompatActivity | 13 | import androidx.appcompat.app.AppCompatActivity |
| 14 | import androidx.localbroadcastmanager.content.LocalBroadcastManager | 14 | import androidx.localbroadcastmanager.content.LocalBroadcastManager |
| 15 | import com.google.android.material.dialog.MaterialAlertDialogBuilder | ||
| 16 | import com.google.android.material.progressindicator.LinearProgressIndicator | ||
| 15 | import org.yuzu.yuzu_emu.NativeLibrary | 17 | import org.yuzu.yuzu_emu.NativeLibrary |
| 16 | import org.yuzu.yuzu_emu.R | 18 | import org.yuzu.yuzu_emu.R |
| 17 | import org.yuzu.yuzu_emu.features.settings.model.Settings | 19 | import org.yuzu.yuzu_emu.features.settings.model.Settings |
| @@ -19,12 +21,15 @@ import org.yuzu.yuzu_emu.features.settings.ui.SettingsFragment.Companion.newInst | |||
| 19 | import org.yuzu.yuzu_emu.utils.DirectoryInitialization | 21 | import org.yuzu.yuzu_emu.utils.DirectoryInitialization |
| 20 | import org.yuzu.yuzu_emu.utils.DirectoryStateReceiver | 22 | import org.yuzu.yuzu_emu.utils.DirectoryStateReceiver |
| 21 | import org.yuzu.yuzu_emu.utils.EmulationMenuSettings | 23 | import org.yuzu.yuzu_emu.utils.EmulationMenuSettings |
| 24 | import org.yuzu.yuzu_emu.utils.ThemeHelper | ||
| 22 | 25 | ||
| 23 | class SettingsActivity : AppCompatActivity(), SettingsActivityView { | 26 | class SettingsActivity : AppCompatActivity(), SettingsActivityView { |
| 24 | private val presenter = SettingsActivityPresenter(this) | 27 | private val presenter = SettingsActivityPresenter(this) |
| 25 | private var dialog: ProgressDialog? = null | 28 | private var dialog: AlertDialog? = null |
| 26 | 29 | ||
| 27 | override fun onCreate(savedInstanceState: Bundle?) { | 30 | override fun onCreate(savedInstanceState: Bundle?) { |
| 31 | ThemeHelper.setTheme(this) | ||
| 32 | |||
| 28 | super.onCreate(savedInstanceState) | 33 | super.onCreate(savedInstanceState) |
| 29 | setContentView(R.layout.activity_settings) | 34 | setContentView(R.layout.activity_settings) |
| 30 | val launcher = intent | 35 | val launcher = intent |
| @@ -33,6 +38,7 @@ class SettingsActivity : AppCompatActivity(), SettingsActivityView { | |||
| 33 | presenter.onCreate(savedInstanceState, menuTag!!, gameID!!) | 38 | presenter.onCreate(savedInstanceState, menuTag!!, gameID!!) |
| 34 | 39 | ||
| 35 | // Show "Back" button in the action bar for navigation | 40 | // Show "Back" button in the action bar for navigation |
| 41 | setSupportActionBar(findViewById(R.id.toolbar_settings)) | ||
| 36 | supportActionBar!!.setDisplayHomeAsUpEnabled(true) | 42 | supportActionBar!!.setDisplayHomeAsUpEnabled(true) |
| 37 | } | 43 | } |
| 38 | 44 | ||
| @@ -123,9 +129,15 @@ class SettingsActivity : AppCompatActivity(), SettingsActivityView { | |||
| 123 | 129 | ||
| 124 | override fun showLoading() { | 130 | override fun showLoading() { |
| 125 | if (dialog == null) { | 131 | if (dialog == null) { |
| 126 | dialog = ProgressDialog(this) | 132 | val root = layoutInflater.inflate(R.layout.dialog_progress_bar, null) |
| 127 | dialog!!.setMessage(getString(R.string.load_settings)) | 133 | val progressBar = root.findViewById<LinearProgressIndicator>(R.id.progress_bar) |
| 128 | dialog!!.isIndeterminate = true | 134 | progressBar.isIndeterminate = true |
| 135 | |||
| 136 | dialog = MaterialAlertDialogBuilder(this) | ||
| 137 | .setTitle(R.string.load_settings) | ||
| 138 | .setView(root) | ||
| 139 | .setCancelable(false) | ||
| 140 | .create() | ||
| 129 | } | 141 | } |
| 130 | dialog!!.show() | 142 | dialog!!.show() |
| 131 | } | 143 | } |
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsAdapter.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsAdapter.kt index 03e0adf56..4eac386cc 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsAdapter.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsAdapter.kt | |||
| @@ -51,7 +51,7 @@ class SettingsAdapter( | |||
| 51 | HeaderViewHolder(view, this) | 51 | HeaderViewHolder(view, this) |
| 52 | } | 52 | } |
| 53 | SettingsItem.TYPE_CHECKBOX -> { | 53 | SettingsItem.TYPE_CHECKBOX -> { |
| 54 | view = inflater.inflate(R.layout.list_item_setting_checkbox, parent, false) | 54 | view = inflater.inflate(R.layout.list_item_setting_switch, parent, false) |
| 55 | CheckBoxSettingViewHolder(view, this) | 55 | CheckBoxSettingViewHolder(view, this) |
| 56 | } | 56 | } |
| 57 | SettingsItem.TYPE_SINGLE_CHOICE, SettingsItem.TYPE_STRING_SINGLE_CHOICE -> { | 57 | SettingsItem.TYPE_SINGLE_CHOICE, SettingsItem.TYPE_STRING_SINGLE_CHOICE -> { |
| @@ -105,7 +105,6 @@ class SettingsAdapter( | |||
| 105 | 105 | ||
| 106 | fun onBooleanClick(item: CheckBoxSetting, position: Int, checked: Boolean) { | 106 | fun onBooleanClick(item: CheckBoxSetting, position: Int, checked: Boolean) { |
| 107 | val setting = item.setChecked(checked) | 107 | val setting = item.setChecked(checked) |
| 108 | notifyItemChanged(position) | ||
| 109 | if (setting != null) { | 108 | if (setting != null) { |
| 110 | fragmentView.putSetting(setting) | 109 | fragmentView.putSetting(setting) |
| 111 | } | 110 | } |
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/CheckBoxSettingViewHolder.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/CheckBoxSettingViewHolder.kt index 35d0586db..3296aed68 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/CheckBoxSettingViewHolder.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/CheckBoxSettingViewHolder.kt | |||
| @@ -4,8 +4,9 @@ | |||
| 4 | package org.yuzu.yuzu_emu.features.settings.ui.viewholder | 4 | package org.yuzu.yuzu_emu.features.settings.ui.viewholder |
| 5 | 5 | ||
| 6 | import android.view.View | 6 | import android.view.View |
| 7 | import android.widget.CheckBox | 7 | import android.widget.CompoundButton |
| 8 | import android.widget.TextView | 8 | import android.widget.TextView |
| 9 | import com.google.android.material.materialswitch.MaterialSwitch | ||
| 9 | import org.yuzu.yuzu_emu.R | 10 | import org.yuzu.yuzu_emu.R |
| 10 | import org.yuzu.yuzu_emu.features.settings.model.view.CheckBoxSetting | 11 | import org.yuzu.yuzu_emu.features.settings.model.view.CheckBoxSetting |
| 11 | import org.yuzu.yuzu_emu.features.settings.model.view.SettingsItem | 12 | import org.yuzu.yuzu_emu.features.settings.model.view.SettingsItem |
| @@ -16,12 +17,12 @@ class CheckBoxSettingViewHolder(itemView: View, adapter: SettingsAdapter) : | |||
| 16 | private lateinit var item: CheckBoxSetting | 17 | private lateinit var item: CheckBoxSetting |
| 17 | private lateinit var textSettingName: TextView | 18 | private lateinit var textSettingName: TextView |
| 18 | private lateinit var textSettingDescription: TextView | 19 | private lateinit var textSettingDescription: TextView |
| 19 | private lateinit var checkbox: CheckBox | 20 | private lateinit var switch: MaterialSwitch |
| 20 | 21 | ||
| 21 | override fun findViews(root: View) { | 22 | override fun findViews(root: View) { |
| 22 | textSettingName = root.findViewById(R.id.text_setting_name) | 23 | textSettingName = root.findViewById(R.id.text_setting_name) |
| 23 | textSettingDescription = root.findViewById(R.id.text_setting_description) | 24 | textSettingDescription = root.findViewById(R.id.text_setting_description) |
| 24 | checkbox = root.findViewById(R.id.checkbox) | 25 | switch = root.findViewById(R.id.switch_widget) |
| 25 | } | 26 | } |
| 26 | 27 | ||
| 27 | override fun bind(item: SettingsItem) { | 28 | override fun bind(item: SettingsItem) { |
| @@ -34,11 +35,13 @@ class CheckBoxSettingViewHolder(itemView: View, adapter: SettingsAdapter) : | |||
| 34 | textSettingDescription.text = "" | 35 | textSettingDescription.text = "" |
| 35 | textSettingDescription.visibility = View.GONE | 36 | textSettingDescription.visibility = View.GONE |
| 36 | } | 37 | } |
| 37 | checkbox.isChecked = this.item.isChecked | 38 | switch.isChecked = this.item.isChecked |
| 39 | switch.setOnCheckedChangeListener { _: CompoundButton, _: Boolean -> | ||
| 40 | adapter.onBooleanClick(item, bindingAdapterPosition, switch.isChecked) | ||
| 41 | } | ||
| 38 | } | 42 | } |
| 39 | 43 | ||
| 40 | override fun onClick(clicked: View) { | 44 | override fun onClick(clicked: View) { |
| 41 | checkbox.toggle() | 45 | switch.toggle() |
| 42 | adapter.onBooleanClick(item, bindingAdapterPosition, checkbox.isChecked) | ||
| 43 | } | 46 | } |
| 44 | } | 47 | } |
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/main/MainActivity.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/main/MainActivity.kt index af0d9f4ff..266403885 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/main/MainActivity.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/main/MainActivity.kt | |||
| @@ -27,6 +27,8 @@ class MainActivity : AppCompatActivity(), MainView { | |||
| 27 | private val presenter = MainPresenter(this) | 27 | private val presenter = MainPresenter(this) |
| 28 | 28 | ||
| 29 | override fun onCreate(savedInstanceState: Bundle?) { | 29 | override fun onCreate(savedInstanceState: Bundle?) { |
| 30 | ThemeHelper.setTheme(this) | ||
| 31 | |||
| 30 | super.onCreate(savedInstanceState) | 32 | super.onCreate(savedInstanceState) |
| 31 | setContentView(R.layout.activity_main) | 33 | setContentView(R.layout.activity_main) |
| 32 | findViews() | 34 | findViews() |
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/InsetsHelper.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/InsetsHelper.kt new file mode 100644 index 000000000..3f9acc5b0 --- /dev/null +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/InsetsHelper.kt | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | package org.yuzu.yuzu_emu.utils | ||
| 2 | |||
| 3 | import android.content.Context | ||
| 4 | |||
| 5 | object InsetsHelper { | ||
| 6 | const val THREE_BUTTON_NAVIGATION = 0 | ||
| 7 | const val TWO_BUTTON_NAVIGATION = 1 | ||
| 8 | const val GESTURE_NAVIGATION = 2 | ||
| 9 | |||
| 10 | fun getSystemGestureType(context: Context): Int { | ||
| 11 | val resources = context.resources | ||
| 12 | val resourceId = | ||
| 13 | resources.getIdentifier("config_navBarInteractionMode", "integer", "android") | ||
| 14 | return if (resourceId != 0) { | ||
| 15 | resources.getInteger(resourceId) | ||
| 16 | } else 0 | ||
| 17 | } | ||
| 18 | } | ||
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/ThemeHelper.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/ThemeHelper.kt new file mode 100644 index 000000000..ce6396e91 --- /dev/null +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/ThemeHelper.kt | |||
| @@ -0,0 +1,67 @@ | |||
| 1 | // SPDX-FileCopyrightText: 2023 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | package org.yuzu.yuzu_emu.utils | ||
| 5 | |||
| 6 | import android.app.Activity | ||
| 7 | import android.content.res.Configuration | ||
| 8 | import android.graphics.Color | ||
| 9 | import androidx.annotation.ColorInt | ||
| 10 | import androidx.appcompat.app.AppCompatActivity | ||
| 11 | import androidx.core.content.ContextCompat | ||
| 12 | import androidx.core.view.WindowCompat | ||
| 13 | import com.google.android.material.color.MaterialColors | ||
| 14 | import org.yuzu.yuzu_emu.R | ||
| 15 | import kotlin.math.roundToInt | ||
| 16 | |||
| 17 | object ThemeHelper { | ||
| 18 | private const val NAV_BAR_ALPHA = 0.9f | ||
| 19 | |||
| 20 | @JvmStatic | ||
| 21 | fun setTheme(activity: AppCompatActivity) { | ||
| 22 | val windowController = WindowCompat.getInsetsController( | ||
| 23 | activity.window, | ||
| 24 | activity.window.decorView | ||
| 25 | ) | ||
| 26 | val isLightMode = | ||
| 27 | (activity.resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_NO | ||
| 28 | windowController.isAppearanceLightStatusBars = isLightMode | ||
| 29 | windowController.isAppearanceLightNavigationBars = isLightMode | ||
| 30 | |||
| 31 | activity.window.statusBarColor = ContextCompat.getColor(activity, android.R.color.transparent) | ||
| 32 | |||
| 33 | val navigationBarColor = | ||
| 34 | MaterialColors.getColor(activity.window.decorView, R.attr.colorSurface) | ||
| 35 | setNavigationBarColor(activity, navigationBarColor) | ||
| 36 | } | ||
| 37 | |||
| 38 | @JvmStatic | ||
| 39 | fun setNavigationBarColor(activity: Activity, @ColorInt color: Int) { | ||
| 40 | val gestureType = InsetsHelper.getSystemGestureType(activity.applicationContext) | ||
| 41 | val orientation = activity.resources.configuration.orientation | ||
| 42 | |||
| 43 | if ((gestureType == InsetsHelper.THREE_BUTTON_NAVIGATION || | ||
| 44 | gestureType == InsetsHelper.TWO_BUTTON_NAVIGATION) && | ||
| 45 | orientation == Configuration.ORIENTATION_LANDSCAPE | ||
| 46 | ) { | ||
| 47 | activity.window.navigationBarColor = color | ||
| 48 | } else if (gestureType == InsetsHelper.THREE_BUTTON_NAVIGATION || | ||
| 49 | gestureType == InsetsHelper.TWO_BUTTON_NAVIGATION | ||
| 50 | ) { | ||
| 51 | activity.window.navigationBarColor = getColorWithOpacity(color, NAV_BAR_ALPHA) | ||
| 52 | } else { | ||
| 53 | activity.window.navigationBarColor = ContextCompat.getColor( | ||
| 54 | activity.applicationContext, | ||
| 55 | android.R.color.transparent | ||
| 56 | ) | ||
| 57 | } | ||
| 58 | } | ||
| 59 | |||
| 60 | @ColorInt | ||
| 61 | private fun getColorWithOpacity(@ColorInt color: Int, alphaFactor: Float): Int { | ||
| 62 | return Color.argb( | ||
| 63 | (alphaFactor * Color.alpha(color)).roundToInt(), Color.red(color), | ||
| 64 | Color.green(color), Color.blue(color) | ||
| 65 | ) | ||
| 66 | } | ||
| 67 | } | ||
diff --git a/src/android/app/src/main/res/drawable/gamelist_divider.xml b/src/android/app/src/main/res/drawable/gamelist_divider.xml deleted file mode 100644 index 7da9dccce..000000000 --- a/src/android/app/src/main/res/drawable/gamelist_divider.xml +++ /dev/null | |||
| @@ -1,11 +0,0 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <shape xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 3 | android:shape="rectangle"> | ||
| 4 | |||
| 5 | <size | ||
| 6 | android:width="1dp" | ||
| 7 | android:height="1dp" /> | ||
| 8 | |||
| 9 | <solid android:color="@color/gamelist_divider" /> | ||
| 10 | |||
| 11 | </shape> | ||
diff --git a/src/android/app/src/main/res/layout/activity_main.xml b/src/android/app/src/main/res/layout/activity_main.xml index cea0922a7..34abf955d 100644 --- a/src/android/app/src/main/res/layout/activity_main.xml +++ b/src/android/app/src/main/res/layout/activity_main.xml | |||
| @@ -5,23 +5,23 @@ | |||
| 5 | android:layout_width="match_parent" | 5 | android:layout_width="match_parent" |
| 6 | android:layout_height="match_parent"> | 6 | android:layout_height="match_parent"> |
| 7 | 7 | ||
| 8 | <FrameLayout | ||
| 9 | android:id="@+id/games_platform_frame" | ||
| 10 | android:layout_width="match_parent" | ||
| 11 | android:layout_height="match_parent" | ||
| 12 | app:layout_behavior="@string/appbar_scrolling_view_behavior" /> | ||
| 13 | |||
| 14 | <com.google.android.material.appbar.AppBarLayout | 8 | <com.google.android.material.appbar.AppBarLayout |
| 15 | android:id="@+id/appbar" | 9 | android:id="@+id/appbar_main" |
| 16 | android:layout_width="match_parent" | 10 | android:layout_width="match_parent" |
| 17 | android:layout_height="wrap_content"> | 11 | android:layout_height="wrap_content" |
| 12 | app:liftOnScrollTargetViewId="@id/grid_games"> | ||
| 18 | 13 | ||
| 19 | <androidx.appcompat.widget.Toolbar | 14 | <androidx.appcompat.widget.Toolbar |
| 20 | android:id="@+id/toolbar_main" | 15 | android:id="@+id/toolbar_main" |
| 21 | android:layout_width="match_parent" | 16 | android:layout_width="match_parent" |
| 22 | android:layout_height="?attr/actionBarSize" | 17 | android:layout_height="?attr/actionBarSize" /> |
| 23 | android:background="?colorPrimary"/> | ||
| 24 | 18 | ||
| 25 | </com.google.android.material.appbar.AppBarLayout> | 19 | </com.google.android.material.appbar.AppBarLayout> |
| 26 | 20 | ||
| 21 | <FrameLayout | ||
| 22 | android:id="@+id/games_platform_frame" | ||
| 23 | android:layout_width="match_parent" | ||
| 24 | android:layout_height="match_parent" | ||
| 25 | app:layout_behavior="@string/appbar_scrolling_view_behavior" /> | ||
| 26 | |||
| 27 | </androidx.coordinatorlayout.widget.CoordinatorLayout> | 27 | </androidx.coordinatorlayout.widget.CoordinatorLayout> |
diff --git a/src/android/app/src/main/res/layout/activity_settings.xml b/src/android/app/src/main/res/layout/activity_settings.xml index 11b91c45f..449deab08 100644 --- a/src/android/app/src/main/res/layout/activity_settings.xml +++ b/src/android/app/src/main/res/layout/activity_settings.xml | |||
| @@ -1,5 +1,27 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <androidx.coordinatorlayout.widget.CoordinatorLayout |
| 3 | android:id="@+id/coordinator_main" | ||
| 4 | xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 5 | xmlns:app="http://schemas.android.com/apk/res-auto" | ||
| 3 | android:layout_width="match_parent" | 6 | android:layout_width="match_parent" |
| 4 | android:layout_height="match_parent" | 7 | android:layout_height="match_parent"> |
| 5 | android:id="@+id/frame_content" /> | 8 | |
| 9 | <com.google.android.material.appbar.AppBarLayout | ||
| 10 | android:id="@+id/appbar_settings" | ||
| 11 | android:layout_width="match_parent" | ||
| 12 | android:layout_height="wrap_content"> | ||
| 13 | |||
| 14 | <androidx.appcompat.widget.Toolbar | ||
| 15 | android:id="@+id/toolbar_settings" | ||
| 16 | android:layout_width="match_parent" | ||
| 17 | android:layout_height="?attr/actionBarSize" /> | ||
| 18 | |||
| 19 | </com.google.android.material.appbar.AppBarLayout> | ||
| 20 | |||
| 21 | <FrameLayout | ||
| 22 | android:id="@+id/frame_content" | ||
| 23 | android:layout_width="match_parent" | ||
| 24 | android:layout_height="match_parent" | ||
| 25 | app:layout_behavior="@string/appbar_scrolling_view_behavior" /> | ||
| 26 | |||
| 27 | </androidx.coordinatorlayout.widget.CoordinatorLayout> | ||
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 a0d453719..a107fec0f 100644 --- a/src/android/app/src/main/res/layout/card_game.xml +++ b/src/android/app/src/main/res/layout/card_game.xml | |||
| @@ -5,7 +5,7 @@ | |||
| 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:background="?attr/selectableItemBackground" | 8 | android:foreground="?attr/selectableItemBackground" |
| 9 | android:clickable="true" | 9 | android:clickable="true" |
| 10 | android:clipToPadding="false" | 10 | android:clipToPadding="false" |
| 11 | android:focusable="true" | 11 | android:focusable="true" |
| @@ -15,7 +15,8 @@ | |||
| 15 | android:paddingBottom="8dp" | 15 | android:paddingBottom="8dp" |
| 16 | android:transitionName="card_game"> | 16 | android:transitionName="card_game"> |
| 17 | 17 | ||
| 18 | <androidx.cardview.widget.CardView | 18 | <com.google.android.material.card.MaterialCardView |
| 19 | style="?attr/materialCardViewElevatedStyle" | ||
| 19 | android:id="@+id/card_game_art" | 20 | android:id="@+id/card_game_art" |
| 20 | android:layout_width="150dp" | 21 | android:layout_width="150dp" |
| 21 | android:layout_height="150dp" | 22 | android:layout_height="150dp" |
| @@ -32,24 +33,24 @@ | |||
| 32 | 33 | ||
| 33 | <TextView | 34 | <TextView |
| 34 | android:id="@+id/text_game_title_inner" | 35 | android:id="@+id/text_game_title_inner" |
| 35 | style="@android:style/TextAppearance.Material.Subhead" | 36 | style="@style/TextAppearance.Material3.BodyLarge" |
| 36 | android:layout_width="match_parent" | 37 | android:layout_width="match_parent" |
| 37 | android:layout_height="match_parent" | 38 | android:layout_height="match_parent" |
| 38 | android:ellipsize="end" | 39 | android:ellipsize="end" |
| 39 | android:gravity="center|top" | 40 | android:gravity="center" |
| 40 | android:maxLines="2" | 41 | android:maxLines="2" |
| 41 | android:paddingLeft="2dp" | 42 | android:paddingLeft="2dp" |
| 42 | android:paddingRight="2dp" | 43 | android:paddingRight="2dp" |
| 43 | android:paddingTop="8dp" | 44 | android:paddingTop="8dp" |
| 44 | android:visibility="visible" | 45 | android:visibility="visible" |
| 45 | tools:text="The Legend of Zelda: The Wind Waker" /> | 46 | tools:text="Super Mario Odyssey" /> |
| 46 | 47 | ||
| 47 | </androidx.cardview.widget.CardView> | 48 | </com.google.android.material.card.MaterialCardView> |
| 48 | 49 | ||
| 49 | <TextView | 50 | <TextView |
| 50 | android:id="@+id/text_game_title" | 51 | android:id="@+id/text_game_title" |
| 51 | style="@android:style/TextAppearance.Material.Subhead" | 52 | style="@style/TextAppearance.Material3.BodyLarge" |
| 52 | android:layout_width="150dp" | 53 | android:layout_width="0dp" |
| 53 | android:layout_height="wrap_content" | 54 | android:layout_height="wrap_content" |
| 54 | android:ellipsize="end" | 55 | android:ellipsize="end" |
| 55 | android:maxLines="2" | 56 | android:maxLines="2" |
| @@ -57,12 +58,12 @@ | |||
| 57 | app:layout_constraintEnd_toEndOf="@+id/card_game_art" | 58 | app:layout_constraintEnd_toEndOf="@+id/card_game_art" |
| 58 | app:layout_constraintStart_toStartOf="@+id/card_game_art" | 59 | app:layout_constraintStart_toStartOf="@+id/card_game_art" |
| 59 | app:layout_constraintTop_toBottomOf="@+id/card_game_art" | 60 | app:layout_constraintTop_toBottomOf="@+id/card_game_art" |
| 60 | tools:text="The Legend of Zelda: The Wind Waker" /> | 61 | tools:text="Super Mario Odyssey" /> |
| 61 | 62 | ||
| 62 | <TextView | 63 | <TextView |
| 63 | android:id="@+id/text_game_caption" | 64 | android:id="@+id/text_game_caption" |
| 64 | style="@android:style/TextAppearance.Material.Caption" | 65 | style="@style/TextAppearance.Material3.BodyMedium" |
| 65 | android:layout_width="150dp" | 66 | android:layout_width="0dp" |
| 66 | android:layout_height="wrap_content" | 67 | android:layout_height="wrap_content" |
| 67 | android:ellipsize="end" | 68 | android:ellipsize="end" |
| 68 | android:lines="1" | 69 | android:lines="1" |
diff --git a/src/android/app/src/main/res/layout/dialog_checkbox.xml b/src/android/app/src/main/res/layout/dialog_checkbox.xml deleted file mode 100644 index c0f307117..000000000 --- a/src/android/app/src/main/res/layout/dialog_checkbox.xml +++ /dev/null | |||
| @@ -1,16 +0,0 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 3 | android:orientation="vertical" | ||
| 4 | android:paddingTop="5dp" | ||
| 5 | android:paddingLeft="20dp" | ||
| 6 | android:paddingRight="20dp" | ||
| 7 | android:paddingBottom="0dp" | ||
| 8 | android:layout_width="match_parent" | ||
| 9 | android:layout_height="match_parent"> | ||
| 10 | |||
| 11 | <CheckBox | ||
| 12 | android:id="@+id/checkBox" | ||
| 13 | android:layout_width="match_parent" | ||
| 14 | android:layout_height="wrap_content" | ||
| 15 | android:text="@string/do_not_show_this_again" /> | ||
| 16 | </LinearLayout> | ||
diff --git a/src/android/app/src/main/res/layout/dialog_progress_bar.xml b/src/android/app/src/main/res/layout/dialog_progress_bar.xml index a81157a29..1dbfd4f7b 100644 --- a/src/android/app/src/main/res/layout/dialog_progress_bar.xml +++ b/src/android/app/src/main/res/layout/dialog_progress_bar.xml | |||
| @@ -1,26 +1,15 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <LinearLayout | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" | 3 | android:layout_width="match_parent" |
| 4 | android:layout_height="match_parent" | 4 | android:layout_height="match_parent" |
| 5 | xmlns:app="http://schemas.android.com/apk/res-auto" | ||
| 5 | android:orientation="vertical"> | 6 | android:orientation="vertical"> |
| 6 | 7 | ||
| 7 | <ProgressBar | 8 | <com.google.android.material.progressindicator.LinearProgressIndicator |
| 8 | android:id="@+id/progress_bar" | 9 | android:id="@+id/progress_bar" |
| 9 | style="?android:attr/progressBarStyleHorizontal" | ||
| 10 | android:layout_width="match_parent" | 10 | android:layout_width="match_parent" |
| 11 | android:layout_height="wrap_content" | 11 | android:layout_height="wrap_content" |
| 12 | android:layout_marginLeft="@dimen/spacing_large" | 12 | android:layout_margin="24dp" |
| 13 | android:layout_marginRight="@dimen/spacing_large" | 13 | app:trackCornerRadius="4dp" /> |
| 14 | android:layout_alignParentEnd="true" | ||
| 15 | android:layout_below="@+id/progress_text" | ||
| 16 | android:layout_alignParentStart="true"/> | ||
| 17 | 14 | ||
| 18 | <TextView | 15 | </LinearLayout> |
| 19 | android:id="@+id/progress_text" | ||
| 20 | android:layout_width="match_parent" | ||
| 21 | android:layout_height="wrap_content" | ||
| 22 | android:layout_marginLeft="@dimen/spacing_large" | ||
| 23 | android:layout_marginRight="@dimen/spacing_large" | ||
| 24 | android:gravity="right" | ||
| 25 | android:text="1/100" /> | ||
| 26 | </LinearLayout> \ No newline at end of file | ||
diff --git a/src/android/app/src/main/res/layout/fragment_emulation.xml b/src/android/app/src/main/res/layout/fragment_emulation.xml index 729a986db..c2eb097f9 100644 --- a/src/android/app/src/main/res/layout/fragment_emulation.xml +++ b/src/android/app/src/main/res/layout/fragment_emulation.xml | |||
| @@ -6,6 +6,17 @@ | |||
| 6 | tools:context="org.yuzu.yuzu_emu.fragments.EmulationFragment"> | 6 | tools:context="org.yuzu.yuzu_emu.fragments.EmulationFragment"> |
| 7 | 7 | ||
| 8 | <!-- This is what everything is rendered to during emulation --> | 8 | <!-- This is what everything is rendered to during emulation --> |
| 9 | <Button | ||
| 10 | android:id="@+id/done_control_config" | ||
| 11 | style="@style/Widget.Material3.Button.Icon" | ||
| 12 | android:layout_width="wrap_content" | ||
| 13 | android:layout_height="wrap_content" | ||
| 14 | android:layout_gravity="center" | ||
| 15 | android:padding="@dimen/spacing_small" | ||
| 16 | android:text="@string/emulation_done" | ||
| 17 | android:visibility="gone" /> | ||
| 18 | |||
| 19 | <!-- This is the onscreen input overlay --> | ||
| 9 | <SurfaceView | 20 | <SurfaceView |
| 10 | android:id="@+id/surface_emulation" | 21 | android:id="@+id/surface_emulation" |
| 11 | android:layout_width="match_parent" | 22 | android:layout_width="match_parent" |
| @@ -13,20 +24,12 @@ | |||
| 13 | android:focusable="false" | 24 | android:focusable="false" |
| 14 | android:focusableInTouchMode="false" /> | 25 | android:focusableInTouchMode="false" /> |
| 15 | 26 | ||
| 16 | <!-- This is the onscreen input overlay --> | ||
| 17 | <org.yuzu.yuzu_emu.overlay.InputOverlay | ||
| 18 | android:id="@+id/surface_input_overlay" | ||
| 19 | android:layout_height="match_parent" | ||
| 20 | android:layout_width="match_parent" | ||
| 21 | android:focusable="true" | ||
| 22 | android:focusableInTouchMode="true" /> | ||
| 23 | |||
| 24 | <TextView | 27 | <TextView |
| 25 | android:id="@+id/show_fps_text" | 28 | android:id="@+id/show_fps_text" |
| 26 | android:layout_marginStart="18dp" | ||
| 27 | android:layout_marginTop="2dp" | ||
| 28 | android:layout_width="wrap_content" | 29 | android:layout_width="wrap_content" |
| 29 | android:layout_height="wrap_content" | 30 | android:layout_height="wrap_content" |
| 31 | android:layout_marginStart="18dp" | ||
| 32 | android:layout_marginTop="2dp" | ||
| 30 | android:clickable="false" | 33 | android:clickable="false" |
| 31 | android:linksClickable="false" | 34 | android:linksClickable="false" |
| 32 | android:longClickable="false" | 35 | android:longClickable="false" |
| @@ -34,15 +37,11 @@ | |||
| 34 | android:textColor="@android:color/white" | 37 | android:textColor="@android:color/white" |
| 35 | android:textSize="12sp" /> | 38 | android:textSize="12sp" /> |
| 36 | 39 | ||
| 37 | <Button | 40 | <org.yuzu.yuzu_emu.overlay.InputOverlay |
| 38 | android:id="@+id/done_control_config" | 41 | android:id="@+id/surface_input_overlay" |
| 39 | android:layout_width="wrap_content" | 42 | android:layout_width="match_parent" |
| 40 | android:layout_height="wrap_content" | 43 | android:layout_height="match_parent" |
| 41 | android:layout_gravity="center" | 44 | android:focusable="true" |
| 42 | android:padding="@dimen/spacing_small" | 45 | android:focusableInTouchMode="true" /> |
| 43 | android:background="@color/citra_orange" | ||
| 44 | android:text="@string/emulation_done" | ||
| 45 | android:visibility="gone" /> | ||
| 46 | 46 | ||
| 47 | </FrameLayout> | 47 | </FrameLayout> |
| 48 | t> | ||
diff --git a/src/android/app/src/main/res/layout/fragment_settings.xml b/src/android/app/src/main/res/layout/fragment_settings.xml index b44e77297..13780927e 100644 --- a/src/android/app/src/main/res/layout/fragment_settings.xml +++ b/src/android/app/src/main/res/layout/fragment_settings.xml | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <org.yuzu.yuzu_emu.features.settings.ui.SettingsFrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <org.yuzu.yuzu_emu.features.settings.ui.SettingsFrameLayout |
| 3 | xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 3 | android:layout_width="match_parent" | 4 | android:layout_width="match_parent" |
| 4 | android:layout_height="match_parent"> | 5 | android:layout_height="match_parent"> |
| 5 | 6 | ||
| @@ -7,6 +8,6 @@ | |||
| 7 | android:id="@+id/list_settings" | 8 | android:id="@+id/list_settings" |
| 8 | android:layout_width="match_parent" | 9 | android:layout_width="match_parent" |
| 9 | android:layout_height="match_parent" | 10 | android:layout_height="match_parent" |
| 10 | android:background="@color/view_background" /> | 11 | android:background="?attr/colorSurface" /> |
| 11 | 12 | ||
| 12 | </org.yuzu.yuzu_emu.features.settings.ui.SettingsFrameLayout> \ No newline at end of file | 13 | </org.yuzu.yuzu_emu.features.settings.ui.SettingsFrameLayout> |
diff --git a/src/android/app/src/main/res/layout/list_item_setting.xml b/src/android/app/src/main/res/layout/list_item_setting.xml index df83684f7..1df218302 100644 --- a/src/android/app/src/main/res/layout/list_item_setting.xml +++ b/src/android/app/src/main/res/layout/list_item_setting.xml | |||
| @@ -8,20 +8,19 @@ | |||
| 8 | android:focusable="true" | 8 | android:focusable="true" |
| 9 | android:gravity="center_vertical" | 9 | android:gravity="center_vertical" |
| 10 | android:minHeight="72dp" | 10 | android:minHeight="72dp" |
| 11 | android:paddingTop="@dimen/spacing_large" | 11 | android:paddingBottom="@dimen/spacing_large" |
| 12 | android:paddingBottom="@dimen/spacing_large"> | 12 | android:paddingTop="@dimen/spacing_large"> |
| 13 | 13 | ||
| 14 | <TextView | 14 | <TextView |
| 15 | android:id="@+id/text_setting_name" | 15 | android:id="@+id/text_setting_name" |
| 16 | style="@style/TextAppearance.AppCompat.Headline" | 16 | style="@style/TextAppearance.Material3.HeadlineMedium" |
| 17 | android:layout_width="0dp" | 17 | android:layout_width="0dp" |
| 18 | android:layout_height="wrap_content" | 18 | android:layout_height="wrap_content" |
| 19 | android:layout_alignParentEnd="true" | ||
| 19 | android:layout_alignParentStart="true" | 20 | android:layout_alignParentStart="true" |
| 20 | android:layout_alignParentTop="true" | 21 | android:layout_alignParentTop="true" |
| 21 | android:layout_alignParentEnd="true" | ||
| 22 | android:layout_marginStart="@dimen/spacing_large" | ||
| 23 | android:layout_marginEnd="@dimen/spacing_large" | 22 | android:layout_marginEnd="@dimen/spacing_large" |
| 24 | android:textColor="@color/header_text" | 23 | android:layout_marginStart="@dimen/spacing_large" |
| 25 | android:textSize="16sp" | 24 | android:textSize="16sp" |
| 26 | tools:text="Setting Name" /> | 25 | tools:text="Setting Name" /> |
| 27 | 26 | ||
| @@ -29,15 +28,14 @@ | |||
| 29 | android:id="@+id/text_setting_description" | 28 | android:id="@+id/text_setting_description" |
| 30 | android:layout_width="wrap_content" | 29 | android:layout_width="wrap_content" |
| 31 | android:layout_height="wrap_content" | 30 | android:layout_height="wrap_content" |
| 32 | android:layout_below="@+id/text_setting_name" | ||
| 33 | android:layout_alignStart="@+id/text_setting_name" | ||
| 34 | android:layout_alignParentStart="true" | ||
| 35 | android:layout_alignParentEnd="true" | 31 | android:layout_alignParentEnd="true" |
| 32 | android:layout_alignParentStart="true" | ||
| 33 | android:layout_alignStart="@+id/text_setting_name" | ||
| 34 | android:layout_below="@+id/text_setting_name" | ||
| 35 | android:layout_marginEnd="@dimen/spacing_large" | ||
| 36 | android:layout_marginStart="@dimen/spacing_large" | 36 | android:layout_marginStart="@dimen/spacing_large" |
| 37 | android:layout_marginTop="@dimen/spacing_small" | 37 | android:layout_marginTop="@dimen/spacing_small" |
| 38 | android:layout_marginEnd="@dimen/spacing_large" | ||
| 39 | android:visibility="visible" | 38 | android:visibility="visible" |
| 40 | tools:text="@string/app_disclaimer" | 39 | tools:text="@string/app_disclaimer" /> |
| 41 | android:textColor="@color/header_subtext" /> | ||
| 42 | 40 | ||
| 43 | </RelativeLayout> \ No newline at end of file | 41 | </RelativeLayout> |
diff --git a/src/android/app/src/main/res/layout/list_item_setting_checkbox.xml b/src/android/app/src/main/res/layout/list_item_setting_switch.xml index 86ba83f11..5315be3ae 100644 --- a/src/android/app/src/main/res/layout/list_item_setting_checkbox.xml +++ b/src/android/app/src/main/res/layout/list_item_setting_switch.xml | |||
| @@ -3,25 +3,18 @@ | |||
| 3 | xmlns:tools="http://schemas.android.com/tools" | 3 | xmlns:tools="http://schemas.android.com/tools" |
| 4 | android:layout_width="match_parent" | 4 | android:layout_width="match_parent" |
| 5 | android:layout_height="wrap_content" | 5 | android:layout_height="wrap_content" |
| 6 | android:minHeight="72dp" | ||
| 7 | android:background="?android:attr/selectableItemBackground" | 6 | android:background="?android:attr/selectableItemBackground" |
| 7 | android:clickable="true" | ||
| 8 | android:focusable="true" | 8 | android:focusable="true" |
| 9 | android:clickable="true"> | 9 | android:minHeight="72dp"> |
| 10 | 10 | ||
| 11 | <TextView | 11 | <com.google.android.material.materialswitch.MaterialSwitch |
| 12 | android:id="@+id/text_setting_name" | 12 | android:id="@+id/switch_widget" |
| 13 | style="@style/TextAppearance.AppCompat.Headline" | 13 | android:layout_width="wrap_content" |
| 14 | android:layout_width="0dp" | ||
| 15 | android:layout_height="wrap_content" | 14 | android:layout_height="wrap_content" |
| 16 | android:layout_alignParentStart="true" | 15 | android:layout_alignParentEnd="true" |
| 17 | android:layout_alignParentTop="true" | 16 | android:layout_centerVertical="true" |
| 18 | android:layout_marginEnd="@dimen/spacing_large" | 17 | android:layout_marginEnd="24dp" /> |
| 19 | android:layout_marginStart="@dimen/spacing_large" | ||
| 20 | android:layout_marginTop="@dimen/spacing_large" | ||
| 21 | android:layout_toStartOf="@+id/checkbox" | ||
| 22 | android:textColor="@color/header_text" | ||
| 23 | android:textSize="16sp" | ||
| 24 | tools:text="@string/frame_limit_enable" /> | ||
| 25 | 18 | ||
| 26 | <TextView | 19 | <TextView |
| 27 | android:id="@+id/text_setting_description" | 20 | android:id="@+id/text_setting_description" |
| @@ -34,19 +27,22 @@ | |||
| 34 | android:layout_marginEnd="@dimen/spacing_large" | 27 | android:layout_marginEnd="@dimen/spacing_large" |
| 35 | android:layout_marginStart="@dimen/spacing_large" | 28 | android:layout_marginStart="@dimen/spacing_large" |
| 36 | android:layout_marginTop="@dimen/spacing_small" | 29 | android:layout_marginTop="@dimen/spacing_small" |
| 37 | android:layout_toStartOf="@+id/checkbox" | 30 | android:layout_toStartOf="@+id/switch_widget" |
| 38 | android:textAlignment="textStart" | 31 | android:textAlignment="textStart" |
| 39 | android:textColor="@color/header_subtext" | ||
| 40 | tools:text="@string/frame_limit_enable_description" /> | 32 | tools:text="@string/frame_limit_enable_description" /> |
| 41 | 33 | ||
| 42 | <CheckBox | 34 | <TextView |
| 43 | android:id="@+id/checkbox" | 35 | style="@style/TextAppearance.Material3.HeadlineMedium" |
| 44 | android:layout_width="wrap_content" | 36 | android:id="@+id/text_setting_name" |
| 37 | android:layout_width="0dp" | ||
| 45 | android:layout_height="wrap_content" | 38 | android:layout_height="wrap_content" |
| 46 | android:layout_alignParentEnd="true" | 39 | android:layout_alignParentStart="true" |
| 47 | android:layout_centerVertical="true" | 40 | android:layout_alignParentTop="true" |
| 48 | android:layout_marginEnd="@dimen/spacing_large" | 41 | android:layout_marginEnd="@dimen/spacing_large" |
| 49 | android:focusable="false" | 42 | android:layout_marginStart="@dimen/spacing_large" |
| 50 | android:clickable="false" /> | 43 | android:layout_marginTop="@dimen/spacing_large" |
| 44 | android:layout_toStartOf="@+id/switch_widget" | ||
| 45 | android:textSize="16sp" | ||
| 46 | tools:text="@string/frame_limit_enable" /> | ||
| 51 | 47 | ||
| 52 | </RelativeLayout> \ No newline at end of file | 48 | </RelativeLayout> |
diff --git a/src/android/app/src/main/res/layout/list_item_settings_header.xml b/src/android/app/src/main/res/layout/list_item_settings_header.xml index d220dfd61..9debb7ba5 100644 --- a/src/android/app/src/main/res/layout/list_item_settings_header.xml +++ b/src/android/app/src/main/res/layout/list_item_settings_header.xml | |||
| @@ -6,14 +6,15 @@ | |||
| 6 | 6 | ||
| 7 | <TextView | 7 | <TextView |
| 8 | android:id="@+id/text_header_name" | 8 | android:id="@+id/text_header_name" |
| 9 | android:layout_width="wrap_content" | 9 | android:layout_width="match_parent" |
| 10 | android:layout_height="wrap_content" | 10 | android:layout_height="wrap_content" |
| 11 | android:layout_gravity="center_vertical" | 11 | android:layout_gravity="start|center_vertical" |
| 12 | android:layout_marginStart="@dimen/spacing_large" | 12 | android:layout_marginHorizontal="@dimen/spacing_large" |
| 13 | android:layout_marginBottom="@dimen/spacing_small" | 13 | android:layout_marginBottom="@dimen/spacing_small" |
| 14 | android:layout_marginTop="@dimen/spacing_small" | 14 | android:layout_marginTop="@dimen/spacing_small" |
| 15 | android:textColor="?android:colorAccent" | 15 | android:textColor="?attr/colorPrimary" |
| 16 | android:textAlignment="viewStart" | ||
| 16 | android:textStyle="bold" | 17 | android:textStyle="bold" |
| 17 | tools:text="CPU Settings" /> | 18 | tools:text="CPU Settings" /> |
| 18 | 19 | ||
| 19 | </FrameLayout> \ No newline at end of file | 20 | </FrameLayout> |
diff --git a/src/android/app/src/main/res/layout/premium_item_setting.xml b/src/android/app/src/main/res/layout/premium_item_setting.xml index 17d5a13b2..171dd175f 100644 --- a/src/android/app/src/main/res/layout/premium_item_setting.xml +++ b/src/android/app/src/main/res/layout/premium_item_setting.xml | |||
| @@ -8,20 +8,20 @@ | |||
| 8 | android:focusable="true" | 8 | android:focusable="true" |
| 9 | android:gravity="center_vertical" | 9 | android:gravity="center_vertical" |
| 10 | android:minHeight="72dp" | 10 | android:minHeight="72dp" |
| 11 | android:paddingTop="@dimen/spacing_large" | 11 | android:paddingBottom="@dimen/spacing_large" |
| 12 | android:paddingBottom="@dimen/spacing_large"> | 12 | android:paddingTop="@dimen/spacing_large"> |
| 13 | 13 | ||
| 14 | <TextView | 14 | <TextView |
| 15 | style="@style/TextAppearance.Material3.HeadlineMedium" | ||
| 15 | android:id="@+id/text_setting_name" | 16 | android:id="@+id/text_setting_name" |
| 16 | style="@style/TextAppearance.AppCompat.Headline" | ||
| 17 | android:layout_width="0dp" | 17 | android:layout_width="0dp" |
| 18 | android:layout_height="wrap_content" | 18 | android:layout_height="wrap_content" |
| 19 | android:layout_alignParentEnd="true" | ||
| 19 | android:layout_alignParentStart="true" | 20 | android:layout_alignParentStart="true" |
| 20 | android:layout_alignParentTop="true" | 21 | android:layout_alignParentTop="true" |
| 21 | android:layout_alignParentEnd="true" | ||
| 22 | android:layout_marginStart="@dimen/spacing_large" | ||
| 23 | android:layout_marginEnd="@dimen/spacing_large" | 22 | android:layout_marginEnd="@dimen/spacing_large" |
| 24 | android:textColor="?android:colorAccent" | 23 | android:layout_marginStart="@dimen/spacing_large" |
| 24 | android:textColor="?attr/colorPrimary" | ||
| 25 | android:textStyle="bold" | 25 | android:textStyle="bold" |
| 26 | tools:text="Setting Name" /> | 26 | tools:text="Setting Name" /> |
| 27 | 27 | ||
| @@ -29,15 +29,14 @@ | |||
| 29 | android:id="@+id/text_setting_description" | 29 | android:id="@+id/text_setting_description" |
| 30 | android:layout_width="wrap_content" | 30 | android:layout_width="wrap_content" |
| 31 | android:layout_height="wrap_content" | 31 | android:layout_height="wrap_content" |
| 32 | android:layout_below="@+id/text_setting_name" | ||
| 33 | android:layout_alignStart="@+id/text_setting_name" | ||
| 34 | android:layout_alignParentStart="true" | ||
| 35 | android:layout_alignParentEnd="true" | 32 | android:layout_alignParentEnd="true" |
| 33 | android:layout_alignParentStart="true" | ||
| 34 | android:layout_alignStart="@+id/text_setting_name" | ||
| 35 | android:layout_below="@+id/text_setting_name" | ||
| 36 | android:layout_marginEnd="@dimen/spacing_large" | ||
| 36 | android:layout_marginStart="@dimen/spacing_large" | 37 | android:layout_marginStart="@dimen/spacing_large" |
| 37 | android:layout_marginTop="@dimen/spacing_small" | 38 | android:layout_marginTop="@dimen/spacing_small" |
| 38 | android:layout_marginEnd="@dimen/spacing_large" | ||
| 39 | android:visibility="visible" | 39 | android:visibility="visible" |
| 40 | tools:text="@string/app_disclaimer" | 40 | tools:text="@string/app_disclaimer" /> |
| 41 | android:textColor="@color/header_subtext" /> | ||
| 42 | 41 | ||
| 43 | </RelativeLayout> \ No newline at end of file | 42 | </RelativeLayout> |
diff --git a/src/android/app/src/main/res/menu/menu_game_grid.xml b/src/android/app/src/main/res/menu/menu_game_grid.xml index 6211f5494..b834a444e 100644 --- a/src/android/app/src/main/res/menu/menu_game_grid.xml +++ b/src/android/app/src/main/res/menu/menu_game_grid.xml | |||
| @@ -7,27 +7,34 @@ | |||
| 7 | android:icon="@drawable/ic_folder" | 7 | android:icon="@drawable/ic_folder" |
| 8 | android:title="@string/select_game_folder" | 8 | android:title="@string/select_game_folder" |
| 9 | app:showAsAction="ifRoom"> | 9 | app:showAsAction="ifRoom"> |
| 10 | |||
| 10 | <menu> | 11 | <menu> |
| 12 | |||
| 11 | <item | 13 | <item |
| 12 | android:id="@+id/button_add_directory" | 14 | android:id="@+id/button_add_directory" |
| 13 | android:icon="@drawable/ic_folder" | 15 | android:icon="@drawable/ic_folder" |
| 14 | android:title="@string/select_game_folder" | 16 | android:title="@string/select_game_folder" |
| 15 | app:showAsAction="ifRoom" /> | 17 | app:showAsAction="ifRoom" /> |
| 18 | |||
| 16 | <item | 19 | <item |
| 17 | android:id="@+id/button_install_keys" | 20 | android:id="@+id/button_install_keys" |
| 18 | android:icon="@drawable/ic_install" | 21 | android:icon="@drawable/ic_install" |
| 19 | android:title="@string/install_keys" | 22 | android:title="@string/install_keys" |
| 20 | app:showAsAction="ifRoom" /> | 23 | app:showAsAction="ifRoom" /> |
| 24 | |||
| 21 | <item | 25 | <item |
| 22 | android:id="@+id/button_select_gpu_driver" | 26 | android:id="@+id/button_select_gpu_driver" |
| 23 | android:icon="@drawable/ic_settings_core" | 27 | android:icon="@drawable/ic_settings" |
| 24 | android:title="@string/select_gpu_driver" | 28 | android:title="@string/select_gpu_driver" |
| 25 | app:showAsAction="ifRoom" /> | 29 | app:showAsAction="ifRoom" /> |
| 30 | |||
| 26 | </menu> | 31 | </menu> |
| 32 | |||
| 27 | </item> | 33 | </item> |
| 34 | |||
| 28 | <item | 35 | <item |
| 29 | android:id="@+id/menu_settings_core" | 36 | android:id="@+id/menu_settings_core" |
| 30 | android:icon="@drawable/ic_settings_core" | 37 | android:icon="@drawable/ic_settings" |
| 31 | android:title="@string/grid_menu_core_settings" | 38 | android:title="@string/grid_menu_core_settings" |
| 32 | app:showAsAction="ifRoom" /> | 39 | app:showAsAction="ifRoom" /> |
| 33 | 40 | ||