Show podcast-specific settings in preferences search (#4990)

This commit is contained in:
peakvalleytech 2021-03-06 11:44:15 -08:00 committed by GitHub
parent 1828dd1622
commit f90656d213
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 2 deletions

View File

@ -2,6 +2,7 @@ package de.danoeh.antennapod.activity;
import android.os.Bundle;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.preference.PreferenceFragmentCompat;
import android.view.Menu;
@ -95,6 +96,8 @@ public class PreferenceActivity extends AppCompatActivity implements SearchPrefe
return R.string.gpodnet_main_label;
case R.xml.preferences_notifications:
return R.string.notification_pref_fragment;
case R.xml.feed_settings:
return R.string.feed_settings_label;
default:
return R.string.settings_label;
}
@ -128,7 +131,16 @@ public class PreferenceActivity extends AppCompatActivity implements SearchPrefe
@Override
public void onSearchResultClicked(SearchPreferenceResult result) {
PreferenceFragmentCompat fragment = openScreen(result.getResourceFile());
result.highlight(fragment);
int screen = result.getResourceFile();
if (screen == R.xml.feed_settings) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.feed_settings_label);
builder.setMessage(R.string.pref_feed_settings_dialog_msg);
builder.setPositiveButton(android.R.string.ok, null);
builder.show();
} else {
PreferenceFragmentCompat fragment = openScreen(result.getResourceFile());
result.highlight(fragment);
}
}
}

View File

@ -145,5 +145,7 @@ public class MainPreferencesFragment extends PreferenceFragmentCompat {
.addBreadcrumb(PreferenceActivity.getTitleOfPage(R.xml.preferences_gpodder));
config.index(R.xml.preferences_notifications)
.addBreadcrumb(PreferenceActivity.getTitleOfPage(R.xml.preferences_notifications));
config.index(R.xml.feed_settings)
.addBreadcrumb(PreferenceActivity.getTitleOfPage(R.xml.feed_settings));
}
}

View File

@ -562,6 +562,7 @@
<string name="not_auto_downloaded">Not auto downloaded</string>
<string name="kept_updated">Kept updated</string>
<string name="not_kept_updated">Not kept updated</string>
<string name="pref_feed_settings_dialog_msg">This setting is unique to each podcast. You can change it by opening the podcast page.</string>
<!-- About screen -->
<string name="about_pref">About</string>