Move preferences to a new module
This commit is contained in:
parent
0101f1244e
commit
d8a2dd5f83
|
@ -90,6 +90,7 @@ dependencies {
|
|||
implementation project(':playback:base')
|
||||
implementation project(':playback:cast')
|
||||
implementation project(':storage:database')
|
||||
implementation project(':storage:preferences')
|
||||
implementation project(':ui:app-start-intent')
|
||||
implementation project(':ui:common')
|
||||
implementation project(':ui:glide')
|
||||
|
|
|
@ -23,7 +23,7 @@ import junit.framework.AssertionFailedError;
|
|||
|
||||
import de.danoeh.antennapod.R;
|
||||
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.playback.PlaybackService;
|
||||
import de.danoeh.antennapod.dialog.RatingDialog;
|
||||
|
|
|
@ -33,7 +33,7 @@ import de.danoeh.antennapod.activity.MainActivity;
|
|||
import de.danoeh.antennapod.model.feed.FeedItem;
|
||||
import de.danoeh.antennapod.model.feed.FeedMedia;
|
||||
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.DBWriter;
|
||||
import de.danoeh.antennapod.core.util.LongList;
|
||||
|
|
|
@ -26,7 +26,7 @@ import java.util.concurrent.TimeUnit;
|
|||
import de.danoeh.antennapod.model.feed.Feed;
|
||||
import de.danoeh.antennapod.model.feed.FeedItem;
|
||||
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.core.service.download.DownloadService;
|
||||
import de.danoeh.antennapod.model.download.DownloadStatus;
|
||||
|
|
|
@ -8,7 +8,7 @@ import java.io.File;
|
|||
import java.io.IOException;
|
||||
|
||||
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.model.download.DownloadStatus;
|
||||
import de.danoeh.antennapod.core.service.download.Downloader;
|
||||
|
|
|
@ -6,7 +6,7 @@ import androidx.test.core.app.ApplicationProvider;
|
|||
import de.danoeh.antennapod.model.feed.FeedItem;
|
||||
import de.danoeh.antennapod.model.feed.FeedMedia;
|
||||
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.DBReader;
|
||||
import de.danoeh.antennapod.core.storage.DBTasks;
|
||||
|
|
|
@ -10,7 +10,7 @@ import de.danoeh.antennapod.activity.MainActivity;
|
|||
import de.danoeh.antennapod.activity.PreferenceActivity;
|
||||
import de.danoeh.antennapod.fragment.CompletedDownloadsFragment;
|
||||
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.NavDrawerFragment;
|
||||
import de.danoeh.antennapod.fragment.PlaybackHistoryFragment;
|
||||
|
|
|
@ -21,8 +21,8 @@ import java.util.concurrent.TimeUnit;
|
|||
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.activity.PreferenceActivity;
|
||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.core.preferences.UserPreferences.EnqueueLocation;
|
||||
import de.danoeh.antennapod.storage.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.storage.preferences.UserPreferences.EnqueueLocation;
|
||||
import de.danoeh.antennapod.core.storage.APCleanupAlgorithm;
|
||||
import de.danoeh.antennapod.core.storage.APNullCleanupAlgorithm;
|
||||
import de.danoeh.antennapod.core.storage.APQueueCleanupAlgorithm;
|
||||
|
@ -79,32 +79,16 @@ public class PreferencesTest {
|
|||
|
||||
@Test
|
||||
public void testSwitchTheme() {
|
||||
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;
|
||||
final UserPreferences.ThemePreference theme = UserPreferences.getTheme();
|
||||
int otherThemeText;
|
||||
if (theme == UserPreferences.ThemePreference.DARK) {
|
||||
otherThemeText = R.string.pref_theme_title_light;
|
||||
} else {
|
||||
otherTheme = R.string.pref_theme_title_light;
|
||||
otherThemeText = R.string.pref_theme_title_dark;
|
||||
}
|
||||
clickPreference(R.string.user_interface_label);
|
||||
clickPreference(R.string.pref_set_theme_title);
|
||||
onView(withText(otherTheme)).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());
|
||||
onView(withText(otherThemeText)).perform(click());
|
||||
Awaitility.await().atMost(1000, MILLISECONDS)
|
||||
.until(() -> UserPreferences.getTheme() != theme);
|
||||
}
|
||||
|
|
|
@ -20,9 +20,10 @@ import android.view.MenuItem;
|
|||
import android.widget.TextView;
|
||||
|
||||
|
||||
import de.danoeh.antennapod.core.preferences.ThemeSwitcher;
|
||||
import de.danoeh.antennapod.error.CrashReportWriter;
|
||||
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 org.apache.commons.io.IOUtils;
|
||||
|
||||
|
@ -39,7 +40,7 @@ public class BugReportActivity extends AppCompatActivity {
|
|||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
setTheme(UserPreferences.getTheme());
|
||||
setTheme(ThemeSwitcher.getTheme(this));
|
||||
super.onCreate(savedInstanceState);
|
||||
getSupportActionBar().setDisplayShowHomeEnabled(true);
|
||||
setContentView(R.layout.bug_report);
|
||||
|
|
|
@ -4,10 +4,10 @@ import android.os.Bundle;
|
|||
import android.text.TextUtils;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.core.preferences.ThemeSwitcher;
|
||||
import de.danoeh.antennapod.net.download.serviceinterface.DownloadServiceInterface;
|
||||
import de.danoeh.antennapod.model.feed.FeedMedia;
|
||||
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.core.storage.DBReader;
|
||||
import de.danoeh.antennapod.core.storage.DBWriter;
|
||||
|
@ -31,7 +31,7 @@ public class DownloadAuthenticationActivity extends AppCompatActivity {
|
|||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
setTheme(UserPreferences.getTranslucentTheme());
|
||||
setTheme(ThemeSwitcher.getTranslucentTheme(this));
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
Validate.isTrue(getIntent().hasExtra(ARG_DOWNLOAD_REQUEST), "Download request missing");
|
||||
|
|
|
@ -32,6 +32,7 @@ import com.bumptech.glide.Glide;
|
|||
import com.google.android.material.bottomsheet.BottomSheetBehavior;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
|
||||
import de.danoeh.antennapod.core.preferences.ThemeSwitcher;
|
||||
import de.danoeh.antennapod.fragment.AllEpisodesFragment;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
|
@ -40,7 +41,7 @@ import org.greenrobot.eventbus.Subscribe;
|
|||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
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.util.download.AutoUpdateManager;
|
||||
import de.danoeh.antennapod.dialog.RatingDialog;
|
||||
|
@ -99,7 +100,7 @@ public class MainActivity extends CastEnabledActivity {
|
|||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
lastTheme = UserPreferences.getNoTitleTheme();
|
||||
lastTheme = ThemeSwitcher.getNoTitleTheme(this);
|
||||
setTheme(lastTheme);
|
||||
if (savedInstanceState != null) {
|
||||
ensureGeneratedViewIdGreaterThan(savedInstanceState.getInt(KEY_GENERATED_VIEW_ID, 0));
|
||||
|
@ -427,7 +428,7 @@ public class MainActivity extends CastEnabledActivity {
|
|||
handleNavIntent();
|
||||
RatingDialog.check();
|
||||
|
||||
if (lastTheme != UserPreferences.getNoTitleTheme()) {
|
||||
if (lastTheme != ThemeSwitcher.getNoTitleTheme(this)) {
|
||||
finish();
|
||||
startActivity(new Intent(this, MainActivity.class));
|
||||
}
|
||||
|
@ -436,7 +437,7 @@ public class MainActivity extends CastEnabledActivity {
|
|||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent 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
|
||||
|
|
|
@ -32,6 +32,7 @@ import com.google.android.material.snackbar.Snackbar;
|
|||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.adapter.FeedItemlistDescriptionAdapter;
|
||||
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.DownloadRequestCreator;
|
||||
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.PlayerStatusEvent;
|
||||
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.model.download.DownloadStatus;
|
||||
import de.danoeh.antennapod.core.service.download.Downloader;
|
||||
|
@ -119,7 +120,7 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
|
|||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
setTheme(UserPreferences.getTranslucentTheme());
|
||||
setTheme(ThemeSwitcher.getTranslucentTheme(this));
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
viewBinding = OnlinefeedviewActivityBinding.inflate(getLayoutInflater());
|
||||
|
|
|
@ -26,7 +26,7 @@ import androidx.core.app.ActivityCompat;
|
|||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.core.export.opml.OpmlElement;
|
||||
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.net.download.serviceinterface.DownloadServiceInterface;
|
||||
|
@ -59,7 +59,7 @@ public class OpmlImportActivity extends AppCompatActivity {
|
|||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
setTheme(UserPreferences.getTheme());
|
||||
setTheme(ThemeSwitcher.getTheme(this));
|
||||
super.onCreate(savedInstanceState);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
viewBinding = OpmlSelectionBinding.inflate(getLayoutInflater());
|
||||
|
|
|
@ -6,14 +6,14 @@ import androidx.appcompat.app.AppCompatActivity;
|
|||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
|
||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.core.preferences.ThemeSwitcher;
|
||||
import de.danoeh.antennapod.dialog.VariableSpeedDialog;
|
||||
|
||||
public class PlaybackSpeedDialogActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
setTheme(UserPreferences.getTranslucentTheme());
|
||||
setTheme(ThemeSwitcher.getTranslucentTheme(this));
|
||||
super.onCreate(savedInstanceState);
|
||||
VariableSpeedDialog speedDialog = new InnerVariableSpeedDialog();
|
||||
speedDialog.show(getSupportFragmentManager(), null);
|
||||
|
|
|
@ -18,7 +18,7 @@ import com.bytehamster.lib.preferencesearch.SearchPreferenceResult;
|
|||
import com.bytehamster.lib.preferencesearch.SearchPreferenceResultListener;
|
||||
|
||||
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.fragment.preferences.AutoDownloadPreferencesFragment;
|
||||
import de.danoeh.antennapod.fragment.preferences.ImportExportPreferencesFragment;
|
||||
|
@ -42,7 +42,7 @@ public class PreferenceActivity extends AppCompatActivity implements SearchPrefe
|
|||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
setTheme(UserPreferences.getTheme());
|
||||
setTheme(ThemeSwitcher.getTheme(this));
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
ActionBar ab = getSupportActionBar();
|
||||
|
|
|
@ -26,7 +26,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
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.NavDrawerData;
|
||||
import de.danoeh.antennapod.databinding.SubscriptionSelectionActivityBinding;
|
||||
|
@ -47,7 +47,7 @@ public class SelectSubscriptionActivity extends AppCompatActivity {
|
|||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
setTheme(UserPreferences.getTranslucentTheme());
|
||||
setTheme(ThemeSwitcher.getTranslucentTheme(this));
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
viewBinding = SubscriptionSelectionActivityBinding.inflate(getLayoutInflater());
|
||||
|
|
|
@ -41,7 +41,7 @@ import de.danoeh.antennapod.event.playback.PlaybackPositionEvent;
|
|||
import de.danoeh.antennapod.event.PlayerErrorEvent;
|
||||
import de.danoeh.antennapod.event.playback.PlaybackServiceEvent;
|
||||
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.storage.DBReader;
|
||||
import de.danoeh.antennapod.core.storage.DBWriter;
|
||||
|
|
|
@ -10,7 +10,7 @@ import android.widget.SeekBar;
|
|||
import android.widget.TextView;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
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.widget.WidgetUpdaterWorker;
|
||||
|
||||
|
@ -27,7 +27,7 @@ public class WidgetConfigActivity extends AppCompatActivity {
|
|||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
setTheme(UserPreferences.getTheme());
|
||||
setTheme(ThemeSwitcher.getTheme(this));
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_widget_config);
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ import com.bumptech.glide.request.transition.Transition;
|
|||
|
||||
import de.danoeh.antennapod.R;
|
||||
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.glide.PaletteBitmap;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import androidx.annotation.NonNull;
|
|||
import androidx.core.util.Consumer;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
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 java.io.File;
|
||||
|
|
|
@ -29,7 +29,7 @@ import de.danoeh.antennapod.fragment.AllEpisodesFragment;
|
|||
import de.danoeh.antennapod.fragment.CompletedDownloadsFragment;
|
||||
import de.danoeh.antennapod.fragment.InboxFragment;
|
||||
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.fragment.AddFeedFragment;
|
||||
import de.danoeh.antennapod.fragment.NavDrawerFragment;
|
||||
|
|
|
@ -9,7 +9,7 @@ import android.view.View;
|
|||
|
||||
import de.danoeh.antennapod.R;
|
||||
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.view.viewholder.EpisodeItemViewHolder;
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ import java.util.Locale;
|
|||
|
||||
import de.danoeh.antennapod.R;
|
||||
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.fragment.FeedItemlistFragment;
|
||||
import de.danoeh.antennapod.fragment.SubscriptionFragment;
|
||||
|
|
|
@ -8,7 +8,7 @@ import de.danoeh.antennapod.R;
|
|||
import de.danoeh.antennapod.net.download.serviceinterface.DownloadServiceInterface;
|
||||
import de.danoeh.antennapod.model.feed.FeedItem;
|
||||
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;
|
||||
|
||||
public class CancelDownloadActionButton extends ItemActionButton {
|
||||
|
|
|
@ -11,7 +11,7 @@ import de.danoeh.antennapod.core.service.download.DownloadService;
|
|||
import de.danoeh.antennapod.core.util.PlaybackStatus;
|
||||
import de.danoeh.antennapod.model.feed.FeedItem;
|
||||
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 {
|
||||
FeedItem item;
|
||||
|
|
|
@ -11,7 +11,7 @@ import java.io.OutputStreamWriter;
|
|||
import java.nio.charset.Charset;
|
||||
|
||||
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 io.reactivex.Observable;
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ package de.danoeh.antennapod.dialog;
|
|||
import android.content.Context;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
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 java.util.List;
|
||||
|
|
|
@ -9,7 +9,7 @@ import android.view.View;
|
|||
import android.widget.ArrayAdapter;
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
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.databinding.FeedRefreshDialogBinding;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
|
|
@ -11,7 +11,7 @@ import java.util.List;
|
|||
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.event.UnreadItemsUpdateEvent;
|
||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.storage.preferences.UserPreferences;
|
||||
|
||||
public class FeedSortDialog {
|
||||
public static void showDialog(Context context) {
|
||||
|
|
|
@ -12,7 +12,7 @@ import androidx.fragment.app.DialogFragment;
|
|||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
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 java.util.List;
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ import java.util.Locale;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
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.model.download.ProxyConfig;
|
||||
import io.reactivex.Completable;
|
||||
|
|
|
@ -9,7 +9,7 @@ import java.text.NumberFormat;
|
|||
import java.util.Locale;
|
||||
|
||||
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.
|
||||
|
|
|
@ -3,7 +3,7 @@ package de.danoeh.antennapod.dialog;
|
|||
import android.content.Context;
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
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.core.util.playback.PlaybackServiceStarter;
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ import de.danoeh.antennapod.R;
|
|||
import de.danoeh.antennapod.event.UnreadItemsUpdateEvent;
|
||||
import de.danoeh.antennapod.model.feed.SubscriptionsFilter;
|
||||
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 static void showDialog(Context context) {
|
||||
|
|
|
@ -15,7 +15,7 @@ import com.google.android.material.chip.Chip;
|
|||
import com.google.android.material.snackbar.Snackbar;
|
||||
import de.danoeh.antennapod.R;
|
||||
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.view.ItemOffsetDecoration;
|
||||
import de.danoeh.antennapod.view.PlaybackSpeedSeekBar;
|
||||
|
|
|
@ -13,7 +13,7 @@ import java.text.SimpleDateFormat;
|
|||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.storage.preferences.UserPreferences;
|
||||
|
||||
public class CrashReportWriter implements Thread.UncaughtExceptionHandler {
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ import de.danoeh.antennapod.event.UnreadItemsUpdateEvent;
|
|||
import de.danoeh.antennapod.model.feed.FeedItem;
|
||||
import de.danoeh.antennapod.model.feed.FeedMedia;
|
||||
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.Converter;
|
||||
import de.danoeh.antennapod.core.util.TimeSpeedConverter;
|
||||
|
|
|
@ -24,7 +24,7 @@ import de.danoeh.antennapod.model.feed.Feed;
|
|||
import de.danoeh.antennapod.model.feed.FeedFilter;
|
||||
import de.danoeh.antennapod.model.feed.FeedPreferences;
|
||||
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.DBWriter;
|
||||
import de.danoeh.antennapod.dialog.AuthenticationDialog;
|
||||
|
|
|
@ -49,7 +49,7 @@ import de.danoeh.antennapod.model.feed.FeedItem;
|
|||
import de.danoeh.antennapod.model.feed.FeedMedia;
|
||||
import de.danoeh.antennapod.core.feed.util.ImageResourceUtils;
|
||||
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.storage.DBReader;
|
||||
import de.danoeh.antennapod.core.util.Converter;
|
||||
|
|
|
@ -27,7 +27,7 @@ import de.danoeh.antennapod.activity.PreferenceActivity;
|
|||
import de.danoeh.antennapod.adapter.NavListAdapter;
|
||||
import de.danoeh.antennapod.core.dialog.ConfirmationDialog;
|
||||
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.DBWriter;
|
||||
import de.danoeh.antennapod.core.storage.NavDrawerData;
|
||||
|
|
|
@ -34,7 +34,7 @@ import de.danoeh.antennapod.core.event.DownloadEvent;
|
|||
import de.danoeh.antennapod.core.event.DownloaderUpdate;
|
||||
import de.danoeh.antennapod.core.feed.util.PlaybackSpeedUtils;
|
||||
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.storage.DBReader;
|
||||
import de.danoeh.antennapod.core.storage.DBWriter;
|
||||
|
|
|
@ -48,7 +48,7 @@ import de.danoeh.antennapod.core.event.DownloadEvent;
|
|||
import de.danoeh.antennapod.event.FeedListUpdateEvent;
|
||||
import de.danoeh.antennapod.event.UnreadItemsUpdateEvent;
|
||||
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.storage.DBReader;
|
||||
import de.danoeh.antennapod.core.storage.DBWriter;
|
||||
|
|
|
@ -16,7 +16,7 @@ import androidx.preference.PreferenceFragmentCompat;
|
|||
import androidx.preference.PreferenceScreen;
|
||||
import de.danoeh.antennapod.R;
|
||||
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.Arrays;
|
||||
|
|
|
@ -9,7 +9,7 @@ import androidx.preference.PreferenceFragmentCompat;
|
|||
import androidx.preference.PreferenceManager;
|
||||
import de.danoeh.antennapod.R;
|
||||
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.ProxyDialog;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import de.danoeh.antennapod.R;
|
|||
import de.danoeh.antennapod.activity.PreferenceActivity;
|
||||
import de.danoeh.antennapod.event.UnreadItemsUpdateEvent;
|
||||
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.VariableSpeedDialog;
|
||||
import java.util.Map;
|
||||
|
|
|
@ -4,7 +4,7 @@ import android.os.Bundle;
|
|||
import androidx.preference.PreferenceFragmentCompat;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.activity.PreferenceActivity;
|
||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.storage.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.dialog.ChooseDataFolderDialog;
|
||||
|
||||
import java.io.File;
|
||||
|
|
|
@ -11,7 +11,7 @@ import androidx.core.app.ActivityCompat;
|
|||
import androidx.preference.PreferenceFragmentCompat;
|
||||
import de.danoeh.antennapod.R;
|
||||
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.FeedSortDialog;
|
||||
import de.danoeh.antennapod.dialog.SubscriptionsFilterDialog;
|
||||
|
|
|
@ -15,7 +15,7 @@ import com.google.android.material.snackbar.Snackbar;
|
|||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.activity.MainActivity;
|
||||
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.service.playback.PlaybackServiceInterface;
|
||||
import de.danoeh.antennapod.core.storage.DBWriter;
|
||||
|
|
|
@ -8,11 +8,11 @@ import androidx.preference.PreferenceManager;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import de.danoeh.antennapod.BuildConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.core.preferences.SleepTimerPreferences;
|
||||
import de.danoeh.antennapod.error.CrashReportWriter;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.core.preferences.UserPreferences.EnqueueLocation;
|
||||
import de.danoeh.antennapod.storage.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.storage.preferences.UserPreferences.EnqueueLocation;
|
||||
import de.danoeh.antennapod.core.util.download.AutoUpdateManager;
|
||||
import de.danoeh.antennapod.fragment.QueueFragment;
|
||||
import de.danoeh.antennapod.fragment.swipeactions.SwipeAction;
|
||||
|
@ -78,8 +78,8 @@ public class PreferenceUpgrader {
|
|||
}
|
||||
}
|
||||
if (oldVersion < 1070400) {
|
||||
int theme = UserPreferences.getTheme();
|
||||
if (theme == R.style.Theme_AntennaPod_Light) {
|
||||
UserPreferences.ThemePreference theme = UserPreferences.getTheme();
|
||||
if (theme == UserPreferences.ThemePreference.LIGHT) {
|
||||
prefs.edit().putString(UserPreferences.PREF_THEME, "system").apply();
|
||||
}
|
||||
|
||||
|
@ -126,6 +126,12 @@ public class PreferenceUpgrader {
|
|||
long value = Long.parseLong(SleepTimerPreferences.lastTimerValue());
|
||||
TimeUnit unit = timeUnits[sleepTimerPreferences.getInt("LastTimeUnit", 1)];
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import android.content.Intent;
|
|||
import android.util.Log;
|
||||
|
||||
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.core.storage.DBTasks;
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ import de.danoeh.antennapod.model.feed.FeedItem;
|
|||
import de.danoeh.antennapod.model.feed.FeedMedia;
|
||||
import de.danoeh.antennapod.model.playback.MediaType;
|
||||
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.NetworkUtils;
|
||||
import de.danoeh.antennapod.model.playback.Playable;
|
||||
|
|
|
@ -33,6 +33,7 @@ dependencies {
|
|||
implementation project(':playback:base')
|
||||
implementation project(':playback:cast')
|
||||
implementation project(':storage:database')
|
||||
implementation project(':storage:preferences')
|
||||
implementation project(':ui:app-start-intent')
|
||||
implementation project(':ui:common')
|
||||
implementation project(':ui:i18n')
|
||||
|
|
|
@ -4,7 +4,7 @@ import android.content.Context;
|
|||
import de.danoeh.antennapod.core.preferences.PlaybackPreferences;
|
||||
import de.danoeh.antennapod.core.preferences.SleepTimerPreferences;
|
||||
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.net.download.serviceinterface.DownloadServiceInterface;
|
||||
import de.danoeh.antennapod.core.service.download.DownloadServiceInterfaceImpl;
|
||||
|
|
|
@ -5,7 +5,7 @@ import androidx.annotation.Nullable;
|
|||
|
||||
import de.danoeh.antennapod.model.feed.FeedItem;
|
||||
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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,7 +6,7 @@ import de.danoeh.antennapod.model.feed.FeedItem;
|
|||
import de.danoeh.antennapod.model.feed.FeedMedia;
|
||||
import de.danoeh.antennapod.model.playback.MediaType;
|
||||
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 static de.danoeh.antennapod.model.feed.FeedPreferences.SPEED_USE_GLOBAL;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -8,7 +8,7 @@ import androidx.work.Worker;
|
|||
import androidx.work.WorkerParameters;
|
||||
|
||||
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.util.NetworkUtils;
|
||||
import de.danoeh.antennapod.core.util.download.AutoUpdateManager;
|
||||
|
|
|
@ -2,7 +2,7 @@ package de.danoeh.antennapod.core.service.download;
|
|||
|
||||
import android.util.Log;
|
||||
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.model.feed.Feed;
|
||||
import de.danoeh.antennapod.model.feed.FeedMedia;
|
||||
|
|
|
@ -45,7 +45,7 @@ import de.danoeh.antennapod.event.FeedItemEvent;
|
|||
import de.danoeh.antennapod.model.feed.Feed;
|
||||
import de.danoeh.antennapod.model.feed.FeedItem;
|
||||
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.FeedSyncTask;
|
||||
import de.danoeh.antennapod.core.service.download.handler.MediaDownloadedHandler;
|
||||
|
|
|
@ -36,7 +36,7 @@ import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory;
|
|||
import com.google.android.exoplayer2.upstream.HttpDataSource;
|
||||
import de.danoeh.antennapod.core.ClientConfig;
|
||||
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.HttpCredentialEncoder;
|
||||
import de.danoeh.antennapod.core.util.NetworkUtils;
|
||||
|
|
|
@ -39,7 +39,7 @@ import de.danoeh.antennapod.model.feed.FeedPreferences;
|
|||
import de.danoeh.antennapod.model.playback.MediaType;
|
||||
import de.danoeh.antennapod.model.feed.VolumeAdaptionSetting;
|
||||
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.core.util.playback.AudioPlayer;
|
||||
import de.danoeh.antennapod.core.util.playback.IPlayer;
|
||||
|
|
|
@ -73,7 +73,7 @@ import de.danoeh.antennapod.event.settings.SpeedPresetChangedEvent;
|
|||
import de.danoeh.antennapod.event.settings.VolumeAdaptionChangedEvent;
|
||||
import de.danoeh.antennapod.core.preferences.PlaybackPreferences;
|
||||
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.storage.DBReader;
|
||||
import de.danoeh.antennapod.core.storage.DBWriter;
|
||||
|
|
|
@ -20,7 +20,7 @@ import androidx.core.content.ContextCompat;
|
|||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
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.util.Converter;
|
||||
import de.danoeh.antennapod.core.feed.util.ImageResourceUtils;
|
||||
|
|
|
@ -13,7 +13,7 @@ import de.danoeh.antennapod.net.download.serviceinterface.DownloadServiceInterfa
|
|||
import de.danoeh.antennapod.core.util.PlaybackStatus;
|
||||
import de.danoeh.antennapod.model.feed.FeedItem;
|
||||
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.PowerUtils;
|
||||
|
||||
|
@ -80,7 +80,7 @@ public class AutomaticDownloadAlgorithm {
|
|||
int deletedEpisodes = EpisodeCleanupAlgorithmFactory.build()
|
||||
.makeRoomForEpisodes(context, autoDownloadableEpisodes);
|
||||
boolean cacheIsUnlimited =
|
||||
UserPreferences.getEpisodeCacheSize() == UserPreferences.getEpisodeCacheSizeUnlimited();
|
||||
UserPreferences.getEpisodeCacheSize() == UserPreferences.EPISODE_CACHE_SIZE_UNLIMITED;
|
||||
int episodeCacheSize = UserPreferences.getEpisodeCacheSize();
|
||||
|
||||
int episodeSpaceLeft;
|
||||
|
|
|
@ -21,7 +21,7 @@ import de.danoeh.antennapod.model.feed.FeedItemFilter;
|
|||
import de.danoeh.antennapod.model.feed.FeedMedia;
|
||||
import de.danoeh.antennapod.model.feed.FeedPreferences;
|
||||
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.storage.database.PodDBAdapter;
|
||||
import de.danoeh.antennapod.storage.database.mapper.DownloadStatusCursorMapper;
|
||||
|
|
|
@ -33,7 +33,7 @@ import de.danoeh.antennapod.core.R;
|
|||
import de.danoeh.antennapod.event.FeedItemEvent;
|
||||
import de.danoeh.antennapod.event.FeedListUpdateEvent;
|
||||
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.core.sync.queue.SynchronizationQueueSink;
|
||||
import de.danoeh.antennapod.model.download.DownloadError;
|
||||
|
|
|
@ -35,7 +35,7 @@ import de.danoeh.antennapod.event.QueueEvent;
|
|||
import de.danoeh.antennapod.event.UnreadItemsUpdateEvent;
|
||||
import de.danoeh.antennapod.core.feed.FeedEvent;
|
||||
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.core.sync.queue.SynchronizationQueueSink;
|
||||
import de.danoeh.antennapod.core.util.FeedItemPermutors;
|
||||
|
|
|
@ -2,7 +2,7 @@ package de.danoeh.antennapod.core.storage;
|
|||
|
||||
import android.content.Context;
|
||||
|
||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.storage.preferences.UserPreferences;
|
||||
|
||||
public abstract class EpisodeCleanupAlgorithm {
|
||||
|
||||
|
@ -50,8 +50,7 @@ public abstract class EpisodeCleanupAlgorithm {
|
|||
*/
|
||||
int getNumEpisodesToCleanup(final int amountOfRoomNeeded) {
|
||||
if (amountOfRoomNeeded >= 0
|
||||
&& UserPreferences.getEpisodeCacheSize() != UserPreferences
|
||||
.getEpisodeCacheSizeUnlimited()) {
|
||||
&& UserPreferences.getEpisodeCacheSize() != UserPreferences.EPISODE_CACHE_SIZE_UNLIMITED) {
|
||||
int downloadedEpisodes = DBReader
|
||||
.getNumberOfDownloadedEpisodes();
|
||||
if (downloadedEpisodes + amountOfRoomNeeded >= UserPreferences
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
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 static EpisodeCleanupAlgorithm build() {
|
||||
|
|
|
@ -13,7 +13,7 @@ import java.util.Locale;
|
|||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
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.
|
||||
|
@ -88,7 +88,7 @@ public class ExceptFavoriteCleanupAlgorithm extends EpisodeCleanupAlgorithm {
|
|||
@Override
|
||||
public int getDefaultCleanupParameter() {
|
||||
int cacheSize = UserPreferences.getEpisodeCacheSize();
|
||||
if (cacheSize != UserPreferences.getEpisodeCacheSizeUnlimited()) {
|
||||
if (cacheSize != UserPreferences.EPISODE_CACHE_SIZE_UNLIMITED) {
|
||||
int downloadedEpisodes = DBReader.getNumberOfDownloadedEpisodes();
|
||||
if (downloadedEpisodes > cacheSize) {
|
||||
return downloadedEpisodes - cacheSize;
|
||||
|
|
|
@ -10,7 +10,7 @@ import java.util.List;
|
|||
import de.danoeh.antennapod.core.service.download.DownloadService;
|
||||
import de.danoeh.antennapod.model.feed.FeedItem;
|
||||
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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -34,7 +34,7 @@ import java.util.concurrent.TimeUnit;
|
|||
|
||||
import de.danoeh.antennapod.core.R;
|
||||
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.storage.DBReader;
|
||||
import de.danoeh.antennapod.core.storage.DBTasks;
|
||||
|
|
|
@ -3,7 +3,7 @@ package de.danoeh.antennapod.core.sync;
|
|||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,7 +3,7 @@ package de.danoeh.antennapod.core.util;
|
|||
import androidx.annotation.NonNull;
|
||||
|
||||
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 java.util.ArrayList;
|
||||
|
|
|
@ -12,7 +12,7 @@ import java.util.List;
|
|||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.storage.preferences.UserPreferences;
|
||||
|
||||
public class NetworkUtils {
|
||||
private static final String REGEX_PATTERN_IP_ADDRESS = "([0-9]{1,3}[\\.]){3}[0-9]{1,3}";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package de.danoeh.antennapod.core.util;
|
||||
|
||||
import android.os.StatFs;
|
||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.storage.preferences.UserPreferences;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package de.danoeh.antennapod.core.util;
|
||||
|
||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.storage.preferences.UserPreferences;
|
||||
|
||||
public class TimeSpeedConverter {
|
||||
private final float speed;
|
||||
|
|
|
@ -19,7 +19,7 @@ import java.util.Calendar;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
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.storage.DBTasks;
|
||||
import de.danoeh.antennapod.core.util.NetworkUtils;
|
||||
|
|
|
@ -10,7 +10,7 @@ import java.util.Arrays;
|
|||
import java.util.List;
|
||||
|
||||
import de.danoeh.antennapod.core.R;
|
||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.storage.preferences.UserPreferences;
|
||||
|
||||
public class NotificationUtils {
|
||||
public static final String CHANNEL_ID_USER_ACTION = "user_action";
|
||||
|
|
|
@ -8,7 +8,7 @@ import android.view.SurfaceHolder;
|
|||
import de.danoeh.antennapod.core.ClientConfig;
|
||||
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.util.Collections;
|
||||
|
|
|
@ -21,7 +21,7 @@ import de.danoeh.antennapod.event.playback.SpeedChangedEvent;
|
|||
import de.danoeh.antennapod.model.playback.MediaType;
|
||||
import de.danoeh.antennapod.core.feed.util.PlaybackSpeedUtils;
|
||||
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.model.playback.Playable;
|
||||
import de.danoeh.antennapod.playback.base.PlaybackServiceMediaPlayer;
|
||||
|
|
|
@ -17,7 +17,7 @@ import com.bumptech.glide.Glide;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
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.core.receiver.MediaButtonReceiver;
|
||||
import de.danoeh.antennapod.core.receiver.PlayerWidget;
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
<resources>
|
||||
<integer name="episode_cache_size_unlimited">-1</integer>
|
||||
<integer name="fragment_transition_duration">300</integer>
|
||||
</resources>
|
||||
|
|
|
@ -34,7 +34,7 @@ import java.util.Objects;
|
|||
|
||||
import de.danoeh.antennapod.core.ApplicationCallbacks;
|
||||
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.DBWriter;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ import de.danoeh.antennapod.model.feed.Feed;
|
|||
import de.danoeh.antennapod.model.feed.FeedItem;
|
||||
import de.danoeh.antennapod.model.feed.FeedMedia;
|
||||
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 org.junit.After;
|
||||
|
|
|
@ -14,7 +14,7 @@ import androidx.test.platform.app.InstrumentationRegistry;
|
|||
import de.danoeh.antennapod.model.feed.Feed;
|
||||
import de.danoeh.antennapod.model.feed.FeedItem;
|
||||
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 org.junit.After;
|
||||
import org.junit.Before;
|
||||
|
|
|
@ -7,7 +7,7 @@ import java.util.List;
|
|||
|
||||
import de.danoeh.antennapod.model.feed.Feed;
|
||||
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.runner.RunWith;
|
||||
|
|
|
@ -13,7 +13,7 @@ import androidx.test.platform.app.InstrumentationRegistry;
|
|||
import de.danoeh.antennapod.model.feed.Feed;
|
||||
import de.danoeh.antennapod.model.feed.FeedItem;
|
||||
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.storage.database.PodDBAdapter;
|
||||
import org.junit.After;
|
||||
|
|
|
@ -24,7 +24,7 @@ import de.danoeh.antennapod.model.feed.Feed;
|
|||
import de.danoeh.antennapod.model.feed.FeedItem;
|
||||
import de.danoeh.antennapod.model.feed.FeedMedia;
|
||||
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 java.util.Collections.singletonList;
|
||||
|
|
|
@ -34,7 +34,7 @@ import de.danoeh.antennapod.model.feed.Feed;
|
|||
import de.danoeh.antennapod.model.feed.FeedItem;
|
||||
import de.danoeh.antennapod.model.feed.FeedMedia;
|
||||
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 static org.junit.Assert.assertEquals;
|
||||
|
|
|
@ -11,7 +11,7 @@ import java.util.List;
|
|||
|
||||
import de.danoeh.antennapod.model.feed.Feed;
|
||||
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.assertTrue;
|
||||
|
|
|
@ -19,14 +19,14 @@ import de.danoeh.antennapod.model.feed.FeedComponent;
|
|||
import de.danoeh.antennapod.model.feed.FeedItem;
|
||||
import de.danoeh.antennapod.model.feed.FeedMedia;
|
||||
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 org.mockito.MockedStatic;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
import static de.danoeh.antennapod.core.preferences.UserPreferences.EnqueueLocation.AFTER_CURRENTLY_PLAYING;
|
||||
import static de.danoeh.antennapod.core.preferences.UserPreferences.EnqueueLocation.BACK;
|
||||
import static de.danoeh.antennapod.core.preferences.UserPreferences.EnqueueLocation.FRONT;
|
||||
import static de.danoeh.antennapod.storage.preferences.UserPreferences.EnqueueLocation.AFTER_CURRENTLY_PLAYING;
|
||||
import static de.danoeh.antennapod.storage.preferences.UserPreferences.EnqueueLocation.BACK;
|
||||
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.list;
|
||||
import static de.danoeh.antennapod.core.util.FeedItemUtil.getIdList;
|
||||
|
|
|
@ -17,6 +17,7 @@ include ':playback:base'
|
|||
include ':playback:cast'
|
||||
|
||||
include ':storage:database'
|
||||
include ':storage:preferences'
|
||||
|
||||
include ':ui:app-start-intent'
|
||||
include ':ui:common'
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
# :storage:preferences
|
||||
|
||||
User settings, but not the actual subscription database.
|
|
@ -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"
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
<manifest package="de.danoeh.antennapod.storage.preferences" />
|
|
@ -1,8 +1,7 @@
|
|||
package de.danoeh.antennapod.core.preferences;
|
||||
package de.danoeh.antennapod.storage.preferences;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Build;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
@ -30,7 +29,6 @@ import java.util.Locale;
|
|||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import de.danoeh.antennapod.core.R;
|
||||
import de.danoeh.antennapod.model.feed.FeedCounter;
|
||||
import de.danoeh.antennapod.model.playback.MediaType;
|
||||
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_FAST_FORWARD = 1;
|
||||
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_ALPHABETICAL = 1;
|
||||
public static final int FEED_ORDER_MOST_PLAYED = 3;
|
||||
|
@ -155,34 +153,20 @@ public class UserPreferences {
|
|||
createNoMediaFile();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns theme as R.style value
|
||||
*
|
||||
* @return R.style.Theme_AntennaPod_Light or R.style.Theme_AntennaPod_Dark
|
||||
*/
|
||||
public static int getTheme() {
|
||||
return readThemeValue(prefs.getString(PREF_THEME, "system"));
|
||||
public enum ThemePreference {
|
||||
LIGHT, DARK, BLACK, SYSTEM
|
||||
}
|
||||
|
||||
public static int getNoTitleTheme() {
|
||||
int theme = getTheme();
|
||||
if (theme == R.style.Theme_AntennaPod_Dark) {
|
||||
return R.style.Theme_AntennaPod_Dark_NoTitle;
|
||||
} else if (theme == R.style.Theme_AntennaPod_TrueBlack) {
|
||||
return R.style.Theme_AntennaPod_TrueBlack_NoTitle;
|
||||
} else {
|
||||
return R.style.Theme_AntennaPod_Light_NoTitle;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
public static ThemePreference getTheme() {
|
||||
switch (prefs.getString(PREF_THEME, "system")) {
|
||||
case "0":
|
||||
return ThemePreference.LIGHT;
|
||||
case "1":
|
||||
return ThemePreference.DARK;
|
||||
case "2":
|
||||
return ThemePreference.BLACK;
|
||||
default:
|
||||
return ThemePreference.SYSTEM;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -551,17 +535,13 @@ public class UserPreferences {
|
|||
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
|
||||
* negative integer EPISODE_CACHE_SIZE_UNLIMITED if the cache size is set to
|
||||
* 'unlimited'.
|
||||
*/
|
||||
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() {
|
||||
|
@ -744,36 +724,11 @@ public class UserPreferences {
|
|||
.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) {
|
||||
int hours = Integer.parseInt(valueFromPrefs);
|
||||
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) {
|
||||
if (valueFromPrefs != null) {
|
||||
try {
|
|
@ -7,6 +7,7 @@ apply from: "../../playFlavor.gradle"
|
|||
dependencies {
|
||||
implementation project(":model")
|
||||
implementation project(":core")
|
||||
implementation project(':storage:preferences')
|
||||
|
||||
implementation "androidx.palette:palette:$paletteVersion"
|
||||
|
||||
|
|
|
@ -13,8 +13,7 @@ import androidx.palette.graphics.Palette;
|
|||
import com.bumptech.glide.load.Options;
|
||||
import com.bumptech.glide.load.engine.Resource;
|
||||
import com.bumptech.glide.load.resource.transcode.ResourceTranscoder;
|
||||
|
||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.storage.preferences.UserPreferences;
|
||||
|
||||
public class PaletteBitmapTranscoder implements ResourceTranscoder<Bitmap, PaletteBitmap> {
|
||||
|
||||
|
|
Loading…
Reference in New Issue