diff options
author | Dominik Schürmann <dominik@dominikschuermann.de> | 2015-02-28 00:22:31 +0100 |
---|---|---|
committer | Dominik Schürmann <dominik@dominikschuermann.de> | 2015-02-28 00:22:31 +0100 |
commit | 0669193e7517920972e4bb577c1bec04fa7b594f (patch) | |
tree | 1cb733b9bf8da6a97c6e9c10303d9e7a61f7c25c /OpenKeychain/src/main/java/org/sufficientlysecure | |
parent | 1c91be84af72b80e3aeec003fe3b9edd09d165a1 (diff) | |
download | open-keychain-0669193e7517920972e4bb577c1bec04fa7b594f.tar.gz open-keychain-0669193e7517920972e4bb577c1bec04fa7b594f.tar.bz2 open-keychain-0669193e7517920972e4bb577c1bec04fa7b594f.zip |
Simplify MainActivity
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/MainActivity.java | 25 | ||||
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/NavDrawerActivity.java | 50 |
2 files changed, 23 insertions, 52 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/MainActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/MainActivity.java index 2f29f9360..04350a57d 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/MainActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/MainActivity.java @@ -23,13 +23,34 @@ import android.os.Bundle; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.operations.results.OperationResult; +import org.sufficientlysecure.keychain.remote.ui.AppsListFragment; import org.sufficientlysecure.keychain.util.Preferences; -public class MainActivity extends NavDrawerActivity { +import it.neokree.materialnavigationdrawer.MaterialNavigationDrawer; + +public class MainActivity extends MaterialNavigationDrawer { @Override public void init(Bundle savedInstanceState) { - super.init(savedInstanceState); + // don't open drawer on first run + disableLearningPattern(); + +// addMultiPaneSupport(); + + // set the header image + // create and set the header + setDrawerHeaderImage(R.drawable.drawer_header); + + // create sections + addSection(newSection(getString(R.string.nav_keys), R.drawable.ic_vpn_key_black_24dp, new KeyListFragment())); + addSection(newSection(getString(R.string.nav_encrypt_decrypt), R.drawable.ic_lock_black_24dp, new EncryptDecryptOverviewFragment())); + addSection(newSection(getString(R.string.title_api_registered_apps), R.drawable.ic_apps_black_24dp, new AppsListFragment())); + + // create bottom section + addBottomSection(newSection(getString(R.string.menu_preferences), R.drawable.ic_settings_black_24dp, new Intent(this, SettingsActivity.class))); + addBottomSection(newSection(getString(R.string.menu_help), R.drawable.ic_help_black_24dp, new Intent(this, HelpActivity.class))); + + // if this is the first time show first time activity Preferences prefs = Preferences.getPreferences(this); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/NavDrawerActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/NavDrawerActivity.java deleted file mode 100644 index fb23c7d3a..000000000 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/NavDrawerActivity.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2015 Dominik Schürmann <dominik@dominikschuermann.de> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package org.sufficientlysecure.keychain.ui; - -import android.content.Intent; -import android.os.Bundle; - -import org.sufficientlysecure.keychain.R; -import org.sufficientlysecure.keychain.remote.ui.AppsListFragment; - -import it.neokree.materialnavigationdrawer.MaterialNavigationDrawer; - -public abstract class NavDrawerActivity extends MaterialNavigationDrawer { - - @Override - public void init(Bundle savedInstanceState) { - // don't open drawer on first run - disableLearningPattern(); - -// addMultiPaneSupport(); - - // set the header image - // create and set the header - setDrawerHeaderImage(R.drawable.drawer_header); - - // create sections - addSection(newSection(getString(R.string.nav_keys), R.drawable.ic_vpn_key_black_24dp, new KeyListFragment())); - addSection(newSection(getString(R.string.nav_encrypt_decrypt), R.drawable.ic_lock_black_24dp, new EncryptDecryptOverviewFragment())); - addSection(newSection(getString(R.string.title_api_registered_apps), R.drawable.ic_apps_black_24dp, new AppsListFragment())); - - // create bottom section - addBottomSection(newSection(getString(R.string.menu_preferences), R.drawable.ic_settings_black_24dp, new Intent(this, SettingsActivity.class))); - addBottomSection(newSection(getString(R.string.menu_help), R.drawable.ic_help_black_24dp, new Intent(this, HelpActivity.class))); - } -} |