mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-28 07:05:29 +03:00
Main activity is now refreshing when the group checkbox is changed
This commit is contained in:
parent
b67bfe3848
commit
7cd13916a3
23
app/src/main/java/emu/skyline/preference/ChkBoxPreference.kt
Normal file
23
app/src/main/java/emu/skyline/preference/ChkBoxPreference.kt
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: MPL-2.0
|
||||
* Copyright © 2020 Skyline Team and Contributors (https://github.com/skyline-emu/)
|
||||
*/
|
||||
|
||||
package emu.skyline.preference
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import androidx.preference.CheckBoxPreference
|
||||
import androidx.preference.R
|
||||
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) {
|
||||
|
||||
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" />
|
||||
<CheckBoxPreference
|
||||
<emu.skyline.preference.ChkBoxPreference
|
||||
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