diff options
author | Thialfihar <thi@thialfihar.org> | 2015-06-11 20:03:59 +0200 |
---|---|---|
committer | Thialfihar <thi@thialfihar.org> | 2015-07-21 20:56:42 +0200 |
commit | 8d2cd333397d3a4bfd5bb3b42eed4bfedad0e17d (patch) | |
tree | a4fc06d76662c833404b800bdcf02a86bca60df2 | |
parent | d359431662c600b25317f54126ba836dd478bdef (diff) | |
download | open-keychain-8d2cd333397d3a4bfd5bb3b42eed4bfedad0e17d.tar.gz open-keychain-8d2cd333397d3a4bfd5bb3b42eed4bfedad0e17d.tar.bz2 open-keychain-8d2cd333397d3a4bfd5bb3b42eed4bfedad0e17d.zip |
Upgrade MaterialDrawer to 3.0.9
-rw-r--r-- | OpenKeychain/build.gradle | 18 | ||||
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/MainActivity.java | 31 |
2 files changed, 26 insertions, 23 deletions
diff --git a/OpenKeychain/build.gradle b/OpenKeychain/build.gradle index cca22bd08..92a338c0d 100644 --- a/OpenKeychain/build.gradle +++ b/OpenKeychain/build.gradle @@ -13,7 +13,7 @@ dependencies { compile 'com.android.support:design:22.2.0' compile 'com.android.support:recyclerview-v7:22.2.0' compile 'com.android.support:cardview-v7:22.1.0' - + // Unit tests in the local JVM with Robolectric // https://developer.android.com/training/testing/unit-testing/local-unit-tests.html // http://robolectric.org/getting-started/ @@ -49,8 +49,8 @@ dependencies { compile 'com.splitwise:tokenautocomplete:1.3.3@aar' compile 'se.emilsjolander:stickylistheaders:2.6.0' compile 'org.sufficientlysecure:html-textview:1.1' - compile 'com.mikepenz.materialdrawer:library:2.8.2@aar' - compile 'com.mikepenz.iconics:library:0.9.1@aar' + compile 'com.mikepenz:materialdrawer:3.0.9@aar' + compile 'com.mikepenz:iconics:1.0.2' compile 'com.mikepenz.iconics:octicons-typeface:2.2.0@aar' compile 'com.mikepenz.iconics:meteocons-typeface:1.1.1@aar' compile 'com.mikepenz.iconics:community-material-typeface:1.0.0@aar' @@ -88,8 +88,8 @@ dependencyVerification { 'com.splitwise:tokenautocomplete:20bee71cc59b3828eb000b684d46ddf738efd56b8fee453a509cd16fda42c8cb', 'se.emilsjolander:stickylistheaders:8c05981ec5725be33f7cee5e68c13f3db49cd5c75f1aaeb04024920b1ef96ad4', 'org.sufficientlysecure:html-textview:ca24b1522be88378634093815ce9ff1b4920c72e7513a045a7846e14069ef988', - 'com.mikepenz.materialdrawer:library:970317ed1a3cb96317f7b8d62ff592b3103eb46dfd68d9b244e7143623dc6d7a', - 'com.mikepenz.iconics:library:4698a36ee4c2af765d0a85779c61474d755b90d66a59020105b6760a8a909e9e', + 'com.mikepenz:materialdrawer:70c3efb3842461db41df6a918ea93969a7da21e63c092be838b153e5a47a17bf', + 'com.mikepenz:iconics:c1a02203d8e0d638959463c00af3ab9096e0a7c1ad5928762eb10ef5ce8a63cd', 'com.mikepenz.iconics:octicons-typeface:67ed7d456a9ce5f5307b85f955797bfb3dd674e2f6defb31c6b8bbe2ede290be', 'com.mikepenz.iconics:meteocons-typeface:39a8a9e70cd8287cdb119af57a672a41dd09240dba6697f5a0dbda1ccc33298b', 'com.mikepenz.iconics:community-material-typeface:f1c5afee5f0f10d66beb3ed0df977246a02a9c46de4e05d7c0264bcde53b6b7f', @@ -130,12 +130,12 @@ android { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 } - + buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - + // Reference them in the java files with e.g. BuildConfig.ACCOUNT_TYPE. buildConfigField "String", "ACCOUNT_TYPE", "\"org.sufficientlysecure.keychain.account\"" @@ -145,13 +145,13 @@ android { debug { applicationIdSuffix ".debug" - + // Reference them in the java files with e.g. BuildConfig.ACCOUNT_TYPE. buildConfigField "String", "ACCOUNT_TYPE", "\"org.sufficientlysecure.keychain.debug.account\"" // Reference them in .xml files. resValue "string", "account_type", "org.sufficientlysecure.keychain.debug.account" - + // Enable code coverage (Jacoco) testCoverageEnabled true } 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 d00c8f367..6f5d98afd 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/MainActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/MainActivity.java @@ -33,6 +33,7 @@ import com.mikepenz.community_material_typeface_library.CommunityMaterial; import com.mikepenz.google_material_typeface_library.GoogleMaterial; import com.mikepenz.iconics.typeface.FontAwesome; import com.mikepenz.materialdrawer.Drawer; +import com.mikepenz.materialdrawer.DrawerBuilder; import com.mikepenz.materialdrawer.model.PrimaryDrawerItem; import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; @@ -56,7 +57,7 @@ public class MainActivity extends BaseNfcActivity implements FabContainer, OnBac public static final String EXTRA_SKIP_FIRST_TIME = "skip_first_time"; public static final String EXTRA_INIT_FRAG = "init_frag"; - public Drawer.Result mDrawerResult; + public Drawer mDrawer; private Toolbar mToolbar; @Override @@ -68,7 +69,7 @@ public class MainActivity extends BaseNfcActivity implements FabContainer, OnBac mToolbar.setTitle(R.string.app_name); setSupportActionBar(mToolbar); - mDrawerResult = new Drawer() + mDrawer = new DrawerBuilder() .withActivity(this) .withHeader(R.layout.main_drawer_header) .withToolbar(mToolbar) @@ -89,7 +90,7 @@ public class MainActivity extends BaseNfcActivity implements FabContainer, OnBac ) .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() { @Override - public void onItemClick(AdapterView<?> parent, View view, int position, long id, IDrawerItem drawerItem) { + public boolean onItemClick(AdapterView<?> parent, View view, int position, long id, IDrawerItem drawerItem) { if (drawerItem != null) { Intent intent = null; switch(drawerItem.getIdentifier()) { @@ -116,6 +117,8 @@ public class MainActivity extends BaseNfcActivity implements FabContainer, OnBac MainActivity.this.startActivity(intent); } } + + return false; } }) .withSelectedItem(-1) @@ -179,28 +182,28 @@ public class MainActivity extends BaseNfcActivity implements FabContainer, OnBac private void onKeysSelected() { mToolbar.setTitle(R.string.app_name); - mDrawerResult.setSelectionByIdentifier(ID_KEYS, false); + mDrawer.setSelectionByIdentifier(ID_KEYS, false); Fragment frag = new KeyListFragment(); setFragment(frag, false); } private void onEnDecryptSelected() { mToolbar.setTitle(R.string.nav_encrypt_decrypt); - mDrawerResult.setSelectionByIdentifier(ID_ENCRYPT_DECRYPT, false); + mDrawer.setSelectionByIdentifier(ID_ENCRYPT_DECRYPT, false); Fragment frag = new EncryptDecryptOverviewFragment(); setFragment(frag, true); } private void onAppsSelected() { mToolbar.setTitle(R.string.nav_apps); - mDrawerResult.setSelectionByIdentifier(ID_APPS, false); + mDrawer.setSelectionByIdentifier(ID_APPS, false); Fragment frag = new AppsListFragment(); setFragment(frag, true); } private void onBackupSelected() { mToolbar.setTitle(R.string.nav_backup); - mDrawerResult.setSelectionByIdentifier(ID_APPS, false); + mDrawer.setSelectionByIdentifier(ID_APPS, false); Fragment frag = new BackupFragment(); setFragment(frag, true); } @@ -208,15 +211,15 @@ public class MainActivity extends BaseNfcActivity implements FabContainer, OnBac @Override protected void onSaveInstanceState(Bundle outState) { // add the values which need to be saved from the drawer to the bundle - outState = mDrawerResult.saveInstanceState(outState); + outState = mDrawer.saveInstanceState(outState); super.onSaveInstanceState(outState); } @Override public void onBackPressed() { // close the drawer first and if the drawer is closed do regular backstack handling - if (mDrawerResult != null && mDrawerResult.isDrawerOpen()) { - mDrawerResult.closeDrawer(); + if (mDrawer != null && mDrawer.isDrawerOpen()) { + mDrawer.closeDrawer(); } else { super.onBackPressed(); } @@ -255,16 +258,16 @@ public class MainActivity extends BaseNfcActivity implements FabContainer, OnBac // make sure the selected icon is the one shown at this point if (frag instanceof KeyListFragment) { mToolbar.setTitle(R.string.app_name); - mDrawerResult.setSelection(mDrawerResult.getPositionFromIdentifier(ID_KEYS), false); + mDrawer.setSelection(mDrawer.getPositionFromIdentifier(ID_KEYS), false); } else if (frag instanceof EncryptDecryptOverviewFragment) { mToolbar.setTitle(R.string.nav_encrypt_decrypt); - mDrawerResult.setSelection(mDrawerResult.getPositionFromIdentifier(ID_ENCRYPT_DECRYPT), false); + mDrawer.setSelection(mDrawer.getPositionFromIdentifier(ID_ENCRYPT_DECRYPT), false); } else if (frag instanceof AppsListFragment) { mToolbar.setTitle(R.string.nav_apps); - mDrawerResult.setSelection(mDrawerResult.getPositionFromIdentifier(ID_APPS), false); + mDrawer.setSelection(mDrawer.getPositionFromIdentifier(ID_APPS), false); } else if (frag instanceof BackupFragment) { mToolbar.setTitle(R.string.nav_backup); - mDrawerResult.setSelection(mDrawerResult.getPositionFromIdentifier(ID_BACKUP), false); + mDrawer.setSelection(mDrawer.getPositionFromIdentifier(ID_BACKUP), false); } } |