mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2026-06-01 20:45:00 -06:00
Removed combo settings as it wasn't liked. Starting Multi Choice impl
This commit is contained in:
parent
3f27121d4f
commit
77081d002a
@ -0,0 +1,62 @@
|
||||
// Copyright 2023 Citra Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
package org.citra.citra_emu.features.settings.model.view
|
||||
|
||||
import org.citra.citra_emu.features.settings.model.AbstractIntSetting
|
||||
import org.citra.citra_emu.features.settings.model.AbstractSetting
|
||||
import org.citra.citra_emu.features.settings.model.AbstractShortSetting
|
||||
|
||||
class MultiChoiceSetting(
|
||||
setting: AbstractSetting?,
|
||||
titleId: Int,
|
||||
descriptionId: Int,
|
||||
val choicesId: Int,
|
||||
val valuesId: Int,
|
||||
val key: String? = null,
|
||||
val defaultValues: Int? = null,
|
||||
override var isEnabled: Boolean = true
|
||||
) : SettingsItem(setting, titleId, descriptionId) {
|
||||
override val type = TYPE_MULTI_CHOICE
|
||||
|
||||
val selectedValue: Int
|
||||
get() {
|
||||
if (setting == null) {
|
||||
return defaultValues!!
|
||||
}
|
||||
|
||||
try {
|
||||
val setting = setting as AbstractIntSetting
|
||||
return setting.int
|
||||
} catch (_: ClassCastException) {
|
||||
}
|
||||
|
||||
try {
|
||||
val setting = setting as AbstractShortSetting
|
||||
return setting.short.toInt()
|
||||
} catch (_: ClassCastException) {
|
||||
}
|
||||
|
||||
return defaultValues!!
|
||||
}
|
||||
|
||||
/**
|
||||
* Write a value to the backing int. If that int was previously null,
|
||||
* initializes a new one and returns it, so it can be added to the Hashmap.
|
||||
*
|
||||
* @param selection New value of the int.
|
||||
* @return the existing setting with the new value applied.
|
||||
*/
|
||||
fun setSelectedValue(selection: Int): AbstractIntSetting {
|
||||
val intSetting = setting as AbstractIntSetting
|
||||
intSetting.int = selection
|
||||
return intSetting
|
||||
}
|
||||
|
||||
fun setSelectedValue(selection: Short): AbstractShortSetting {
|
||||
val shortSetting = setting as AbstractShortSetting
|
||||
shortSetting.short = selection
|
||||
return shortSetting
|
||||
}
|
||||
}
|
||||
@ -47,5 +47,6 @@ abstract class SettingsItem(
|
||||
const val TYPE_INPUT_BINDING = 8
|
||||
const val TYPE_STRING_INPUT = 9
|
||||
const val TYPE_FLOAT_INPUT = 10
|
||||
const val TYPE_MULTI_CHOICE = 11
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,143 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/button_combo"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/button_a"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginStart="36dp"
|
||||
android:layout_marginTop="95dp"
|
||||
android:layout_marginBottom="2dp"
|
||||
android:text="@string/button_a"
|
||||
app:layout_constraintBottom_toTopOf="@+id/button_b"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/button_b"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginStart="36dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginBottom="2dp"
|
||||
android:text="@string/button_b"
|
||||
app:layout_constraintBottom_toTopOf="@+id/button_x"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/button_a" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/button_x"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginStart="36dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginBottom="2dp"
|
||||
android:text="@string/button_x"
|
||||
app:layout_constraintBottom_toTopOf="@+id/button_y"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/button_b" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/button_y"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginStart="37dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginBottom="510dp"
|
||||
android:text="@string/button_y"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/button_x" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/button_l"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginStart="52dp"
|
||||
android:layout_marginTop="93dp"
|
||||
android:layout_marginBottom="2dp"
|
||||
android:text="@string/button_l"
|
||||
app:layout_constraintBottom_toTopOf="@+id/button_r"
|
||||
app:layout_constraintStart_toEndOf="@+id/button_a"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/button_home"
|
||||
android:layout_width="105dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginStart="152dp"
|
||||
android:layout_marginTop="93dp"
|
||||
android:layout_marginBottom="2dp"
|
||||
android:text="@string/button_home"
|
||||
app:layout_constraintBottom_toTopOf="@+id/button_r"
|
||||
app:layout_constraintStart_toEndOf="@+id/button_a"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.473" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/button_r"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginStart="52dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:text="@string/button_r"
|
||||
app:layout_constraintBottom_toTopOf="@+id/button_zl"
|
||||
app:layout_constraintStart_toEndOf="@+id/button_b"
|
||||
app:layout_constraintTop_toBottomOf="@+id/button_l" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/button_start"
|
||||
android:layout_width="105dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginStart="152dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginBottom="2dp"
|
||||
android:text="@string/button_start"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintBottom_toTopOf="@+id/button_zl"
|
||||
app:layout_constraintStart_toEndOf="@+id/button_b"
|
||||
app:layout_constraintTop_toBottomOf="@+id/button_l"
|
||||
app:layout_constraintVertical_bias="0.555" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/button_zl"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginStart="52dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginBottom="2dp"
|
||||
android:text="@string/button_zl"
|
||||
app:layout_constraintBottom_toTopOf="@+id/button_zr"
|
||||
app:layout_constraintStart_toEndOf="@+id/button_x"
|
||||
app:layout_constraintTop_toBottomOf="@+id/button_r" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/button_select"
|
||||
android:layout_width="105dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginStart="152dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:text="@string/button_select"
|
||||
app:layout_constraintBottom_toTopOf="@+id/button_zr"
|
||||
app:layout_constraintStart_toEndOf="@+id/button_x"
|
||||
app:layout_constraintTop_toBottomOf="@+id/button_r"
|
||||
app:layout_constraintVertical_bias="0.472" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/button_zr"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginStart="52dp"
|
||||
android:layout_marginBottom="508dp"
|
||||
android:text="@string/button_zr"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/button_y"
|
||||
app:layout_constraintTop_toBottomOf="@+id/button_zl" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
Loading…
Reference in New Issue
Block a user