mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-25 21:54:17 +01:00
Remove OSC EditMode
enum
An enum isn't needed anymore, as there's no state to enumerate anymore.
This commit is contained in:
parent
2556b25ebf
commit
e91993698f
@ -68,7 +68,6 @@ class OnScreenControllerView @JvmOverloads constructor(context : Context, attrs
|
||||
}
|
||||
|
||||
internal val editInfo = OnScreenEditInfo()
|
||||
val isEditing get() = editInfo.isEditing
|
||||
val editButton get() = editInfo.editButton
|
||||
fun setOnEditButtonChangedListener(listener : OnEditButtonChangedListener?) {
|
||||
editInfo.onEditButtonChangedListener = listener
|
||||
@ -283,9 +282,12 @@ class OnScreenControllerView @JvmOverloads constructor(context : Context, attrs
|
||||
setOnTouchListener(playingTouchHandler)
|
||||
}
|
||||
|
||||
fun setEditMode(editMode : EditMode) {
|
||||
editInfo.editMode = editMode
|
||||
setOnTouchListener(if (isEditing) editingTouchHandler else playingTouchHandler)
|
||||
fun setEditMode(isEdit : Boolean) {
|
||||
// Select all buttons when entering edit if we weren't already editing
|
||||
if (!editInfo.isEditing)
|
||||
selectAllButtons()
|
||||
editInfo.isEditing = isEdit
|
||||
setOnTouchListener(if (isEdit) editingTouchHandler else playingTouchHandler)
|
||||
}
|
||||
|
||||
fun selectAllButtons() {
|
||||
|
@ -133,8 +133,7 @@ class OnScreenEditActivity : AppCompatActivity() {
|
||||
|
||||
binding.dragHandle.setOnTouchListener(dragPanelListener)
|
||||
|
||||
binding.onScreenControllerView.setEditMode(EditMode.Move)
|
||||
binding.onScreenControllerView.selectAllButtons()
|
||||
binding.onScreenControllerView.setEditMode(true)
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
|
@ -8,11 +8,6 @@ package emu.skyline.input.onscreen
|
||||
import android.content.res.Resources
|
||||
import android.util.TypedValue
|
||||
|
||||
enum class EditMode {
|
||||
None,
|
||||
Move
|
||||
}
|
||||
|
||||
typealias OnEditButtonChangedListener = ((ConfigurableButton) -> Unit)
|
||||
|
||||
/**
|
||||
@ -21,9 +16,9 @@ typealias OnEditButtonChangedListener = ((ConfigurableButton) -> Unit)
|
||||
*/
|
||||
class OnScreenEditInfo {
|
||||
/**
|
||||
* The current edit mode
|
||||
* Whether the buttons are currently in edit mode
|
||||
*/
|
||||
var editMode : EditMode = EditMode.None
|
||||
var isEditing : Boolean = false
|
||||
|
||||
/**
|
||||
* The button that is currently being edited
|
||||
@ -47,8 +42,6 @@ class OnScreenEditInfo {
|
||||
|
||||
var arrowKeyMoveAmount : Int = ArrowKeyMoveAmount
|
||||
|
||||
val isEditing get() = editMode != EditMode.None
|
||||
|
||||
companion object {
|
||||
/**
|
||||
* The size of the grid, calculated from the value of 8dp
|
||||
|
Loading…
Reference in New Issue
Block a user