mirror of
https://github.com/AntennaPod/AntennaPod.git
synced 2025-02-02 11:46:55 +01:00
Move notification settings to their own screen (#4526)
added a new fragment named "notification manager" replaced all settings related into this fragment
This commit is contained in:
parent
971df75a25
commit
6098058a32
@ -19,6 +19,7 @@ import de.danoeh.antennapod.fragment.preferences.GpodderPreferencesFragment;
|
||||
import de.danoeh.antennapod.fragment.preferences.ImportExportPreferencesFragment;
|
||||
import de.danoeh.antennapod.fragment.preferences.MainPreferencesFragment;
|
||||
import de.danoeh.antennapod.fragment.preferences.NetworkPreferencesFragment;
|
||||
import de.danoeh.antennapod.fragment.preferences.NotificationPreferencesFragment;
|
||||
import de.danoeh.antennapod.fragment.preferences.PlaybackPreferencesFragment;
|
||||
import de.danoeh.antennapod.fragment.preferences.StoragePreferencesFragment;
|
||||
import de.danoeh.antennapod.fragment.preferences.UserInterfacePreferencesFragment;
|
||||
@ -70,6 +71,8 @@ public class PreferenceActivity extends AppCompatActivity implements SearchPrefe
|
||||
prefFragment = new GpodderPreferencesFragment();
|
||||
} else if (screen == R.xml.preferences_playback) {
|
||||
prefFragment = new PlaybackPreferencesFragment();
|
||||
} else if (screen == R.xml.preferences_notifications) {
|
||||
prefFragment = new NotificationPreferencesFragment();
|
||||
}
|
||||
return prefFragment;
|
||||
}
|
||||
@ -90,6 +93,8 @@ public class PreferenceActivity extends AppCompatActivity implements SearchPrefe
|
||||
return R.string.user_interface_label;
|
||||
case R.xml.preferences_gpodder:
|
||||
return R.string.gpodnet_main_label;
|
||||
case R.xml.preferences_notifications:
|
||||
return R.string.notification_pref_fragment;
|
||||
default:
|
||||
return R.string.settings_label;
|
||||
}
|
||||
|
@ -30,7 +30,6 @@ public class GpodderPreferencesFragment extends PreferenceFragmentCompat {
|
||||
private static final String PREF_GPODNET_FORCE_FULL_SYNC = "pref_gpodnet_force_full_sync";
|
||||
private static final String PREF_GPODNET_LOGOUT = "pref_gpodnet_logout";
|
||||
private static final String PREF_GPODNET_HOSTNAME = "pref_gpodnet_hostname";
|
||||
private static final String PREF_GPODNET_NOTIFICATIONS = "pref_gpodnet_notifications";
|
||||
|
||||
@Override
|
||||
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
||||
@ -112,7 +111,6 @@ public class GpodderPreferencesFragment extends PreferenceFragmentCompat {
|
||||
findPreference(PREF_GPODNET_SYNC).setEnabled(loggedIn);
|
||||
findPreference(PREF_GPODNET_FORCE_FULL_SYNC).setEnabled(loggedIn);
|
||||
findPreference(PREF_GPODNET_LOGOUT).setEnabled(loggedIn);
|
||||
findPreference(PREF_GPODNET_NOTIFICATIONS).setEnabled(loggedIn);
|
||||
if (loggedIn) {
|
||||
String format = getActivity().getString(R.string.pref_gpodnet_login_status);
|
||||
String summary = String.format(format, GpodnetPreferences.getUsername(),
|
||||
|
@ -26,6 +26,7 @@ public class MainPreferencesFragment extends PreferenceFragmentCompat {
|
||||
private static final String PREF_CATEGORY_PROJECT = "project";
|
||||
private static final String STATISTICS = "statistics";
|
||||
private static final String PREF_ABOUT = "prefAbout";
|
||||
private static final String PREF_NOTIFICATION = "notifications";
|
||||
|
||||
@Override
|
||||
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
||||
@ -68,6 +69,10 @@ public class MainPreferencesFragment extends PreferenceFragmentCompat {
|
||||
((PreferenceActivity) getActivity()).openScreen(R.xml.preferences_storage);
|
||||
return true;
|
||||
});
|
||||
findPreference(PREF_NOTIFICATION).setOnPreferenceClickListener(preference -> {
|
||||
((PreferenceActivity) getActivity()).openScreen(R.xml.preferences_notifications);
|
||||
return true;
|
||||
});
|
||||
|
||||
findPreference(PREF_ABOUT).setOnPreferenceClickListener(
|
||||
preference -> {
|
||||
@ -121,5 +126,7 @@ public class MainPreferencesFragment extends PreferenceFragmentCompat {
|
||||
.addBreadcrumb(PreferenceActivity.getTitleOfPage(R.xml.preferences_autodownload));
|
||||
config.index(R.xml.preferences_gpodder)
|
||||
.addBreadcrumb(PreferenceActivity.getTitleOfPage(R.xml.preferences_gpodder));
|
||||
config.index(R.xml.preferences_notifications)
|
||||
.addBreadcrumb(PreferenceActivity.getTitleOfPage(R.xml.preferences_notifications));
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,30 @@
|
||||
package de.danoeh.antennapod.fragment.preferences;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.preference.PreferenceFragmentCompat;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.activity.PreferenceActivity;
|
||||
import de.danoeh.antennapod.core.preferences.GpodnetPreferences;
|
||||
|
||||
public class NotificationPreferencesFragment extends PreferenceFragmentCompat {
|
||||
|
||||
private static final String TAG = "NotificationPrefFragment";
|
||||
private static final String PREF_GPODNET_NOTIFICATIONS = "pref_gpodnet_notifications";
|
||||
|
||||
@Override
|
||||
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
||||
addPreferencesFromResource(R.xml.preferences_notifications);
|
||||
setUpScreen();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
((PreferenceActivity) getActivity()).getSupportActionBar().setTitle(R.string.notification_pref_fragment);
|
||||
}
|
||||
|
||||
private void setUpScreen() {
|
||||
final boolean loggedIn = GpodnetPreferences.loggedIn();
|
||||
findPreference(PREF_GPODNET_NOTIFICATIONS).setEnabled(loggedIn);
|
||||
}
|
||||
}
|
@ -39,6 +39,11 @@
|
||||
android:summary="@string/storage_sum"
|
||||
android:icon="?attr/storage" />
|
||||
|
||||
<Preference
|
||||
android:key="notifications"
|
||||
android:title="@string/notification_pref_fragment"
|
||||
android:icon="?attr/ic_notifications"/>
|
||||
|
||||
<Preference
|
||||
android:key="statistics"
|
||||
android:title="@string/statistics_label"
|
||||
|
@ -26,10 +26,5 @@
|
||||
<Preference
|
||||
android:key="pref_gpodnet_hostname"
|
||||
android:title="@string/pref_gpodnet_sethostname_title"/>
|
||||
<SwitchPreferenceCompat
|
||||
android:key="pref_gpodnet_notifications"
|
||||
android:title="@string/pref_gpodnet_notifications_title"
|
||||
android:summary="@string/pref_gpodnet_notifications_sum"
|
||||
android:defaultValue="true"/>
|
||||
|
||||
</PreferenceScreen>
|
||||
|
@ -29,18 +29,6 @@
|
||||
numberpicker:maxValue="50"
|
||||
android:key="prefParallelDownloads"
|
||||
android:title="@string/pref_parallel_downloads_title"/>
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="true"
|
||||
android:enabled="true"
|
||||
android:key="prefShowDownloadReport"
|
||||
android:summary="@string/pref_showDownloadReport_sum"
|
||||
android:title="@string/pref_showDownloadReport_title"/>
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:enabled="true"
|
||||
android:key="prefShowAutoDownloadReport"
|
||||
android:summary="@string/pref_showAutoDownloadReport_sum"
|
||||
android:title="@string/pref_showAutoDownloadReport_title"/>
|
||||
<Preference
|
||||
android:key="prefProxy"
|
||||
android:summary="@string/pref_proxy_sum"
|
||||
|
22
app/src/main/res/xml/preferences_notifications.xml
Normal file
22
app/src/main/res/xml/preferences_notifications.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="true"
|
||||
android:enabled="true"
|
||||
android:key="prefShowDownloadReport"
|
||||
android:summary="@string/pref_showDownloadReport_sum"
|
||||
android:title="@string/pref_showDownloadReport_title" />
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:enabled="true"
|
||||
android:key="prefShowAutoDownloadReport"
|
||||
android:summary="@string/pref_showAutoDownloadReport_sum"
|
||||
android:title="@string/pref_showAutoDownloadReport_title" />
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="true"
|
||||
android:key="pref_gpodnet_notifications"
|
||||
android:summary="@string/pref_gpodnet_notifications_sum"
|
||||
android:title="@string/pref_gpodnet_notifications_title" />
|
||||
</PreferenceScreen>
|
9
core/src/main/res/drawable/ic_notifications_black.xml
Normal file
9
core/src/main/res/drawable/ic_notifications_black.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M12,22c1.1,0 2,-0.9 2,-2h-4c0,1.1 0.89,2 2,2zM18,16v-5c0,-3.07 -1.64,-5.64 -4.5,-6.32L13.5,4c0,-0.83 -0.67,-1.5 -1.5,-1.5s-1.5,0.67 -1.5,1.5v0.68C7.63,5.36 6,7.92 6,11v5l-2,2v1h16v-1l-2,-2z"/>
|
||||
</vector>
|
5
core/src/main/res/drawable/ic_notifications_white.xml
Normal file
5
core/src/main/res/drawable/ic_notifications_white.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FFFFFFFF" android:pathData="M12,22c1.1,0 2,-0.9 2,-2h-4c0,1.1 0.89,2 2,2zM18,16v-5c0,-3.07 -1.64,-5.64 -4.5,-6.32L13.5,4c0,-0.83 -0.67,-1.5 -1.5,-1.5s-1.5,0.67 -1.5,1.5v0.68C7.63,5.36 6,7.92 6,11v5l-2,2v1h16v-1l-2,-2z"/>
|
||||
</vector>
|
@ -60,6 +60,7 @@
|
||||
<attr name="background_elevated" format="color"/>
|
||||
<attr name="filter_dialog_clear" format="reference"/>
|
||||
<attr name="filter_dialog_button_background" format="reference"/>
|
||||
<attr name="ic_notifications" format="reference"/>
|
||||
|
||||
<declare-styleable name="SquareImageView">
|
||||
<attr name="direction" format="enum">
|
||||
|
@ -30,6 +30,7 @@
|
||||
<string name="episode_cache_full_message">The episode cache limit has been reached. You can increase the cache size in the Settings.</string>
|
||||
<string name="playback_statistics_label">Playback</string>
|
||||
<string name="download_statistics_label">Downloads</string>
|
||||
<string name="notification_pref_fragment">Notifications</string>
|
||||
|
||||
<!-- Statistics fragment -->
|
||||
<string name="total_time_listened_to_podcasts">Total time of podcasts played:</string>
|
||||
@ -443,7 +444,7 @@
|
||||
<string name="pref_gpodnet_full_sync_title">Force full synchronization</string>
|
||||
<string name="pref_gpodnet_full_sync_sum">Sync all subscriptions and episode states with gpodder.net.</string>
|
||||
<string name="pref_gpodnet_login_status"><![CDATA[Logged in as <i>%1$s</i> with device <i>%2$s</i>]]></string>
|
||||
<string name="pref_gpodnet_notifications_title">Show sync error notifications</string>
|
||||
<string name="pref_gpodnet_notifications_title">Synchronization failed</string>
|
||||
<string name="pref_gpodnet_notifications_sum">This setting does not apply to authentication errors.</string>
|
||||
<string name="pref_playback_speed_sum">Customize the speeds available for variable speed playback</string>
|
||||
<string name="pref_feed_playback_speed_sum">The speed to use when starting audio playback for episodes in this podcast</string>
|
||||
@ -471,9 +472,9 @@
|
||||
<string name="pref_compact_notification_buttons_dialog_error">You can only select a maximum of %1$d items.</string>
|
||||
<string name="pref_lockscreen_background_title">Set Lockscreen Background</string>
|
||||
<string name="pref_lockscreen_background_sum">Set the lockscreen background to the current episode\'s image. As a side effect, this will also show the image in third party apps.</string>
|
||||
<string name="pref_showDownloadReport_title">Show Download Report</string>
|
||||
<string name="pref_showDownloadReport_title">Download failed</string>
|
||||
<string name="pref_showDownloadReport_sum">If downloads fail, generate a report that shows the details of the failure.</string>
|
||||
<string name="pref_showAutoDownloadReport_title">Show Auto Download Report</string>
|
||||
<string name="pref_showAutoDownloadReport_title">Automatic download completed</string>
|
||||
<string name="pref_showAutoDownloadReport_sum">Show a notification for automatically downloaded episodes.</string>
|
||||
<string name="pref_expand_notify_unsupport_toast">Android versions before 4.1 do not support expanded notifications.</string>
|
||||
<string name="pref_enqueue_location_title">Enqueue Location</string>
|
||||
|
@ -75,6 +75,7 @@
|
||||
<item name="scrollbar_thumb">@drawable/scrollbar_thumb_light</item>
|
||||
<item name="filter_dialog_clear">@color/filter_dialog_clear_light</item>
|
||||
<item name="filter_dialog_button_background">@drawable/filter_dialog_background_light</item>
|
||||
<item name="ic_notifications">@drawable/ic_notifications_black</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.AntennaPod.Dark" parent="Theme.Base.AntennaPod.Dark">
|
||||
@ -152,6 +153,7 @@
|
||||
<item name="scrollbar_thumb">@drawable/scrollbar_thumb_dark</item>
|
||||
<item name="filter_dialog_clear">@color/filter_dialog_clear_dark</item>
|
||||
<item name="filter_dialog_button_background">@drawable/filter_dialog_background_dark</item>
|
||||
<item name="ic_notifications">@drawable/ic_notifications_white</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.AntennaPod.TrueBlack" parent="Theme.Base.AntennaPod.TrueBlack">
|
||||
|
Loading…
x
Reference in New Issue
Block a user