diff options
author | ByteHamster <info@bytehamster.com> | 2018-05-07 20:02:07 +0200 |
---|---|---|
committer | ByteHamster <info@bytehamster.com> | 2018-05-07 20:02:07 +0200 |
commit | 407f92be12e1e69a4de51c228153d697782195fd (patch) | |
tree | 3d8fe742feddb90c6122ffc0fb16c6a668e95ba4 /app | |
parent | 4787e2ecc97c8da89af27f6db943e69c90484518 (diff) | |
parent | 36ac93e031cfaa335c1f6f0268e888c01eeeb5fd (diff) | |
download | AntennaPod-407f92be12e1e69a4de51c228153d697782195fd.zip |
Merge branch 'develop' into api-26-support
Diffstat (limited to 'app')
19 files changed, 336 insertions, 259 deletions
diff --git a/app/build.gradle b/app/build.gradle index e4f66fe64..1e8d0c8f5 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" @@ -172,6 +173,7 @@ dependencies { implementation "com.github.AntennaPod:AntennaPod-AudioPlayer:$audioPlayerVersion" implementation 'com.github.mfietz:fyydlin:v0.3' + implementation 'com.github.ByteHamster:SearchPreference:v1.0.3' androidTestImplementation "com.jayway.android.robotium:robotium-solo:$robotiumSoloVersion" } diff --git a/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java index 701f9b79a..091f8daab 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java @@ -43,6 +43,7 @@ import de.danoeh.antennapod.core.storage.DBReader; import de.danoeh.antennapod.core.storage.DBTasks; import de.danoeh.antennapod.core.storage.DBWriter; import de.danoeh.antennapod.core.util.Converter; +import de.danoeh.antennapod.core.util.FeedItemUtil; import de.danoeh.antennapod.core.util.Flavors; import de.danoeh.antennapod.core.util.ShareUtils; import de.danoeh.antennapod.core.util.StorageUtils; @@ -324,11 +325,11 @@ public abstract class MediaplayerActivity extends CastEnabledActivity implements ((FeedMedia) media).getItem().getFlattrStatus().flattrable() ); - boolean hasWebsiteLink = media != null && media.getWebsiteLink() != null; + boolean hasWebsiteLink = ( getWebsiteLinkWithFallback(media) != null ); menu.findItem(R.id.visit_website_item).setVisible(hasWebsiteLink); boolean isItemAndHasLink = isFeedMedia && - ((FeedMedia) media).getItem() != null && ((FeedMedia) media).getItem().getLink() != null; + ShareUtils.hasLinkToShare(((FeedMedia) media).getItem()); menu.findItem(R.id.share_link_item).setVisible(isItemAndHasLink); menu.findItem(R.id.share_link_with_position_item).setVisible(isItemAndHasLink); @@ -564,7 +565,7 @@ public abstract class MediaplayerActivity extends CastEnabledActivity implements }); break; case R.id.visit_website_item: - Uri uri = Uri.parse(media.getWebsiteLink()); + Uri uri = Uri.parse(getWebsiteLinkWithFallback(media)); startActivity(new Intent(Intent.ACTION_VIEW, uri)); break; case R.id.support_item: @@ -607,6 +608,17 @@ public abstract class MediaplayerActivity extends CastEnabledActivity implements } } + private static String getWebsiteLinkWithFallback(Playable media) { + if (media == null) { + return null; + } else if (media.getWebsiteLink() != null) { + return media.getWebsiteLink(); + } else if (media instanceof FeedMedia) { + return FeedItemUtil.getLinkWithFallback(((FeedMedia)media).getItem()); + } + return null; + } + @Override protected void onResume() { super.onResume(); 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..3f005fe36 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; @@ -15,6 +14,9 @@ import android.widget.FrameLayout; import java.lang.ref.WeakReference; +import com.bytehamster.lib.preferencesearch.SearchPreference; +import com.bytehamster.lib.preferencesearch.SearchPreferenceResult; +import com.bytehamster.lib.preferencesearch.SearchPreferenceResultListener; import de.danoeh.antennapod.R; import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.preferences.PreferenceController; @@ -23,20 +25,25 @@ import de.danoeh.antennapod.preferences.PreferenceController; * PreferenceActivity for API 11+. In order to change the behavior of the preference UI, see * PreferenceController. */ -public class PreferenceActivity extends AppCompatActivity { +public class PreferenceActivity extends AppCompatActivity implements SearchPreferenceResultListener { public static final String PARAM_RESOURCE = "resource"; 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; } @Override + public PreferenceFragmentCompat getFragment() { + return fragment; + } + + @Override public Preference findPreference(CharSequence key) { return fragment.findPreference(key); } @@ -47,7 +54,7 @@ public class PreferenceActivity extends AppCompatActivity { } @Override - public Activity getActivity() { + public AppCompatActivity getActivity() { return PreferenceActivity.this; } }; @@ -77,12 +84,21 @@ public class PreferenceActivity extends AppCompatActivity { // since the MainFragment depends on the preferenceController already being created preferenceController = new PreferenceController(preferenceUI); - PreferenceFragment prefFragment = new MainFragment(); + showPreferenceScreen(R.xml.preferences, false); + } + + private void showPreferenceScreen(int screen, boolean addHistory) { + PreferenceFragmentCompat prefFragment = new MainFragment(); preferenceUI.setFragment(prefFragment); Bundle args = new Bundle(); - args.putInt(PARAM_RESOURCE, R.xml.preferences); + args.putInt(PARAM_RESOURCE, screen); prefFragment.setArguments(args); - getFragmentManager().beginTransaction().replace(R.id.content, prefFragment).commit(); + if (addHistory) { + getSupportFragmentManager().beginTransaction().replace(R.id.content, prefFragment) + .addToBackStack(getString(PreferenceController.getTitleOfPage(screen))).commit(); + } else { + getSupportFragmentManager().beginTransaction().replace(R.id.content, prefFragment).commit(); + } } @Override @@ -101,10 +117,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 +128,23 @@ public class PreferenceActivity extends AppCompatActivity { } } - public static class MainFragment extends PreferenceFragment { + @Override + public void onSearchResultClicked(SearchPreferenceResult result) { + showPreferenceScreen(result.getResourceFile(), true); + result.highlight(preferenceUI.getFragment()); + } + + 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 +159,16 @@ public class PreferenceActivity extends AppCompatActivity { super.onResume(); PreferenceActivity activity = instance.get(); if(activity != null && activity.preferenceController != null) { - activity.setTitle(getTitle(screen)); + activity.setTitle(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/adapter/DownloadedEpisodesListAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/DownloadedEpisodesListAdapter.java index c62c30c90..c4f476634 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/DownloadedEpisodesListAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/DownloadedEpisodesListAdapter.java @@ -100,8 +100,10 @@ public class DownloadedEpisodesListAdapter extends BaseAdapter { FeedItem.State state = item.getState(); if (state == FeedItem.State.PLAYING) { holder.butSecondary.setEnabled(false); + holder.butSecondary.setAlpha(0.5f); } else { holder.butSecondary.setEnabled(true); + holder.butSecondary.setAlpha(1.0f); } holder.butSecondary.setFocusable(false); holder.butSecondary.setTag(item); diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java index 63727a1f4..6b589493b 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java @@ -433,6 +433,16 @@ public class ItemFragment extends Fragment implements OnSwipeGesture { butAction1Text = R.string.download_label; } } + + FeedItem.State state = item.getState(); + if (butAction2Text == R.string.delete_label && state == FeedItem.State.PLAYING) { + butAction2.setEnabled(false); + butAction2.setAlpha(0.5f); + } else { + butAction2.setEnabled(true); + butAction2.setAlpha(1.0f); + } + if(butAction1Icon != null && butAction1Text != 0) { butAction1.setText(butAction1Icon +"\u0020\u0020" + getActivity().getString(butAction1Text)); Iconify.addIcons(butAction1); diff --git a/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedItemMenuHandler.java b/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedItemMenuHandler.java index f6f73e017..de47ee5e4 100644 --- a/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedItemMenuHandler.java +++ b/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedItemMenuHandler.java @@ -17,6 +17,7 @@ import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.core.service.playback.PlaybackService; import de.danoeh.antennapod.core.storage.DBTasks; import de.danoeh.antennapod.core.storage.DBWriter; +import de.danoeh.antennapod.core.util.FeedItemUtil; import de.danoeh.antennapod.core.util.IntentUtils; import de.danoeh.antennapod.core.util.LongList; import de.danoeh.antennapod.core.util.ShareUtils; @@ -86,7 +87,7 @@ public class FeedItemMenuHandler { mi.setItemVisibility(R.id.add_to_queue_item, false); } - if (!showExtendedMenu || selectedItem.getLink() == null) { + if (!showExtendedMenu || !ShareUtils.hasLinkToShare(selectedItem)) { mi.setItemVisibility(R.id.visit_website_item, false); mi.setItemVisibility(R.id.share_link_item, false); mi.setItemVisibility(R.id.share_link_with_position_item, false); @@ -216,7 +217,7 @@ public class FeedItemMenuHandler { DBWriter.setFeedItemAutoDownload(selectedItem, false); break; case R.id.visit_website_item: - Uri uri = Uri.parse(selectedItem.getLink()); + Uri uri = Uri.parse(FeedItemUtil.getLinkWithFallback(selectedItem)); Intent intent = new Intent(Intent.ACTION_VIEW, uri); if(IntentUtils.isCallable(context, intent)) { context.startActivity(intent); 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..31a31adb4 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,28 @@ 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 com.bytehamster.lib.preferencesearch.SearchPreference; 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 +95,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 +178,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 +303,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 +325,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 +395,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 +416,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 +453,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 +481,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 +489,28 @@ 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(); + setupSearch(); + 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 +557,73 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc }); } - private boolean openScreen(int preferences, Activity activity) { - Fragment prefFragment = new PreferenceActivity.MainFragment(); + private void setupSearch() { + final AppCompatActivity activity = ui.getActivity(); + + SearchPreference searchPreference = (SearchPreference) ui.findPreference("searchPreference"); + searchPreference.setActivity(activity); + searchPreference.setFragmentContainerViewId(R.id.content); + searchPreference.setBreadcrumbsEnabled(true); + + searchPreference.index() + .addBreadcrumb(getTitleOfPage(R.xml.preferences_user_interface)) + .addFile(R.xml.preferences_user_interface); + searchPreference.index() + .addBreadcrumb(getTitleOfPage(R.xml.preferences_playback)) + .addFile(R.xml.preferences_playback); + searchPreference.index() + .addBreadcrumb(getTitleOfPage(R.xml.preferences_network)) + .addFile(R.xml.preferences_network); + searchPreference.index() + .addBreadcrumb(getTitleOfPage(R.xml.preferences_storage)) + .addFile(R.xml.preferences_storage); + searchPreference.index() + .addBreadcrumb(getTitleOfPage(R.xml.preferences_network)) + .addBreadcrumb(R.string.automation) + .addBreadcrumb(getTitleOfPage(R.xml.preferences_autodownload)) + .addFile(R.xml.preferences_autodownload); + searchPreference.index() + .addBreadcrumb(getTitleOfPage(R.xml.preferences_integrations)) + .addBreadcrumb(getTitleOfPage(R.xml.preferences_gpodder)) + .addFile(R.xml.preferences_gpodder); + searchPreference.index() + .addBreadcrumb(getTitleOfPage(R.xml.preferences_integrations)) + .addBreadcrumb(getTitleOfPage(R.xml.preferences_flattr)) + .addFile(R.xml.preferences_flattr); + } + + 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 static 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 +693,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 +867,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 +1188,8 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc public interface PreferenceUI { - void setFragment(PreferenceFragment fragment); + void setFragment(PreferenceFragmentCompat fragment); + PreferenceFragmentCompat getFragment(); /** * Finds a preference based on its key. @@ -1124,6 +1198,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.xml b/app/src/main/res/xml/preferences.xml index 8472f7b26..d3b72e17c 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -1,10 +1,14 @@ <?xml version="1.0" encoding="utf-8"?> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> + + <com.bytehamster.lib.preferencesearch.SearchPreference + android:key="searchPreference" /> + <Preference - android:key="prefScreenInterface" - android:title="@string/user_interface_label" - android:icon="?attr/type_video" /> + android:key="prefScreenInterface" + android:title="@string/user_interface_label" + android:icon="?attr/type_video" /> <Preference android:key="prefScreenPlayback" 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" |