Fix compile errors
This commit is contained in:
parent
39e9622205
commit
85d9bd9106
@ -59,8 +59,4 @@ abstract class BasePreferenceFragment : PreferenceFragmentCompat(),
|
|||||||
else
|
else
|
||||||
view.setPadding(0, view.paddingTop, view.paddingRight, view.paddingBottom)
|
view.setPadding(0, view.paddingTop, view.paddingRight, view.paddingBottom)
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun <T: Preference> findPref(key: CharSequence): T {
|
|
||||||
return findPreference(key) as T
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -57,46 +57,46 @@ class SettingsFragment : BasePreferenceFragment() {
|
|||||||
preferenceManager.setStorageDeviceProtected()
|
preferenceManager.setStorageDeviceProtected()
|
||||||
setPreferencesFromResource(R.xml.app_settings, rootKey)
|
setPreferencesFromResource(R.xml.app_settings, rootKey)
|
||||||
|
|
||||||
updateChannel = findPref(Config.Key.UPDATE_CHANNEL)
|
updateChannel = findPreference(Config.Key.UPDATE_CHANNEL)!!
|
||||||
rootConfig = findPref(Config.Key.ROOT_ACCESS)
|
rootConfig = findPreference(Config.Key.ROOT_ACCESS)!!
|
||||||
autoRes = findPref(Config.Key.SU_AUTO_RESPONSE)
|
autoRes = findPreference(Config.Key.SU_AUTO_RESPONSE)!!
|
||||||
requestTimeout = findPref(Config.Key.SU_REQUEST_TIMEOUT)
|
requestTimeout = findPreference(Config.Key.SU_REQUEST_TIMEOUT)!!
|
||||||
suNotification = findPref(Config.Key.SU_NOTIFICATION)
|
suNotification = findPreference(Config.Key.SU_NOTIFICATION)!!
|
||||||
multiuserConfig = findPref(Config.Key.SU_MULTIUSER_MODE)
|
multiuserConfig = findPreference(Config.Key.SU_MULTIUSER_MODE)!!
|
||||||
nsConfig = findPref(Config.Key.SU_MNT_NS)
|
nsConfig = findPreference(Config.Key.SU_MNT_NS)!!
|
||||||
val reauth = findPreference(Config.Key.SU_REAUTH) as SwitchPreferenceCompat
|
val reauth = findPreference<SwitchPreferenceCompat>(Config.Key.SU_REAUTH)!!
|
||||||
val fingerprint = findPreference(Config.Key.SU_FINGERPRINT) as SwitchPreferenceCompat
|
val fingerprint = findPreference<SwitchPreferenceCompat>(Config.Key.SU_FINGERPRINT)!!
|
||||||
val generalCatagory = findPreference("general") as PreferenceCategory
|
val generalCatagory = findPreference<PreferenceCategory>("general")!!
|
||||||
val magiskCategory = findPreference("magisk") as PreferenceCategory
|
val magiskCategory = findPreference<PreferenceCategory>("magisk")!!
|
||||||
val suCategory = findPreference("superuser") as PreferenceCategory
|
val suCategory = findPreference<PreferenceCategory>("superuser")!!
|
||||||
val hideManager = findPreference("hide")
|
val hideManager = findPreference<Preference>("hide")!!
|
||||||
hideManager.setOnPreferenceClickListener {
|
hideManager.setOnPreferenceClickListener {
|
||||||
PatchAPK.hideManager(requireContext())
|
PatchAPK.hideManager(requireContext())
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
val restoreManager = findPreference("restore")
|
val restoreManager = findPreference<Preference>("restore")
|
||||||
restoreManager.setOnPreferenceClickListener {
|
restoreManager?.setOnPreferenceClickListener {
|
||||||
DownloadService(requireContext()) {
|
DownloadService(requireContext()) {
|
||||||
subject = DownloadSubject.Manager(Configuration.APK.Restore)
|
subject = DownloadSubject.Manager(Configuration.APK.Restore)
|
||||||
}
|
}
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
findPreference("clear").setOnPreferenceClickListener {
|
findPreference<Preference>("clear")?.setOnPreferenceClickListener {
|
||||||
Completable.fromAction { repoDB.clear() }.subscribeK {
|
Completable.fromAction { repoDB.clear() }.subscribeK {
|
||||||
Utils.toast(R.string.repo_cache_cleared, Toast.LENGTH_SHORT)
|
Utils.toast(R.string.repo_cache_cleared, Toast.LENGTH_SHORT)
|
||||||
}
|
}
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
findPreference("hosts").setOnPreferenceClickListener {
|
findPreference<Preference>("hosts")?.setOnPreferenceClickListener {
|
||||||
Shell.su("add_hosts_module").submit {
|
Shell.su("add_hosts_module").submit {
|
||||||
Utils.toast(R.string.settings_hosts_toast, Toast.LENGTH_SHORT)
|
Utils.toast(R.string.settings_hosts_toast, Toast.LENGTH_SHORT)
|
||||||
}
|
}
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
findPreference(Config.Key.DOWNLOAD_PATH).apply {
|
findPreference<Preference>(Config.Key.DOWNLOAD_PATH)?.apply {
|
||||||
summary = Config.downloadPath
|
summary = Config.downloadPath
|
||||||
}.setOnPreferenceClickListener { preference ->
|
}?.setOnPreferenceClickListener { preference ->
|
||||||
activity.withExternalRW {
|
activity.withExternalRW {
|
||||||
onSuccess {
|
onSuccess {
|
||||||
showDownloadDialog {
|
showDownloadDialog {
|
||||||
@ -122,7 +122,7 @@ class SettingsFragment : BasePreferenceFragment() {
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
setLocalePreference(findPreference(Config.Key.LOCALE) as ListPreference)
|
setLocalePreference(findPreference(Config.Key.LOCALE)!!)
|
||||||
|
|
||||||
/* We only show canary channels if user is already on canary channel
|
/* We only show canary channels if user is already on canary channel
|
||||||
* or the user have already chosen canary channel */
|
* or the user have already chosen canary channel */
|
||||||
|
Loading…
Reference in New Issue
Block a user