mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2025-03-19 20:18:37 +01:00
Code cleanup + Rebrand feature to "Quick Configure"
This commit is contained in:
parent
c9cf901d1c
commit
2656290107
@ -11,12 +11,12 @@ import android.view.MotionEvent
|
|||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import org.citra.citra_emu.R
|
import org.citra.citra_emu.R
|
||||||
import org.citra.citra_emu.databinding.DialogControllerautomappingBinding
|
import org.citra.citra_emu.databinding.DialogControllerQuickConfigBinding
|
||||||
import org.citra.citra_emu.features.settings.model.view.InputBindingSetting
|
import org.citra.citra_emu.features.settings.model.view.InputBindingSetting
|
||||||
import kotlin.math.abs
|
import kotlin.math.abs
|
||||||
|
|
||||||
|
|
||||||
class ControllerAutomappingDialog(
|
class ControllerQuickConfigDialog(
|
||||||
private var context: Context,
|
private var context: Context,
|
||||||
buttons: ArrayList<List<String>>,
|
buttons: ArrayList<List<String>>,
|
||||||
titles: ArrayList<List<Int>>,
|
titles: ArrayList<List<Int>>,
|
||||||
@ -25,7 +25,7 @@ class ControllerAutomappingDialog(
|
|||||||
|
|
||||||
private var index = 0
|
private var index = 0
|
||||||
val inflater = LayoutInflater.from(context)
|
val inflater = LayoutInflater.from(context)
|
||||||
val automappingBinding = DialogControllerautomappingBinding.inflate(inflater)
|
val automappingBinding = DialogControllerQuickConfigBinding.inflate(inflater)
|
||||||
var dialog: AlertDialog? = null
|
var dialog: AlertDialog? = null
|
||||||
|
|
||||||
var allButtons = arrayListOf<String>()
|
var allButtons = arrayListOf<String>()
|
||||||
@ -90,7 +90,7 @@ class ControllerAutomappingDialog(
|
|||||||
|
|
||||||
var lastTitle = setting?.value ?: ""
|
var lastTitle = setting?.value ?: ""
|
||||||
if(lastTitle.isBlank()) {
|
if(lastTitle.isBlank()) {
|
||||||
lastTitle = context.getString(R.string.automapping_unassigned)
|
lastTitle = context.getString(R.string.controller_quick_config_unassigned)
|
||||||
}
|
}
|
||||||
automappingBinding.lastMappingDescription.text = lastTitle
|
automappingBinding.lastMappingDescription.text = lastTitle
|
||||||
automappingBinding.lastMappingIcon.setImageDrawable(automappingBinding.currentMappingIcon.drawable)
|
automappingBinding.lastMappingIcon.setImageDrawable(automappingBinding.currentMappingIcon.drawable)
|
||||||
@ -103,7 +103,7 @@ class ControllerAutomappingDialog(
|
|||||||
|
|
||||||
if (allButtons.size-1 < index) {
|
if (allButtons.size-1 < index) {
|
||||||
dialog?.getButton(AlertDialog.BUTTON_POSITIVE)?.text =
|
dialog?.getButton(AlertDialog.BUTTON_POSITIVE)?.text =
|
||||||
context.getString(R.string.automapping_dialog_finish)
|
context.getString(R.string.controller_quick_config_finish)
|
||||||
dialog?.getButton(AlertDialog.BUTTON_NEGATIVE)?.visibility = View.GONE
|
dialog?.getButton(AlertDialog.BUTTON_NEGATIVE)?.visibility = View.GONE
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,11 +149,8 @@ class ControllerAutomappingDialog(
|
|||||||
private var prevDeviceId = 0
|
private var prevDeviceId = 0
|
||||||
private var waitingForEvent = true
|
private var waitingForEvent = true
|
||||||
private var setting: InputBindingSetting? = null
|
private var setting: InputBindingSetting? = null
|
||||||
|
|
||||||
|
|
||||||
private var debounceTimestamp = System.currentTimeMillis()
|
private var debounceTimestamp = System.currentTimeMillis()
|
||||||
|
|
||||||
|
|
||||||
private fun onKeyEvent(event: KeyEvent): Boolean {
|
private fun onKeyEvent(event: KeyEvent): Boolean {
|
||||||
return when (event.action) {
|
return when (event.action) {
|
||||||
KeyEvent.ACTION_UP -> {
|
KeyEvent.ACTION_UP -> {
|
||||||
@ -179,7 +176,6 @@ class ControllerAutomappingDialog(
|
|||||||
if (event.action != MotionEvent.ACTION_MOVE) return false
|
if (event.action != MotionEvent.ACTION_MOVE) return false
|
||||||
|
|
||||||
val input = event.device
|
val input = event.device
|
||||||
|
|
||||||
val motionRanges = input.motionRanges
|
val motionRanges = input.motionRanges
|
||||||
|
|
||||||
if (input.id != prevDeviceId) {
|
if (input.id != prevDeviceId) {
|
@ -66,7 +66,7 @@ import org.citra.citra_emu.features.settings.ui.viewholder.SubmenuViewHolder
|
|||||||
import org.citra.citra_emu.features.settings.ui.viewholder.SwitchSettingViewHolder
|
import org.citra.citra_emu.features.settings.ui.viewholder.SwitchSettingViewHolder
|
||||||
import org.citra.citra_emu.fragments.MessageDialogFragment
|
import org.citra.citra_emu.fragments.MessageDialogFragment
|
||||||
import org.citra.citra_emu.fragments.MotionBottomSheetDialogFragment
|
import org.citra.citra_emu.fragments.MotionBottomSheetDialogFragment
|
||||||
import org.citra.citra_emu.utils.PermissionsHandler.preferences
|
import org.citra.citra_emu.utils.PermissionsHandler
|
||||||
import org.citra.citra_emu.utils.SystemSaveGame
|
import org.citra.citra_emu.utils.SystemSaveGame
|
||||||
import java.lang.IllegalStateException
|
import java.lang.IllegalStateException
|
||||||
import java.lang.NumberFormatException
|
import java.lang.NumberFormatException
|
||||||
@ -516,8 +516,7 @@ class SettingsAdapter(
|
|||||||
.show()
|
.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onClickAutoconfigureControls() {
|
fun onClickControllerQuickConfig() {
|
||||||
|
|
||||||
val buttons = arrayListOf(
|
val buttons = arrayListOf(
|
||||||
Settings.buttonKeys,
|
Settings.buttonKeys,
|
||||||
Settings.circlePadKeys,
|
Settings.circlePadKeys,
|
||||||
@ -536,10 +535,7 @@ class SettingsAdapter(
|
|||||||
Settings.triggerTitles
|
Settings.triggerTitles
|
||||||
)
|
)
|
||||||
|
|
||||||
Settings.buttonTitles
|
ControllerQuickConfigDialog(context, buttons, titles, PermissionsHandler.preferences).show()
|
||||||
ControllerAutomappingDialog(context, buttons, titles, preferences).show()
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun closeDialog() {
|
fun closeDialog() {
|
||||||
|
@ -646,15 +646,13 @@ class SettingsFragmentPresenter(private val fragmentView: SettingsFragmentView)
|
|||||||
private fun addControlsSettings(sl: ArrayList<SettingsItem>) {
|
private fun addControlsSettings(sl: ArrayList<SettingsItem>) {
|
||||||
settingsActivity.setToolbarTitle(settingsActivity.getString(R.string.preferences_controls))
|
settingsActivity.setToolbarTitle(settingsActivity.getString(R.string.preferences_controls))
|
||||||
sl.apply {
|
sl.apply {
|
||||||
add(HeaderSetting(R.string.auto_configure))
|
|
||||||
|
|
||||||
add(
|
add(
|
||||||
RunnableSetting(
|
RunnableSetting(
|
||||||
R.string.auto_configure,
|
R.string.controller_quick_config,
|
||||||
0,
|
0,
|
||||||
false,
|
false,
|
||||||
0,
|
0,
|
||||||
{ settingsAdapter.onClickAutoconfigureControls() }
|
{ settingsAdapter.onClickControllerQuickConfig() }
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -140,6 +140,9 @@
|
|||||||
<string name="button_zr" translatable="false">ZR</string>
|
<string name="button_zr" translatable="false">ZR</string>
|
||||||
<string name="input_message_analog_only">This control must be bound to a gamepad analog stick or D-pad axis!</string>
|
<string name="input_message_analog_only">This control must be bound to a gamepad analog stick or D-pad axis!</string>
|
||||||
<string name="input_message_button_only">This control must be bound to a gamepad button!</string>
|
<string name="input_message_button_only">This control must be bound to a gamepad button!</string>
|
||||||
|
<string name="controller_quick_config">Quick Configure</string>
|
||||||
|
<string name="controller_quick_config_finish">Finish</string>
|
||||||
|
<string name="controller_quick_config_unassigned">Unassigned</string>
|
||||||
|
|
||||||
<!-- System files strings -->
|
<!-- System files strings -->
|
||||||
<string name="system_files">System Files</string>
|
<string name="system_files">System Files</string>
|
||||||
@ -169,7 +172,6 @@
|
|||||||
<string name="home_menu_warning_description">Due to how slow Android\'s storage access framework is for accessing Azahar\'s files, downloading multiple versions of system files can dramatically slow down loading for applications, save states, and the Applications list. Only download the files that you require to avoid any issues with loading speeds.</string>
|
<string name="home_menu_warning_description">Due to how slow Android\'s storage access framework is for accessing Azahar\'s files, downloading multiple versions of system files can dramatically slow down loading for applications, save states, and the Applications list. Only download the files that you require to avoid any issues with loading speeds.</string>
|
||||||
|
|
||||||
<!-- Generic buttons (Shared with lots of stuff) -->
|
<!-- Generic buttons (Shared with lots of stuff) -->
|
||||||
<string name="auto_configure">Auto Configuration</string>
|
|
||||||
<string name="generic_buttons">Buttons</string>
|
<string name="generic_buttons">Buttons</string>
|
||||||
<string name="button">Button</string>
|
<string name="button">Button</string>
|
||||||
|
|
||||||
@ -766,8 +768,6 @@
|
|||||||
<string name="artic_base_enter_address">Enter Artic Base server address</string>
|
<string name="artic_base_enter_address">Enter Artic Base server address</string>
|
||||||
<string name="delay_render_thread">Delay game render thread</string>
|
<string name="delay_render_thread">Delay game render thread</string>
|
||||||
<string name="delay_render_thread_description">Delay the game render thread when it submits data to the GPU. Helps with performance issues in the (very few) applications with dynamic framerates.</string>
|
<string name="delay_render_thread_description">Delay the game render thread when it submits data to the GPU. Helps with performance issues in the (very few) applications with dynamic framerates.</string>
|
||||||
<string name="automapping_dialog_finish">Finish</string>
|
|
||||||
<string name="automapping_unassigned">Unassigned</string>
|
|
||||||
|
|
||||||
<!-- Quickload&Save-->
|
<!-- Quickload&Save-->
|
||||||
<string name="emulation_quicksave_slot">Quicksave</string>
|
<string name="emulation_quicksave_slot">Quicksave</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user