Remove import activity from drawer, make it reachable from key list only

This commit is contained in:
Dominik Schürmann 2014-04-05 23:40:11 +02:00
parent 49bf040dae
commit d0c6971273
8 changed files with 32 additions and 35 deletions

View File

@ -98,12 +98,12 @@
android:name=".ui.SelectPublicKeyActivity"
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
android:label="@string/title_select_recipients"
android:launchMode="singleTop"></activity>
android:launchMode="singleTop" />
<activity
android:name=".ui.SelectSecretKeyActivity"
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
android:label="@string/title_select_secret_key"
android:launchMode="singleTop"></activity>
android:launchMode="singleTop" />
<activity
android:name=".ui.EncryptActivity"
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
@ -361,6 +361,9 @@
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".ui.KeyListActivity" />
</activity>
<activity
android:name=".ui.HelpActivity"

View File

@ -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
};
}

View File

@ -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();

View File

@ -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<CharSequence> 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();

View File

@ -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);

View File

@ -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: {

View File

@ -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)
);
}

View File

@ -10,27 +10,10 @@
app:showAsAction="collapseActionView|ifRoom" />
<item
android:id="@+id/menu_key_list_add"
android:id="@+id/menu_key_list_import"
app:showAsAction="ifRoom|withText"
android:icon="@drawable/ic_action_add_person"
android:title="@string/menu_add_keys">
<menu>
<item
android:id="@+id/menu_key_list_import"
app:showAsAction="never"
android:title="@string/menu_import" />
<item
android:id="@+id/menu_key_list_create"
app:showAsAction="never"
android:title="@string/menu_create_key" />
<item
android:id="@+id/menu_key_list_create_expert"
app:showAsAction="never"
android:title="@string/menu_create_key_expert" />
</menu>
</item>
android:title="@string/menu_add_keys" />
<item
android:id="@+id/menu_key_list_export"
@ -38,4 +21,14 @@
android:icon="@drawable/ic_action_import_export"
android:title="@string/menu_export_all_keys" />
<item
android:id="@+id/menu_key_list_create"
app:showAsAction="never"
android:title="@string/menu_create_key" />
<item
android:id="@+id/menu_key_list_create_expert"
app:showAsAction="never"
android:title="@string/menu_create_key_expert" />
</menu>