From d0c6971273f76ce0766f90ea9fb6dacbeb5dd3a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Sat, 5 Apr 2014 23:40:11 +0200 Subject: Remove import activity from drawer, make it reachable from key list only --- .../src/main/java/org/sufficientlysecure/keychain/Constants.java | 5 +---- .../java/org/sufficientlysecure/keychain/ui/DrawerActivity.java | 3 +-- .../org/sufficientlysecure/keychain/ui/ImportKeysActivity.java | 8 ++++---- .../java/org/sufficientlysecure/keychain/ui/KeyListActivity.java | 9 +++++++-- .../java/org/sufficientlysecure/keychain/ui/KeyListFragment.java | 2 +- .../java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java | 2 +- 6 files changed, 15 insertions(+), 14 deletions(-) (limited to 'OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain') diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/Constants.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/Constants.java index 5b9f53b09..b3bfaa229 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/Constants.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/Constants.java @@ -48,8 +48,7 @@ public final class Constants { public static final class Path { public static final String APP_DIR = Environment.getExternalStorageDirectory() + "/OpenKeychain"; - public static final String APP_DIR_FILE_SEC = APP_DIR + "/secexport.asc"; - public static final String APP_DIR_FILE_PUB = APP_DIR + "/pubexport.asc"; + public static final String APP_DIR_FILE = APP_DIR + "/export.asc"; } public static final class Pref { @@ -72,13 +71,11 @@ public final class Constants { public static final Class KEY_LIST = KeyListActivity.class; public static final Class ENCRYPT = EncryptActivity.class; public static final Class DECRYPT = DecryptActivity.class; - public static final Class IMPORT_KEYS = ImportKeysActivity.class; public static final Class REGISTERED_APPS_LIST = AppsListActivity.class; public static final Class[] ARRAY = new Class[]{ KEY_LIST, ENCRYPT, DECRYPT, - IMPORT_KEYS, REGISTERED_APPS_LIST }; } diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/DrawerActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/DrawerActivity.java index f81224380..c875818e3 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/DrawerActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/DrawerActivity.java @@ -81,7 +81,6 @@ public class DrawerActivity extends ActionBarActivity { new NavItem("fa-user", getString(R.string.nav_contacts)), new NavItem("fa-lock", getString(R.string.nav_encrypt)), new NavItem("fa-unlock", getString(R.string.nav_decrypt)), - new NavItem("fa-download", getString(R.string.nav_import)), new NavItem("fa-android", getString(R.string.nav_apps))}; mDrawerList.setAdapter(new NavigationDrawerAdapter(this, R.layout.drawer_list_item, @@ -264,7 +263,7 @@ public class DrawerActivity extends ActionBarActivity { @Override public View getView(int position, View convertView, ViewGroup parent) { View row = convertView; - NavItemHolder holder = null; + NavItemHolder holder; if (row == null) { LayoutInflater inflater = ((Activity) mContext).getLayoutInflater(); diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java index 9b8b92136..6ea79473a 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java @@ -32,6 +32,7 @@ import android.os.Parcelable; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentTransaction; import android.support.v7.app.ActionBar; +import android.support.v7.app.ActionBarActivity; import android.view.View; import android.view.View.OnClickListener; import android.widget.ArrayAdapter; @@ -41,6 +42,7 @@ import com.devspark.appmsg.AppMsg; import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.R; +import org.sufficientlysecure.keychain.helper.ActionBarHelper; import org.sufficientlysecure.keychain.pgp.PgpKeyHelper; import org.sufficientlysecure.keychain.service.KeychainIntentService; import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler; @@ -51,7 +53,7 @@ import org.sufficientlysecure.keychain.util.Log; import java.util.ArrayList; import java.util.Locale; -public class ImportKeysActivity extends DrawerActivity implements ActionBar.OnNavigationListener { +public class ImportKeysActivity extends ActionBarActivity implements ActionBar.OnNavigationListener { public static final String ACTION_IMPORT_KEY = Constants.INTENT_PREFIX + "IMPORT_KEY"; public static final String ACTION_IMPORT_KEY_FROM_QR_CODE = Constants.INTENT_PREFIX + "IMPORT_KEY_FROM_QR_CODE"; @@ -113,10 +115,9 @@ public class ImportKeysActivity extends DrawerActivity implements ActionBar.OnNa if (ACTION_IMPORT_KEY_FROM_KEYSERVER_AND_RETURN.equals(getIntent().getAction())) { setTitle(R.string.nav_import); } else { + ActionBarHelper.setBackButton(this); getSupportActionBar().setDisplayShowTitleEnabled(false); - setupDrawerNavigation(savedInstanceState); - // set drop down navigation Context context = getSupportActionBar().getThemedContext(); ArrayAdapter navigationAdapter = ArrayAdapter.createFromResource(context, @@ -128,7 +129,6 @@ public class ImportKeysActivity extends DrawerActivity implements ActionBar.OnNa handleActions(savedInstanceState, getIntent()); } - protected void handleActions(Bundle savedInstanceState, Intent intent) { String action = intent.getAction(); Bundle extras = intent.getExtras(); diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListActivity.java index 1bc6d4ee1..8db643583 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListActivity.java @@ -53,7 +53,7 @@ public class KeyListActivity extends DrawerActivity { public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_key_list_import: - callIntentForDrawerItem(Constants.DrawerItems.IMPORT_KEYS); + importKeys(); return true; case R.id.menu_key_list_create: @@ -65,7 +65,7 @@ public class KeyListActivity extends DrawerActivity { return true; case R.id.menu_key_list_export: - mExportHelper.showExportKeysDialog(null, Constants.Path.APP_DIR_FILE_PUB, true); + mExportHelper.showExportKeysDialog(null, Constants.Path.APP_DIR_FILE, true); return true; default: @@ -73,6 +73,11 @@ public class KeyListActivity extends DrawerActivity { } } + private void importKeys() { + Intent intent = new Intent(this, ImportKeysActivity.class); + startActivityForResult(intent, 0); + } + private void createKey() { Intent intent = new Intent(this, EditKeyActivity.class); intent.setAction(EditKeyActivity.ACTION_CREATE_KEY); diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java index 1d8f7c8ad..425f5f036 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java @@ -193,7 +193,7 @@ public class KeyListFragment extends Fragment ids = mAdapter.getCurrentSelectedMasterKeyIds(); ExportHelper mExportHelper = new ExportHelper((ActionBarActivity) getActivity()); mExportHelper.showExportKeysDialog( - ids, Constants.Path.APP_DIR_FILE_PUB, mAdapter.isAnySecretSelected()); + ids, Constants.Path.APP_DIR_FILE, mAdapter.isAnySecretSelected()); break; } case R.id.menu_key_list_multi_select_all: { diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java index 7f4e97937..cce34139c 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java @@ -159,7 +159,7 @@ public class ViewKeyActivity extends ActionBarActivity { mExportHelper.showExportKeysDialog( new long[]{(Long) data.get(KeychainContract.KeyRings.MASTER_KEY_ID)}, - Constants.Path.APP_DIR_FILE_PUB, + Constants.Path.APP_DIR_FILE, ((Long) data.get(KeychainContract.KeyRings.HAS_SECRET) == 1) ); } -- cgit v1.2.3