From 7f406980507c6a5b8c0fa6ac7dba8e640316bd45 Mon Sep 17 00:00:00 2001 From: Tom Hennen Date: Fri, 25 Mar 2016 08:41:05 -0400 Subject: [PATCH] add faq --- .../preferences/PreferenceController.java | 26 ++++++++++++------- app/src/main/res/xml/preferences.xml | 3 +++ core/src/main/res/values/strings.xml | 1 + 3 files changed, 21 insertions(+), 9 deletions(-) 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 3aa04f202..116272578 100644 --- a/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceController.java +++ b/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceController.java @@ -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; @@ -328,7 +329,7 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc Toast.LENGTH_SHORT); toast.show(); return true; - }); + }); ui.findPreference(PreferenceController.PREF_GPODNET_LOGOUT).setOnPreferenceClickListener( preference -> { GpodnetPreferences.logout(); @@ -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(); diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index ad497a90d..675687fb8 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -275,6 +275,9 @@ android:title="@string/statistics_label"/> + diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml index 23e04440a..d7a9e3877 100644 --- a/core/src/main/res/values/strings.xml +++ b/core/src/main/res/values/strings.xml @@ -402,6 +402,7 @@ Current value: %1$s Proxy Set a network proxy + FAQ Known issues No web browser found.