Merge pull request #2701 from ByteHamster/preference-search-update

Improve autodownload in search
This commit is contained in:
Martin Fietz 2018-05-19 19:53:04 +02:00 committed by GitHub
commit 03b2079087
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 14 deletions

View File

@ -180,7 +180,7 @@ dependencies {
implementation "com.github.AntennaPod:AntennaPod-AudioPlayer:$audioPlayerVersion" implementation "com.github.AntennaPod:AntennaPod-AudioPlayer:$audioPlayerVersion"
implementation 'com.github.mfietz:fyydlin:v0.3' implementation 'com.github.mfietz:fyydlin:v0.3'
implementation 'com.github.ByteHamster:SearchPreference:v1.0.3' implementation 'com.github.ByteHamster:SearchPreference:v1.0.8'
androidTestImplementation "com.jayway.android.robotium:robotium-solo:$robotiumSoloVersion" androidTestImplementation "com.jayway.android.robotium:robotium-solo:$robotiumSoloVersion"
} }

View File

@ -37,6 +37,7 @@ import android.widget.Toast;
import com.afollestad.materialdialogs.MaterialDialog; import com.afollestad.materialdialogs.MaterialDialog;
import com.bytehamster.lib.preferencesearch.SearchConfiguration;
import com.bytehamster.lib.preferencesearch.SearchPreference; import com.bytehamster.lib.preferencesearch.SearchPreference;
import de.danoeh.antennapod.activity.AboutActivity; import de.danoeh.antennapod.activity.AboutActivity;
import de.danoeh.antennapod.activity.ImportExportActivity; import de.danoeh.antennapod.activity.ImportExportActivity;
@ -561,32 +562,33 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc
final AppCompatActivity activity = ui.getActivity(); final AppCompatActivity activity = ui.getActivity();
SearchPreference searchPreference = (SearchPreference) ui.findPreference("searchPreference"); SearchPreference searchPreference = (SearchPreference) ui.findPreference("searchPreference");
searchPreference.setActivity(activity); SearchConfiguration config = searchPreference.getSearchConfiguration();
searchPreference.setFragmentContainerViewId(R.id.content); config.setActivity(activity);
searchPreference.setBreadcrumbsEnabled(true); config.setFragmentContainerViewId(R.id.content);
config.setBreadcrumbsEnabled(true);
searchPreference.index() config.index()
.addBreadcrumb(getTitleOfPage(R.xml.preferences_user_interface)) .addBreadcrumb(getTitleOfPage(R.xml.preferences_user_interface))
.addFile(R.xml.preferences_user_interface); .addFile(R.xml.preferences_user_interface);
searchPreference.index() config.index()
.addBreadcrumb(getTitleOfPage(R.xml.preferences_playback)) .addBreadcrumb(getTitleOfPage(R.xml.preferences_playback))
.addFile(R.xml.preferences_playback); .addFile(R.xml.preferences_playback);
searchPreference.index() config.index()
.addBreadcrumb(getTitleOfPage(R.xml.preferences_network)) .addBreadcrumb(getTitleOfPage(R.xml.preferences_network))
.addFile(R.xml.preferences_network); .addFile(R.xml.preferences_network);
searchPreference.index() config.index()
.addBreadcrumb(getTitleOfPage(R.xml.preferences_storage)) .addBreadcrumb(getTitleOfPage(R.xml.preferences_storage))
.addFile(R.xml.preferences_storage); .addFile(R.xml.preferences_storage);
searchPreference.index() config.index()
.addBreadcrumb(getTitleOfPage(R.xml.preferences_network)) .addBreadcrumb(getTitleOfPage(R.xml.preferences_network))
.addBreadcrumb(R.string.automation) .addBreadcrumb(R.string.automation)
.addBreadcrumb(getTitleOfPage(R.xml.preferences_autodownload)) .addBreadcrumb(getTitleOfPage(R.xml.preferences_autodownload))
.addFile(R.xml.preferences_autodownload); .addFile(R.xml.preferences_autodownload);
searchPreference.index() config.index()
.addBreadcrumb(getTitleOfPage(R.xml.preferences_integrations)) .addBreadcrumb(getTitleOfPage(R.xml.preferences_integrations))
.addBreadcrumb(getTitleOfPage(R.xml.preferences_gpodder)) .addBreadcrumb(getTitleOfPage(R.xml.preferences_gpodder))
.addFile(R.xml.preferences_gpodder); .addFile(R.xml.preferences_gpodder);
searchPreference.index() config.index()
.addBreadcrumb(getTitleOfPage(R.xml.preferences_integrations)) .addBreadcrumb(getTitleOfPage(R.xml.preferences_integrations))
.addBreadcrumb(getTitleOfPage(R.xml.preferences_flattr)) .addBreadcrumb(getTitleOfPage(R.xml.preferences_flattr))
.addFile(R.xml.preferences_flattr); .addFile(R.xml.preferences_flattr);

View File

@ -1,11 +1,13 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen <PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:search="http://schemas.android.com/apk/com.bytehamster.lib.preferencesearch">
<de.danoeh.antennapod.preferences.MasterSwitchPreference <de.danoeh.antennapod.preferences.MasterSwitchPreference
android:key="prefEnableAutoDl" android:key="prefEnableAutoDl"
android:title="@string/pref_automatic_download_title" android:title="@string/pref_automatic_download_title"
search:summary="@string/pref_automatic_download_sum"
android:defaultValue="false"/> android:defaultValue="false"/>
<ListPreference <ListPreference
android:defaultValue="25" android:defaultValue="25"

View File

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen <PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:search="http://schemas.android.com/apk/com.bytehamster.lib.preferencesearch">
<PreferenceCategory android:title="@string/automation"> <PreferenceCategory android:title="@string/automation">
<Preference <Preference
android:key="prefAutoUpdateIntervall" android:key="prefAutoUpdateIntervall"
@ -16,7 +17,8 @@
<Preference <Preference
android:summary="@string/pref_automatic_download_sum" android:summary="@string/pref_automatic_download_sum"
android:key="prefAutoDownloadSettings" android:key="prefAutoDownloadSettings"
android:title="@string/pref_automatic_download_title" /> android:title="@string/pref_automatic_download_title"
search:ignore="true" />
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory android:title="@string/download_pref_details"> <PreferenceCategory android:title="@string/download_pref_details">