diff options
15 files changed, 239 insertions, 249 deletions
diff --git a/app/build.gradle b/app/build.gradle index e4f66fe64..6a991f7f2 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -139,6 +139,7 @@ dependencies { implementation "com.android.support:support-v4:$supportVersion" implementation "com.android.support:appcompat-v7:$supportVersion" implementation "com.android.support:design:$supportVersion" + implementation "com.android.support:preference-v14:$supportVersion" implementation "com.android.support:gridlayout-v7:$supportVersion" implementation "com.android.support:percent:$supportVersion" implementation "com.android.support:recyclerview-v7:$supportVersion" 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 a6aec2425..34c68084f 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/PreferenceActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/PreferenceActivity.java @@ -1,13 +1,12 @@ package de.danoeh.antennapod.activity; -import android.app.Activity; import android.content.Intent; import android.os.Bundle; -import android.preference.Preference; -import android.preference.PreferenceFragment; -import android.preference.PreferenceScreen; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; +import android.support.v7.preference.Preference; +import android.support.v7.preference.PreferenceFragmentCompat; +import android.support.v7.preference.PreferenceScreen; import android.view.Menu; import android.view.MenuItem; import android.view.ViewGroup; @@ -29,10 +28,10 @@ public class PreferenceActivity extends AppCompatActivity { private static WeakReference<PreferenceActivity> instance; private PreferenceController preferenceController; private final PreferenceController.PreferenceUI preferenceUI = new PreferenceController.PreferenceUI() { - private PreferenceFragment fragment; + private PreferenceFragmentCompat fragment; @Override - public void setFragment(PreferenceFragment fragment) { + public void setFragment(PreferenceFragmentCompat fragment) { this.fragment = fragment; } @@ -47,7 +46,7 @@ public class PreferenceActivity extends AppCompatActivity { } @Override - public Activity getActivity() { + public AppCompatActivity getActivity() { return PreferenceActivity.this; } }; @@ -77,12 +76,12 @@ public class PreferenceActivity extends AppCompatActivity { // since the MainFragment depends on the preferenceController already being created preferenceController = new PreferenceController(preferenceUI); - PreferenceFragment prefFragment = new MainFragment(); + PreferenceFragmentCompat 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(); + getSupportFragmentManager().beginTransaction().replace(R.id.content, prefFragment).commit(); } @Override @@ -101,10 +100,10 @@ public class PreferenceActivity extends AppCompatActivity { public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: - if (getFragmentManager().getBackStackEntryCount() == 0) { + if (getSupportFragmentManager().getBackStackEntryCount() == 0) { finish(); } else { - getFragmentManager().popBackStack(); + getSupportFragmentManager().popBackStack(); } return true; default: @@ -112,13 +111,17 @@ public class PreferenceActivity extends AppCompatActivity { } } - public static class MainFragment extends PreferenceFragment { + public static class MainFragment extends PreferenceFragmentCompat { private int screen; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setRetainInstance(true); + } + + @Override + public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { screen = getArguments().getInt(PARAM_RESOURCE); addPreferencesFromResource(screen); PreferenceActivity activity = instance.get(); @@ -133,35 +136,16 @@ public class PreferenceActivity extends AppCompatActivity { super.onResume(); PreferenceActivity activity = instance.get(); if(activity != null && activity.preferenceController != null) { - activity.setTitle(getTitle(screen)); + activity.setTitle(activity.preferenceController.getTitleOfPage(screen)); activity.preferenceUI.setFragment(this); activity.preferenceController.onResume(screen); } } - private int getTitle(int preferences) { - switch (preferences) { - case R.xml.preferences_network: - return R.string.network_pref; - case R.xml.preferences_autodownload: - return R.string.pref_automatic_download_title; - 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_integrations: - return R.string.integrations_label; - default: - return R.string.settings_label; - } - } - @Override public void onPause() { PreferenceActivity activity = instance.get(); - if (screen == R.xml.preferences_integrations) { + if (screen == R.xml.preferences_gpodder) { activity.preferenceController.unregisterGpodnet(); } super.onPause(); diff --git a/app/src/main/java/de/danoeh/antennapod/preferences/MasterSwitchPreference.java b/app/src/main/java/de/danoeh/antennapod/preferences/MasterSwitchPreference.java index bcac65804..e500267fe 100644 --- a/app/src/main/java/de/danoeh/antennapod/preferences/MasterSwitchPreference.java +++ b/app/src/main/java/de/danoeh/antennapod/preferences/MasterSwitchPreference.java @@ -4,13 +4,14 @@ import android.annotation.TargetApi; import android.content.Context; import android.graphics.Typeface; import android.os.Build; +import android.support.v14.preference.SwitchPreference; +import android.support.v7.preference.PreferenceViewHolder; import android.util.AttributeSet; import android.util.TypedValue; -import android.view.View; import android.widget.TextView; import de.danoeh.antennapod.R; -public class MasterSwitchPreference extends SwitchCompatPreference { +public class MasterSwitchPreference extends SwitchPreference { public MasterSwitchPreference(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); @@ -29,15 +30,16 @@ public class MasterSwitchPreference extends SwitchCompatPreference { super(context); } + @Override - protected void onBindView(View view) { - super.onBindView(view); + public void onBindViewHolder(PreferenceViewHolder holder) { + super.onBindViewHolder(holder); TypedValue typedValue = new TypedValue(); getContext().getTheme().resolveAttribute(R.attr.master_switch_background, typedValue, true); - view.setBackgroundColor(typedValue.data); + holder.itemView.setBackgroundColor(typedValue.data); - TextView title = (TextView) view.findViewById(android.R.id.title); + TextView title = (TextView) holder.findViewById(android.R.id.title); if (title != null) { title.setTypeface(title.getTypeface(), Typeface.BOLD); } 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 fceaf6abf..62d4793cf 100644 --- a/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceController.java +++ b/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceController.java @@ -3,7 +3,6 @@ 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; @@ -18,31 +17,27 @@ 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; import android.support.v4.app.ActivityCompat; import android.support.v4.content.FileProvider; import android.support.v7.app.AlertDialog; -import android.text.Editable; +import android.support.v7.app.AppCompatActivity; +import android.support.v7.preference.CheckBoxPreference; +import android.support.v7.preference.ListPreference; +import android.support.v7.preference.Preference; +import android.support.v7.preference.PreferenceFragmentCompat; +import android.support.v7.preference.PreferenceManager; +import android.support.v7.preference.PreferenceScreen; import android.text.Html; -import android.text.TextWatcher; import android.text.format.DateFormat; import android.text.format.DateUtils; import android.util.Log; -import android.widget.EditText; import android.widget.ListView; 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; @@ -99,8 +94,9 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc private static final String PREF_SCREEN_INTEGRATIONS = "prefScreenIntegrations"; private static final String PREF_SCREEN_STORAGE = "prefScreenStorage"; private static final String PREF_SCREEN_AUTODL = "prefAutoDownloadSettings"; + private static final String PREF_SCREEN_FLATTR = "prefFlattrSettings"; + private static final String PREF_SCREEN_GPODDER = "prefGpodderSettings"; - 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"; private static final String PREF_AUTO_FLATTR_PREFS = "prefAutoFlattrPrefs"; @@ -181,6 +177,12 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc case R.xml.preferences_integrations: setupIntegrationsScreen(); break; + case R.xml.preferences_flattr: + setupFlattrScreen(); + break; + case R.xml.preferences_gpodder: + setupGpodderScreen(); + break; case R.xml.preferences_storage: setupStorageScreen(); break; @@ -300,7 +302,20 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc } private void setupIntegrationsScreen() { - final Activity activity = ui.getActivity(); + final AppCompatActivity activity = ui.getActivity(); + + ui.findPreference(PREF_SCREEN_FLATTR).setOnPreferenceClickListener(preference -> { + openScreen(R.xml.preferences_flattr, activity); + return true; + }); + ui.findPreference(PREF_SCREEN_GPODDER).setOnPreferenceClickListener(preference -> { + openScreen(R.xml.preferences_gpodder, activity); + return true; + }); + } + + private void setupFlattrScreen() { + final AppCompatActivity activity = ui.getActivity(); ui.findPreference(PreferenceController.PREF_FLATTR_REVOKE).setOnPreferenceClickListener( preference -> { @@ -309,6 +324,29 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc 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); + checkFlattrItemVisibility(); + } + }); + return true; + }); + } + + private void setupGpodderScreen() { + final AppCompatActivity activity = ui.getActivity(); + ui.findPreference(PreferenceController.PREF_GPODNET_SETLOGIN_INFORMATION) .setOnPreferenceClickListener(preference -> { AuthenticationDialog dialog = new AuthenticationDialog(activity, @@ -356,24 +394,6 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc 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); - checkFlattrItemVisibility(); - } - }); - return true; - }); } private void setupPlaybackScreen() { @@ -395,7 +415,7 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc return true; }); if (!PictureInPictureUtil.supportsPictureInPicture(activity)) { - MaterialListPreference behaviour = (MaterialListPreference) ui.findPreference(UserPreferences.PREF_VIDEO_BEHAVIOR); + ListPreference behaviour = (ListPreference) 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); } @@ -432,9 +452,11 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc } private void setupNetworkScreen() { - final Activity activity = ui.getActivity(); - ui.findPreference(PREF_SCREEN_AUTODL).setOnPreferenceClickListener(preference -> - openScreen(R.xml.preferences_autodownload, activity)); + final AppCompatActivity activity = ui.getActivity(); + ui.findPreference(PREF_SCREEN_AUTODL).setOnPreferenceClickListener(preference -> { + openScreen(R.xml.preferences_autodownload, activity); + return true; + }); ui.findPreference(UserPreferences.PREF_UPDATE_INTERVAL) .setOnPreferenceClickListener(preference -> { showUpdateIntervalTimePreferencesDialog(); @@ -458,33 +480,6 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc } ); // validate and set correct value: number of downloads between 1 and 50 (inclusive) - final EditText ev = ((EditTextPreference) ui.findPreference(UserPreferences.PREF_PARALLEL_DOWNLOADS)).getEditText(); - ev.addTextChangedListener(new TextWatcher() { - @Override - public void beforeTextChanged(CharSequence s, int start, int count, int after) { - } - - @Override - public void onTextChanged(CharSequence s, int start, int before, int count) { - } - - @Override - public void afterTextChanged(Editable s) { - if (s.length() > 0) { - try { - int value = Integer.parseInt(s.toString()); - if (value <= 0) { - ev.setText("1"); - } else if (value > 50) { - ev.setText("50"); - } - } catch (NumberFormatException e) { - ev.setText("6"); - } - ev.setSelection(ev.getText().length()); - } - } - }); ui.findPreference(PREF_PROXY).setOnPreferenceClickListener(preference -> { ProxyDialog dialog = new ProxyDialog(ui.getActivity()); dialog.createDialog().show(); @@ -493,17 +488,27 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc } 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_NETWORK).setOnPreferenceClickListener(preference -> - openScreen(R.xml.preferences_network, activity)); - ui.findPreference(PREF_SCREEN_INTEGRATIONS).setOnPreferenceClickListener(preference -> - openScreen(R.xml.preferences_integrations, activity)); - ui.findPreference(PREF_SCREEN_STORAGE).setOnPreferenceClickListener(preference -> - openScreen(R.xml.preferences_storage, activity)); + final AppCompatActivity activity = ui.getActivity(); + ui.findPreference(PREF_SCREEN_USER_INTERFACE).setOnPreferenceClickListener(preference -> { + openScreen(R.xml.preferences_user_interface, activity); + return true; + }); + ui.findPreference(PREF_SCREEN_PLAYBACK).setOnPreferenceClickListener(preference -> { + openScreen(R.xml.preferences_playback, activity); + return true; + }); + ui.findPreference(PREF_SCREEN_NETWORK).setOnPreferenceClickListener(preference -> { + openScreen(R.xml.preferences_network, activity); + return true; + }); + ui.findPreference(PREF_SCREEN_INTEGRATIONS).setOnPreferenceClickListener(preference -> { + openScreen(R.xml.preferences_integrations, activity); + return true; + }); + ui.findPreference(PREF_SCREEN_STORAGE).setOnPreferenceClickListener(preference -> { + openScreen(R.xml.preferences_storage, activity); + return true; + }); ui.findPreference(PreferenceController.PREF_ABOUT).setOnPreferenceClickListener( preference -> { @@ -550,15 +555,38 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc }); } - private boolean openScreen(int preferences, Activity activity) { - Fragment prefFragment = new PreferenceActivity.MainFragment(); + public PreferenceFragmentCompat openScreen(int preferences, AppCompatActivity activity) { + PreferenceFragmentCompat prefFragment = new PreferenceActivity.MainFragment(); Bundle args = new Bundle(); args.putInt(PARAM_RESOURCE, preferences); prefFragment.setArguments(args); - activity.getFragmentManager().beginTransaction() + activity.getSupportFragmentManager().beginTransaction() .replace(R.id.content, prefFragment) .addToBackStack(TAG).commit(); - return true; + return prefFragment; + } + + public int getTitleOfPage(int preferences) { + switch (preferences) { + case R.xml.preferences_network: + return R.string.network_pref; + case R.xml.preferences_autodownload: + return R.string.pref_automatic_download_title; + 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_integrations: + return R.string.integrations_label; + case R.xml.preferences_flattr: + return R.string.flattr_label; + case R.xml.preferences_gpodder: + return R.string.gpodnet_main_label; + default: + return R.string.settings_label; + } } private boolean export(ExportWriter exportWriter) { @@ -628,9 +656,14 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc setDataFolderText(); break; case R.xml.preferences_integrations: + setIntegrationsItemVisibility(); + return; + case R.xml.preferences_flattr: + checkFlattrItemVisibility(); + break; + case R.xml.preferences_gpodder: GpodnetPreferences.registerOnSharedPreferenceChangeListener(gpoddernetListener); updateGpodnetPreferenceScreen(); - checkFlattrItemVisibility(); break; case R.xml.preferences_playback: checkSonicItemVisibility(); @@ -797,10 +830,13 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc } } + private void setIntegrationsItemVisibility() { + ui.findPreference(PreferenceController.PREF_SCREEN_FLATTR).setEnabled(FlattrUtils.hasAPICredentials()); + } + @SuppressWarnings("deprecation") 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); @@ -1115,7 +1151,7 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc public interface PreferenceUI { - void setFragment(PreferenceFragment fragment); + void setFragment(PreferenceFragmentCompat fragment); /** * Finds a preference based on its key. @@ -1124,6 +1160,6 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc PreferenceScreen getPreferenceScreen(); - Activity getActivity(); + AppCompatActivity getActivity(); } } diff --git a/app/src/main/java/de/danoeh/antennapod/preferences/SwitchCompatPreference.java b/app/src/main/java/de/danoeh/antennapod/preferences/SwitchCompatPreference.java deleted file mode 100644 index 10c11b88e..000000000 --- a/app/src/main/java/de/danoeh/antennapod/preferences/SwitchCompatPreference.java +++ /dev/null @@ -1,37 +0,0 @@ -package de.danoeh.antennapod.preferences; - -import android.annotation.TargetApi; -import android.content.Context; -import android.os.Build; -import android.preference.CheckBoxPreference; -import android.util.AttributeSet; - -import de.danoeh.antennapod.R; - -public class SwitchCompatPreference extends CheckBoxPreference { - - public SwitchCompatPreference(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - init(); - } - - @TargetApi(Build.VERSION_CODES.LOLLIPOP) - public SwitchCompatPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { - super(context, attrs, defStyleAttr, defStyleRes); - init(); - } - - public SwitchCompatPreference(Context context, AttributeSet attrs) { - super(context, attrs); - init(); - } - - public SwitchCompatPreference(Context context) { - super(context); - init(); - } - - private void init() { - setWidgetLayoutResource(R.layout.preference_switch_layout); - } -}
\ No newline at end of file diff --git a/app/src/main/res/layout/preference_switch_layout.xml b/app/src/main/res/layout/preference_switch_layout.xml deleted file mode 100644 index 54fa74061..000000000 --- a/app/src/main/res/layout/preference_switch_layout.xml +++ /dev/null @@ -1,9 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<android.support.v7.widget.SwitchCompat - xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@android:id/checkbox" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:background="@null" - android:clickable="false" - android:focusable="false" />
\ No newline at end of file diff --git a/app/src/main/res/xml/preferences_autodownload.xml b/app/src/main/res/xml/preferences_autodownload.xml index 72716423a..037e92d75 100644 --- a/app/src/main/res/xml/preferences_autodownload.xml +++ b/app/src/main/res/xml/preferences_autodownload.xml @@ -7,14 +7,14 @@ android:key="prefEnableAutoDl" android:title="@string/pref_automatic_download_title" android:defaultValue="false"/> - <com.afollestad.materialdialogs.prefs.MaterialListPreference + <ListPreference 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 + <ListPreference android:defaultValue="-1" android:entries="@array/episode_cleanup_entries" android:key="prefEpisodeCleanup" @@ -22,17 +22,17 @@ android:summary="@string/pref_episode_cleanup_summary" android:entryValues="@array/episode_cleanup_values" app:useStockLayout="true"/> - <de.danoeh.antennapod.preferences.SwitchCompatPreference + <SwitchPreference 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 + <SwitchPreference 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 + <SwitchPreference android:key="prefEnableAutoDownloadWifiFilter" android:title="@string/pref_autodl_wifi_filter_title" android:summary="@string/pref_autodl_wifi_filter_sum"/> diff --git a/app/src/main/res/xml/preferences_flattr.xml b/app/src/main/res/xml/preferences_flattr.xml new file mode 100644 index 000000000..6b4c38a0b --- /dev/null +++ b/app/src/main/res/xml/preferences_flattr.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<PreferenceScreen + xmlns:android="http://schemas.android.com/apk/res/android"> + + <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> diff --git a/app/src/main/res/xml/preferences_gpodder.xml b/app/src/main/res/xml/preferences_gpodder.xml new file mode 100644 index 000000000..5789f5f84 --- /dev/null +++ b/app/src/main/res/xml/preferences_gpodder.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="utf-8"?> +<PreferenceScreen + xmlns:android="http://schemas.android.com/apk/res/android"> + + <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"/> + <SwitchPreference + android:key="pref_gpodnet_notifications" + android:title="@string/pref_gpodnet_notifications_title" + android:summary="@string/pref_gpodnet_notifications_sum" + android:defaultValue="true"/> + +</PreferenceScreen> diff --git a/app/src/main/res/xml/preferences_integrations.xml b/app/src/main/res/xml/preferences_integrations.xml index 8ce35b596..c0fd299ec 100644 --- a/app/src/main/res/xml/preferences_integrations.xml +++ b/app/src/main/res/xml/preferences_integrations.xml @@ -3,61 +3,14 @@ xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> - <PreferenceScreen + <Preference 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> + android:summary="@string/flattr_summary" /> - <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 + <Preference 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> + android:summary="@string/gpodnet_summary" /> </PreferenceScreen> diff --git a/app/src/main/res/xml/preferences_network.xml b/app/src/main/res/xml/preferences_network.xml index 77792bf88..05f960219 100644 --- a/app/src/main/res/xml/preferences_network.xml +++ b/app/src/main/res/xml/preferences_network.xml @@ -7,7 +7,7 @@ android:key="prefAutoUpdateIntervall" android:summary="@string/pref_autoUpdateIntervallOrTime_sum" android:title="@string/pref_autoUpdateIntervallOrTime_title"/> - <de.danoeh.antennapod.preferences.SwitchCompatPreference + <SwitchPreference android:defaultValue="false" android:enabled="true" android:key="prefMobileUpdate" @@ -20,13 +20,13 @@ </PreferenceCategory> <PreferenceCategory android:title="@string/download_pref_details"> - <com.afollestad.materialdialogs.prefs.MaterialEditTextPreference + <EditTextPreference android:defaultValue="4" android:inputType="number" android:key="prefParallelDownloads" android:title="@string/pref_parallel_downloads_title" app:useStockLayout="true"/> - <de.danoeh.antennapod.preferences.SwitchCompatPreference + <SwitchPreference android:defaultValue="true" android:enabled="true" android:key="prefShowDownloadReport" diff --git a/app/src/main/res/xml/preferences_playback.xml b/app/src/main/res/xml/preferences_playback.xml index 49a53726c..c43f6da71 100644 --- a/app/src/main/res/xml/preferences_playback.xml +++ b/app/src/main/res/xml/preferences_playback.xml @@ -4,39 +4,39 @@ xmlns:app="http://schemas.android.com/apk/res-auto"> <PreferenceCategory android:title="@string/interruptions"> - <de.danoeh.antennapod.preferences.SwitchCompatPreference + <SwitchPreference 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 + <SwitchPreference 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 + <SwitchPreference 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 + <SwitchPreference 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 + <SwitchPreference 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 + <ListPreference android:defaultValue="stop" android:entries="@array/video_background_behavior_options" android:entryValues="@array/video_background_behavior_values" @@ -47,13 +47,13 @@ </PreferenceCategory> <PreferenceCategory android:title="@string/buttons"> - <de.danoeh.antennapod.preferences.SwitchCompatPreference + <SwitchPreference 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 + <SwitchPreference android:defaultValue="false" android:enabled="true" android:key="prefHardwarePreviousButtonRestarts" @@ -74,25 +74,25 @@ </PreferenceCategory> <PreferenceCategory android:title="@string/queue_label"> - <de.danoeh.antennapod.preferences.SwitchCompatPreference + <SwitchPreference 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 + <SwitchPreference 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 + <SwitchPreference 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 + <ListPreference android:defaultValue="30" android:entries="@array/smart_mark_as_played_values" android:entryValues="@array/smart_mark_as_played_values" @@ -100,7 +100,7 @@ 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 + <SwitchPreference android:defaultValue="true" android:enabled="true" android:key="prefSkipKeepsEpisode" @@ -109,7 +109,7 @@ </PreferenceCategory> <PreferenceCategory android:title="@string/media_player"> - <de.danoeh.antennapod.preferences.SwitchCompatPreference + <SwitchPreference android:defaultValue="true" android:enabled="false" android:key="prefSonic" @@ -118,7 +118,7 @@ </PreferenceCategory> <PreferenceCategory android:title="@string/experimental_pref"> - <de.danoeh.antennapod.preferences.SwitchCompatPreference + <SwitchPreference android:defaultValue="false" android:enabled="true" android:key="prefCast" diff --git a/app/src/main/res/xml/preferences_storage.xml b/app/src/main/res/xml/preferences_storage.xml index 091b02ced..fe48cc99c 100644 --- a/app/src/main/res/xml/preferences_storage.xml +++ b/app/src/main/res/xml/preferences_storage.xml @@ -13,13 +13,13 @@ android:key="prefImageCacheSize" android:summary="@string/pref_image_cache_size_sum" android:defaultValue="100"/> - <de.danoeh.antennapod.preferences.SwitchCompatPreference + <SwitchPreference 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 + <SwitchPreference android:defaultValue="true" android:enabled="true" android:key="prefFavoriteKeepsEpisode" diff --git a/app/src/main/res/xml/preferences_user_interface.xml b/app/src/main/res/xml/preferences_user_interface.xml index 7ffa1b00f..da694b844 100644 --- a/app/src/main/res/xml/preferences_user_interface.xml +++ b/app/src/main/res/xml/preferences_user_interface.xml @@ -4,7 +4,7 @@ xmlns:app="http://schemas.android.com/apk/res-auto"> <PreferenceCategory android:title="@string/appearance"> - <com.afollestad.materialdialogs.prefs.MaterialListPreference + <ListPreference android:entryValues="@array/theme_values" android:entries="@array/theme_options" android:title="@string/pref_set_theme_title" @@ -16,7 +16,7 @@ android:key="prefHiddenDrawerItems" android:summary="@string/pref_nav_drawer_items_sum" android:title="@string/pref_nav_drawer_items_title"/> - <com.afollestad.materialdialogs.prefs.MaterialListPreference + <ListPreference 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" @@ -24,7 +24,7 @@ android:summary="@string/pref_nav_drawer_feed_order_sum" android:defaultValue="0" app:useStockLayout="true"/> - <com.afollestad.materialdialogs.prefs.MaterialListPreference + <ListPreference 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" @@ -34,13 +34,13 @@ app:useStockLayout="true"/> </PreferenceCategory> <PreferenceCategory android:title="@string/external_elements"> - <de.danoeh.antennapod.preferences.SwitchCompatPreference + <SwitchPreference 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 + <SwitchPreference android:defaultValue="true" android:enabled="true" android:key="prefPersistNotify" @@ -50,7 +50,7 @@ android:key="prefCompactNotificationButtons" android:summary="@string/pref_compact_notification_buttons_sum" android:title="@string/pref_compact_notification_buttons_title"/> - <de.danoeh.antennapod.preferences.SwitchCompatPreference + <SwitchPreference android:defaultValue="true" android:enabled="true" android:key="prefLockscreenBackground" diff --git a/core/src/main/res/values/styles.xml b/core/src/main/res/values/styles.xml index 77758a223..3a215588e 100644 --- a/core/src/main/res/values/styles.xml +++ b/core/src/main/res/values/styles.xml @@ -67,6 +67,7 @@ <item type="attr" name="ic_create_new_folder">@drawable/ic_create_new_folder_grey600_24dp</item> <item type="attr" name="ic_cast_disconnect">@drawable/ic_cast_disconnect_grey600_36dp</item> <item type="attr" name="master_switch_background">@color/master_switch_background_light</item> + <item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item> </style> <style name="Theme.AntennaPod.Dark" parent="Theme.Base.AntennaPod.Dark"> @@ -135,6 +136,7 @@ <item type="attr" name="ic_create_new_folder">@drawable/ic_create_new_folder_white_24dp</item> <item type="attr" name="ic_cast_disconnect">@drawable/ic_cast_disconnect_white_36dp</item> <item type="attr" name="master_switch_background">@color/master_switch_background_dark</item> + <item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item> </style> <style name="Theme.AntennaPod.Light.NoTitle" parent="Theme.Base.AntennaPod.Light.NoTitle"> @@ -204,6 +206,7 @@ <item type="attr" name="ic_create_new_folder">@drawable/ic_create_new_folder_grey600_24dp</item> <item type="attr" name="ic_cast_disconnect">@drawable/ic_cast_disconnect_grey600_36dp</item> <item type="attr" name="master_switch_background">@color/master_switch_background_light</item> + <item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item> </style> <style name="Theme.AntennaPod.Dark.NoTitle" parent="Theme.Base.AntennaPod.Dark.NoTitle"> @@ -273,6 +276,7 @@ <item type="attr" name="ic_create_new_folder">@drawable/ic_create_new_folder_white_24dp</item> <item type="attr" name="ic_cast_disconnect">@drawable/ic_cast_disconnect_white_36dp</item> <item type="attr" name="master_switch_background">@color/master_switch_background_dark</item> + <item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item> </style> <style name="Theme.AntennaPod.Dark.Splash" parent="Theme.AppCompat.NoActionBar"> |