summaryrefslogtreecommitdiffstats
path: root/src/android
diff options
context:
space:
mode:
authorCharles Lombardo <clombardo169@gmail.com>2023-03-08 02:04:04 +0100
committerbunnei <bunneidev@gmail.com>2023-06-03 09:05:36 +0200
commit3a5b9ecba2a599aa49ca2a9512036ab16de1f284 (patch)
tree47d3c6634e1e8b82fe07b1f9dde98618054a18f6 /src/android
parentandroid: Convert StringSetting to Kotlin (diff)
downloadyuzu-3a5b9ecba2a599aa49ca2a9512036ab16de1f284.tar
yuzu-3a5b9ecba2a599aa49ca2a9512036ab16de1f284.tar.gz
yuzu-3a5b9ecba2a599aa49ca2a9512036ab16de1f284.tar.bz2
yuzu-3a5b9ecba2a599aa49ca2a9512036ab16de1f284.tar.lz
yuzu-3a5b9ecba2a599aa49ca2a9512036ab16de1f284.tar.xz
yuzu-3a5b9ecba2a599aa49ca2a9512036ab16de1f284.tar.zst
yuzu-3a5b9ecba2a599aa49ca2a9512036ab16de1f284.zip
Diffstat (limited to 'src/android')
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/CheckBoxSettingViewHolder.java54
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/CheckBoxSettingViewHolder.kt41
2 files changed, 41 insertions, 54 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/CheckBoxSettingViewHolder.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/CheckBoxSettingViewHolder.java
deleted file mode 100644
index 2b05739e7..000000000
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/CheckBoxSettingViewHolder.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.yuzu.yuzu_emu.features.settings.ui.viewholder;
-
-import android.view.View;
-import android.widget.CheckBox;
-import android.widget.TextView;
-
-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;
-import org.yuzu.yuzu_emu.features.settings.ui.SettingsAdapter;
-
-public final class CheckBoxSettingViewHolder extends SettingViewHolder {
- private CheckBoxSetting mItem;
-
- private TextView mTextSettingName;
- private TextView mTextSettingDescription;
-
- private CheckBox mCheckbox;
-
- public CheckBoxSettingViewHolder(View itemView, SettingsAdapter adapter) {
- super(itemView, adapter);
- }
-
- @Override
- protected void findViews(View root) {
- mTextSettingName = root.findViewById(R.id.text_setting_name);
- mTextSettingDescription = root.findViewById(R.id.text_setting_description);
- mCheckbox = root.findViewById(R.id.checkbox);
- }
-
- @Override
- public void bind(SettingsItem item) {
- mItem = (CheckBoxSetting) item;
-
- mTextSettingName.setText(item.getNameId());
-
- if (item.getDescriptionId() > 0) {
- mTextSettingDescription.setText(item.getDescriptionId());
- mTextSettingDescription.setVisibility(View.VISIBLE);
- } else {
- mTextSettingDescription.setText("");
- mTextSettingDescription.setVisibility(View.GONE);
- }
-
- mCheckbox.setChecked(mItem.isChecked());
- }
-
- @Override
- public void onClick(View clicked) {
- mCheckbox.toggle();
-
- getAdapter().onBooleanClick(mItem, getAdapterPosition(), mCheckbox.isChecked());
- }
-}
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
new file mode 100644
index 000000000..5f9d564db
--- /dev/null
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/CheckBoxSettingViewHolder.kt
@@ -0,0 +1,41 @@
+package org.yuzu.yuzu_emu.features.settings.ui.viewholder
+
+import android.view.View
+import android.widget.CheckBox
+import android.widget.TextView
+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
+import org.yuzu.yuzu_emu.features.settings.ui.SettingsAdapter
+
+class CheckBoxSettingViewHolder(itemView: View, adapter: SettingsAdapter) :
+ SettingViewHolder(itemView, adapter) {
+ private lateinit var item: CheckBoxSetting
+ private lateinit var textSettingName: TextView
+ private lateinit var textSettingDescription: TextView
+ private lateinit var checkbox: CheckBox
+
+ 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)
+ }
+
+ override fun bind(item: SettingsItem) {
+ this.item = item as CheckBoxSetting
+ textSettingName.setText(item.nameId)
+ if (item.descriptionId!! > 0) {
+ textSettingDescription.setText(item.descriptionId)
+ textSettingDescription.visibility = View.VISIBLE
+ } else {
+ textSettingDescription.text = ""
+ textSettingDescription.visibility = View.GONE
+ }
+ checkbox.isChecked = this.item.isChecked
+ }
+
+ override fun onClick(clicked: View) {
+ checkbox.toggle()
+ adapter.onBooleanClick(item, bindingAdapterPosition, checkbox.isChecked)
+ }
+}