mirror of
https://github.com/AntennaPod/AntennaPod.git
synced 2025-10-29 03:36:21 +00:00
Move remaining subscription settings to subscription screen (#7981)
This commit is contained in:
parent
60f4c4cb20
commit
720aba1602
@ -6,28 +6,22 @@ import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.widget.Button;
|
||||
import android.widget.ListView;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.event.PlayerStatusEvent;
|
||||
import de.danoeh.antennapod.event.UnreadItemsUpdateEvent;
|
||||
import de.danoeh.antennapod.storage.preferences.UsageStatistics;
|
||||
import de.danoeh.antennapod.storage.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.ui.preferences.screen.AnimatedPreferenceFragment;
|
||||
import de.danoeh.antennapod.ui.screen.subscriptions.FeedSortDialog;
|
||||
import de.danoeh.antennapod.ui.screen.drawer.DrawerPreferencesDialog;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.ui.screen.drawer.DrawerPreferencesDialog;
|
||||
import de.danoeh.antennapod.ui.screen.subscriptions.SubscriptionsFilterDialog;
|
||||
import de.danoeh.antennapod.event.PlayerStatusEvent;
|
||||
import de.danoeh.antennapod.event.UnreadItemsUpdateEvent;
|
||||
import de.danoeh.antennapod.storage.preferences.UserPreferences;
|
||||
|
||||
public class UserInterfacePreferencesFragment extends AnimatedPreferenceFragment {
|
||||
private static final String PREF_SWIPE = "prefSwipe";
|
||||
|
||||
@ -76,17 +70,6 @@ public class UserInterfacePreferencesFragment extends AnimatedPreferenceFragment
|
||||
showFullNotificationButtonsDialog();
|
||||
return true;
|
||||
});
|
||||
findPreference(UserPreferences.PREF_FILTER_FEED)
|
||||
.setOnPreferenceClickListener((preference -> {
|
||||
new SubscriptionsFilterDialog().show(getChildFragmentManager(), "filter");
|
||||
return true;
|
||||
}));
|
||||
|
||||
findPreference(UserPreferences.PREF_DRAWER_FEED_ORDER)
|
||||
.setOnPreferenceClickListener((preference -> {
|
||||
FeedSortDialog.showDialog(requireContext());
|
||||
return true;
|
||||
}));
|
||||
findPreference(PREF_SWIPE)
|
||||
.setOnPreferenceClickListener(preference -> {
|
||||
((PreferenceActivity) getActivity()).openScreen(R.xml.preferences_swipe);
|
||||
|
||||
@ -0,0 +1,37 @@
|
||||
package de.danoeh.antennapod.ui.screen.subscriptions;
|
||||
|
||||
import android.content.Context;
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.event.UnreadItemsUpdateEvent;
|
||||
import de.danoeh.antennapod.model.feed.FeedCounter;
|
||||
import de.danoeh.antennapod.storage.preferences.UserPreferences;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class FeedCounterDialog {
|
||||
public static void showDialog(Context context) {
|
||||
MaterialAlertDialogBuilder dialog = new MaterialAlertDialogBuilder(context);
|
||||
dialog.setTitle(context.getString(R.string.pref_nav_drawer_feed_counter_title));
|
||||
dialog.setNegativeButton(android.R.string.cancel, (d, listener) -> d.dismiss());
|
||||
|
||||
int selected = UserPreferences.getFeedCounterSetting().id;
|
||||
List<String> entryValues =
|
||||
Arrays.asList(context.getResources().getStringArray(R.array.nav_drawer_feed_counter_values));
|
||||
final int selectedIndex = entryValues.indexOf("" + selected);
|
||||
|
||||
String[] items = context.getResources().getStringArray(R.array.nav_drawer_feed_counter_options);
|
||||
dialog.setSingleChoiceItems(items, selectedIndex, (d, which) -> {
|
||||
if (selectedIndex != which) {
|
||||
UserPreferences.setFeedCounterSetting(
|
||||
FeedCounter.fromOrdinal(Integer.parseInt(entryValues.get(which))));
|
||||
//Update subscriptions
|
||||
EventBus.getDefault().post(new UnreadItemsUpdateEvent());
|
||||
}
|
||||
d.dismiss();
|
||||
});
|
||||
dialog.show();
|
||||
}
|
||||
}
|
||||
@ -17,7 +17,7 @@ import de.danoeh.antennapod.storage.preferences.UserPreferences;
|
||||
public class FeedSortDialog {
|
||||
public static void showDialog(Context context) {
|
||||
MaterialAlertDialogBuilder dialog = new MaterialAlertDialogBuilder(context);
|
||||
dialog.setTitle(context.getString(R.string.pref_nav_drawer_feed_order_title));
|
||||
dialog.setTitle(context.getString(R.string.sort));
|
||||
dialog.setNegativeButton(android.R.string.cancel, (d, listener) -> d.dismiss());
|
||||
|
||||
int selected = UserPreferences.getFeedOrder().id;
|
||||
|
||||
@ -233,6 +233,9 @@ public class SubscriptionFragment extends Fragment
|
||||
} else if (itemId == R.id.subscriptions_sort) {
|
||||
FeedSortDialog.showDialog(requireContext());
|
||||
return true;
|
||||
} else if (itemId == R.id.subscriptions_counter) {
|
||||
FeedCounterDialog.showDialog(requireContext());
|
||||
return true;
|
||||
} else if (itemId == R.id.subscription_display_list) {
|
||||
setColumnNumber(1);
|
||||
return true;
|
||||
|
||||
@ -24,6 +24,10 @@
|
||||
android:id="@+id/subscriptions_sort"
|
||||
android:title="@string/sort"
|
||||
custom:showAsAction="never" />
|
||||
<item
|
||||
android:id="@+id/subscriptions_counter"
|
||||
android:title="@string/pref_nav_drawer_feed_counter_title"
|
||||
custom:showAsAction="never" />
|
||||
<item
|
||||
android:id="@+id/subscription_num_columns"
|
||||
android:title="@string/subscription_num_columns"
|
||||
|
||||
@ -278,6 +278,10 @@ public abstract class UserPreferences {
|
||||
return FeedCounter.fromOrdinal(Integer.parseInt(value));
|
||||
}
|
||||
|
||||
public static void setFeedCounterSetting(FeedCounter counter) {
|
||||
prefs.edit().putString(PREF_DRAWER_FEED_COUNTER, "" + counter.id).apply();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} if episodes should use their own cover, {@code false} otherwise
|
||||
*/
|
||||
|
||||
@ -489,10 +489,7 @@
|
||||
<string name="bottom_navigation_summary">Access the most important screens from everywhere, in a single tap</string>
|
||||
<string name="pref_nav_drawer_items_title">Customize navigation</string>
|
||||
<string name="pref_nav_drawer_items_sum">Change which items appear in the navigation drawer or bottom navigation</string>
|
||||
<string name="pref_nav_drawer_feed_order_title">Set subscription order</string>
|
||||
<string name="pref_nav_drawer_feed_order_sum">Change the order of your subscriptions</string>
|
||||
<string name="pref_nav_drawer_feed_counter_title">Set subscription counter</string>
|
||||
<string name="pref_nav_drawer_feed_counter_sum">Change the information displayed by the subscription counter. Also affects the sorting of subscriptions if \'Subscription Order\' is set to \'Counter\'.</string>
|
||||
<string name="pref_nav_drawer_feed_counter_title">Counter</string>
|
||||
<string name="pref_automatic_download_title">Automatic download</string>
|
||||
<string name="pref_automatic_download_global_description">Automatically download episodes from the inbox. Can be overridden per podcast.</string>
|
||||
<string name="pref_automatic_download_queue_title">Download queued</string>
|
||||
@ -561,8 +558,6 @@
|
||||
<string name="pref_delete_removes_from_queue_sum">Automatically remove an episode from the queue when it is deleted</string>
|
||||
<string name="pref_downloads_button_action_title">Play from downloads screen</string>
|
||||
<string name="pref_downloads_button_action_sum">Display play button instead of delete button on downloads screen</string>
|
||||
<string name="pref_filter_feed_title">Subscription filter</string>
|
||||
<string name="pref_filter_feed_sum">Filter your subscriptions in navigation drawer and subscriptions screen</string>
|
||||
<string name="subscriptions_counter_greater_zero">Counter greater than zero</string>
|
||||
<string name="auto_downloaded">Auto downloaded</string>
|
||||
<string name="not_auto_downloaded">Not auto downloaded</string>
|
||||
|
||||
@ -17,23 +17,6 @@
|
||||
android:summary="@string/pref_tinted_theme_message"
|
||||
android:defaultValue="false" />
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:title="@string/subscriptions_label">
|
||||
<Preference
|
||||
android:title="@string/pref_nav_drawer_feed_order_title"
|
||||
android:key="prefDrawerFeedOrder"
|
||||
android:summary="@string/pref_nav_drawer_feed_order_sum"/>
|
||||
<de.danoeh.antennapod.ui.preferences.preference.MaterialListPreference
|
||||
android:entryValues="@array/nav_drawer_feed_counter_values"
|
||||
android:entries="@array/nav_drawer_feed_counter_options"
|
||||
android:title="@string/pref_nav_drawer_feed_counter_title"
|
||||
android:key="prefDrawerFeedIndicator"
|
||||
android:summary="@string/pref_nav_drawer_feed_counter_sum"
|
||||
android:defaultValue="1"/>
|
||||
<Preference
|
||||
android:title="@string/pref_filter_feed_title"
|
||||
android:key="prefSubscriptionsFilter"
|
||||
android:summary="@string/pref_filter_feed_sum" />
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:title="@string/episode_information">
|
||||
<SwitchPreferenceCompat
|
||||
android:title="@string/pref_episode_cover_title"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user