mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-27 14:55:30 +03:00
pull request requested changes
This commit is contained in:
parent
7cd13916a3
commit
75f6f5e31c
@ -64,6 +64,11 @@ class MainActivity : AppCompatActivity() {
|
||||
private var formatFilter : RomFormat? = null
|
||||
private var appEntries : Map<RomFormat, List<AppEntry>>? = null
|
||||
|
||||
enum class SortingOrder {
|
||||
AlphabeticalAsc,
|
||||
AlphabeticalDesc
|
||||
}
|
||||
|
||||
private var refreshIconVisible = false
|
||||
set(visible) {
|
||||
field = visible
|
||||
@ -245,14 +250,14 @@ class MainActivity : AppCompatActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun sortGameList(gameList : List<AppEntry>) : MutableList<AppEntry> {
|
||||
private fun sortGameList(gameList : List<AppEntry>) : List<AppEntry> {
|
||||
val sortedApps : MutableList<AppEntry> = mutableListOf<AppEntry>()
|
||||
gameList.forEach { entry -> sortedApps.add(entry) }
|
||||
when (preferenceSettings.sortAppsBy) {
|
||||
1 -> sortedApps.sortByDescending { it.name }
|
||||
else -> sortedApps.sortBy { it.name }
|
||||
SortingOrder.AlphabeticalAsc.ordinal -> sortedApps.sortBy { it.name }
|
||||
SortingOrder.AlphabeticalDesc.ordinal -> sortedApps.sortByDescending { it.name }
|
||||
}
|
||||
return sortedApps
|
||||
return sortedApps.toList()
|
||||
}
|
||||
|
||||
private fun handleState(state : MainState) = when (state) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: MPL-2.0
|
||||
* Copyright © 2020 Skyline Team and Contributors (https://github.com/skyline-emu/)
|
||||
* Copyright © 2023 Skyline Team and Contributors (https://github.com/skyline-emu/)
|
||||
*/
|
||||
|
||||
package emu.skyline.preference
|
||||
@ -14,8 +14,7 @@ import emu.skyline.di.getSettings
|
||||
/**
|
||||
* This preference is used with checkboxes that need to refresh the main activity when changed
|
||||
*/
|
||||
class ChkBoxPreference @JvmOverloads constructor(context : Context, attrs : AttributeSet? = null, defStyleAttr : Int = R.attr.checkBoxPreferenceStyle) : CheckBoxPreference(context, attrs, defStyleAttr) {
|
||||
|
||||
class RefreshCheckBoxPreference @JvmOverloads constructor(context : Context, attrs : AttributeSet? = null, defStyleAttr : Int = R.attr.checkBoxPreferenceStyle) : CheckBoxPreference(context, attrs, defStyleAttr) {
|
||||
override fun onClick() {
|
||||
context?.getSettings()?.refreshRequired = true
|
||||
super.onClick()
|
@ -22,7 +22,7 @@
|
||||
app:key="layout_type"
|
||||
app:title="@string/layout_type"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
<emu.skyline.preference.ChkBoxPreference
|
||||
<emu.skyline.preference.RefreshCheckBoxPreference
|
||||
android:defaultValue="true"
|
||||
android:summaryOff="@string/group_by_format_desc_off"
|
||||
android:summaryOn="@string/group_by_format_desc_on"
|
||||
|
Loading…
Reference in New Issue
Block a user