From e044d03d7ffc3daf6ee78584ad0968730a83d191 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Fri, 18 Apr 2014 17:21:32 +0200 Subject: [PATCH] FIx nfc button --- .../keychain/ui/HelpActivity.java | 19 +++++++++++++------ .../keychain/ui/ImportKeysNFCFragment.java | 2 +- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/HelpActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/HelpActivity.java index fcc913a08..e81bc1563 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/HelpActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/HelpActivity.java @@ -29,6 +29,13 @@ import org.sufficientlysecure.keychain.ui.adapter.TabsAdapter; public class HelpActivity extends ActionBarActivity { public static final String EXTRA_SELECTED_TAB = "selected_tab"; + public static final int TAB_START = 0; + public static final int TAB_FAQ = 1; + public static final int TAB_WOT = 2; + public static final int TAB_NFC = 3; + public static final int TAB_CHANGELOG = 4; + public static final int TAB_ABOUT = 5; + ViewPager mViewPager; TabsAdapter mTabsAdapter; @@ -57,29 +64,29 @@ public class HelpActivity extends ActionBarActivity { Bundle startBundle = new Bundle(); startBundle.putInt(HelpHtmlFragment.ARG_HTML_FILE, R.raw.help_start); mTabsAdapter.addTab(actionBar.newTab().setText(getString(R.string.help_tab_start)), - HelpHtmlFragment.class, startBundle, (selectedTab == 0)); + HelpHtmlFragment.class, startBundle, (selectedTab == TAB_START)); Bundle faqBundle = new Bundle(); faqBundle.putInt(HelpHtmlFragment.ARG_HTML_FILE, R.raw.help_faq); mTabsAdapter.addTab(actionBar.newTab().setText(getString(R.string.help_tab_faq)), - HelpHtmlFragment.class, faqBundle, (selectedTab == 1)); + HelpHtmlFragment.class, faqBundle, (selectedTab == TAB_FAQ)); Bundle wotBundle = new Bundle(); wotBundle.putInt(HelpHtmlFragment.ARG_HTML_FILE, R.raw.help_wot); mTabsAdapter.addTab(actionBar.newTab().setText(getString(R.string.help_tab_wot)), - HelpHtmlFragment.class, wotBundle, (selectedTab == 2)); + HelpHtmlFragment.class, wotBundle, (selectedTab == TAB_WOT)); Bundle nfcBundle = new Bundle(); nfcBundle.putInt(HelpHtmlFragment.ARG_HTML_FILE, R.raw.help_nfc_beam); mTabsAdapter.addTab(actionBar.newTab().setText(getString(R.string.help_tab_nfc_beam)), - HelpHtmlFragment.class, nfcBundle, (selectedTab == 3)); + HelpHtmlFragment.class, nfcBundle, (selectedTab == TAB_NFC)); Bundle changelogBundle = new Bundle(); changelogBundle.putInt(HelpHtmlFragment.ARG_HTML_FILE, R.raw.help_changelog); mTabsAdapter.addTab(actionBar.newTab().setText(getString(R.string.help_tab_changelog)), - HelpHtmlFragment.class, changelogBundle, (selectedTab == 4)); + HelpHtmlFragment.class, changelogBundle, (selectedTab == TAB_CHANGELOG)); mTabsAdapter.addTab(actionBar.newTab().setText(getString(R.string.help_tab_about)), - HelpAboutFragment.class, null, (selectedTab == 5)); + HelpAboutFragment.class, null, (selectedTab == TAB_ABOUT)); } } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysNFCFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysNFCFragment.java index f2bb8a5d1..45f464b1c 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysNFCFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysNFCFragment.java @@ -59,7 +59,7 @@ public class ImportKeysNFCFragment extends Fragment { public void onClick(View v) { // show nfc help Intent intent = new Intent(getActivity(), HelpActivity.class); - intent.putExtra(HelpActivity.EXTRA_SELECTED_TAB, 2); + intent.putExtra(HelpActivity.EXTRA_SELECTED_TAB, HelpActivity.TAB_NFC); startActivityForResult(intent, 0); } });