Merge pull request #1823 from TomHennen/settings_cleanup

Settings cleanup
This commit is contained in:
Tom Hennen 2016-03-25 09:14:01 -04:00
commit 163af2a632
3 changed files with 30 additions and 12 deletions

View File

@ -90,6 +90,7 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc
public static final String PREF_EXPANDED_NOTIFICATION = "prefExpandNotify";
public static final String PREF_PROXY = "prefProxy";
public static final String PREF_KNOWN_ISSUES = "prefKnownIssues";
public static final String PREF_FAQ = "prefFaq";
public static final String PREF_SEND_CRASH_REPORT = "prefSendCrashReport";
private final PreferenceUI ui;
@ -382,14 +383,11 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc
return true;
});
ui.findPreference(PREF_KNOWN_ISSUES).setOnPreferenceClickListener(preference -> {
String url = "https://github.com/AntennaPod/AntennaPod/labels/bug";
try {
Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
ui.getActivity().startActivity(myIntent);
} catch (ActivityNotFoundException e) {
Toast.makeText(ui.getActivity(), R.string.pref_no_browser_found, Toast.LENGTH_LONG).show();
Log.e(TAG, Log.getStackTraceString(e));
}
openInBrowser("https://github.com/AntennaPod/AntennaPod/labels/bug");
return true;
});
ui.findPreference(PREF_FAQ).setOnPreferenceClickListener(preference -> {
openInBrowser("http://antennapod.org/faq.html");
return true;
});
ui.findPreference(PREF_SEND_CRASH_REPORT).setOnPreferenceClickListener(preference -> {
@ -410,6 +408,16 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc
setSelectedNetworksEnabled(UserPreferences.isEnableAutodownloadWifiFilter());
}
private void openInBrowser(String url) {
try {
Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
ui.getActivity().startActivity(myIntent);
} catch (ActivityNotFoundException e) {
Toast.makeText(ui.getActivity(), R.string.pref_no_browser_found, Toast.LENGTH_LONG).show();
Log.e(TAG, Log.getStackTraceString(e));
}
}
public void onResume() {
checkItemVisibility();
setUpdateIntervalText();

View File

@ -254,7 +254,7 @@
android:title="@string/pref_gpodnet_sethostname_title"/>
</PreferenceScreen>
</PreferenceCategory>
<PreferenceCategory android:title="@string/other_pref">
<PreferenceCategory android:title="@string/storage_pref">
<Preference
android:title="@string/choose_data_directory"
android:key="prefChooseDataDir"/>
@ -265,15 +265,19 @@
android:key="prefImageCacheSize"
android:summary="@string/pref_image_cache_size_sum"
android:defaultValue="100"/>
</PreferenceCategory>
<PreferenceCategory android:title="@string/other_pref">
<Preference
android:key="prefOpmlExport"
android:title="@string/opml_export_label"/>
<Preference
android:key="statistics"
android:title="@string/statistics_label"/>
</PreferenceCategory>
<PreferenceCategory android:title="@string/project_pref">
<Preference
android:key="prefAbout"
android:title="@string/about_pref"/>
android:key="prefFaq"
android:title="@string/pref_faq"/>
<Preference
android:key="prefKnownIssues"
android:title="@string/pref_known_issues"/>
@ -281,6 +285,9 @@
android:key="prefSendCrashReport"
android:title="@string/crash_report_title"
android:summary="@string/crash_report_sum"/>
<Preference
android:key="prefAbout"
android:title="@string/about_pref"/>
</PreferenceCategory>
</PreferenceScreen>

View File

@ -289,6 +289,8 @@
<!-- Preferences -->
<string name="storage_pref">Storage</string>
<string name="project_pref">Project</string>
<string name="other_pref">Other</string>
<string name="about_pref">About</string>
<string name="queue_label">Queue</string>
@ -400,6 +402,7 @@
<string name="pref_current_value">Current value: %1$s</string>
<string name="pref_proxy_title">Proxy</string>
<string name="pref_proxy_sum">Set a network proxy</string>
<string name="pref_faq">FAQ</string>
<string name="pref_known_issues">Known issues</string>
<string name="pref_no_browser_found">No web browser found.</string>