Move preferences to a new module

This commit is contained in:
ByteHamster 2022-11-06 14:32:47 +01:00
parent 0101f1244e
commit d8a2dd5f83
99 changed files with 229 additions and 196 deletions

View File

@ -90,6 +90,7 @@ dependencies {
implementation project(':playback:base') implementation project(':playback:base')
implementation project(':playback:cast') implementation project(':playback:cast')
implementation project(':storage:database') implementation project(':storage:database')
implementation project(':storage:preferences')
implementation project(':ui:app-start-intent') implementation project(':ui:app-start-intent')
implementation project(':ui:common') implementation project(':ui:common')
implementation project(':ui:glide') implementation project(':ui:glide')

View File

@ -23,7 +23,7 @@ import junit.framework.AssertionFailedError;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.MainActivity; import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.core.service.download.DownloadService; import de.danoeh.antennapod.core.service.download.DownloadService;
import de.danoeh.antennapod.core.service.playback.PlaybackService; import de.danoeh.antennapod.core.service.playback.PlaybackService;
import de.danoeh.antennapod.dialog.RatingDialog; import de.danoeh.antennapod.dialog.RatingDialog;

View File

@ -33,7 +33,7 @@ import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.model.feed.FeedItem;
import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.model.feed.FeedMedia;
import de.danoeh.antennapod.core.preferences.PlaybackPreferences; import de.danoeh.antennapod.core.preferences.PlaybackPreferences;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.core.storage.DBReader; import de.danoeh.antennapod.core.storage.DBReader;
import de.danoeh.antennapod.core.storage.DBWriter; import de.danoeh.antennapod.core.storage.DBWriter;
import de.danoeh.antennapod.core.util.LongList; import de.danoeh.antennapod.core.util.LongList;

View File

@ -26,7 +26,7 @@ import java.util.concurrent.TimeUnit;
import de.danoeh.antennapod.model.feed.Feed; import de.danoeh.antennapod.model.feed.Feed;
import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.model.feed.FeedItem;
import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.model.feed.FeedMedia;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.net.download.serviceinterface.DownloadRequest; import de.danoeh.antennapod.net.download.serviceinterface.DownloadRequest;
import de.danoeh.antennapod.core.service.download.DownloadService; import de.danoeh.antennapod.core.service.download.DownloadService;
import de.danoeh.antennapod.model.download.DownloadStatus; import de.danoeh.antennapod.model.download.DownloadStatus;

View File

@ -8,7 +8,7 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import de.danoeh.antennapod.model.feed.FeedFile; import de.danoeh.antennapod.model.feed.FeedFile;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.net.download.serviceinterface.DownloadRequest; import de.danoeh.antennapod.net.download.serviceinterface.DownloadRequest;
import de.danoeh.antennapod.model.download.DownloadStatus; import de.danoeh.antennapod.model.download.DownloadStatus;
import de.danoeh.antennapod.core.service.download.Downloader; import de.danoeh.antennapod.core.service.download.Downloader;

View File

@ -6,7 +6,7 @@ import androidx.test.core.app.ApplicationProvider;
import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.model.feed.FeedItem;
import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.model.feed.FeedMedia;
import de.danoeh.antennapod.core.preferences.PlaybackPreferences; import de.danoeh.antennapod.core.preferences.PlaybackPreferences;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.core.storage.AutomaticDownloadAlgorithm; import de.danoeh.antennapod.core.storage.AutomaticDownloadAlgorithm;
import de.danoeh.antennapod.core.storage.DBReader; import de.danoeh.antennapod.core.storage.DBReader;
import de.danoeh.antennapod.core.storage.DBTasks; import de.danoeh.antennapod.core.storage.DBTasks;

View File

@ -10,7 +10,7 @@ import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.activity.PreferenceActivity; import de.danoeh.antennapod.activity.PreferenceActivity;
import de.danoeh.antennapod.fragment.CompletedDownloadsFragment; import de.danoeh.antennapod.fragment.CompletedDownloadsFragment;
import de.danoeh.antennapod.model.feed.Feed; import de.danoeh.antennapod.model.feed.Feed;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.fragment.AllEpisodesFragment; import de.danoeh.antennapod.fragment.AllEpisodesFragment;
import de.danoeh.antennapod.fragment.NavDrawerFragment; import de.danoeh.antennapod.fragment.NavDrawerFragment;
import de.danoeh.antennapod.fragment.PlaybackHistoryFragment; import de.danoeh.antennapod.fragment.PlaybackHistoryFragment;

View File

@ -21,8 +21,8 @@ import java.util.concurrent.TimeUnit;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.PreferenceActivity; import de.danoeh.antennapod.activity.PreferenceActivity;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.core.preferences.UserPreferences.EnqueueLocation; import de.danoeh.antennapod.storage.preferences.UserPreferences.EnqueueLocation;
import de.danoeh.antennapod.core.storage.APCleanupAlgorithm; import de.danoeh.antennapod.core.storage.APCleanupAlgorithm;
import de.danoeh.antennapod.core.storage.APNullCleanupAlgorithm; import de.danoeh.antennapod.core.storage.APNullCleanupAlgorithm;
import de.danoeh.antennapod.core.storage.APQueueCleanupAlgorithm; import de.danoeh.antennapod.core.storage.APQueueCleanupAlgorithm;
@ -79,32 +79,16 @@ public class PreferencesTest {
@Test @Test
public void testSwitchTheme() { public void testSwitchTheme() {
final int theme = UserPreferences.getTheme(); final UserPreferences.ThemePreference theme = UserPreferences.getTheme();
int otherTheme; int otherThemeText;
if (theme == de.danoeh.antennapod.core.R.style.Theme_AntennaPod_Light) { if (theme == UserPreferences.ThemePreference.DARK) {
otherTheme = R.string.pref_theme_title_dark; otherThemeText = R.string.pref_theme_title_light;
} else { } else {
otherTheme = R.string.pref_theme_title_light; otherThemeText = R.string.pref_theme_title_dark;
} }
clickPreference(R.string.user_interface_label); clickPreference(R.string.user_interface_label);
clickPreference(R.string.pref_set_theme_title); clickPreference(R.string.pref_set_theme_title);
onView(withText(otherTheme)).perform(click()); onView(withText(otherThemeText)).perform(click());
Awaitility.await().atMost(1000, MILLISECONDS)
.until(() -> UserPreferences.getTheme() != theme);
}
@Test
public void testSwitchThemeBack() {
final int theme = UserPreferences.getTheme();
int otherTheme;
if (theme == de.danoeh.antennapod.core.R.style.Theme_AntennaPod_Light) {
otherTheme = R.string.pref_theme_title_dark;
} else {
otherTheme = R.string.pref_theme_title_light;
}
clickPreference(R.string.user_interface_label);
clickPreference(R.string.pref_set_theme_title);
onView(withText(otherTheme)).perform(click());
Awaitility.await().atMost(1000, MILLISECONDS) Awaitility.await().atMost(1000, MILLISECONDS)
.until(() -> UserPreferences.getTheme() != theme); .until(() -> UserPreferences.getTheme() != theme);
} }

View File

@ -20,9 +20,10 @@ import android.view.MenuItem;
import android.widget.TextView; import android.widget.TextView;
import de.danoeh.antennapod.core.preferences.ThemeSwitcher;
import de.danoeh.antennapod.error.CrashReportWriter; import de.danoeh.antennapod.error.CrashReportWriter;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.core.util.IntentUtils; import de.danoeh.antennapod.core.util.IntentUtils;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
@ -39,7 +40,7 @@ public class BugReportActivity extends AppCompatActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
setTheme(UserPreferences.getTheme()); setTheme(ThemeSwitcher.getTheme(this));
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
getSupportActionBar().setDisplayShowHomeEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true);
setContentView(R.layout.bug_report); setContentView(R.layout.bug_report);

View File

@ -4,10 +4,10 @@ import android.os.Bundle;
import android.text.TextUtils; import android.text.TextUtils;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.core.preferences.ThemeSwitcher;
import de.danoeh.antennapod.net.download.serviceinterface.DownloadServiceInterface; import de.danoeh.antennapod.net.download.serviceinterface.DownloadServiceInterface;
import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.model.feed.FeedMedia;
import de.danoeh.antennapod.model.feed.FeedPreferences; import de.danoeh.antennapod.model.feed.FeedPreferences;
import de.danoeh.antennapod.core.preferences.UserPreferences;
import de.danoeh.antennapod.net.download.serviceinterface.DownloadRequest; import de.danoeh.antennapod.net.download.serviceinterface.DownloadRequest;
import de.danoeh.antennapod.core.storage.DBReader; import de.danoeh.antennapod.core.storage.DBReader;
import de.danoeh.antennapod.core.storage.DBWriter; import de.danoeh.antennapod.core.storage.DBWriter;
@ -31,7 +31,7 @@ public class DownloadAuthenticationActivity extends AppCompatActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
setTheme(UserPreferences.getTranslucentTheme()); setTheme(ThemeSwitcher.getTranslucentTheme(this));
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
Validate.isTrue(getIntent().hasExtra(ARG_DOWNLOAD_REQUEST), "Download request missing"); Validate.isTrue(getIntent().hasExtra(ARG_DOWNLOAD_REQUEST), "Download request missing");

View File

@ -32,6 +32,7 @@ import com.bumptech.glide.Glide;
import com.google.android.material.bottomsheet.BottomSheetBehavior; import com.google.android.material.bottomsheet.BottomSheetBehavior;
import com.google.android.material.snackbar.Snackbar; import com.google.android.material.snackbar.Snackbar;
import de.danoeh.antennapod.core.preferences.ThemeSwitcher;
import de.danoeh.antennapod.fragment.AllEpisodesFragment; import de.danoeh.antennapod.fragment.AllEpisodesFragment;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
@ -40,7 +41,7 @@ import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode; import org.greenrobot.eventbus.ThreadMode;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.core.receiver.MediaButtonReceiver; import de.danoeh.antennapod.core.receiver.MediaButtonReceiver;
import de.danoeh.antennapod.core.util.download.AutoUpdateManager; import de.danoeh.antennapod.core.util.download.AutoUpdateManager;
import de.danoeh.antennapod.dialog.RatingDialog; import de.danoeh.antennapod.dialog.RatingDialog;
@ -99,7 +100,7 @@ public class MainActivity extends CastEnabledActivity {
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
lastTheme = UserPreferences.getNoTitleTheme(); lastTheme = ThemeSwitcher.getNoTitleTheme(this);
setTheme(lastTheme); setTheme(lastTheme);
if (savedInstanceState != null) { if (savedInstanceState != null) {
ensureGeneratedViewIdGreaterThan(savedInstanceState.getInt(KEY_GENERATED_VIEW_ID, 0)); ensureGeneratedViewIdGreaterThan(savedInstanceState.getInt(KEY_GENERATED_VIEW_ID, 0));
@ -427,7 +428,7 @@ public class MainActivity extends CastEnabledActivity {
handleNavIntent(); handleNavIntent();
RatingDialog.check(); RatingDialog.check();
if (lastTheme != UserPreferences.getNoTitleTheme()) { if (lastTheme != ThemeSwitcher.getNoTitleTheme(this)) {
finish(); finish();
startActivity(new Intent(this, MainActivity.class)); startActivity(new Intent(this, MainActivity.class));
} }
@ -436,7 +437,7 @@ public class MainActivity extends CastEnabledActivity {
@Override @Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data); super.onActivityResult(requestCode, resultCode, data);
lastTheme = UserPreferences.getNoTitleTheme(); // Don't recreate activity when a result is pending lastTheme = ThemeSwitcher.getNoTitleTheme(this); // Don't recreate activity when a result is pending
} }
@Override @Override

View File

@ -32,6 +32,7 @@ import com.google.android.material.snackbar.Snackbar;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.adapter.FeedItemlistDescriptionAdapter; import de.danoeh.antennapod.adapter.FeedItemlistDescriptionAdapter;
import de.danoeh.antennapod.core.event.DownloadEvent; import de.danoeh.antennapod.core.event.DownloadEvent;
import de.danoeh.antennapod.core.preferences.ThemeSwitcher;
import de.danoeh.antennapod.core.service.download.DownloadService; import de.danoeh.antennapod.core.service.download.DownloadService;
import de.danoeh.antennapod.core.service.download.DownloadRequestCreator; import de.danoeh.antennapod.core.service.download.DownloadRequestCreator;
import de.danoeh.antennapod.core.feed.FeedUrlNotFoundException; import de.danoeh.antennapod.core.feed.FeedUrlNotFoundException;
@ -41,7 +42,7 @@ import de.danoeh.antennapod.core.util.DownloadErrorLabel;
import de.danoeh.antennapod.event.FeedListUpdateEvent; import de.danoeh.antennapod.event.FeedListUpdateEvent;
import de.danoeh.antennapod.event.PlayerStatusEvent; import de.danoeh.antennapod.event.PlayerStatusEvent;
import de.danoeh.antennapod.core.preferences.PlaybackPreferences; import de.danoeh.antennapod.core.preferences.PlaybackPreferences;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.net.download.serviceinterface.DownloadRequest; import de.danoeh.antennapod.net.download.serviceinterface.DownloadRequest;
import de.danoeh.antennapod.model.download.DownloadStatus; import de.danoeh.antennapod.model.download.DownloadStatus;
import de.danoeh.antennapod.core.service.download.Downloader; import de.danoeh.antennapod.core.service.download.Downloader;
@ -119,7 +120,7 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
setTheme(UserPreferences.getTranslucentTheme()); setTheme(ThemeSwitcher.getTranslucentTheme(this));
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
viewBinding = OnlinefeedviewActivityBinding.inflate(getLayoutInflater()); viewBinding = OnlinefeedviewActivityBinding.inflate(getLayoutInflater());

View File

@ -26,7 +26,7 @@ import androidx.core.app.ActivityCompat;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.core.export.opml.OpmlElement; import de.danoeh.antennapod.core.export.opml.OpmlElement;
import de.danoeh.antennapod.core.export.opml.OpmlReader; import de.danoeh.antennapod.core.export.opml.OpmlReader;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.core.preferences.ThemeSwitcher;
import de.danoeh.antennapod.core.service.download.DownloadRequestCreator; import de.danoeh.antennapod.core.service.download.DownloadRequestCreator;
import de.danoeh.antennapod.net.download.serviceinterface.DownloadServiceInterface; import de.danoeh.antennapod.net.download.serviceinterface.DownloadServiceInterface;
@ -59,7 +59,7 @@ public class OpmlImportActivity extends AppCompatActivity {
@Override @Override
protected void onCreate(@Nullable Bundle savedInstanceState) { protected void onCreate(@Nullable Bundle savedInstanceState) {
setTheme(UserPreferences.getTheme()); setTheme(ThemeSwitcher.getTheme(this));
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
viewBinding = OpmlSelectionBinding.inflate(getLayoutInflater()); viewBinding = OpmlSelectionBinding.inflate(getLayoutInflater());

View File

@ -6,14 +6,14 @@ import androidx.appcompat.app.AppCompatActivity;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.os.Bundle; import android.os.Bundle;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.core.preferences.ThemeSwitcher;
import de.danoeh.antennapod.dialog.VariableSpeedDialog; import de.danoeh.antennapod.dialog.VariableSpeedDialog;
public class PlaybackSpeedDialogActivity extends AppCompatActivity { public class PlaybackSpeedDialogActivity extends AppCompatActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
setTheme(UserPreferences.getTranslucentTheme()); setTheme(ThemeSwitcher.getTranslucentTheme(this));
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
VariableSpeedDialog speedDialog = new InnerVariableSpeedDialog(); VariableSpeedDialog speedDialog = new InnerVariableSpeedDialog();
speedDialog.show(getSupportFragmentManager(), null); speedDialog.show(getSupportFragmentManager(), null);

View File

@ -18,7 +18,7 @@ import com.bytehamster.lib.preferencesearch.SearchPreferenceResult;
import com.bytehamster.lib.preferencesearch.SearchPreferenceResultListener; import com.bytehamster.lib.preferencesearch.SearchPreferenceResultListener;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.core.preferences.ThemeSwitcher;
import de.danoeh.antennapod.databinding.SettingsActivityBinding; import de.danoeh.antennapod.databinding.SettingsActivityBinding;
import de.danoeh.antennapod.fragment.preferences.AutoDownloadPreferencesFragment; import de.danoeh.antennapod.fragment.preferences.AutoDownloadPreferencesFragment;
import de.danoeh.antennapod.fragment.preferences.ImportExportPreferencesFragment; import de.danoeh.antennapod.fragment.preferences.ImportExportPreferencesFragment;
@ -42,7 +42,7 @@ public class PreferenceActivity extends AppCompatActivity implements SearchPrefe
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
setTheme(UserPreferences.getTheme()); setTheme(ThemeSwitcher.getTheme(this));
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
ActionBar ab = getSupportActionBar(); ActionBar ab = getSupportActionBar();

View File

@ -26,7 +26,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.core.preferences.ThemeSwitcher;
import de.danoeh.antennapod.core.storage.DBReader; import de.danoeh.antennapod.core.storage.DBReader;
import de.danoeh.antennapod.core.storage.NavDrawerData; import de.danoeh.antennapod.core.storage.NavDrawerData;
import de.danoeh.antennapod.databinding.SubscriptionSelectionActivityBinding; import de.danoeh.antennapod.databinding.SubscriptionSelectionActivityBinding;
@ -47,7 +47,7 @@ public class SelectSubscriptionActivity extends AppCompatActivity {
@Override @Override
protected void onCreate(@Nullable Bundle savedInstanceState) { protected void onCreate(@Nullable Bundle savedInstanceState) {
setTheme(UserPreferences.getTranslucentTheme()); setTheme(ThemeSwitcher.getTranslucentTheme(this));
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
viewBinding = SubscriptionSelectionActivityBinding.inflate(getLayoutInflater()); viewBinding = SubscriptionSelectionActivityBinding.inflate(getLayoutInflater());

View File

@ -41,7 +41,7 @@ import de.danoeh.antennapod.event.playback.PlaybackPositionEvent;
import de.danoeh.antennapod.event.PlayerErrorEvent; import de.danoeh.antennapod.event.PlayerErrorEvent;
import de.danoeh.antennapod.event.playback.PlaybackServiceEvent; import de.danoeh.antennapod.event.playback.PlaybackServiceEvent;
import de.danoeh.antennapod.event.playback.SleepTimerUpdatedEvent; import de.danoeh.antennapod.event.playback.SleepTimerUpdatedEvent;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.core.service.playback.PlaybackService; import de.danoeh.antennapod.core.service.playback.PlaybackService;
import de.danoeh.antennapod.core.storage.DBReader; import de.danoeh.antennapod.core.storage.DBReader;
import de.danoeh.antennapod.core.storage.DBWriter; import de.danoeh.antennapod.core.storage.DBWriter;

View File

@ -10,7 +10,7 @@ import android.widget.SeekBar;
import android.widget.TextView; import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.core.preferences.ThemeSwitcher;
import de.danoeh.antennapod.core.receiver.PlayerWidget; import de.danoeh.antennapod.core.receiver.PlayerWidget;
import de.danoeh.antennapod.core.widget.WidgetUpdaterWorker; import de.danoeh.antennapod.core.widget.WidgetUpdaterWorker;
@ -27,7 +27,7 @@ public class WidgetConfigActivity extends AppCompatActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
setTheme(UserPreferences.getTheme()); setTheme(ThemeSwitcher.getTheme(this));
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_widget_config); setContentView(R.layout.activity_widget_config);

View File

@ -23,7 +23,7 @@ import com.bumptech.glide.request.transition.Transition;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.MainActivity; import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.ui.common.ThemeUtils; import de.danoeh.antennapod.ui.common.ThemeUtils;
import de.danoeh.antennapod.ui.glide.PaletteBitmap; import de.danoeh.antennapod.ui.glide.PaletteBitmap;

View File

@ -12,7 +12,7 @@ import androidx.annotation.NonNull;
import androidx.core.util.Consumer; import androidx.core.util.Consumer;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.core.util.StorageUtils; import de.danoeh.antennapod.core.util.StorageUtils;
import java.io.File; import java.io.File;

View File

@ -29,7 +29,7 @@ import de.danoeh.antennapod.fragment.AllEpisodesFragment;
import de.danoeh.antennapod.fragment.CompletedDownloadsFragment; import de.danoeh.antennapod.fragment.CompletedDownloadsFragment;
import de.danoeh.antennapod.fragment.InboxFragment; import de.danoeh.antennapod.fragment.InboxFragment;
import de.danoeh.antennapod.model.feed.Feed; import de.danoeh.antennapod.model.feed.Feed;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.core.storage.NavDrawerData; import de.danoeh.antennapod.core.storage.NavDrawerData;
import de.danoeh.antennapod.fragment.AddFeedFragment; import de.danoeh.antennapod.fragment.AddFeedFragment;
import de.danoeh.antennapod.fragment.NavDrawerFragment; import de.danoeh.antennapod.fragment.NavDrawerFragment;

View File

@ -9,7 +9,7 @@ import android.view.View;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.MainActivity; import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.fragment.swipeactions.SwipeActions; import de.danoeh.antennapod.fragment.swipeactions.SwipeActions;
import de.danoeh.antennapod.view.viewholder.EpisodeItemViewHolder; import de.danoeh.antennapod.view.viewholder.EpisodeItemViewHolder;

View File

@ -34,7 +34,7 @@ import java.util.Locale;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.MainActivity; import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.core.storage.NavDrawerData; import de.danoeh.antennapod.core.storage.NavDrawerData;
import de.danoeh.antennapod.fragment.FeedItemlistFragment; import de.danoeh.antennapod.fragment.FeedItemlistFragment;
import de.danoeh.antennapod.fragment.SubscriptionFragment; import de.danoeh.antennapod.fragment.SubscriptionFragment;

View File

@ -8,7 +8,7 @@ import de.danoeh.antennapod.R;
import de.danoeh.antennapod.net.download.serviceinterface.DownloadServiceInterface; import de.danoeh.antennapod.net.download.serviceinterface.DownloadServiceInterface;
import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.model.feed.FeedItem;
import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.model.feed.FeedMedia;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.core.storage.DBWriter; import de.danoeh.antennapod.core.storage.DBWriter;
public class CancelDownloadActionButton extends ItemActionButton { public class CancelDownloadActionButton extends ItemActionButton {

View File

@ -11,7 +11,7 @@ import de.danoeh.antennapod.core.service.download.DownloadService;
import de.danoeh.antennapod.core.util.PlaybackStatus; import de.danoeh.antennapod.core.util.PlaybackStatus;
import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.model.feed.FeedItem;
import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.model.feed.FeedMedia;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
public abstract class ItemActionButton { public abstract class ItemActionButton {
FeedItem item; FeedItem item;

View File

@ -11,7 +11,7 @@ import java.io.OutputStreamWriter;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import de.danoeh.antennapod.core.export.ExportWriter; import de.danoeh.antennapod.core.export.ExportWriter;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.core.storage.DBReader; import de.danoeh.antennapod.core.storage.DBReader;
import io.reactivex.Observable; import io.reactivex.Observable;

View File

@ -3,7 +3,7 @@ package de.danoeh.antennapod.dialog;
import android.content.Context; import android.content.Context;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.fragment.NavDrawerFragment; import de.danoeh.antennapod.fragment.NavDrawerFragment;
import java.util.List; import java.util.List;

View File

@ -9,7 +9,7 @@ import android.view.View;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.core.util.download.AutoUpdateManager; import de.danoeh.antennapod.core.util.download.AutoUpdateManager;
import de.danoeh.antennapod.databinding.FeedRefreshDialogBinding; import de.danoeh.antennapod.databinding.FeedRefreshDialogBinding;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;

View File

@ -11,7 +11,7 @@ import java.util.List;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.event.UnreadItemsUpdateEvent; import de.danoeh.antennapod.event.UnreadItemsUpdateEvent;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
public class FeedSortDialog { public class FeedSortDialog {
public static void showDialog(Context context) { public static void showDialog(Context context) {

View File

@ -12,7 +12,7 @@ import androidx.fragment.app.DialogFragment;
import android.widget.Button; import android.widget.Button;
import android.widget.CheckBox; import android.widget.CheckBox;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.core.util.playback.PlaybackController; import de.danoeh.antennapod.core.util.playback.PlaybackController;
import java.util.List; import java.util.List;

View File

@ -28,7 +28,7 @@ import java.util.Locale;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.core.service.download.AntennapodHttpClient; import de.danoeh.antennapod.core.service.download.AntennapodHttpClient;
import de.danoeh.antennapod.model.download.ProxyConfig; import de.danoeh.antennapod.model.download.ProxyConfig;
import io.reactivex.Completable; import io.reactivex.Completable;

View File

@ -9,7 +9,7 @@ import java.text.NumberFormat;
import java.util.Locale; import java.util.Locale;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
/** /**
* Shows the dialog that allows setting the skip time. * Shows the dialog that allows setting the skip time.

View File

@ -3,7 +3,7 @@ package de.danoeh.antennapod.dialog;
import android.content.Context; import android.content.Context;
import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.model.playback.Playable; import de.danoeh.antennapod.model.playback.Playable;
import de.danoeh.antennapod.core.util.playback.PlaybackServiceStarter; import de.danoeh.antennapod.core.util.playback.PlaybackServiceStarter;

View File

@ -21,7 +21,7 @@ import de.danoeh.antennapod.R;
import de.danoeh.antennapod.event.UnreadItemsUpdateEvent; import de.danoeh.antennapod.event.UnreadItemsUpdateEvent;
import de.danoeh.antennapod.model.feed.SubscriptionsFilter; import de.danoeh.antennapod.model.feed.SubscriptionsFilter;
import de.danoeh.antennapod.core.feed.SubscriptionsFilterGroup; import de.danoeh.antennapod.core.feed.SubscriptionsFilterGroup;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
public class SubscriptionsFilterDialog { public class SubscriptionsFilterDialog {
public static void showDialog(Context context) { public static void showDialog(Context context) {

View File

@ -15,7 +15,7 @@ import com.google.android.material.chip.Chip;
import com.google.android.material.snackbar.Snackbar; import com.google.android.material.snackbar.Snackbar;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.event.playback.SpeedChangedEvent; import de.danoeh.antennapod.event.playback.SpeedChangedEvent;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.core.util.playback.PlaybackController; import de.danoeh.antennapod.core.util.playback.PlaybackController;
import de.danoeh.antennapod.view.ItemOffsetDecoration; import de.danoeh.antennapod.view.ItemOffsetDecoration;
import de.danoeh.antennapod.view.PlaybackSpeedSeekBar; import de.danoeh.antennapod.view.PlaybackSpeedSeekBar;

View File

@ -13,7 +13,7 @@ import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.Locale; import java.util.Locale;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
public class CrashReportWriter implements Thread.UncaughtExceptionHandler { public class CrashReportWriter implements Thread.UncaughtExceptionHandler {

View File

@ -52,7 +52,7 @@ import de.danoeh.antennapod.event.UnreadItemsUpdateEvent;
import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.model.feed.FeedItem;
import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.model.feed.FeedMedia;
import de.danoeh.antennapod.core.feed.util.PlaybackSpeedUtils; import de.danoeh.antennapod.core.feed.util.PlaybackSpeedUtils;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.core.util.ChapterUtils; import de.danoeh.antennapod.core.util.ChapterUtils;
import de.danoeh.antennapod.core.util.Converter; import de.danoeh.antennapod.core.util.Converter;
import de.danoeh.antennapod.core.util.TimeSpeedConverter; import de.danoeh.antennapod.core.util.TimeSpeedConverter;

View File

@ -24,7 +24,7 @@ import de.danoeh.antennapod.model.feed.Feed;
import de.danoeh.antennapod.model.feed.FeedFilter; import de.danoeh.antennapod.model.feed.FeedFilter;
import de.danoeh.antennapod.model.feed.FeedPreferences; import de.danoeh.antennapod.model.feed.FeedPreferences;
import de.danoeh.antennapod.model.feed.VolumeAdaptionSetting; import de.danoeh.antennapod.model.feed.VolumeAdaptionSetting;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.core.storage.DBReader; import de.danoeh.antennapod.core.storage.DBReader;
import de.danoeh.antennapod.core.storage.DBWriter; import de.danoeh.antennapod.core.storage.DBWriter;
import de.danoeh.antennapod.dialog.AuthenticationDialog; import de.danoeh.antennapod.dialog.AuthenticationDialog;

View File

@ -49,7 +49,7 @@ import de.danoeh.antennapod.model.feed.FeedItem;
import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.model.feed.FeedMedia;
import de.danoeh.antennapod.core.feed.util.ImageResourceUtils; import de.danoeh.antennapod.core.feed.util.ImageResourceUtils;
import de.danoeh.antennapod.core.preferences.UsageStatistics; import de.danoeh.antennapod.core.preferences.UsageStatistics;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.core.service.download.Downloader; import de.danoeh.antennapod.core.service.download.Downloader;
import de.danoeh.antennapod.core.storage.DBReader; import de.danoeh.antennapod.core.storage.DBReader;
import de.danoeh.antennapod.core.util.Converter; import de.danoeh.antennapod.core.util.Converter;

View File

@ -27,7 +27,7 @@ import de.danoeh.antennapod.activity.PreferenceActivity;
import de.danoeh.antennapod.adapter.NavListAdapter; import de.danoeh.antennapod.adapter.NavListAdapter;
import de.danoeh.antennapod.core.dialog.ConfirmationDialog; import de.danoeh.antennapod.core.dialog.ConfirmationDialog;
import de.danoeh.antennapod.core.menuhandler.MenuItemUtils; import de.danoeh.antennapod.core.menuhandler.MenuItemUtils;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.core.storage.DBReader; import de.danoeh.antennapod.core.storage.DBReader;
import de.danoeh.antennapod.core.storage.DBWriter; import de.danoeh.antennapod.core.storage.DBWriter;
import de.danoeh.antennapod.core.storage.NavDrawerData; import de.danoeh.antennapod.core.storage.NavDrawerData;

View File

@ -34,7 +34,7 @@ import de.danoeh.antennapod.core.event.DownloadEvent;
import de.danoeh.antennapod.core.event.DownloaderUpdate; import de.danoeh.antennapod.core.event.DownloaderUpdate;
import de.danoeh.antennapod.core.feed.util.PlaybackSpeedUtils; import de.danoeh.antennapod.core.feed.util.PlaybackSpeedUtils;
import de.danoeh.antennapod.core.menuhandler.MenuItemUtils; import de.danoeh.antennapod.core.menuhandler.MenuItemUtils;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.core.service.download.DownloadService; import de.danoeh.antennapod.core.service.download.DownloadService;
import de.danoeh.antennapod.core.storage.DBReader; import de.danoeh.antennapod.core.storage.DBReader;
import de.danoeh.antennapod.core.storage.DBWriter; import de.danoeh.antennapod.core.storage.DBWriter;

View File

@ -48,7 +48,7 @@ import de.danoeh.antennapod.core.event.DownloadEvent;
import de.danoeh.antennapod.event.FeedListUpdateEvent; import de.danoeh.antennapod.event.FeedListUpdateEvent;
import de.danoeh.antennapod.event.UnreadItemsUpdateEvent; import de.danoeh.antennapod.event.UnreadItemsUpdateEvent;
import de.danoeh.antennapod.core.menuhandler.MenuItemUtils; import de.danoeh.antennapod.core.menuhandler.MenuItemUtils;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.core.service.download.DownloadService; import de.danoeh.antennapod.core.service.download.DownloadService;
import de.danoeh.antennapod.core.storage.DBReader; import de.danoeh.antennapod.core.storage.DBReader;
import de.danoeh.antennapod.core.storage.DBWriter; import de.danoeh.antennapod.core.storage.DBWriter;

View File

@ -16,7 +16,7 @@ import androidx.preference.PreferenceFragmentCompat;
import androidx.preference.PreferenceScreen; import androidx.preference.PreferenceScreen;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.PreferenceActivity; import de.danoeh.antennapod.activity.PreferenceActivity;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;

View File

@ -9,7 +9,7 @@ import androidx.preference.PreferenceFragmentCompat;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.PreferenceActivity; import de.danoeh.antennapod.activity.PreferenceActivity;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.dialog.FeedRefreshIntervalDialog; import de.danoeh.antennapod.dialog.FeedRefreshIntervalDialog;
import de.danoeh.antennapod.dialog.ProxyDialog; import de.danoeh.antennapod.dialog.ProxyDialog;

View File

@ -12,7 +12,7 @@ import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.PreferenceActivity; import de.danoeh.antennapod.activity.PreferenceActivity;
import de.danoeh.antennapod.event.UnreadItemsUpdateEvent; import de.danoeh.antennapod.event.UnreadItemsUpdateEvent;
import de.danoeh.antennapod.core.preferences.UsageStatistics; import de.danoeh.antennapod.core.preferences.UsageStatistics;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.dialog.SkipPreferenceDialog; import de.danoeh.antennapod.dialog.SkipPreferenceDialog;
import de.danoeh.antennapod.dialog.VariableSpeedDialog; import de.danoeh.antennapod.dialog.VariableSpeedDialog;
import java.util.Map; import java.util.Map;

View File

@ -4,7 +4,7 @@ import android.os.Bundle;
import androidx.preference.PreferenceFragmentCompat; import androidx.preference.PreferenceFragmentCompat;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.PreferenceActivity; import de.danoeh.antennapod.activity.PreferenceActivity;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.dialog.ChooseDataFolderDialog; import de.danoeh.antennapod.dialog.ChooseDataFolderDialog;
import java.io.File; import java.io.File;

View File

@ -11,7 +11,7 @@ import androidx.core.app.ActivityCompat;
import androidx.preference.PreferenceFragmentCompat; import androidx.preference.PreferenceFragmentCompat;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.PreferenceActivity; import de.danoeh.antennapod.activity.PreferenceActivity;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.dialog.DrawerPreferencesDialog; import de.danoeh.antennapod.dialog.DrawerPreferencesDialog;
import de.danoeh.antennapod.dialog.FeedSortDialog; import de.danoeh.antennapod.dialog.FeedSortDialog;
import de.danoeh.antennapod.dialog.SubscriptionsFilterDialog; import de.danoeh.antennapod.dialog.SubscriptionsFilterDialog;

View File

@ -15,7 +15,7 @@ import com.google.android.material.snackbar.Snackbar;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.MainActivity; import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.core.preferences.PlaybackPreferences; import de.danoeh.antennapod.core.preferences.PlaybackPreferences;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.core.receiver.MediaButtonReceiver; import de.danoeh.antennapod.core.receiver.MediaButtonReceiver;
import de.danoeh.antennapod.core.service.playback.PlaybackServiceInterface; import de.danoeh.antennapod.core.service.playback.PlaybackServiceInterface;
import de.danoeh.antennapod.core.storage.DBWriter; import de.danoeh.antennapod.core.storage.DBWriter;

View File

@ -8,11 +8,11 @@ import androidx.preference.PreferenceManager;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.core.preferences.SleepTimerPreferences; import de.danoeh.antennapod.core.preferences.SleepTimerPreferences;
import de.danoeh.antennapod.error.CrashReportWriter; import de.danoeh.antennapod.error.CrashReportWriter;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences.EnqueueLocation;
import de.danoeh.antennapod.core.preferences.UserPreferences.EnqueueLocation;
import de.danoeh.antennapod.core.util.download.AutoUpdateManager; import de.danoeh.antennapod.core.util.download.AutoUpdateManager;
import de.danoeh.antennapod.fragment.QueueFragment; import de.danoeh.antennapod.fragment.QueueFragment;
import de.danoeh.antennapod.fragment.swipeactions.SwipeAction; import de.danoeh.antennapod.fragment.swipeactions.SwipeAction;
@ -78,8 +78,8 @@ public class PreferenceUpgrader {
} }
} }
if (oldVersion < 1070400) { if (oldVersion < 1070400) {
int theme = UserPreferences.getTheme(); UserPreferences.ThemePreference theme = UserPreferences.getTheme();
if (theme == R.style.Theme_AntennaPod_Light) { if (theme == UserPreferences.ThemePreference.LIGHT) {
prefs.edit().putString(UserPreferences.PREF_THEME, "system").apply(); prefs.edit().putString(UserPreferences.PREF_THEME, "system").apply();
} }
@ -126,6 +126,12 @@ public class PreferenceUpgrader {
long value = Long.parseLong(SleepTimerPreferences.lastTimerValue()); long value = Long.parseLong(SleepTimerPreferences.lastTimerValue());
TimeUnit unit = timeUnits[sleepTimerPreferences.getInt("LastTimeUnit", 1)]; TimeUnit unit = timeUnits[sleepTimerPreferences.getInt("LastTimeUnit", 1)];
SleepTimerPreferences.setLastTimer(String.valueOf(unit.toMinutes(value))); SleepTimerPreferences.setLastTimer(String.valueOf(unit.toMinutes(value)));
if (prefs.getString(UserPreferences.PREF_EPISODE_CACHE_SIZE, "20")
.equals(context.getString(R.string.pref_episode_cache_unlimited))) {
prefs.edit().putString(UserPreferences.PREF_EPISODE_CACHE_SIZE,
"" + UserPreferences.EPISODE_CACHE_SIZE_UNLIMITED).apply();
}
} }
} }
} }

View File

@ -6,7 +6,7 @@ import android.content.Intent;
import android.util.Log; import android.util.Log;
import de.danoeh.antennapod.core.ClientConfigurator; import de.danoeh.antennapod.core.ClientConfigurator;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.net.download.serviceinterface.DownloadServiceInterface; import de.danoeh.antennapod.net.download.serviceinterface.DownloadServiceInterface;
import de.danoeh.antennapod.core.storage.DBTasks; import de.danoeh.antennapod.core.storage.DBTasks;

View File

@ -31,7 +31,7 @@ import de.danoeh.antennapod.model.feed.FeedItem;
import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.model.feed.FeedMedia;
import de.danoeh.antennapod.model.playback.MediaType; import de.danoeh.antennapod.model.playback.MediaType;
import de.danoeh.antennapod.core.feed.util.ImageResourceUtils; import de.danoeh.antennapod.core.feed.util.ImageResourceUtils;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.core.util.Converter; import de.danoeh.antennapod.core.util.Converter;
import de.danoeh.antennapod.core.util.NetworkUtils; import de.danoeh.antennapod.core.util.NetworkUtils;
import de.danoeh.antennapod.model.playback.Playable; import de.danoeh.antennapod.model.playback.Playable;

View File

@ -33,6 +33,7 @@ dependencies {
implementation project(':playback:base') implementation project(':playback:base')
implementation project(':playback:cast') implementation project(':playback:cast')
implementation project(':storage:database') implementation project(':storage:database')
implementation project(':storage:preferences')
implementation project(':ui:app-start-intent') implementation project(':ui:app-start-intent')
implementation project(':ui:common') implementation project(':ui:common')
implementation project(':ui:i18n') implementation project(':ui:i18n')

View File

@ -4,7 +4,7 @@ import android.content.Context;
import de.danoeh.antennapod.core.preferences.PlaybackPreferences; import de.danoeh.antennapod.core.preferences.PlaybackPreferences;
import de.danoeh.antennapod.core.preferences.SleepTimerPreferences; import de.danoeh.antennapod.core.preferences.SleepTimerPreferences;
import de.danoeh.antennapod.core.preferences.UsageStatistics; import de.danoeh.antennapod.core.preferences.UsageStatistics;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.core.service.download.AntennapodHttpClient; import de.danoeh.antennapod.core.service.download.AntennapodHttpClient;
import de.danoeh.antennapod.net.download.serviceinterface.DownloadServiceInterface; import de.danoeh.antennapod.net.download.serviceinterface.DownloadServiceInterface;
import de.danoeh.antennapod.core.service.download.DownloadServiceInterfaceImpl; import de.danoeh.antennapod.core.service.download.DownloadServiceInterfaceImpl;

View File

@ -5,7 +5,7 @@ import androidx.annotation.Nullable;
import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.model.feed.FeedItem;
import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.model.feed.FeedMedia;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.model.playback.Playable; import de.danoeh.antennapod.model.playback.Playable;
/** /**

View File

@ -6,7 +6,7 @@ import de.danoeh.antennapod.model.feed.FeedItem;
import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.model.feed.FeedMedia;
import de.danoeh.antennapod.model.playback.MediaType; import de.danoeh.antennapod.model.playback.MediaType;
import de.danoeh.antennapod.core.preferences.PlaybackPreferences; import de.danoeh.antennapod.core.preferences.PlaybackPreferences;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.model.playback.Playable; import de.danoeh.antennapod.model.playback.Playable;
import static de.danoeh.antennapod.model.feed.FeedPreferences.SPEED_USE_GLOBAL; import static de.danoeh.antennapod.model.feed.FeedPreferences.SPEED_USE_GLOBAL;

View File

@ -0,0 +1,62 @@
package de.danoeh.antennapod.core.preferences;
import android.content.Context;
import android.content.res.Configuration;
import androidx.annotation.StyleRes;
import de.danoeh.antennapod.core.R;
import de.danoeh.antennapod.storage.preferences.UserPreferences;
public abstract class ThemeSwitcher {
@StyleRes
public static int getTheme(Context context) {
switch (readThemeValue(context)) {
case DARK:
return R.style.Theme_AntennaPod_Dark;
case BLACK:
return R.style.Theme_AntennaPod_TrueBlack;
case LIGHT: // fall-through
default:
return R.style.Theme_AntennaPod_Light;
}
}
@StyleRes
public static int getNoTitleTheme(Context context) {
switch (readThemeValue(context)) {
case DARK:
return R.style.Theme_AntennaPod_Dark_NoTitle;
case BLACK:
return R.style.Theme_AntennaPod_TrueBlack_NoTitle;
case LIGHT: // fall-through
default:
return R.style.Theme_AntennaPod_Light_NoTitle;
}
}
@StyleRes
public static int getTranslucentTheme(Context context) {
switch (readThemeValue(context)) {
case DARK:
return R.style.Theme_AntennaPod_Dark_Translucent;
case BLACK:
return R.style.Theme_AntennaPod_TrueBlack_Translucent;
case LIGHT: // fall-through
default:
return R.style.Theme_AntennaPod_Light_Translucent;
}
}
private static UserPreferences.ThemePreference readThemeValue(Context context) {
UserPreferences.ThemePreference theme = UserPreferences.getTheme();
if (theme == UserPreferences.ThemePreference.SYSTEM) {
int nightMode = context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
if (nightMode == Configuration.UI_MODE_NIGHT_YES) {
return UserPreferences.ThemePreference.DARK;
} else {
return UserPreferences.ThemePreference.LIGHT;
}
}
return theme;
}
}

View File

@ -8,7 +8,7 @@ import androidx.work.Worker;
import androidx.work.WorkerParameters; import androidx.work.WorkerParameters;
import de.danoeh.antennapod.core.ClientConfigurator; import de.danoeh.antennapod.core.ClientConfigurator;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.core.storage.DBTasks; import de.danoeh.antennapod.core.storage.DBTasks;
import de.danoeh.antennapod.core.util.NetworkUtils; import de.danoeh.antennapod.core.util.NetworkUtils;
import de.danoeh.antennapod.core.util.download.AutoUpdateManager; import de.danoeh.antennapod.core.util.download.AutoUpdateManager;

View File

@ -2,7 +2,7 @@ package de.danoeh.antennapod.core.service.download;
import android.util.Log; import android.util.Log;
import android.webkit.URLUtil; import android.webkit.URLUtil;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.core.util.FileNameGenerator; import de.danoeh.antennapod.core.util.FileNameGenerator;
import de.danoeh.antennapod.model.feed.Feed; import de.danoeh.antennapod.model.feed.Feed;
import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.model.feed.FeedMedia;

View File

@ -45,7 +45,7 @@ import de.danoeh.antennapod.event.FeedItemEvent;
import de.danoeh.antennapod.model.feed.Feed; import de.danoeh.antennapod.model.feed.Feed;
import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.model.feed.FeedItem;
import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.model.feed.FeedMedia;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.core.service.download.handler.FailedDownloadHandler; import de.danoeh.antennapod.core.service.download.handler.FailedDownloadHandler;
import de.danoeh.antennapod.core.service.download.handler.FeedSyncTask; import de.danoeh.antennapod.core.service.download.handler.FeedSyncTask;
import de.danoeh.antennapod.core.service.download.handler.MediaDownloadedHandler; import de.danoeh.antennapod.core.service.download.handler.MediaDownloadedHandler;

View File

@ -36,7 +36,7 @@ import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory;
import com.google.android.exoplayer2.upstream.HttpDataSource; import com.google.android.exoplayer2.upstream.HttpDataSource;
import de.danoeh.antennapod.core.ClientConfig; import de.danoeh.antennapod.core.ClientConfig;
import de.danoeh.antennapod.core.R; import de.danoeh.antennapod.core.R;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.core.service.download.AntennapodHttpClient; import de.danoeh.antennapod.core.service.download.AntennapodHttpClient;
import de.danoeh.antennapod.core.service.download.HttpCredentialEncoder; import de.danoeh.antennapod.core.service.download.HttpCredentialEncoder;
import de.danoeh.antennapod.core.util.NetworkUtils; import de.danoeh.antennapod.core.util.NetworkUtils;

View File

@ -39,7 +39,7 @@ import de.danoeh.antennapod.model.feed.FeedPreferences;
import de.danoeh.antennapod.model.playback.MediaType; import de.danoeh.antennapod.model.playback.MediaType;
import de.danoeh.antennapod.model.feed.VolumeAdaptionSetting; import de.danoeh.antennapod.model.feed.VolumeAdaptionSetting;
import de.danoeh.antennapod.core.feed.util.PlaybackSpeedUtils; import de.danoeh.antennapod.core.feed.util.PlaybackSpeedUtils;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.playback.base.RewindAfterPauseUtils; import de.danoeh.antennapod.playback.base.RewindAfterPauseUtils;
import de.danoeh.antennapod.core.util.playback.AudioPlayer; import de.danoeh.antennapod.core.util.playback.AudioPlayer;
import de.danoeh.antennapod.core.util.playback.IPlayer; import de.danoeh.antennapod.core.util.playback.IPlayer;

View File

@ -73,7 +73,7 @@ import de.danoeh.antennapod.event.settings.SpeedPresetChangedEvent;
import de.danoeh.antennapod.event.settings.VolumeAdaptionChangedEvent; import de.danoeh.antennapod.event.settings.VolumeAdaptionChangedEvent;
import de.danoeh.antennapod.core.preferences.PlaybackPreferences; import de.danoeh.antennapod.core.preferences.PlaybackPreferences;
import de.danoeh.antennapod.core.preferences.SleepTimerPreferences; import de.danoeh.antennapod.core.preferences.SleepTimerPreferences;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.core.receiver.MediaButtonReceiver; import de.danoeh.antennapod.core.receiver.MediaButtonReceiver;
import de.danoeh.antennapod.core.storage.DBReader; import de.danoeh.antennapod.core.storage.DBReader;
import de.danoeh.antennapod.core.storage.DBWriter; import de.danoeh.antennapod.core.storage.DBWriter;

View File

@ -20,7 +20,7 @@ import androidx.core.content.ContextCompat;
import com.bumptech.glide.Glide; import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions; import com.bumptech.glide.request.RequestOptions;
import de.danoeh.antennapod.core.R; import de.danoeh.antennapod.core.R;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.core.receiver.MediaButtonReceiver; import de.danoeh.antennapod.core.receiver.MediaButtonReceiver;
import de.danoeh.antennapod.core.util.Converter; import de.danoeh.antennapod.core.util.Converter;
import de.danoeh.antennapod.core.feed.util.ImageResourceUtils; import de.danoeh.antennapod.core.feed.util.ImageResourceUtils;

View File

@ -13,7 +13,7 @@ import de.danoeh.antennapod.net.download.serviceinterface.DownloadServiceInterfa
import de.danoeh.antennapod.core.util.PlaybackStatus; import de.danoeh.antennapod.core.util.PlaybackStatus;
import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.model.feed.FeedItem;
import de.danoeh.antennapod.model.feed.FeedPreferences; import de.danoeh.antennapod.model.feed.FeedPreferences;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.core.util.NetworkUtils; import de.danoeh.antennapod.core.util.NetworkUtils;
import de.danoeh.antennapod.core.util.PowerUtils; import de.danoeh.antennapod.core.util.PowerUtils;
@ -80,7 +80,7 @@ public class AutomaticDownloadAlgorithm {
int deletedEpisodes = EpisodeCleanupAlgorithmFactory.build() int deletedEpisodes = EpisodeCleanupAlgorithmFactory.build()
.makeRoomForEpisodes(context, autoDownloadableEpisodes); .makeRoomForEpisodes(context, autoDownloadableEpisodes);
boolean cacheIsUnlimited = boolean cacheIsUnlimited =
UserPreferences.getEpisodeCacheSize() == UserPreferences.getEpisodeCacheSizeUnlimited(); UserPreferences.getEpisodeCacheSize() == UserPreferences.EPISODE_CACHE_SIZE_UNLIMITED;
int episodeCacheSize = UserPreferences.getEpisodeCacheSize(); int episodeCacheSize = UserPreferences.getEpisodeCacheSize();
int episodeSpaceLeft; int episodeSpaceLeft;

View File

@ -21,7 +21,7 @@ import de.danoeh.antennapod.model.feed.FeedItemFilter;
import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.model.feed.FeedMedia;
import de.danoeh.antennapod.model.feed.FeedPreferences; import de.danoeh.antennapod.model.feed.FeedPreferences;
import de.danoeh.antennapod.model.feed.SubscriptionsFilter; import de.danoeh.antennapod.model.feed.SubscriptionsFilter;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.model.download.DownloadStatus; import de.danoeh.antennapod.model.download.DownloadStatus;
import de.danoeh.antennapod.storage.database.PodDBAdapter; import de.danoeh.antennapod.storage.database.PodDBAdapter;
import de.danoeh.antennapod.storage.database.mapper.DownloadStatusCursorMapper; import de.danoeh.antennapod.storage.database.mapper.DownloadStatusCursorMapper;

View File

@ -33,7 +33,7 @@ import de.danoeh.antennapod.core.R;
import de.danoeh.antennapod.event.FeedItemEvent; import de.danoeh.antennapod.event.FeedItemEvent;
import de.danoeh.antennapod.event.FeedListUpdateEvent; import de.danoeh.antennapod.event.FeedListUpdateEvent;
import de.danoeh.antennapod.event.MessageEvent; import de.danoeh.antennapod.event.MessageEvent;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.model.download.DownloadStatus; import de.danoeh.antennapod.model.download.DownloadStatus;
import de.danoeh.antennapod.core.sync.queue.SynchronizationQueueSink; import de.danoeh.antennapod.core.sync.queue.SynchronizationQueueSink;
import de.danoeh.antennapod.model.download.DownloadError; import de.danoeh.antennapod.model.download.DownloadError;

View File

@ -35,7 +35,7 @@ import de.danoeh.antennapod.event.QueueEvent;
import de.danoeh.antennapod.event.UnreadItemsUpdateEvent; import de.danoeh.antennapod.event.UnreadItemsUpdateEvent;
import de.danoeh.antennapod.core.feed.FeedEvent; import de.danoeh.antennapod.core.feed.FeedEvent;
import de.danoeh.antennapod.core.preferences.PlaybackPreferences; import de.danoeh.antennapod.core.preferences.PlaybackPreferences;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.model.download.DownloadStatus; import de.danoeh.antennapod.model.download.DownloadStatus;
import de.danoeh.antennapod.core.sync.queue.SynchronizationQueueSink; import de.danoeh.antennapod.core.sync.queue.SynchronizationQueueSink;
import de.danoeh.antennapod.core.util.FeedItemPermutors; import de.danoeh.antennapod.core.util.FeedItemPermutors;

View File

@ -2,7 +2,7 @@ package de.danoeh.antennapod.core.storage;
import android.content.Context; import android.content.Context;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
public abstract class EpisodeCleanupAlgorithm { public abstract class EpisodeCleanupAlgorithm {
@ -50,8 +50,7 @@ public abstract class EpisodeCleanupAlgorithm {
*/ */
int getNumEpisodesToCleanup(final int amountOfRoomNeeded) { int getNumEpisodesToCleanup(final int amountOfRoomNeeded) {
if (amountOfRoomNeeded >= 0 if (amountOfRoomNeeded >= 0
&& UserPreferences.getEpisodeCacheSize() != UserPreferences && UserPreferences.getEpisodeCacheSize() != UserPreferences.EPISODE_CACHE_SIZE_UNLIMITED) {
.getEpisodeCacheSizeUnlimited()) {
int downloadedEpisodes = DBReader int downloadedEpisodes = DBReader
.getNumberOfDownloadedEpisodes(); .getNumberOfDownloadedEpisodes();
if (downloadedEpisodes + amountOfRoomNeeded >= UserPreferences if (downloadedEpisodes + amountOfRoomNeeded >= UserPreferences

View File

@ -1,6 +1,6 @@
package de.danoeh.antennapod.core.storage; package de.danoeh.antennapod.core.storage;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
public abstract class EpisodeCleanupAlgorithmFactory { public abstract class EpisodeCleanupAlgorithmFactory {
public static EpisodeCleanupAlgorithm build() { public static EpisodeCleanupAlgorithm build() {

View File

@ -13,7 +13,7 @@ import java.util.Locale;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.model.feed.FeedItem;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
/** /**
* A cleanup algorithm that removes any item that isn't a favorite but only if space is needed. * A cleanup algorithm that removes any item that isn't a favorite but only if space is needed.
@ -88,7 +88,7 @@ public class ExceptFavoriteCleanupAlgorithm extends EpisodeCleanupAlgorithm {
@Override @Override
public int getDefaultCleanupParameter() { public int getDefaultCleanupParameter() {
int cacheSize = UserPreferences.getEpisodeCacheSize(); int cacheSize = UserPreferences.getEpisodeCacheSize();
if (cacheSize != UserPreferences.getEpisodeCacheSizeUnlimited()) { if (cacheSize != UserPreferences.EPISODE_CACHE_SIZE_UNLIMITED) {
int downloadedEpisodes = DBReader.getNumberOfDownloadedEpisodes(); int downloadedEpisodes = DBReader.getNumberOfDownloadedEpisodes();
if (downloadedEpisodes > cacheSize) { if (downloadedEpisodes > cacheSize) {
return downloadedEpisodes - cacheSize; return downloadedEpisodes - cacheSize;

View File

@ -10,7 +10,7 @@ import java.util.List;
import de.danoeh.antennapod.core.service.download.DownloadService; import de.danoeh.antennapod.core.service.download.DownloadService;
import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.model.feed.FeedItem;
import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.model.feed.FeedMedia;
import de.danoeh.antennapod.core.preferences.UserPreferences.EnqueueLocation; import de.danoeh.antennapod.storage.preferences.UserPreferences.EnqueueLocation;
import de.danoeh.antennapod.model.playback.Playable; import de.danoeh.antennapod.model.playback.Playable;
/** /**

View File

@ -34,7 +34,7 @@ import java.util.concurrent.TimeUnit;
import de.danoeh.antennapod.core.R; import de.danoeh.antennapod.core.R;
import de.danoeh.antennapod.event.SyncServiceEvent; import de.danoeh.antennapod.event.SyncServiceEvent;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.core.service.download.AntennapodHttpClient; import de.danoeh.antennapod.core.service.download.AntennapodHttpClient;
import de.danoeh.antennapod.core.storage.DBReader; import de.danoeh.antennapod.core.storage.DBReader;
import de.danoeh.antennapod.core.storage.DBTasks; import de.danoeh.antennapod.core.storage.DBTasks;

View File

@ -3,7 +3,7 @@ package de.danoeh.antennapod.core.sync;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import de.danoeh.antennapod.core.ClientConfig; import de.danoeh.antennapod.core.ClientConfig;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.core.sync.queue.SynchronizationQueueSink; import de.danoeh.antennapod.core.sync.queue.SynchronizationQueueSink;
/** /**

View File

@ -3,7 +3,7 @@ package de.danoeh.antennapod.core.util;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.model.feed.FeedMedia;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -12,7 +12,7 @@ import java.util.List;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
public class NetworkUtils { public class NetworkUtils {
private static final String REGEX_PATTERN_IP_ADDRESS = "([0-9]{1,3}[\\.]){3}[0-9]{1,3}"; private static final String REGEX_PATTERN_IP_ADDRESS = "([0-9]{1,3}[\\.]){3}[0-9]{1,3}";

View File

@ -1,7 +1,7 @@
package de.danoeh.antennapod.core.util; package de.danoeh.antennapod.core.util;
import android.os.StatFs; import android.os.StatFs;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import java.io.File; import java.io.File;

View File

@ -1,6 +1,6 @@
package de.danoeh.antennapod.core.util; package de.danoeh.antennapod.core.util;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
public class TimeSpeedConverter { public class TimeSpeedConverter {
private final float speed; private final float speed;

View File

@ -19,7 +19,7 @@ import java.util.Calendar;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import de.danoeh.antennapod.core.R; import de.danoeh.antennapod.core.R;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.core.service.FeedUpdateWorker; import de.danoeh.antennapod.core.service.FeedUpdateWorker;
import de.danoeh.antennapod.core.storage.DBTasks; import de.danoeh.antennapod.core.storage.DBTasks;
import de.danoeh.antennapod.core.util.NetworkUtils; import de.danoeh.antennapod.core.util.NetworkUtils;

View File

@ -10,7 +10,7 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import de.danoeh.antennapod.core.R; import de.danoeh.antennapod.core.R;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
public class NotificationUtils { public class NotificationUtils {
public static final String CHANNEL_ID_USER_ACTION = "user_action"; public static final String CHANNEL_ID_USER_ACTION = "user_action";

View File

@ -8,7 +8,7 @@ import android.view.SurfaceHolder;
import de.danoeh.antennapod.core.ClientConfig; import de.danoeh.antennapod.core.ClientConfig;
import org.antennapod.audio.MediaPlayer; import org.antennapod.audio.MediaPlayer;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import java.io.IOException; import java.io.IOException;
import java.util.Collections; import java.util.Collections;

View File

@ -21,7 +21,7 @@ import de.danoeh.antennapod.event.playback.SpeedChangedEvent;
import de.danoeh.antennapod.model.playback.MediaType; import de.danoeh.antennapod.model.playback.MediaType;
import de.danoeh.antennapod.core.feed.util.PlaybackSpeedUtils; import de.danoeh.antennapod.core.feed.util.PlaybackSpeedUtils;
import de.danoeh.antennapod.core.preferences.PlaybackPreferences; import de.danoeh.antennapod.core.preferences.PlaybackPreferences;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.core.service.playback.PlaybackService; import de.danoeh.antennapod.core.service.playback.PlaybackService;
import de.danoeh.antennapod.model.playback.Playable; import de.danoeh.antennapod.model.playback.Playable;
import de.danoeh.antennapod.playback.base.PlaybackServiceMediaPlayer; import de.danoeh.antennapod.playback.base.PlaybackServiceMediaPlayer;

View File

@ -17,7 +17,7 @@ import com.bumptech.glide.Glide;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import de.danoeh.antennapod.core.R; import de.danoeh.antennapod.core.R;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.model.playback.MediaType; import de.danoeh.antennapod.model.playback.MediaType;
import de.danoeh.antennapod.core.receiver.MediaButtonReceiver; import de.danoeh.antennapod.core.receiver.MediaButtonReceiver;
import de.danoeh.antennapod.core.receiver.PlayerWidget; import de.danoeh.antennapod.core.receiver.PlayerWidget;

View File

@ -1,4 +1,3 @@
<resources> <resources>
<integer name="episode_cache_size_unlimited">-1</integer>
<integer name="fragment_transition_duration">300</integer> <integer name="fragment_transition_duration">300</integer>
</resources> </resources>

View File

@ -34,7 +34,7 @@ import java.util.Objects;
import de.danoeh.antennapod.core.ApplicationCallbacks; import de.danoeh.antennapod.core.ApplicationCallbacks;
import de.danoeh.antennapod.core.ClientConfig; import de.danoeh.antennapod.core.ClientConfig;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.core.storage.DBReader; import de.danoeh.antennapod.core.storage.DBReader;
import de.danoeh.antennapod.core.storage.DBWriter; import de.danoeh.antennapod.core.storage.DBWriter;

View File

@ -19,7 +19,7 @@ import de.danoeh.antennapod.model.feed.Feed;
import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.model.feed.FeedItem;
import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.model.feed.FeedMedia;
import de.danoeh.antennapod.core.preferences.PlaybackPreferences; import de.danoeh.antennapod.core.preferences.PlaybackPreferences;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.storage.database.PodDBAdapter; import de.danoeh.antennapod.storage.database.PodDBAdapter;
import org.junit.After; import org.junit.After;

View File

@ -14,7 +14,7 @@ import androidx.test.platform.app.InstrumentationRegistry;
import de.danoeh.antennapod.model.feed.Feed; import de.danoeh.antennapod.model.feed.Feed;
import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.model.feed.FeedItem;
import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.model.feed.FeedMedia;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.storage.database.PodDBAdapter; import de.danoeh.antennapod.storage.database.PodDBAdapter;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;

View File

@ -7,7 +7,7 @@ import java.util.List;
import de.danoeh.antennapod.model.feed.Feed; import de.danoeh.antennapod.model.feed.Feed;
import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.model.feed.FeedItem;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;

View File

@ -13,7 +13,7 @@ import androidx.test.platform.app.InstrumentationRegistry;
import de.danoeh.antennapod.model.feed.Feed; import de.danoeh.antennapod.model.feed.Feed;
import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.model.feed.FeedItem;
import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.model.feed.FeedMedia;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.core.util.LongList; import de.danoeh.antennapod.core.util.LongList;
import de.danoeh.antennapod.storage.database.PodDBAdapter; import de.danoeh.antennapod.storage.database.PodDBAdapter;
import org.junit.After; import org.junit.After;

View File

@ -24,7 +24,7 @@ import de.danoeh.antennapod.model.feed.Feed;
import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.model.feed.FeedItem;
import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.model.feed.FeedMedia;
import de.danoeh.antennapod.core.preferences.PlaybackPreferences; import de.danoeh.antennapod.core.preferences.PlaybackPreferences;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import static de.danoeh.antennapod.core.util.FeedItemUtil.getIdList; import static de.danoeh.antennapod.core.util.FeedItemUtil.getIdList;
import static java.util.Collections.singletonList; import static java.util.Collections.singletonList;

View File

@ -34,7 +34,7 @@ import de.danoeh.antennapod.model.feed.Feed;
import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.model.feed.FeedItem;
import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.model.feed.FeedMedia;
import de.danoeh.antennapod.core.preferences.PlaybackPreferences; import de.danoeh.antennapod.core.preferences.PlaybackPreferences;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.core.util.FeedItemUtil; import de.danoeh.antennapod.core.util.FeedItemUtil;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;

View File

@ -11,7 +11,7 @@ import java.util.List;
import de.danoeh.antennapod.model.feed.Feed; import de.danoeh.antennapod.model.feed.Feed;
import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.model.feed.FeedItem;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;

View File

@ -19,14 +19,14 @@ import de.danoeh.antennapod.model.feed.FeedComponent;
import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.model.feed.FeedItem;
import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.model.feed.FeedMedia;
import de.danoeh.antennapod.core.feed.FeedMother; import de.danoeh.antennapod.core.feed.FeedMother;
import de.danoeh.antennapod.core.preferences.UserPreferences.EnqueueLocation; import de.danoeh.antennapod.storage.preferences.UserPreferences.EnqueueLocation;
import de.danoeh.antennapod.model.playback.Playable; import de.danoeh.antennapod.model.playback.Playable;
import org.mockito.MockedStatic; import org.mockito.MockedStatic;
import org.mockito.Mockito; import org.mockito.Mockito;
import static de.danoeh.antennapod.core.preferences.UserPreferences.EnqueueLocation.AFTER_CURRENTLY_PLAYING; import static de.danoeh.antennapod.storage.preferences.UserPreferences.EnqueueLocation.AFTER_CURRENTLY_PLAYING;
import static de.danoeh.antennapod.core.preferences.UserPreferences.EnqueueLocation.BACK; import static de.danoeh.antennapod.storage.preferences.UserPreferences.EnqueueLocation.BACK;
import static de.danoeh.antennapod.core.preferences.UserPreferences.EnqueueLocation.FRONT; import static de.danoeh.antennapod.storage.preferences.UserPreferences.EnqueueLocation.FRONT;
import static de.danoeh.antennapod.core.util.CollectionTestUtil.concat; import static de.danoeh.antennapod.core.util.CollectionTestUtil.concat;
import static de.danoeh.antennapod.core.util.CollectionTestUtil.list; import static de.danoeh.antennapod.core.util.CollectionTestUtil.list;
import static de.danoeh.antennapod.core.util.FeedItemUtil.getIdList; import static de.danoeh.antennapod.core.util.FeedItemUtil.getIdList;

View File

@ -17,6 +17,7 @@ include ':playback:base'
include ':playback:cast' include ':playback:cast'
include ':storage:database' include ':storage:database'
include ':storage:preferences'
include ':ui:app-start-intent' include ':ui:app-start-intent'
include ':ui:common' include ':ui:common'

View File

@ -0,0 +1,3 @@
# :storage:preferences
User settings, but not the actual subscription database.

View File

@ -0,0 +1,18 @@
plugins {
id("com.android.library")
}
apply from: "../../common.gradle"
android {
lintOptions {
disable "StaticFieldLeak"
}
}
dependencies {
implementation project(':model')
annotationProcessor "androidx.annotation:annotation:$annotationVersion"
implementation "androidx.fragment:fragment:$fragmentVersion"
implementation "androidx.preference:preference:$preferenceVersion"
}

View File

@ -0,0 +1 @@
<manifest package="de.danoeh.antennapod.storage.preferences" />

View File

@ -1,8 +1,7 @@
package de.danoeh.antennapod.core.preferences; package de.danoeh.antennapod.storage.preferences;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.os.Build; import android.os.Build;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
@ -30,7 +29,6 @@ import java.util.Locale;
import java.util.Set; import java.util.Set;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import de.danoeh.antennapod.core.R;
import de.danoeh.antennapod.model.feed.FeedCounter; import de.danoeh.antennapod.model.feed.FeedCounter;
import de.danoeh.antennapod.model.playback.MediaType; import de.danoeh.antennapod.model.playback.MediaType;
import de.danoeh.antennapod.model.feed.SubscriptionsFilter; import de.danoeh.antennapod.model.feed.SubscriptionsFilter;
@ -132,7 +130,7 @@ public class UserPreferences {
private static final int NOTIFICATION_BUTTON_REWIND = 0; private static final int NOTIFICATION_BUTTON_REWIND = 0;
private static final int NOTIFICATION_BUTTON_FAST_FORWARD = 1; private static final int NOTIFICATION_BUTTON_FAST_FORWARD = 1;
private static final int NOTIFICATION_BUTTON_SKIP = 2; private static final int NOTIFICATION_BUTTON_SKIP = 2;
private static final int EPISODE_CACHE_SIZE_UNLIMITED = -1; public static final int EPISODE_CACHE_SIZE_UNLIMITED = -1;
public static final int FEED_ORDER_COUNTER = 0; public static final int FEED_ORDER_COUNTER = 0;
public static final int FEED_ORDER_ALPHABETICAL = 1; public static final int FEED_ORDER_ALPHABETICAL = 1;
public static final int FEED_ORDER_MOST_PLAYED = 3; public static final int FEED_ORDER_MOST_PLAYED = 3;
@ -155,34 +153,20 @@ public class UserPreferences {
createNoMediaFile(); createNoMediaFile();
} }
/** public enum ThemePreference {
* Returns theme as R.style value LIGHT, DARK, BLACK, SYSTEM
*
* @return R.style.Theme_AntennaPod_Light or R.style.Theme_AntennaPod_Dark
*/
public static int getTheme() {
return readThemeValue(prefs.getString(PREF_THEME, "system"));
} }
public static int getNoTitleTheme() { public static ThemePreference getTheme() {
int theme = getTheme(); switch (prefs.getString(PREF_THEME, "system")) {
if (theme == R.style.Theme_AntennaPod_Dark) { case "0":
return R.style.Theme_AntennaPod_Dark_NoTitle; return ThemePreference.LIGHT;
} else if (theme == R.style.Theme_AntennaPod_TrueBlack) { case "1":
return R.style.Theme_AntennaPod_TrueBlack_NoTitle; return ThemePreference.DARK;
} else { case "2":
return R.style.Theme_AntennaPod_Light_NoTitle; return ThemePreference.BLACK;
} default:
} return ThemePreference.SYSTEM;
public static int getTranslucentTheme() {
int theme = getTheme();
if (theme == R.style.Theme_AntennaPod_Dark) {
return R.style.Theme_AntennaPod_Dark_Translucent;
} else if (theme == R.style.Theme_AntennaPod_TrueBlack) {
return R.style.Theme_AntennaPod_TrueBlack_Translucent;
} else {
return R.style.Theme_AntennaPod_Light_Translucent;
} }
} }
@ -551,17 +535,13 @@ public class UserPreferences {
return Integer.parseInt(prefs.getString(PREF_PARALLEL_DOWNLOADS, "4")); return Integer.parseInt(prefs.getString(PREF_PARALLEL_DOWNLOADS, "4"));
} }
public static int getEpisodeCacheSizeUnlimited() {
return context.getResources().getInteger(R.integer.episode_cache_size_unlimited);
}
/** /**
* Returns the capacity of the episode cache. This method will return the * Returns the capacity of the episode cache. This method will return the
* negative integer EPISODE_CACHE_SIZE_UNLIMITED if the cache size is set to * negative integer EPISODE_CACHE_SIZE_UNLIMITED if the cache size is set to
* 'unlimited'. * 'unlimited'.
*/ */
public static int getEpisodeCacheSize() { public static int getEpisodeCacheSize() {
return readEpisodeCacheSizeInternal(prefs.getString(PREF_EPISODE_CACHE_SIZE, "20")); return Integer.parseInt(prefs.getString(PREF_EPISODE_CACHE_SIZE, "20"));
} }
public static boolean isEnableAutodownload() { public static boolean isEnableAutodownload() {
@ -744,36 +724,11 @@ public class UserPreferences {
.apply(); .apply();
} }
private static int readThemeValue(String valueFromPrefs) {
switch (valueFromPrefs) {
case "0":
return R.style.Theme_AntennaPod_Light;
case "1":
return R.style.Theme_AntennaPod_Dark;
case "2":
return R.style.Theme_AntennaPod_TrueBlack;
default:
int nightMode = context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
if (nightMode == Configuration.UI_MODE_NIGHT_YES) {
return R.style.Theme_AntennaPod_Dark;
}
return R.style.Theme_AntennaPod_Light;
}
}
private static long readUpdateInterval(String valueFromPrefs) { private static long readUpdateInterval(String valueFromPrefs) {
int hours = Integer.parseInt(valueFromPrefs); int hours = Integer.parseInt(valueFromPrefs);
return TimeUnit.HOURS.toMillis(hours); return TimeUnit.HOURS.toMillis(hours);
} }
private static int readEpisodeCacheSizeInternal(String valueFromPrefs) {
if (valueFromPrefs.equals(context.getString(R.string.pref_episode_cache_unlimited))) {
return EPISODE_CACHE_SIZE_UNLIMITED;
} else {
return Integer.parseInt(valueFromPrefs);
}
}
private static List<Float> readPlaybackSpeedArray(String valueFromPrefs) { private static List<Float> readPlaybackSpeedArray(String valueFromPrefs) {
if (valueFromPrefs != null) { if (valueFromPrefs != null) {
try { try {

View File

@ -7,6 +7,7 @@ apply from: "../../playFlavor.gradle"
dependencies { dependencies {
implementation project(":model") implementation project(":model")
implementation project(":core") implementation project(":core")
implementation project(':storage:preferences')
implementation "androidx.palette:palette:$paletteVersion" implementation "androidx.palette:palette:$paletteVersion"

View File

@ -13,8 +13,7 @@ import androidx.palette.graphics.Palette;
import com.bumptech.glide.load.Options; import com.bumptech.glide.load.Options;
import com.bumptech.glide.load.engine.Resource; import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.resource.transcode.ResourceTranscoder; import com.bumptech.glide.load.resource.transcode.ResourceTranscoder;
import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.core.preferences.UserPreferences;
public class PaletteBitmapTranscoder implements ResourceTranscoder<Bitmap, PaletteBitmap> { public class PaletteBitmapTranscoder implements ResourceTranscoder<Bitmap, PaletteBitmap> {