Commit 60879205 authored by Daniel Wolf's avatar Daniel Wolf
Browse files

Removed wrong references to MainActivity

parent d1a1eb68
Pipeline #5100 passed with stages
in 1 minute and 5 seconds
......@@ -162,8 +162,8 @@ fun IntArray.toStringArray(): Array<String> {
return stringArray as Array<String>
}
fun Activity.restart() {
val intent = intent
fun <T:Activity>Activity.restart(activityClass:Class<T>? = null) {
val intent = (if(activityClass != null) Intent(this, activityClass) else intent)
.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_NO_ANIMATION)
finish()
startActivity(intent)
......
......@@ -163,7 +163,6 @@ class SettingsFragment : PreferenceFragmentCompat() {
queryLogging.setOnPreferenceChangeListener { _, newValue ->
requireContext().getPreferences().queryLoggingEnabled = newValue as Boolean
(requireActivity() as MainActivity).reloadMenuItems()
true
}
exportQueries.summary =
......@@ -252,7 +251,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
if (newTheme != null) {
removePreferenceListener()
requireContext().getPreferences().theme = newTheme
requireActivity().restart()
requireActivity().restart(MainActivity::class.java)
true
} else {
false
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment