diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/activity/PreferenceActivity.java | 55 | ||||
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/preferences/PreferenceController.java | 422 | ||||
-rw-r--r-- | app/src/main/res/xml/preferences.xml | 372 | ||||
-rw-r--r-- | app/src/main/res/xml/preferences_downloads.xml | 75 | ||||
-rw-r--r-- | app/src/main/res/xml/preferences_playback.xml | 128 | ||||
-rw-r--r-- | app/src/main/res/xml/preferences_services.xml | 63 | ||||
-rw-r--r-- | app/src/main/res/xml/preferences_storage.xml | 43 | ||||
-rw-r--r-- | app/src/main/res/xml/preferences_user_interface.xml | 60 |
8 files changed, 705 insertions, 513 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/activity/PreferenceActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/PreferenceActivity.java index 12d918a76..5fe5bc334 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/PreferenceActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/PreferenceActivity.java @@ -24,13 +24,20 @@ import de.danoeh.antennapod.preferences.PreferenceController; */ public class PreferenceActivity extends AppCompatActivity { + public static final String PARAM_RESOURCE = "resource"; private static WeakReference<PreferenceActivity> instance; private PreferenceController preferenceController; - private MainFragment prefFragment; private final PreferenceController.PreferenceUI preferenceUI = new PreferenceController.PreferenceUI() { + private PreferenceFragment fragment; + + @Override + public void setFragment(PreferenceFragment fragment) { + this.fragment = fragment; + } + @Override public Preference findPreference(CharSequence key) { - return prefFragment.findPreference(key); + return fragment.findPreference(key); } @Override @@ -64,7 +71,11 @@ public class PreferenceActivity extends AppCompatActivity { // since the MainFragment depends on the preferenceController already being created preferenceController = new PreferenceController(preferenceUI); - prefFragment = new MainFragment(); + PreferenceFragment prefFragment = new MainFragment(); + preferenceUI.setFragment(prefFragment); + Bundle args = new Bundle(); + args.putInt(PARAM_RESOURCE, R.xml.preferences); + prefFragment.setArguments(args); getFragmentManager().beginTransaction().replace(R.id.content, prefFragment).commit(); } @@ -84,7 +95,11 @@ public class PreferenceActivity extends AppCompatActivity { public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: - finish(); + if (getFragmentManager().getBackStackEntryCount() == 0) { + finish(); + } else { + getFragmentManager().popBackStack(); + } return true; default: return false; @@ -97,10 +112,11 @@ public class PreferenceActivity extends AppCompatActivity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setRetainInstance(true); - addPreferencesFromResource(R.xml.preferences); + addPreferencesFromResource(getArguments().getInt(PARAM_RESOURCE)); PreferenceActivity activity = instance.get(); - if(activity != null && activity.preferenceController != null) { - activity.preferenceController.onCreate(); + if (activity != null && activity.preferenceController != null) { + activity.preferenceUI.setFragment(this); + activity.preferenceController.onCreate(getArguments().getInt(PARAM_RESOURCE)); } } @@ -109,7 +125,26 @@ public class PreferenceActivity extends AppCompatActivity { super.onResume(); PreferenceActivity activity = instance.get(); if(activity != null && activity.preferenceController != null) { - activity.preferenceController.onResume(); + activity.setTitle(getTitle(getArguments().getInt(PARAM_RESOURCE))); + activity.preferenceUI.setFragment(this); + activity.preferenceController.onResume(getArguments().getInt(PARAM_RESOURCE)); + } + } + + private int getTitle(int preferences) { + switch (preferences) { + case R.xml.preferences_downloads: + return R.string.downloads_label; + case R.xml.preferences_playback: + return R.string.playback_pref; + case R.xml.preferences_storage: + return R.string.storage_pref; + case R.xml.preferences_user_interface: + return R.string.user_interface_label; + case R.xml.preferences_services: + return R.string.services_label; + default: + return R.string.settings_label; } } @@ -117,7 +152,8 @@ public class PreferenceActivity extends AppCompatActivity { public void onPause() { PreferenceActivity activity = instance.get(); if(activity != null && activity.preferenceController != null) { - activity.preferenceController.onPause(); + activity.preferenceUI.setFragment(this); + activity.preferenceController.onPause(getArguments().getInt(PARAM_RESOURCE)); } super.onPause(); } @@ -126,6 +162,7 @@ public class PreferenceActivity extends AppCompatActivity { public void onStop() { PreferenceActivity activity = instance.get(); if(activity != null && activity.preferenceController != null) { + activity.preferenceUI.setFragment(this); activity.preferenceController.onStop(); } super.onStop(); diff --git a/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceController.java b/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceController.java index 0e9cf73e0..407ab0bdb 100644 --- a/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceController.java +++ b/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceController.java @@ -3,6 +3,7 @@ package de.danoeh.antennapod.preferences; import android.Manifest; import android.annotation.SuppressLint; import android.app.Activity; +import android.app.Fragment; import android.app.ProgressDialog; import android.app.TimePickerDialog; import android.content.ActivityNotFoundException; @@ -16,10 +17,12 @@ import android.net.Uri; import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiManager; import android.os.Build; +import android.os.Bundle; import android.preference.CheckBoxPreference; import android.preference.EditTextPreference; import android.preference.ListPreference; import android.preference.Preference; +import android.preference.PreferenceFragment; import android.preference.PreferenceManager; import android.preference.PreferenceScreen; import android.support.design.widget.Snackbar; @@ -38,9 +41,21 @@ import android.widget.Toast; import com.afollestad.materialdialogs.MaterialDialog; +import de.danoeh.antennapod.activity.AboutActivity; import com.afollestad.materialdialogs.prefs.MaterialListPreference; import de.danoeh.antennapod.activity.ImportExportActivity; +import de.danoeh.antennapod.activity.MediaplayerActivity; import de.danoeh.antennapod.activity.OpmlImportFromPathActivity; +import de.danoeh.antennapod.activity.PreferenceActivity; +import de.danoeh.antennapod.activity.StatisticsActivity; +import de.danoeh.antennapod.core.export.html.HtmlWriter; +import de.danoeh.antennapod.core.export.opml.OpmlWriter; +import de.danoeh.antennapod.core.service.GpodnetSyncService; +import de.danoeh.antennapod.dialog.AuthenticationDialog; +import de.danoeh.antennapod.dialog.AutoFlattrPreferenceDialog; +import de.danoeh.antennapod.dialog.GpodnetSetHostnameDialog; +import de.danoeh.antennapod.dialog.ProxyDialog; +import de.danoeh.antennapod.dialog.VariableSpeedDialog; import de.danoeh.antennapod.core.util.gui.PictureInPictureUtil; import org.apache.commons.lang3.ArrayUtils; @@ -55,30 +70,21 @@ import java.util.concurrent.TimeUnit; import de.danoeh.antennapod.CrashReportWriter; import de.danoeh.antennapod.R; -import de.danoeh.antennapod.activity.AboutActivity; import de.danoeh.antennapod.activity.DirectoryChooserActivity; import de.danoeh.antennapod.activity.MainActivity; -import de.danoeh.antennapod.activity.MediaplayerActivity; -import de.danoeh.antennapod.activity.StatisticsActivity; import de.danoeh.antennapod.asynctask.ExportWorker; import de.danoeh.antennapod.core.export.ExportWriter; -import de.danoeh.antennapod.core.export.html.HtmlWriter; -import de.danoeh.antennapod.core.export.opml.OpmlWriter; import de.danoeh.antennapod.core.preferences.GpodnetPreferences; import de.danoeh.antennapod.core.preferences.UserPreferences; -import de.danoeh.antennapod.core.service.GpodnetSyncService; import de.danoeh.antennapod.core.util.flattr.FlattrUtils; -import de.danoeh.antennapod.dialog.AuthenticationDialog; -import de.danoeh.antennapod.dialog.AutoFlattrPreferenceDialog; import de.danoeh.antennapod.dialog.ChooseDataFolderDialog; -import de.danoeh.antennapod.dialog.GpodnetSetHostnameDialog; -import de.danoeh.antennapod.dialog.ProxyDialog; -import de.danoeh.antennapod.dialog.VariableSpeedDialog; import rx.Observable; import rx.Subscription; import rx.android.schedulers.AndroidSchedulers; import rx.schedulers.Schedulers; +import static de.danoeh.antennapod.activity.PreferenceActivity.PARAM_RESOURCE; + /** * Sets up a preference UI that lets the user change user preferences. */ @@ -87,6 +93,12 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc private static final String TAG = "PreferenceController"; + private static final String PREF_SCREEN_USER_INTERFACE = "prefScreenInterface"; + private static final String PREF_SCREEN_PLAYBACK = "prefScreenPlayback"; + private static final String PREF_SCREEN_DOWNLOADS = "prefScreenDownloads"; + private static final String PREF_SCREEN_SERVICES = "prefScreenServices"; + private static final String PREF_SCREEN_STORAGE = "prefScreenStorage"; + private static final String PREF_FLATTR_SETTINGS = "prefFlattrSettings"; private static final String PREF_FLATTR_AUTH = "pref_flattr_authenticate"; private static final String PREF_FLATTR_REVOKE = "prefRevokeAccess"; @@ -145,7 +157,37 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc } } - public void onCreate() { + + + public void onCreate(int screen) { + switch (screen) { + case R.xml.preferences: + setupMainScreen(); + break; + case R.xml.preferences_downloads: + setupDownloadsScreen(); + buildAutodownloadSelectedNetworsPreference(); + setSelectedNetworksEnabled(UserPreferences.isEnableAutodownloadWifiFilter()); + buildEpisodeCleanupPreference(); + break; + case R.xml.preferences_playback: + setupPlaybackScreen(); + PreferenceControllerFlavorHelper.setupFlavoredUI(ui); + buildSmartMarkAsPlayedPreference(); + break; + case R.xml.preferences_services: + setupServicesScreen(); + break; + case R.xml.preferences_storage: + setupStorageScreen(); + break; + case R.xml.preferences_user_interface: + setupInterfaceScreen(); + break; + } + } + + private void setupInterfaceScreen() { final Activity activity = ui.getActivity(); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { @@ -160,25 +202,34 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc } ); } - ui.findPreference(PreferenceController.PREF_FLATTR_REVOKE).setOnPreferenceClickListener( - preference -> { - FlattrUtils.revokeAccessToken(activity); - checkItemVisibility(); - return true; - } - ); - ui.findPreference(PreferenceController.PREF_ABOUT).setOnPreferenceClickListener( - preference -> { - activity.startActivity(new Intent(activity, AboutActivity.class)); + ui.findPreference(UserPreferences.PREF_THEME) + .setOnPreferenceChangeListener( + (preference, newValue) -> { + Intent i = new Intent(activity, MainActivity.class); + i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK + | Intent.FLAG_ACTIVITY_NEW_TASK); + activity.finish(); + activity.startActivity(i); + return true; + } + ); + ui.findPreference(UserPreferences.PREF_HIDDEN_DRAWER_ITEMS) + .setOnPreferenceClickListener(preference -> { + showDrawerPreferencesDialog(); return true; - } - ); - ui.findPreference(PreferenceController.STATISTICS).setOnPreferenceClickListener( - preference -> { - activity.startActivity(new Intent(activity, StatisticsActivity.class)); + }); + + ui.findPreference(UserPreferences.PREF_COMPACT_NOTIFICATION_BUTTONS) + .setOnPreferenceClickListener(preference -> { + showNotificationButtonsDialog(); return true; - } - ); + }); + + } + + private void setupStorageScreen() { + final Activity activity = ui.getActivity(); + ui.findPreference(PreferenceController.IMPORT_EXPORT).setOnPreferenceClickListener( preference -> { activity.startActivity(new Intent(activity, ImportExportActivity.class)); @@ -227,35 +278,132 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc return true; } ); - ui.findPreference(UserPreferences.PREF_THEME) - .setOnPreferenceChangeListener( - (preference, newValue) -> { - Intent i = new Intent(activity, MainActivity.class); - i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK - | Intent.FLAG_ACTIVITY_NEW_TASK); - activity.finish(); - activity.startActivity(i); - return true; + ui.findPreference(UserPreferences.PREF_IMAGE_CACHE_SIZE).setOnPreferenceChangeListener( + (preference, o) -> { + if (o instanceof String) { + int newValue = Integer.parseInt((String) o) * 1024 * 1024; + if (newValue != UserPreferences.getImageCacheSize()) { + AlertDialog.Builder dialog = new AlertDialog.Builder(ui.getActivity()); + dialog.setTitle(android.R.string.dialog_alert_title); + dialog.setMessage(R.string.pref_restart_required); + dialog.setPositiveButton(android.R.string.ok, null); + dialog.show(); } - ); - ui.findPreference(UserPreferences.PREF_HIDDEN_DRAWER_ITEMS) + return true; + } + return false; + } + ); + } + + private void setupServicesScreen() { + final Activity activity = ui.getActivity(); + + ui.findPreference(PreferenceController.PREF_FLATTR_REVOKE).setOnPreferenceClickListener( + preference -> { + FlattrUtils.revokeAccessToken(activity); + checkFlattrItemVisibility(); + return true; + } + ); + ui.findPreference(PreferenceController.PREF_GPODNET_SETLOGIN_INFORMATION) .setOnPreferenceClickListener(preference -> { - showDrawerPreferencesDialog(); + AuthenticationDialog dialog = new AuthenticationDialog(activity, + R.string.pref_gpodnet_setlogin_information_title, false, false, GpodnetPreferences.getUsername(), + null) { + + @Override + protected void onConfirmed(String username, String password, boolean saveUsernamePassword) { + GpodnetPreferences.setPassword(password); + } + }; + dialog.show(); + return true; + }); + ui.findPreference(PreferenceController.PREF_GPODNET_SYNC). + setOnPreferenceClickListener(preference -> { + GpodnetSyncService.sendSyncIntent(ui.getActivity().getApplicationContext()); + Toast toast = Toast.makeText(ui.getActivity(), R.string.pref_gpodnet_sync_started, + Toast.LENGTH_SHORT); + toast.show(); + return true; + }); + ui.findPreference(PreferenceController.PREF_GPODNET_FORCE_FULL_SYNC). + setOnPreferenceClickListener(preference -> { + GpodnetPreferences.setLastSubscriptionSyncTimestamp(0L); + GpodnetPreferences.setLastEpisodeActionsSyncTimestamp(0L); + GpodnetPreferences.setLastSyncAttempt(false, 0); + updateLastGpodnetSyncReport(false, 0); + GpodnetSyncService.sendSyncIntent(ui.getActivity().getApplicationContext()); + Toast toast = Toast.makeText(ui.getActivity(), R.string.pref_gpodnet_sync_started, + Toast.LENGTH_SHORT); + toast.show(); + return true; + }); + ui.findPreference(PreferenceController.PREF_GPODNET_LOGOUT).setOnPreferenceClickListener( + preference -> { + GpodnetPreferences.logout(); + Toast toast = Toast.makeText(activity, R.string.pref_gpodnet_logout_toast, Toast.LENGTH_SHORT); + toast.show(); + updateGpodnetPreferenceScreen(); + return true; + }); + ui.findPreference(PreferenceController.PREF_GPODNET_HOSTNAME).setOnPreferenceClickListener( + preference -> { + GpodnetSetHostnameDialog.createDialog(activity).setOnDismissListener(dialog -> updateGpodnetPreferenceScreen()); return true; }); - ui.findPreference(UserPreferences.PREF_COMPACT_NOTIFICATION_BUTTONS) + ui.findPreference(PreferenceController.PREF_AUTO_FLATTR_PREFS) .setOnPreferenceClickListener(preference -> { - showNotificationButtonsDialog(); + AutoFlattrPreferenceDialog.newAutoFlattrPreferenceDialog(activity, + new AutoFlattrPreferenceDialog.AutoFlattrPreferenceDialogInterface() { + @Override + public void onCancelled() { + + } + + @Override + public void onConfirmed(boolean autoFlattrEnabled, float autoFlattrValue) { + UserPreferences.setAutoFlattrSettings(autoFlattrEnabled, autoFlattrValue); + checkFlattrItemVisibility(); + } + }); + return true; + }); + } + + private void setupPlaybackScreen() { + final Activity activity = ui.getActivity(); + + ui.findPreference(PreferenceController.PREF_PLAYBACK_SPEED_LAUNCHER) + .setOnPreferenceClickListener(preference -> { + VariableSpeedDialog.showDialog(activity); + return true; + }); + ui.findPreference(PreferenceController.PREF_PLAYBACK_REWIND_DELTA_LAUNCHER) + .setOnPreferenceClickListener(preference -> { + MediaplayerActivity.showSkipPreference(activity, MediaplayerActivity.SkipDirection.SKIP_REWIND); + return true; + }); + ui.findPreference(PreferenceController.PREF_PLAYBACK_FAST_FORWARD_DELTA_LAUNCHER) + .setOnPreferenceClickListener(preference -> { + MediaplayerActivity.showSkipPreference(activity, MediaplayerActivity.SkipDirection.SKIP_FORWARD); return true; }); + if (!PictureInPictureUtil.supportsPictureInPicture(activity)) { + MaterialListPreference behaviour = (MaterialListPreference) ui.findPreference(UserPreferences.PREF_VIDEO_BEHAVIOR); + behaviour.setEntries(R.array.video_background_behavior_options_without_pip); + behaviour.setEntryValues(R.array.video_background_behavior_values_without_pip); + } + } + private void setupDownloadsScreen() { ui.findPreference(UserPreferences.PREF_UPDATE_INTERVAL) .setOnPreferenceClickListener(preference -> { showUpdateIntervalTimePreferencesDialog(); return true; }); - ui.findPreference(UserPreferences.PREF_ENABLE_AUTODL).setOnPreferenceChangeListener( (preference, newValue) -> { if (newValue instanceof Boolean) { @@ -332,112 +480,38 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc return true; } ); - ui.findPreference(PreferenceController.PREF_PLAYBACK_SPEED_LAUNCHER) - .setOnPreferenceClickListener(preference -> { - VariableSpeedDialog.showDialog(activity); - return true; - }); - ui.findPreference(PreferenceController.PREF_PLAYBACK_REWIND_DELTA_LAUNCHER) - .setOnPreferenceClickListener(preference -> { - MediaplayerActivity.showSkipPreference(activity, MediaplayerActivity.SkipDirection.SKIP_REWIND); - return true; - }); - ui.findPreference(PreferenceController.PREF_PLAYBACK_FAST_FORWARD_DELTA_LAUNCHER) - .setOnPreferenceClickListener(preference -> { - MediaplayerActivity.showSkipPreference(activity, MediaplayerActivity.SkipDirection.SKIP_FORWARD); - return true; - }); - ui.findPreference(PreferenceController.PREF_GPODNET_SETLOGIN_INFORMATION) - .setOnPreferenceClickListener(preference -> { - AuthenticationDialog dialog = new AuthenticationDialog(activity, - R.string.pref_gpodnet_setlogin_information_title, false, false, GpodnetPreferences.getUsername(), - null) { + ui.findPreference(PREF_PROXY).setOnPreferenceClickListener(preference -> { + ProxyDialog dialog = new ProxyDialog(ui.getActivity()); + dialog.createDialog().show(); + return true; + }); + } - @Override - protected void onConfirmed(String username, String password, boolean saveUsernamePassword) { - GpodnetPreferences.setPassword(password); - } - }; - dialog.show(); - return true; - }); - ui.findPreference(PreferenceController.PREF_GPODNET_SYNC). - setOnPreferenceClickListener(preference -> { - GpodnetSyncService.sendSyncIntent(ui.getActivity().getApplicationContext()); - Toast toast = Toast.makeText(ui.getActivity(), R.string.pref_gpodnet_sync_started, - Toast.LENGTH_SHORT); - toast.show(); - return true; - }); - ui.findPreference(PreferenceController.PREF_GPODNET_FORCE_FULL_SYNC). - setOnPreferenceClickListener(preference -> { - GpodnetPreferences.setLastSubscriptionSyncTimestamp(0L); - GpodnetPreferences.setLastEpisodeActionsSyncTimestamp(0L); - GpodnetPreferences.setLastSyncAttempt(false, 0); - updateLastGpodnetSyncReport(false, 0); - GpodnetSyncService.sendSyncIntent(ui.getActivity().getApplicationContext()); - Toast toast = Toast.makeText(ui.getActivity(), R.string.pref_gpodnet_sync_started, - Toast.LENGTH_SHORT); - toast.show(); - return true; - }); - ui.findPreference(PreferenceController.PREF_GPODNET_LOGOUT).setOnPreferenceClickListener( + private void setupMainScreen() { + final Activity activity = ui.getActivity(); + ui.findPreference(PREF_SCREEN_USER_INTERFACE).setOnPreferenceClickListener(preference -> + openScreen(R.xml.preferences_user_interface, activity)); + ui.findPreference(PREF_SCREEN_PLAYBACK).setOnPreferenceClickListener(preference -> + openScreen(R.xml.preferences_playback, activity)); + ui.findPreference(PREF_SCREEN_DOWNLOADS).setOnPreferenceClickListener(preference -> + openScreen(R.xml.preferences_downloads, activity)); + ui.findPreference(PREF_SCREEN_SERVICES).setOnPreferenceClickListener(preference -> + openScreen(R.xml.preferences_services, activity)); + ui.findPreference(PREF_SCREEN_STORAGE).setOnPreferenceClickListener(preference -> + openScreen(R.xml.preferences_storage, activity)); + + ui.findPreference(PreferenceController.PREF_ABOUT).setOnPreferenceClickListener( preference -> { - GpodnetPreferences.logout(); - Toast toast = Toast.makeText(activity, R.string.pref_gpodnet_logout_toast, Toast.LENGTH_SHORT); - toast.show(); - updateGpodnetPreferenceScreen(); + activity.startActivity(new Intent(activity, AboutActivity.class)); return true; - }); - ui.findPreference(PreferenceController.PREF_GPODNET_HOSTNAME).setOnPreferenceClickListener( + } + ); + ui.findPreference(PreferenceController.STATISTICS).setOnPreferenceClickListener( preference -> { - GpodnetSetHostnameDialog.createDialog(activity).setOnDismissListener(dialog -> updateGpodnetPreferenceScreen()); - return true; - }); - - ui.findPreference(PreferenceController.PREF_AUTO_FLATTR_PREFS) - .setOnPreferenceClickListener(preference -> { - AutoFlattrPreferenceDialog.newAutoFlattrPreferenceDialog(activity, - new AutoFlattrPreferenceDialog.AutoFlattrPreferenceDialogInterface() { - @Override - public void onCancelled() { - - } - - @Override - public void onConfirmed(boolean autoFlattrEnabled, float autoFlattrValue) { - UserPreferences.setAutoFlattrSettings(autoFlattrEnabled, autoFlattrValue); - checkItemVisibility(); - } - }); + activity.startActivity(new Intent(activity, StatisticsActivity.class)); return true; - }); - ui.findPreference(UserPreferences.PREF_IMAGE_CACHE_SIZE).setOnPreferenceChangeListener( - (preference, o) -> { - if (o instanceof String) { - int newValue = Integer.parseInt((String) o) * 1024 * 1024; - if (newValue != UserPreferences.getImageCacheSize()) { - AlertDialog.Builder dialog = new AlertDialog.Builder(ui.getActivity()); - dialog.setTitle(android.R.string.dialog_alert_title); - dialog.setMessage(R.string.pref_restart_required); - dialog.setPositiveButton(android.R.string.ok, null); - dialog.show(); - } - return true; - } - return false; } ); - if (!PictureInPictureUtil.supportsPictureInPicture(activity)) { - MaterialListPreference behaviour = (MaterialListPreference) ui.findPreference(UserPreferences.PREF_VIDEO_BEHAVIOR); - behaviour.setEntries(R.array.video_background_behavior_options_without_pip); - behaviour.setEntryValues(R.array.video_background_behavior_values_without_pip); - } - ui.findPreference(PREF_PROXY).setOnPreferenceClickListener(preference -> { - ProxyDialog dialog = new ProxyDialog(ui.getActivity()); - dialog.createDialog().show(); - return true; - }); ui.findPreference(PREF_KNOWN_ISSUES).setOnPreferenceClickListener(preference -> { openInBrowser("https://github.com/AntennaPod/AntennaPod/labels/bug"); return true; @@ -469,11 +543,17 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc ui.getActivity().startActivity(Intent.createChooser(emailIntent, intentTitle)); return true; }); - PreferenceControllerFlavorHelper.setupFlavoredUI(ui); - buildEpisodeCleanupPreference(); - buildSmartMarkAsPlayedPreference(); - buildAutodownloadSelectedNetworsPreference(); - setSelectedNetworksEnabled(UserPreferences.isEnableAutodownloadWifiFilter()); + } + + private boolean openScreen(int preferences, Activity activity) { + Fragment prefFragment = new PreferenceActivity.MainFragment(); + Bundle args = new Bundle(); + args.putInt(PARAM_RESOURCE, preferences); + prefFragment.setArguments(args); + activity.getFragmentManager().beginTransaction() + .replace(R.id.content, prefFragment) + .addToBackStack(TAG).commit(); + return true; } private boolean export(ExportWriter exportWriter) { @@ -529,22 +609,36 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc } } - public void onResume() { - checkItemVisibility(); - setUpdateIntervalText(); - setParallelDownloadsText(UserPreferences.getParallelDownloads()); - setEpisodeCacheSizeText(UserPreferences.getEpisodeCacheSize()); - setDataFolderText(); - GpodnetPreferences.registerOnSharedPreferenceChangeListener(gpoddernetListener); - updateGpodnetPreferenceScreen(); + public void onResume(int screen) { + switch (screen) { + case R.xml.preferences_downloads: + setUpdateIntervalText(); + setParallelDownloadsText(UserPreferences.getParallelDownloads()); + setEpisodeCacheSizeText(UserPreferences.getEpisodeCacheSize()); + checkAutodownloadItemVisibility(); + break; + case R.xml.preferences_storage: + setDataFolderText(); + break; + case R.xml.preferences_services: + GpodnetPreferences.registerOnSharedPreferenceChangeListener(gpoddernetListener); + updateGpodnetPreferenceScreen(); + checkFlattrItemVisibility(); + break; + case R.xml.preferences_playback: + checkSonicItemVisibility(); + break; + } } - public void onPause() { - GpodnetPreferences.unregisterOnSharedPreferenceChangeListener(gpoddernetListener); + public void onPause(int screen) { + if (screen == R.xml.preferences_services) { + GpodnetPreferences.unregisterOnSharedPreferenceChangeListener(gpoddernetListener); + } } public void onStop() { - if(subscription != null) { + if (subscription != null) { subscription.unsubscribe(); } } @@ -699,21 +793,23 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc } @SuppressWarnings("deprecation") - private void checkItemVisibility() { + private void checkFlattrItemVisibility() { boolean hasFlattrToken = FlattrUtils.hasToken(); ui.findPreference(PreferenceController.PREF_FLATTR_SETTINGS).setEnabled(FlattrUtils.hasAPICredentials()); ui.findPreference(PreferenceController.PREF_FLATTR_AUTH).setEnabled(!hasFlattrToken); ui.findPreference(PreferenceController.PREF_FLATTR_REVOKE).setEnabled(hasFlattrToken); ui.findPreference(PreferenceController.PREF_AUTO_FLATTR_PREFS).setEnabled(hasFlattrToken); + } + private void checkAutodownloadItemVisibility() { boolean autoDownload = UserPreferences.isEnableAutodownload(); ui.findPreference(UserPreferences.PREF_EPISODE_CACHE_SIZE).setEnabled(autoDownload); ui.findPreference(UserPreferences.PREF_ENABLE_AUTODL_ON_BATTERY).setEnabled(autoDownload); ui.findPreference(UserPreferences.PREF_ENABLE_AUTODL_WIFI_FILTER).setEnabled(autoDownload); setSelectedNetworksEnabled(autoDownload && UserPreferences.isEnableAutodownloadWifiFilter()); + } - ui.findPreference(PREF_SEND_CRASH_REPORT).setEnabled(CrashReportWriter.getFile().exists()); - + private void checkSonicItemVisibility() { if (Build.VERSION.SDK_INT >= 16) { ui.findPreference(UserPreferences.PREF_SONIC).setEnabled(true); } else { @@ -1013,6 +1109,8 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc public interface PreferenceUI { + void setFragment(PreferenceFragment fragment); + /** * Finds a preference based on its key. */ diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index 622fef05b..587c3f9df 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -1,338 +1,36 @@ <?xml version="1.0" encoding="utf-8"?> <PreferenceScreen - xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto"> - - <PreferenceCategory android:title="@string/user_interface_label"> - <com.afollestad.materialdialogs.prefs.MaterialListPreference - android:entryValues="@array/theme_values" - android:entries="@array/theme_options" - android:title="@string/pref_set_theme_title" - android:key="prefTheme" - android:summary="@string/pref_set_theme_sum" - android:defaultValue="0" - app:useStockLayout="true"/> - <PreferenceScreen - android:key="prefDrawerSettings" - android:summary="@string/pref_nav_drawer_sum" - android:title="@string/pref_nav_drawer_title"> - <Preference - android:key="prefHiddenDrawerItems" - android:summary="@string/pref_nav_drawer_items_sum" - android:title="@string/pref_nav_drawer_items_title" /> - <com.afollestad.materialdialogs.prefs.MaterialListPreference - android:entryValues="@array/nav_drawer_feed_order_values" - android:entries="@array/nav_drawer_feed_order_options" - android:title="@string/pref_nav_drawer_feed_order_title" - android:key="prefDrawerFeedOrder" - android:summary="@string/pref_nav_drawer_feed_order_sum" - android:defaultValue="0" - app:useStockLayout="true"/> - <com.afollestad.materialdialogs.prefs.MaterialListPreference - android:entryValues="@array/nav_drawer_feed_counter_values" - android:entries="@array/nav_drawer_feed_counter_options" - android:title="@string/pref_nav_drawer_feed_counter_title" - android:key="prefDrawerFeedIndicator" - android:summary="@string/pref_nav_drawer_feed_counter_sum" - android:defaultValue="0" - app:useStockLayout="true"/> - </PreferenceScreen> - <de.danoeh.antennapod.preferences.SwitchCompatPreference - android:defaultValue="false" - android:enabled="true" - android:key="prefExpandNotify" - android:summary="@string/pref_expandNotify_sum" - android:title="@string/pref_expandNotify_title"/> - <de.danoeh.antennapod.preferences.SwitchCompatPreference - android:defaultValue="true" - android:enabled="true" - android:key="prefPersistNotify" - android:summary="@string/pref_persistNotify_sum" - android:title="@string/pref_persistNotify_title"/> - <Preference - android:key="prefCompactNotificationButtons" - android:summary="@string/pref_compact_notification_buttons_sum" - android:title="@string/pref_compact_notification_buttons_title"/> - <de.danoeh.antennapod.preferences.SwitchCompatPreference - android:defaultValue="true" - android:enabled="true" - android:key="prefLockscreenBackground" - android:summary="@string/pref_lockscreen_background_sum" - android:title="@string/pref_lockscreen_background_title"/> - <de.danoeh.antennapod.preferences.SwitchCompatPreference - android:defaultValue="true" - android:enabled="true" - android:key="prefShowDownloadReport" - android:summary="@string/pref_showDownloadReport_sum" - android:title="@string/pref_showDownloadReport_title"/> - </PreferenceCategory> - - <PreferenceCategory android:title="@string/queue_label"> - <de.danoeh.antennapod.preferences.SwitchCompatPreference - android:defaultValue="false" - android:enabled="true" - android:key="prefQueueAddToFront" - android:summary="@string/pref_queueAddToFront_sum" - android:title="@string/pref_queueAddToFront_title"/> - </PreferenceCategory> - - <PreferenceCategory android:title="@string/playback_pref"> - <de.danoeh.antennapod.preferences.SwitchCompatPreference - android:defaultValue="true" - android:enabled="false" - android:key="prefSonic" - android:summary="@string/pref_sonic_message" - android:title="@string/pref_sonic_title"/> - <de.danoeh.antennapod.preferences.SwitchCompatPreference - android:defaultValue="true" - android:enabled="true" - android:key="prefPauseOnHeadsetDisconnect" - android:summary="@string/pref_pauseOnDisconnect_sum" - android:title="@string/pref_pauseOnHeadsetDisconnect_title"/> - <de.danoeh.antennapod.preferences.SwitchCompatPreference - android:defaultValue="true" - android:enabled="true" - android:dependency="prefPauseOnHeadsetDisconnect" - android:key="prefUnpauseOnHeadsetReconnect" - android:summary="@string/pref_unpauseOnHeadsetReconnect_sum" - android:title="@string/pref_unpauseOnHeadsetReconnect_title"/> - <de.danoeh.antennapod.preferences.SwitchCompatPreference - android:defaultValue="false" - android:enabled="true" - android:dependency="prefPauseOnHeadsetDisconnect" - android:key="prefUnpauseOnBluetoothReconnect" - android:summary="@string/pref_unpauseOnBluetoothReconnect_sum" - android:title="@string/pref_unpauseOnBluetoothReconnect_title"/> - <de.danoeh.antennapod.preferences.SwitchCompatPreference - android:defaultValue="false" - android:enabled="true" - android:key="prefHardwareForwardButtonSkips" - android:summary="@string/pref_hardwareForwardButtonSkips_sum" - android:title="@string/pref_hardwareForwardButtonSkips_title"/> - <Preference - android:key="prefPlaybackFastForwardDeltaLauncher" - android:summary="@string/pref_fast_forward_sum" - android:title="@string/pref_fast_forward" /> - <Preference - android:key="prefPlaybackRewindDeltaLauncher" - android:summary="@string/pref_rewind_sum" - android:title="@string/pref_rewind" /> - <de.danoeh.antennapod.preferences.SwitchCompatPreference - android:defaultValue="false" - android:enabled="true" - android:key="prefHardwarePreviousButtonRestarts" - android:summary="@string/pref_hardwarePreviousButtonRestarts_sum" - android:title="@string/pref_hardwarePreviousButtonRestarts_title"/> - <de.danoeh.antennapod.preferences.SwitchCompatPreference - android:defaultValue="true" - android:enabled="true" - android:key="prefFollowQueue" - android:summary="@string/pref_followQueue_sum" - android:title="@string/pref_followQueue_title"/> - <de.danoeh.antennapod.preferences.SwitchCompatPreference - android:defaultValue="true" - android:enabled="true" - android:key="prefSkipKeepsEpisode" - android:summary="@string/pref_skip_keeps_episodes_sum" - android:title="@string/pref_skip_keeps_episodes_title"/> - <de.danoeh.antennapod.preferences.SwitchCompatPreference - android:defaultValue="true" - android:enabled="true" - android:key="prefFavoriteKeepsEpisode" - android:summary="@string/pref_favorite_keeps_episodes_sum" - android:title="@string/pref_favorite_keeps_episodes_title"/> - <de.danoeh.antennapod.preferences.SwitchCompatPreference - android:defaultValue="false" - android:enabled="true" - android:key="prefAutoDelete" - android:summary="@string/pref_auto_delete_sum" - android:title="@string/pref_auto_delete_title"/> - <com.afollestad.materialdialogs.prefs.MaterialListPreference - android:defaultValue="30" - android:entries="@array/smart_mark_as_played_values" - android:entryValues="@array/smart_mark_as_played_values" - android:key="prefSmartMarkAsPlayedSecs" - android:summary="@string/pref_smart_mark_as_played_sum" - android:title="@string/pref_smart_mark_as_played_title" - app:useStockLayout="true"/> - <Preference - android:key="prefPlaybackSpeedLauncher" - android:summary="@string/pref_playback_speed_sum" - android:title="@string/pref_playback_speed_title" /> - <de.danoeh.antennapod.preferences.SwitchCompatPreference - android:defaultValue="false" - android:enabled="true" - android:key="prefPauseForFocusLoss" - android:summary="@string/pref_pausePlaybackForFocusLoss_sum" - android:title="@string/pref_pausePlaybackForFocusLoss_title" /> - <de.danoeh.antennapod.preferences.SwitchCompatPreference - android:defaultValue="true" - android:enabled="true" - android:key="prefResumeAfterCall" - android:summary="@string/pref_resumeAfterCall_sum" - android:title="@string/pref_resumeAfterCall_title"/> - <com.afollestad.materialdialogs.prefs.MaterialListPreference - android:defaultValue="stop" - android:entries="@array/video_background_behavior_options" - android:entryValues="@array/video_background_behavior_values" - android:key="prefVideoBehavior" - android:summary="@string/pref_videoBehavior_sum" - android:title="@string/pref_videoBehavior_title" - app:useStockLayout="true"/> - - </PreferenceCategory> - <PreferenceCategory android:title="@string/network_pref"> - <de.danoeh.antennapod.preferences.SwitchCompatPreference - android:defaultValue="true" - android:enabled="true" - android:key="prefEnqueueDownloaded" - android:summary="@string/pref_enqueue_downloaded_summary" - android:title="@string/pref_enqueue_downloaded_title" /> - <Preference - android:key="prefAutoUpdateIntervall" - android:summary="@string/pref_autoUpdateIntervallOrTime_sum" - android:title="@string/pref_autoUpdateIntervallOrTime_title"/> - <de.danoeh.antennapod.preferences.SwitchCompatPreference - android:defaultValue="false" - android:enabled="true" - android:key="prefMobileUpdate" - android:summary="@string/pref_mobileUpdate_sum" - android:title="@string/pref_mobileUpdate_title"/> - <com.afollestad.materialdialogs.prefs.MaterialListPreference - android:defaultValue="-1" - android:entries="@array/episode_cleanup_entries" - android:key="prefEpisodeCleanup" - android:title="@string/pref_episode_cleanup_title" - android:summary="@string/pref_episode_cleanup_summary" - android:entryValues="@array/episode_cleanup_values" - app:useStockLayout="true"/> - <com.afollestad.materialdialogs.prefs.MaterialEditTextPreference - android:defaultValue="4" - android:inputType="number" - android:key="prefParallelDownloads" - android:title="@string/pref_parallel_downloads_title" - app:useStockLayout="true"/> - <PreferenceScreen - android:summary="@string/pref_automatic_download_sum" - android:key="prefAutoDownloadSettings" - android:title="@string/pref_automatic_download_title"> - <de.danoeh.antennapod.preferences.SwitchCompatPreference - android:key="prefEnableAutoDl" - android:title="@string/pref_automatic_download_title" - android:defaultValue="false"/> - <com.afollestad.materialdialogs.prefs.MaterialListPreference - android:defaultValue="25" - android:entries="@array/episode_cache_size_entries" - android:key="prefEpisodeCacheSize" - android:title="@string/pref_episode_cache_title" - android:entryValues="@array/episode_cache_size_values" - app:useStockLayout="true"/> - <de.danoeh.antennapod.preferences.SwitchCompatPreference - android:key="prefEnableAutoDownloadOnBattery" - android:title="@string/pref_automatic_download_on_battery_title" - android:summary="@string/pref_automatic_download_on_battery_sum" - android:defaultValue="true"/> - <de.danoeh.antennapod.preferences.SwitchCompatPreference - android:key="prefEnableAutoDownloadOnMobile" - android:title="@string/pref_autodl_allow_on_mobile_title" - android:summary="@string/pref_autodl_allow_on_mobile_sum" - android:defaultValue="false"/> - <de.danoeh.antennapod.preferences.SwitchCompatPreference - android:key="prefEnableAutoDownloadWifiFilter" - android:title="@string/pref_autodl_wifi_filter_title" - android:summary="@string/pref_autodl_wifi_filter_sum"/> - </PreferenceScreen> - <Preference - android:key="prefProxy" - android:summary="@string/pref_proxy_sum" - android:title="@string/pref_proxy_title" /> - - </PreferenceCategory> - - <PreferenceCategory android:title="@string/services_label"> - <PreferenceScreen - android:key="prefFlattrSettings" - android:title="@string/flattr_label"> - <PreferenceScreen - android:key="pref_flattr_authenticate" - android:summary="@string/pref_flattr_auth_sum" - android:title="@string/pref_flattr_auth_title"> - <intent android:action=".activities.FlattrAuthActivity"/> - </PreferenceScreen> - - <Preference - android:key="prefAutoFlattrPrefs" - android:summary="@string/pref_auto_flattr_sum" - android:title="@string/pref_auto_flattr_title" /> - <Preference - android:key="prefRevokeAccess" - android:summary="@string/pref_revokeAccess_sum" - android:title="@string/pref_revokeAccess_title"/> - </PreferenceScreen> - <PreferenceScreen - android:key="prefGpodderSettings" - android:title="@string/gpodnet_main_label"> - - <PreferenceScreen - android:key="pref_gpodnet_authenticate" - android:title="@string/pref_gpodnet_authenticate_title" - android:summary="@string/pref_gpodnet_authenticate_sum"> - <intent android:action=".activity.gpoddernet.GpodnetAuthenticationActivity"/> - </PreferenceScreen> - <Preference - android:key="pref_gpodnet_setlogin_information" - android:title="@string/pref_gpodnet_setlogin_information_title" - android:summary="@string/pref_gpodnet_setlogin_information_sum"/> - <Preference - android:key="pref_gpodnet_sync" - android:title="@string/pref_gpodnet_sync_changes_title" - android:summary="@string/pref_gpodnet_sync_changes_sum"/> - <Preference - android:key="pref_gpodnet_force_full_sync" - android:title="@string/pref_gpodnet_full_sync_title" - android:summary="@string/pref_gpodnet_full_sync_sum"/> - <Preference - android:key="pref_gpodnet_logout" - android:title="@string/pref_gpodnet_logout_title"/> - <Preference - android:key="pref_gpodnet_hostname" - android:title="@string/pref_gpodnet_sethostname_title"/> - <de.danoeh.antennapod.preferences.SwitchCompatPreference - android:key="pref_gpodnet_notifications" - android:title="@string/pref_gpodnet_notifications_title" - android:summary="@string/pref_gpodnet_notifications_sum" - android:defaultValue="true"/> - </PreferenceScreen> - </PreferenceCategory> - <PreferenceCategory android:title="@string/storage_pref"> - <Preference - android:title="@string/choose_data_directory" - android:key="prefChooseDataDir"/> - <ListPreference - android:entryValues="@array/image_cache_size_values" - android:entries="@array/image_cache_size_options" - android:title="@string/pref_image_cache_size_title" - android:key="prefImageCacheSize" - android:summary="@string/pref_image_cache_size_sum" - android:defaultValue="100"/> - </PreferenceCategory> - <PreferenceCategory android:title="@string/other_pref"> - <Preference - android:key="prefOpmlExport" - android:title="@string/opml_export_label"/> - <Preference - android:key="prefOpmlImport" - android:title="@string/opml_import_label"/> - <Preference - android:key="prefHtmlExport" - android:title="@string/html_export_label"/> - <Preference - android:key="importExport" - android:title="@string/import_export"/> - <Preference + xmlns:android="http://schemas.android.com/apk/res/android"> + <Preference + android:key="prefScreenInterface" + android:title="@string/user_interface_label" + android:icon="?attr/type_video" /> + + <Preference + android:key="prefScreenPlayback" + android:title="@string/playback_pref" + android:icon="?attr/av_play" /> + + <Preference + android:key="prefScreenDownloads" + android:title="@string/downloads_label" + android:icon="?attr/av_download" /> + + <Preference + android:key="prefScreenServices" + android:title="@string/services_label" + android:icon="?attr/ic_unfav" /> + + <Preference + android:key="prefScreenStorage" + android:title="@string/storage_pref" + android:icon="?attr/storage" /> + + <Preference android:key="statistics" - android:title="@string/statistics_label"/> - </PreferenceCategory> + android:title="@string/statistics_label" + android:icon="?attr/statistics" /> + <PreferenceCategory android:title="@string/project_pref"> <Preference android:key="prefFaq" @@ -348,14 +46,4 @@ android:key="prefAbout" android:title="@string/about_pref"/> </PreferenceCategory> - - <PreferenceCategory android:title="@string/experimental_pref"> - <de.danoeh.antennapod.preferences.SwitchCompatPreference - android:defaultValue="false" - android:enabled="true" - android:key="prefCast" - android:summary="@string/pref_cast_message" - android:title="@string/pref_cast_title"/> - </PreferenceCategory> - </PreferenceScreen> diff --git a/app/src/main/res/xml/preferences_downloads.xml b/app/src/main/res/xml/preferences_downloads.xml new file mode 100644 index 000000000..ad1e753cc --- /dev/null +++ b/app/src/main/res/xml/preferences_downloads.xml @@ -0,0 +1,75 @@ +<?xml version="1.0" encoding="utf-8"?> +<PreferenceScreen + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto"> + + <PreferenceCategory android:title="@string/data_usage"> + <Preference + android:key="prefAutoUpdateIntervall" + android:summary="@string/pref_autoUpdateIntervallOrTime_sum" + android:title="@string/pref_autoUpdateIntervallOrTime_title"/> + <de.danoeh.antennapod.preferences.SwitchCompatPreference + android:defaultValue="false" + android:enabled="true" + android:key="prefMobileUpdate" + android:summary="@string/pref_mobileUpdate_sum" + android:title="@string/pref_mobileUpdate_title"/> + <com.afollestad.materialdialogs.prefs.MaterialEditTextPreference + android:defaultValue="4" + android:inputType="number" + android:key="prefParallelDownloads" + android:title="@string/pref_parallel_downloads_title" + app:useStockLayout="true"/> + <PreferenceScreen + android:summary="@string/pref_automatic_download_sum" + android:key="prefAutoDownloadSettings" + android:title="@string/pref_automatic_download_title"> + <de.danoeh.antennapod.preferences.SwitchCompatPreference + android:key="prefEnableAutoDl" + android:title="@string/pref_automatic_download_title" + android:defaultValue="false"/> + <com.afollestad.materialdialogs.prefs.MaterialListPreference + android:defaultValue="25" + android:entries="@array/episode_cache_size_entries" + android:key="prefEpisodeCacheSize" + android:title="@string/pref_episode_cache_title" + android:entryValues="@array/episode_cache_size_values" + app:useStockLayout="true"/> + <com.afollestad.materialdialogs.prefs.MaterialListPreference + android:defaultValue="-1" + android:entries="@array/episode_cleanup_entries" + android:key="prefEpisodeCleanup" + android:title="@string/pref_episode_cleanup_title" + android:summary="@string/pref_episode_cleanup_summary" + android:entryValues="@array/episode_cleanup_values" + app:useStockLayout="true"/> + <de.danoeh.antennapod.preferences.SwitchCompatPreference + android:key="prefEnableAutoDownloadOnBattery" + android:title="@string/pref_automatic_download_on_battery_title" + android:summary="@string/pref_automatic_download_on_battery_sum" + android:defaultValue="true"/> + <de.danoeh.antennapod.preferences.SwitchCompatPreference + android:key="prefEnableAutoDownloadOnMobile" + android:title="@string/pref_autodl_allow_on_mobile_title" + android:summary="@string/pref_autodl_allow_on_mobile_sum" + android:defaultValue="false"/> + <de.danoeh.antennapod.preferences.SwitchCompatPreference + android:key="prefEnableAutoDownloadWifiFilter" + android:title="@string/pref_autodl_wifi_filter_title" + android:summary="@string/pref_autodl_wifi_filter_sum"/> + </PreferenceScreen> + </PreferenceCategory> + + <PreferenceCategory android:title="@string/download_pref_details"> + <de.danoeh.antennapod.preferences.SwitchCompatPreference + android:defaultValue="true" + android:enabled="true" + android:key="prefShowDownloadReport" + android:summary="@string/pref_showDownloadReport_sum" + android:title="@string/pref_showDownloadReport_title"/> + <Preference + android:key="prefProxy" + android:summary="@string/pref_proxy_sum" + android:title="@string/pref_proxy_title"/> + </PreferenceCategory> +</PreferenceScreen> diff --git a/app/src/main/res/xml/preferences_playback.xml b/app/src/main/res/xml/preferences_playback.xml new file mode 100644 index 000000000..49a53726c --- /dev/null +++ b/app/src/main/res/xml/preferences_playback.xml @@ -0,0 +1,128 @@ +<?xml version="1.0" encoding="utf-8"?> +<PreferenceScreen + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto"> + + <PreferenceCategory android:title="@string/interruptions"> + <de.danoeh.antennapod.preferences.SwitchCompatPreference + android:defaultValue="true" + android:enabled="true" + android:key="prefPauseOnHeadsetDisconnect" + android:summary="@string/pref_pauseOnDisconnect_sum" + android:title="@string/pref_pauseOnHeadsetDisconnect_title"/> + <de.danoeh.antennapod.preferences.SwitchCompatPreference + android:defaultValue="true" + android:enabled="true" + android:dependency="prefPauseOnHeadsetDisconnect" + android:key="prefUnpauseOnHeadsetReconnect" + android:summary="@string/pref_unpauseOnHeadsetReconnect_sum" + android:title="@string/pref_unpauseOnHeadsetReconnect_title"/> + <de.danoeh.antennapod.preferences.SwitchCompatPreference + android:defaultValue="false" + android:enabled="true" + android:dependency="prefPauseOnHeadsetDisconnect" + android:key="prefUnpauseOnBluetoothReconnect" + android:summary="@string/pref_unpauseOnBluetoothReconnect_sum" + android:title="@string/pref_unpauseOnBluetoothReconnect_title"/> + <de.danoeh.antennapod.preferences.SwitchCompatPreference + android:defaultValue="false" + android:enabled="true" + android:key="prefPauseForFocusLoss" + android:summary="@string/pref_pausePlaybackForFocusLoss_sum" + android:title="@string/pref_pausePlaybackForFocusLoss_title"/> + <de.danoeh.antennapod.preferences.SwitchCompatPreference + android:defaultValue="true" + android:enabled="true" + android:key="prefResumeAfterCall" + android:summary="@string/pref_resumeAfterCall_sum" + android:title="@string/pref_resumeAfterCall_title"/> + <com.afollestad.materialdialogs.prefs.MaterialListPreference + android:defaultValue="stop" + android:entries="@array/video_background_behavior_options" + android:entryValues="@array/video_background_behavior_values" + android:key="prefVideoBehavior" + android:summary="@string/pref_videoBehavior_sum" + android:title="@string/pref_videoBehavior_title" + app:useStockLayout="true"/> + </PreferenceCategory> + + <PreferenceCategory android:title="@string/buttons"> + <de.danoeh.antennapod.preferences.SwitchCompatPreference + android:defaultValue="false" + android:enabled="true" + android:key="prefHardwareForwardButtonSkips" + android:summary="@string/pref_hardwareForwardButtonSkips_sum" + android:title="@string/pref_hardwareForwardButtonSkips_title"/> + <de.danoeh.antennapod.preferences.SwitchCompatPreference + android:defaultValue="false" + android:enabled="true" + android:key="prefHardwarePreviousButtonRestarts" + android:summary="@string/pref_hardwarePreviousButtonRestarts_sum" + android:title="@string/pref_hardwarePreviousButtonRestarts_title"/> + <Preference + android:key="prefPlaybackFastForwardDeltaLauncher" + android:summary="@string/pref_fast_forward_sum" + android:title="@string/pref_fast_forward"/> + <Preference + android:key="prefPlaybackRewindDeltaLauncher" + android:summary="@string/pref_rewind_sum" + android:title="@string/pref_rewind"/> + <Preference + android:key="prefPlaybackSpeedLauncher" + android:summary="@string/pref_playback_speed_sum" + android:title="@string/pref_playback_speed_title"/> + </PreferenceCategory> + + <PreferenceCategory android:title="@string/queue_label"> + <de.danoeh.antennapod.preferences.SwitchCompatPreference + android:defaultValue="true" + android:enabled="true" + android:key="prefEnqueueDownloaded" + android:summary="@string/pref_enqueue_downloaded_summary" + android:title="@string/pref_enqueue_downloaded_title" /> + <de.danoeh.antennapod.preferences.SwitchCompatPreference + android:defaultValue="false" + android:enabled="true" + android:key="prefQueueAddToFront" + android:summary="@string/pref_queueAddToFront_sum" + android:title="@string/pref_queueAddToFront_title"/> + <de.danoeh.antennapod.preferences.SwitchCompatPreference + android:defaultValue="true" + android:enabled="true" + android:key="prefFollowQueue" + android:summary="@string/pref_followQueue_sum" + android:title="@string/pref_followQueue_title"/> + <com.afollestad.materialdialogs.prefs.MaterialListPreference + android:defaultValue="30" + android:entries="@array/smart_mark_as_played_values" + android:entryValues="@array/smart_mark_as_played_values" + android:key="prefSmartMarkAsPlayedSecs" + android:summary="@string/pref_smart_mark_as_played_sum" + android:title="@string/pref_smart_mark_as_played_title" + app:useStockLayout="true"/> + <de.danoeh.antennapod.preferences.SwitchCompatPreference + android:defaultValue="true" + android:enabled="true" + android:key="prefSkipKeepsEpisode" + android:summary="@string/pref_skip_keeps_episodes_sum" + android:title="@string/pref_skip_keeps_episodes_title"/> + </PreferenceCategory> + + <PreferenceCategory android:title="@string/media_player"> + <de.danoeh.antennapod.preferences.SwitchCompatPreference + android:defaultValue="true" + android:enabled="false" + android:key="prefSonic" + android:summary="@string/pref_sonic_message" + android:title="@string/pref_sonic_title"/> + </PreferenceCategory> + + <PreferenceCategory android:title="@string/experimental_pref"> + <de.danoeh.antennapod.preferences.SwitchCompatPreference + android:defaultValue="false" + android:enabled="true" + android:key="prefCast" + android:summary="@string/pref_cast_message" + android:title="@string/pref_cast_title"/> + </PreferenceCategory> +</PreferenceScreen> diff --git a/app/src/main/res/xml/preferences_services.xml b/app/src/main/res/xml/preferences_services.xml new file mode 100644 index 000000000..8ce35b596 --- /dev/null +++ b/app/src/main/res/xml/preferences_services.xml @@ -0,0 +1,63 @@ +<?xml version="1.0" encoding="utf-8"?> +<PreferenceScreen + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto"> + + <PreferenceScreen + android:key="prefFlattrSettings" + android:title="@string/flattr_label" + android:summary="@string/flattr_summary"> + <PreferenceScreen + android:key="pref_flattr_authenticate" + android:summary="@string/pref_flattr_auth_sum" + android:title="@string/pref_flattr_auth_title"> + <intent android:action=".activities.FlattrAuthActivity"/> + </PreferenceScreen> + + <Preference + android:key="prefAutoFlattrPrefs" + android:summary="@string/pref_auto_flattr_sum" + android:title="@string/pref_auto_flattr_title"/> + <Preference + android:key="prefRevokeAccess" + android:summary="@string/pref_revokeAccess_sum" + android:title="@string/pref_revokeAccess_title"/> + </PreferenceScreen> + + <PreferenceScreen + android:key="prefGpodderSettings" + android:title="@string/gpodnet_main_label" + android:summary="@string/gpodnet_summary"> + + <PreferenceScreen + android:key="pref_gpodnet_authenticate" + android:title="@string/pref_gpodnet_authenticate_title" + android:summary="@string/pref_gpodnet_authenticate_sum"> + <intent android:action=".activity.gpoddernet.GpodnetAuthenticationActivity"/> + </PreferenceScreen> + <Preference + android:key="pref_gpodnet_setlogin_information" + android:title="@string/pref_gpodnet_setlogin_information_title" + android:summary="@string/pref_gpodnet_setlogin_information_sum"/> + <Preference + android:key="pref_gpodnet_sync" + android:title="@string/pref_gpodnet_sync_changes_title" + android:summary="@string/pref_gpodnet_sync_changes_sum"/> + <Preference + android:key="pref_gpodnet_force_full_sync" + android:title="@string/pref_gpodnet_full_sync_title" + android:summary="@string/pref_gpodnet_full_sync_sum"/> + <Preference + android:key="pref_gpodnet_logout" + android:title="@string/pref_gpodnet_logout_title"/> + <Preference + android:key="pref_gpodnet_hostname" + android:title="@string/pref_gpodnet_sethostname_title"/> + <de.danoeh.antennapod.preferences.SwitchCompatPreference + android:key="pref_gpodnet_notifications" + android:title="@string/pref_gpodnet_notifications_title" + android:summary="@string/pref_gpodnet_notifications_sum" + android:defaultValue="true"/> + </PreferenceScreen> + +</PreferenceScreen> diff --git a/app/src/main/res/xml/preferences_storage.xml b/app/src/main/res/xml/preferences_storage.xml new file mode 100644 index 000000000..091b02ced --- /dev/null +++ b/app/src/main/res/xml/preferences_storage.xml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="utf-8"?> +<PreferenceScreen + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto"> + + <Preference + android:title="@string/choose_data_directory" + android:key="prefChooseDataDir"/> + <ListPreference + android:entryValues="@array/image_cache_size_values" + android:entries="@array/image_cache_size_options" + android:title="@string/pref_image_cache_size_title" + android:key="prefImageCacheSize" + android:summary="@string/pref_image_cache_size_sum" + android:defaultValue="100"/> + <de.danoeh.antennapod.preferences.SwitchCompatPreference + android:defaultValue="false" + android:enabled="true" + android:key="prefAutoDelete" + android:summary="@string/pref_auto_delete_sum" + android:title="@string/pref_auto_delete_title"/> + <de.danoeh.antennapod.preferences.SwitchCompatPreference + android:defaultValue="true" + android:enabled="true" + android:key="prefFavoriteKeepsEpisode" + android:summary="@string/pref_favorite_keeps_episodes_sum" + android:title="@string/pref_favorite_keeps_episodes_title"/> + + <PreferenceCategory android:title="@string/import_export_pref"> + <Preference + android:key="prefOpmlExport" + android:title="@string/opml_export_label"/> + <Preference + android:key="prefOpmlImport" + android:title="@string/opml_import_label"/> + <Preference + android:key="prefHtmlExport" + android:title="@string/html_export_label"/> + <Preference + android:key="importExport" + android:title="@string/import_export"/> + </PreferenceCategory> +</PreferenceScreen> diff --git a/app/src/main/res/xml/preferences_user_interface.xml b/app/src/main/res/xml/preferences_user_interface.xml new file mode 100644 index 000000000..7ffa1b00f --- /dev/null +++ b/app/src/main/res/xml/preferences_user_interface.xml @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="utf-8"?> +<PreferenceScreen + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto"> + + <PreferenceCategory android:title="@string/appearance"> + <com.afollestad.materialdialogs.prefs.MaterialListPreference + android:entryValues="@array/theme_values" + android:entries="@array/theme_options" + android:title="@string/pref_set_theme_title" + android:key="prefTheme" + android:summary="@string/pref_set_theme_sum" + android:defaultValue="0" + app:useStockLayout="true"/> + <Preference + android:key="prefHiddenDrawerItems" + android:summary="@string/pref_nav_drawer_items_sum" + android:title="@string/pref_nav_drawer_items_title"/> + <com.afollestad.materialdialogs.prefs.MaterialListPreference + android:entryValues="@array/nav_drawer_feed_order_values" + android:entries="@array/nav_drawer_feed_order_options" + android:title="@string/pref_nav_drawer_feed_order_title" + android:key="prefDrawerFeedOrder" + android:summary="@string/pref_nav_drawer_feed_order_sum" + android:defaultValue="0" + app:useStockLayout="true"/> + <com.afollestad.materialdialogs.prefs.MaterialListPreference + android:entryValues="@array/nav_drawer_feed_counter_values" + android:entries="@array/nav_drawer_feed_counter_options" + android:title="@string/pref_nav_drawer_feed_counter_title" + android:key="prefDrawerFeedIndicator" + android:summary="@string/pref_nav_drawer_feed_counter_sum" + android:defaultValue="0" + app:useStockLayout="true"/> + </PreferenceCategory> + <PreferenceCategory android:title="@string/external_elements"> + <de.danoeh.antennapod.preferences.SwitchCompatPreference + android:defaultValue="false" + android:enabled="true" + android:key="prefExpandNotify" + android:summary="@string/pref_expandNotify_sum" + android:title="@string/pref_expandNotify_title"/> + <de.danoeh.antennapod.preferences.SwitchCompatPreference + android:defaultValue="true" + android:enabled="true" + android:key="prefPersistNotify" + android:summary="@string/pref_persistNotify_sum" + android:title="@string/pref_persistNotify_title"/> + <Preference + android:key="prefCompactNotificationButtons" + android:summary="@string/pref_compact_notification_buttons_sum" + android:title="@string/pref_compact_notification_buttons_title"/> + <de.danoeh.antennapod.preferences.SwitchCompatPreference + android:defaultValue="true" + android:enabled="true" + android:key="prefLockscreenBackground" + android:summary="@string/pref_lockscreen_background_sum" + android:title="@string/pref_lockscreen_background_title"/> + </PreferenceCategory> +</PreferenceScreen> |