diff --git a/app/src/main/kotlin/com/github/gotify/settings/SettingsActivity.kt b/app/src/main/kotlin/com/github/gotify/settings/SettingsActivity.kt
index e60877b..eebe0d9 100644
--- a/app/src/main/kotlin/com/github/gotify/settings/SettingsActivity.kt
+++ b/app/src/main/kotlin/com/github/gotify/settings/SettingsActivity.kt
@@ -78,33 +78,15 @@ internal class SettingsActivity : AppCompatActivity(), OnSharedPreferenceChangeL
findPreference(getString(R.string.setting_key_notification_channels))
messageLayout?.onPreferenceChangeListener =
Preference.OnPreferenceChangeListener { _, _ ->
- MaterialAlertDialogBuilder(requireContext())
- .setTitle(R.string.setting_message_layout_dialog_title)
- .setMessage(R.string.setting_message_layout_dialog_message)
- .setPositiveButton(
- getString(R.string.setting_message_layout_dialog_button1)
- ) { _, _ ->
- restartApp()
- }
- .setNegativeButton(
- getString(R.string.setting_message_layout_dialog_button2),
- null
- )
- .show()
+ showRestartDialog()
true
}
notificationChannels?.onPreferenceChangeListener =
Preference.OnPreferenceChangeListener { _, _ ->
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
- return@OnPreferenceChangeListener true
+ return@OnPreferenceChangeListener false
}
-
- MaterialAlertDialogBuilder(requireContext())
- .setTitle(R.string.setting_notification_channels_dialog_title)
- .setMessage(R.string.setting_notification_channels_dialog_message)
- .setPositiveButton(android.R.string.ok, null)
- .show()
-
+ showRestartDialog()
true
}
}
@@ -127,6 +109,17 @@ internal class SettingsActivity : AppCompatActivity(), OnSharedPreferenceChangeL
)
}
+ private fun showRestartDialog() {
+ MaterialAlertDialogBuilder(requireContext())
+ .setTitle(R.string.setting_restart_dialog_title)
+ .setMessage(R.string.setting_restart_dialog_message)
+ .setPositiveButton(getString(R.string.setting_restart_dialog_button1)) { _, _ ->
+ restartApp()
+ }
+ .setNegativeButton(getString(R.string.setting_restart_dialog_button2), null)
+ .show()
+ }
+
private fun restartApp() {
val packageManager = requireContext().packageManager
val packageName = requireContext().packageName
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index d8fc202..d539e49 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -74,17 +74,15 @@
theme
Message layout
message_layout
- Restart App?
- The change will be effective on next app start.\n\nDo you want to restart now?
- Restart
- Later
+ Restart App?
+ The change will be effective on next app start.\n\nDo you want to restart now?
+ Restart
+ Later
Time format
time_format
Notifications
Separate app notification channels
notification_channels
- Manual refresh required
- For the change to take effect you must manually refresh the apps using the refresh button in the main menu.
Push message
App:
Priority: