Add Notifications to settings
This commit is contained in:
parent
20da756257
commit
96bf4c92d2
|
@ -2,6 +2,7 @@ package org.pixeldroid.app.settings
|
|||
|
||||
import android.content.Intent
|
||||
import android.content.SharedPreferences
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import androidx.preference.PreferenceFragmentCompat
|
||||
import androidx.preference.PreferenceManager
|
||||
|
@ -79,6 +80,11 @@ class SettingsActivity : BaseActivity(), SharedPreferences.OnSharedPreferenceCha
|
|||
class SettingsFragment : PreferenceFragmentCompat() {
|
||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||
setPreferencesFromResource(R.xml.root_preferences, rootKey)
|
||||
|
||||
//Hide Notification setting for Android versions where it doesn't work
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
||||
preferenceScreen.removePreference(preferenceManager.findPreference("notification"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -235,4 +235,7 @@ For more info about Pixelfed, you can check here: https://pixelfed.org"</string>
|
|||
|
||||
<!-- Error message when a selected file can not be found -->
|
||||
<string name="file_not_found">File %1$s was not found</string>
|
||||
<string name="notifications_settings">Notification settings</string>
|
||||
<string name="notifications_settings_summary">Manage what notifications you want to receive</string>
|
||||
<string name="login_notifications">Couldn\'t fetch latest notifications</string>
|
||||
</resources>
|
|
@ -21,6 +21,16 @@
|
|||
app:useSimpleSummaryProvider="true"
|
||||
app:icon="@drawable/translate_black_24dp" />
|
||||
|
||||
<Preference android:title="@string/notifications_settings"
|
||||
android:key="notification"
|
||||
android:summary="@string/notifications_settings_summary"
|
||||
app:icon="@drawable/ic_baseline_notifications_active_24">
|
||||
<intent android:action="android.settings.APP_NOTIFICATION_SETTINGS">
|
||||
<extra android:name="android.provider.extra.APP_PACKAGE"
|
||||
android:value="@string/application_id" />
|
||||
</intent>
|
||||
</Preference>
|
||||
|
||||
<Preference android:title="@string/about"
|
||||
android:key="about"
|
||||
android:summary="@string/about_pixeldroid"
|
||||
|
|
Loading…
Reference in New Issue