From bb161d5fa9d56c5fc7369c979d6fd4eeff187987 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Thu, 9 Jan 2014 22:58:52 +0100 Subject: implement navigation drawer --- .../keychain/ui/HelpActivity.java | 44 ++++++---------------- 1 file changed, 11 insertions(+), 33 deletions(-) (limited to 'OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/HelpActivity.java') diff --git a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/HelpActivity.java b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/HelpActivity.java index 13350b6c6..7407564a9 100644 --- a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/HelpActivity.java +++ b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/HelpActivity.java @@ -17,27 +17,24 @@ package org.sufficientlysecure.keychain.ui; +import java.util.ArrayList; + import org.sufficientlysecure.keychain.R; +import android.content.Context; import android.content.Intent; import android.os.Bundle; +import android.support.v4.app.Fragment; +import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.app.FragmentTransaction; +import android.support.v4.view.ViewPager; import android.widget.TextView; import com.actionbarsherlock.app.ActionBar; import com.actionbarsherlock.app.ActionBar.Tab; -import com.actionbarsherlock.view.MenuItem; - -import java.util.ArrayList; - -import android.content.Context; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentPagerAdapter; -import android.support.v4.view.ViewPager; - import com.actionbarsherlock.app.SherlockFragmentActivity; -public class HelpActivity extends SherlockFragmentActivity { +public class HelpActivity extends DrawerActivity { public static final String EXTRA_SELECTED_TAB = "selectedTab"; ViewPager mViewPager; @@ -45,37 +42,18 @@ public class HelpActivity extends SherlockFragmentActivity { TextView tabCenter; TextView tabText; - /** - * Menu Items - */ - @Override - public boolean onOptionsItemSelected(MenuItem item) { - switch (item.getItemId()) { - case android.R.id.home: - // app icon in Action Bar clicked; go home - Intent intent = new Intent(this, MainActivity.class); - intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); - startActivity(intent); - return true; - default: - return super.onOptionsItemSelected(item); - } - } - @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - + setContentView(R.layout.help_activity); - mViewPager = new ViewPager(this); - mViewPager.setId(R.id.pager); + mViewPager = (ViewPager) findViewById(R.id.pager); + + setupDrawerNavigation(savedInstanceState); - setContentView(mViewPager); ActionBar bar = getSupportActionBar(); bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); - bar.setDisplayShowTitleEnabled(true); - bar.setDisplayHomeAsUpEnabled(true); mTabsAdapter = new TabsAdapter(this, mViewPager); -- cgit v1.2.3 From 3abad09cb0f755a53b47a239c4738b4d1718abfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Thu, 9 Jan 2014 23:51:23 +0100 Subject: preferences and help into menu not drawer according to guidelines and google apps --- .../sufficientlysecure/keychain/ui/HelpActivity.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/HelpActivity.java') diff --git a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/HelpActivity.java b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/HelpActivity.java index 7407564a9..d604c1c86 100644 --- a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/HelpActivity.java +++ b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/HelpActivity.java @@ -34,7 +34,7 @@ import com.actionbarsherlock.app.ActionBar; import com.actionbarsherlock.app.ActionBar.Tab; import com.actionbarsherlock.app.SherlockFragmentActivity; -public class HelpActivity extends DrawerActivity { +public class HelpActivity extends SherlockFragmentActivity { public static final String EXTRA_SELECTED_TAB = "selectedTab"; ViewPager mViewPager; @@ -50,10 +50,11 @@ public class HelpActivity extends DrawerActivity { mViewPager = (ViewPager) findViewById(R.id.pager); - setupDrawerNavigation(savedInstanceState); - - ActionBar bar = getSupportActionBar(); - bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); + final ActionBar actionBar = getSupportActionBar(); + actionBar.setDisplayShowTitleEnabled(true); + actionBar.setDisplayHomeAsUpEnabled(false); + actionBar.setHomeButtonEnabled(false); + actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); mTabsAdapter = new TabsAdapter(this, mViewPager); @@ -65,20 +66,20 @@ public class HelpActivity extends DrawerActivity { Bundle startBundle = new Bundle(); startBundle.putInt(HelpFragmentHtml.ARG_HTML_FILE, R.raw.help_start); - mTabsAdapter.addTab(bar.newTab().setText(getString(R.string.help_tab_start)), + mTabsAdapter.addTab(actionBar.newTab().setText(getString(R.string.help_tab_start)), HelpFragmentHtml.class, startBundle, (selectedTab == 0 ? true : false)); Bundle nfcBundle = new Bundle(); nfcBundle.putInt(HelpFragmentHtml.ARG_HTML_FILE, R.raw.help_nfc_beam); - mTabsAdapter.addTab(bar.newTab().setText(getString(R.string.help_tab_nfc_beam)), + mTabsAdapter.addTab(actionBar.newTab().setText(getString(R.string.help_tab_nfc_beam)), HelpFragmentHtml.class, nfcBundle, (selectedTab == 1 ? true : false)); Bundle changelogBundle = new Bundle(); changelogBundle.putInt(HelpFragmentHtml.ARG_HTML_FILE, R.raw.help_changelog); - mTabsAdapter.addTab(bar.newTab().setText(getString(R.string.help_tab_changelog)), + mTabsAdapter.addTab(actionBar.newTab().setText(getString(R.string.help_tab_changelog)), HelpFragmentHtml.class, changelogBundle, (selectedTab == 2 ? true : false)); - mTabsAdapter.addTab(bar.newTab().setText(getString(R.string.help_tab_about)), + mTabsAdapter.addTab(actionBar.newTab().setText(getString(R.string.help_tab_about)), HelpFragmentAbout.class, null, (selectedTab == 3 ? true : false)); } -- cgit v1.2.3