From d8e8f3bc9914a1c9b767487aff87a8efacbccb1e Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 6 Aug 2018 17:04:24 +0000 Subject: [PATCH] Added link to FAQ --- .../java/eu/faircode/email/ActivityView.java | 16 ++++++++++++++++ app/src/main/res/values/strings.xml | 1 + 2 files changed, 17 insertions(+) diff --git a/app/src/main/java/eu/faircode/email/ActivityView.java b/app/src/main/java/eu/faircode/email/ActivityView.java index fbfcb632..3b83f8c5 100644 --- a/app/src/main/java/eu/faircode/email/ActivityView.java +++ b/app/src/main/java/eu/faircode/email/ActivityView.java @@ -26,6 +26,7 @@ import android.content.Intent; import android.content.IntentFilter; import android.content.SharedPreferences; import android.content.res.Configuration; +import android.net.Uri; import android.os.Bundle; import android.preference.PreferenceManager; import android.support.annotation.NonNull; @@ -107,6 +108,9 @@ public class ActivityView extends ActivityBase implements FragmentManager.OnBack case R.string.menu_setup: onMenuSetup(); break; + case R.string.menu_faq: + onMenuFAQ(); + break; case R.string.menu_about: onMenuAbout(); break; @@ -275,10 +279,18 @@ public class ActivityView extends ActivityBase implements FragmentManager.OnBack public void updateDrawer() { ArrayAdapterDrawer drawerArray = new ArrayAdapterDrawer(this, R.layout.item_drawer); drawerArray.add(new DrawerItem(ActivityView.this, R.string.menu_setup)); + if (getIntentFAQ().resolveActivity(getPackageManager()) != null) + drawerArray.add(new DrawerItem(ActivityView.this, R.string.menu_faq)); drawerArray.add(new DrawerItem(ActivityView.this, R.string.menu_about)); drawerList.setAdapter(drawerArray); } + private Intent getIntentFAQ() { + Intent intent = new Intent(Intent.ACTION_VIEW); + intent.setData(Uri.parse("https://github.com/M66B/open-source-email/blob/master/FAQ.md")); + return intent; + } + private void onMenuFolders() { getSupportFragmentManager().popBackStack("unified", 0); @@ -291,6 +303,10 @@ public class ActivityView extends ActivityBase implements FragmentManager.OnBack startActivity(new Intent(ActivityView.this, ActivitySetup.class)); } + private void onMenuFAQ() { + startActivity(getIntentFAQ()); + } + private void onMenuAbout() { FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); fragmentTransaction.replace(R.id.content_frame, new FragmentAbout()).addToBackStack("about"); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9fd78777..9aa6cef1 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -14,6 +14,7 @@ Folders Setup + FAQ About I agree