diff options
31 files changed, 994 insertions, 780 deletions
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 011cd9663..ff4abe56a 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/Constants.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/Constants.java @@ -19,6 +19,11 @@ package org.sufficientlysecure.keychain; import android.os.Environment; import org.spongycastle.jce.provider.BouncyCastleProvider; +import org.sufficientlysecure.keychain.service.remote.RegisteredAppsListActivity; +import org.sufficientlysecure.keychain.ui.DecryptActivity; +import org.sufficientlysecure.keychain.ui.EncryptActivity; +import org.sufficientlysecure.keychain.ui.ImportKeysActivity; +import org.sufficientlysecure.keychain.ui.KeyListActivity; public final class Constants { @@ -63,4 +68,13 @@ public final class Constants { public static final String KEY_SERVERS = "pool.sks-keyservers.net, subkeys.pgp.net, pgp.mit.edu"; } + public static final class DrawerItems { + 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 = RegisteredAppsListActivity.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/Id.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/Id.java index 1d79edd43..784ec340e 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/Id.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/Id.java @@ -119,6 +119,7 @@ public final class Id { public static final int secret_key = 0x21070002; public static final int user_id = 0x21070003; public static final int key = 0x21070004; + public static final int public_secret_key = 0x21070005; } public static final class choice { diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/ActionBarHelper.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/ActionBarHelper.java index 91e50637e..a26df556d 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/ActionBarHelper.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/ActionBarHelper.java @@ -37,7 +37,6 @@ public class ActionBarHelper { * @param activity */ public static void setBackButton(ActionBarActivity activity) { - // set actionbar without home button if called from another app final ActionBar actionBar = activity.getSupportActionBar(); Log.d(Constants.TAG, "calling package (only set when using startActivityForResult)=" + activity.getCallingPackage()); diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/ExportHelper.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/ExportHelper.java index 557d75dbf..03cf936ee 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/ExportHelper.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/ExportHelper.java @@ -30,12 +30,18 @@ import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.Id; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.compatibility.DialogFragmentWorkaround; +import org.sufficientlysecure.keychain.provider.KeychainContract; +import org.sufficientlysecure.keychain.provider.ProviderHelper; import org.sufficientlysecure.keychain.service.KeychainIntentService; import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler; import org.sufficientlysecure.keychain.ui.dialog.DeleteKeyDialogFragment; import org.sufficientlysecure.keychain.ui.dialog.FileDialogFragment; import org.sufficientlysecure.keychain.util.Log; +import java.lang.reflect.Array; +import java.security.Provider; +import java.util.ArrayList; + public class ExportHelper { protected FileDialogFragment mFileDialog; protected String mExportFilename; @@ -62,8 +68,8 @@ public class ExportHelper { /** * Show dialog where to export keys */ - public void showExportKeysDialog(final long[] rowIds, final int keyType, - final String exportFilename) { + public void showExportKeysDialog(final long[] masterKeyIds, final int keyType, + final String exportFilename, final String checkboxString) { mExportFilename = exportFilename; // Message is received after file is selected @@ -72,9 +78,14 @@ public class ExportHelper { public void handleMessage(Message message) { if (message.what == FileDialogFragment.MESSAGE_OKAY) { Bundle data = message.getData(); + int type = keyType; mExportFilename = data.getString(FileDialogFragment.MESSAGE_DATA_FILENAME); - exportKeys(rowIds, keyType); + if( data.getBoolean(FileDialogFragment.MESSAGE_DATA_CHECKED) ) { + type = Id.type.public_secret_key; + } + + exportKeys(masterKeyIds, type); } } }; @@ -85,7 +96,7 @@ public class ExportHelper { DialogFragmentWorkaround.INTERFACE.runnableRunDelayed(new Runnable() { public void run() { String title = null; - if (rowIds == null) { + if (masterKeyIds == null) { // export all keys title = mActivity.getString(R.string.title_export_keys); } else { @@ -93,15 +104,10 @@ public class ExportHelper { title = mActivity.getString(R.string.title_export_key); } - String message = null; - if (keyType == Id.type.public_key) { - message = mActivity.getString(R.string.specify_file_to_export_to); - } else { - message = mActivity.getString(R.string.specify_file_to_export_secret_keys_to); - } + String message = mActivity.getString(R.string.specify_file_to_export_to); mFileDialog = FileDialogFragment.newInstance(messenger, title, message, - exportFilename, null); + exportFilename, checkboxString); mFileDialog.show(mActivity.getSupportFragmentManager(), "fileDialog"); } @@ -111,7 +117,7 @@ public class ExportHelper { /** * Export keys */ - public void exportKeys(long[] rowIds, int keyType) { + public void exportKeys(long[] masterKeyIds, int keyType) { Log.d(Constants.TAG, "exportKeys started"); // Send all information needed to service to export key in other thread @@ -125,10 +131,10 @@ public class ExportHelper { data.putString(KeychainIntentService.EXPORT_FILENAME, mExportFilename); data.putInt(KeychainIntentService.EXPORT_KEY_TYPE, keyType); - if (rowIds == null) { + if (masterKeyIds == null) { data.putBoolean(KeychainIntentService.EXPORT_ALL, true); } else { - data.putLongArray(KeychainIntentService.EXPORT_KEY_RING_ROW_ID, rowIds); + data.putLongArray(KeychainIntentService.EXPORT_KEY_RING_MASTER_KEY_ID, masterKeyIds); } intent.putExtra(KeychainIntentService.EXTRA_DATA, data); diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java index dbfa521e5..0e0fdec83 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java @@ -36,6 +36,7 @@ import org.sufficientlysecure.keychain.util.KeyServer.AddKeyException; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; +import java.security.Provider; import java.util.ArrayList; import java.util.List; @@ -158,60 +159,68 @@ public class PgpImportExport { return returnData; } - public Bundle exportKeyRings(ArrayList<Long> keyRingRowIds, int keyType, + public Bundle exportKeyRings(ArrayList<Long> publicKeyRingMasterIds, ArrayList<Long> secretKeyRingMasterIds, OutputStream outStream) throws PgpGeneralException, PGPException, IOException { Bundle returnData = new Bundle(); - int rowIdsSize = keyRingRowIds.size(); + int masterKeyIdsSize = publicKeyRingMasterIds.size() + secretKeyRingMasterIds.size(); + int progress = 0; updateProgress( mContext.getResources().getQuantityString(R.plurals.progress_exporting_key, - rowIdsSize), 0, 100); + masterKeyIdsSize), 0, 100); if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { throw new PgpGeneralException( mContext.getString(R.string.error_external_storage_not_ready)); } - // For each row id - for (int i = 0; i < rowIdsSize; ++i) { + // For each public masterKey id + for (long pubKeyMasterId : publicKeyRingMasterIds) { + progress++; // Create an output stream ArmoredOutputStream arOutStream = new ArmoredOutputStream(outStream); arOutStream.setHeader("Version", PgpHelper.getFullVersion(mContext)); - // If the keyType is secret get the PGPSecretKeyRing - // based on the row id and encode it to the output - if (keyType == Id.type.secret_key) { - updateProgress(i * 100 / rowIdsSize / 2, 100); - PGPSecretKeyRing secretKeyRing = - ProviderHelper.getPGPSecretKeyRingByRowId(mContext, keyRingRowIds.get(i)); + updateProgress(progress * 100 / masterKeyIdsSize, 100); + PGPPublicKeyRing publicKeyRing = + ProviderHelper.getPGPPublicKeyRingByMasterKeyId(mContext, pubKeyMasterId); - if (secretKeyRing != null) { - secretKeyRing.encode(arOutStream); - } - if (mKeychainServiceListener.hasServiceStopped()) { - arOutStream.close(); - return null; - } - } else { - updateProgress(i * 100 / rowIdsSize, 100); - PGPPublicKeyRing publicKeyRing = - ProviderHelper.getPGPPublicKeyRingByRowId(mContext, keyRingRowIds.get(i)); + if (publicKeyRing != null) { + publicKeyRing.encode(arOutStream); + } - if (publicKeyRing != null) { - publicKeyRing.encode(arOutStream); - } + if (mKeychainServiceListener.hasServiceStopped()) { + arOutStream.close(); + return null; + } - if (mKeychainServiceListener.hasServiceStopped()) { - arOutStream.close(); - return null; - } + arOutStream.close(); + } + + // For each secret masterKey id + for (long secretKeyMasterId : secretKeyRingMasterIds) { + progress++; + // Create an output stream + ArmoredOutputStream arOutStream = new ArmoredOutputStream(outStream); + arOutStream.setHeader("Version", PgpHelper.getFullVersion(mContext)); + + updateProgress(progress * 100 / masterKeyIdsSize, 100); + PGPSecretKeyRing secretKeyRing = + ProviderHelper.getPGPSecretKeyRingByMasterKeyId(mContext, secretKeyMasterId); + + if (secretKeyRing != null) { + secretKeyRing.encode(arOutStream); + } + if (mKeychainServiceListener.hasServiceStopped()) { + arOutStream.close(); + return null; } arOutStream.close(); } - returnData.putInt(KeychainIntentService.RESULT_EXPORT, rowIdsSize); + returnData.putInt(KeychainIntentService.RESULT_EXPORT, masterKeyIdsSize); updateProgress(R.string.progress_done, 100, 100); diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java index daaff5d54..6ec6dcf8a 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java @@ -131,7 +131,6 @@ public class KeychainIntentService extends IntentService public static final String EXPORT_KEY_TYPE = "export_key_type"; public static final String EXPORT_ALL = "export_all"; public static final String EXPORT_KEY_RING_MASTER_KEY_ID = "export_key_ring_id"; - public static final String EXPORT_KEY_RING_ROW_ID = "export_key_rind_row_id"; // upload key public static final String UPLOAD_KEY_SERVER = "upload_key_server"; @@ -662,16 +661,11 @@ public class KeychainIntentService extends IntentService if (data.containsKey(EXPORT_KEY_TYPE)) { keyType = data.getInt(EXPORT_KEY_TYPE); } - + long[] masterKeyIds = data.getLongArray(EXPORT_KEY_RING_MASTER_KEY_ID); String outputFile = data.getString(EXPORT_FILENAME); - long[] rowIds = new long[0]; - - // If not exporting all keys get the rowIds of the keys to export from the intent + // If not exporting all keys get the masterKeyIds of the keys to export from the intent boolean exportAll = data.getBoolean(EXPORT_ALL); - if (!exportAll) { - rowIds = data.getLongArray(EXPORT_KEY_RING_ROW_ID); - } /* Operation */ @@ -680,30 +674,38 @@ public class KeychainIntentService extends IntentService throw new PgpGeneralException(getString(R.string.error_external_storage_not_ready)); } - // OutputStream - FileOutputStream outStream = new FileOutputStream(outputFile); + ArrayList<Long> publicMasterKeyIds = new ArrayList<Long>(); + ArrayList<Long> secretMasterKeyIds = new ArrayList<Long>(); + ArrayList<Long> allPublicMasterKeyIds = ProviderHelper.getPublicKeyRingsMasterKeyIds(this); + ArrayList<Long> allSecretMasterKeyIds = ProviderHelper.getSecretKeyRingsMasterKeyIds(this); - ArrayList<Long> keyRingRowIds = new ArrayList<Long>(); if (exportAll) { - - // get all key ring row ids based on export type - if (keyType == Id.type.public_key) { - keyRingRowIds = ProviderHelper.getPublicKeyRingsRowIds(this); - } else { - keyRingRowIds = ProviderHelper.getSecretKeyRingsRowIds(this); + // get all public key ring MasterKey ids + if (keyType == Id.type.public_key || keyType == Id.type.public_secret_key) { + publicMasterKeyIds = allPublicMasterKeyIds; + } + // get all secret key ring MasterKey ids + if (keyType == Id.type.secret_key || keyType == Id.type.public_secret_key) { + secretMasterKeyIds = allSecretMasterKeyIds; } } else { - for (long rowId : rowIds) { - keyRingRowIds.add(rowId); + + for (long masterKeyId : masterKeyIds) { + if ((keyType == Id.type.public_key || keyType == Id.type.public_secret_key) + && allPublicMasterKeyIds.contains(masterKeyId)) { + publicMasterKeyIds.add(masterKeyId); + } + if ((keyType == Id.type.secret_key || keyType == Id.type.public_secret_key) + && allSecretMasterKeyIds.contains(masterKeyId)) { + secretMasterKeyIds.add(masterKeyId); + } } } - Bundle resultData; - PgpImportExport pgpImportExport = new PgpImportExport(this, this, this); - - resultData = pgpImportExport - .exportKeyRings(keyRingRowIds, keyType, outStream); + Bundle resultData = pgpImportExport + .exportKeyRings(publicMasterKeyIds, secretMasterKeyIds, + new FileOutputStream(outputFile)); if (mIsCanceled) { boolean isDeleted = new File(outputFile).delete(); 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 c0fd53007..f01e67449 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 @@ -21,19 +21,17 @@ import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.res.Configuration; +import android.graphics.Color; import android.os.Bundle; import android.support.v4.app.ActionBarDrawerToggle; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarActivity; import android.view.*; -import android.widget.AdapterView; -import android.widget.ArrayAdapter; -import android.widget.ListView; -import android.widget.TextView; +import android.widget.*; import com.beardedhen.androidbootstrap.FontAwesomeText; +import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.R; -import org.sufficientlysecure.keychain.service.remote.RegisteredAppsListActivity; public class DrawerActivity extends ActionBarActivity { private DrawerLayout mDrawerLayout; @@ -42,10 +40,8 @@ public class DrawerActivity extends ActionBarActivity { private CharSequence mDrawerTitle; private CharSequence mTitle; + private boolean mIsDrawerLocked = false; - private static Class[] mItemsClass = new Class[]{KeyListActivity.class, - EncryptActivity.class, DecryptActivity.class, ImportKeysActivity.class, - RegisteredAppsListActivity.class}; private Class mSelectedItem; private static final int MENU_ID_PREFERENCE = 222; @@ -55,10 +51,22 @@ public class DrawerActivity extends ActionBarActivity { mDrawerTitle = getString(R.string.app_name); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerList = (ListView) findViewById(R.id.left_drawer); - - // set a custom shadow that overlays the main content when the drawer - // opens - mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); + ViewGroup viewGroup = (ViewGroup) findViewById(R.id.content_frame); + int leftMarginLoaded = ((ViewGroup.MarginLayoutParams) viewGroup.getLayoutParams()).leftMargin; + int leftMarginInTablets = (int) getResources().getDimension(R.dimen.drawer_size); + int errorInMarginAllowed = 5; + + // if the left margin of the loaded layout is close to the + // one used in tablets then set drawer as open and locked + if( Math.abs(leftMarginLoaded - leftMarginInTablets) < errorInMarginAllowed) { + mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_OPEN, mDrawerList); + mDrawerLayout.setScrimColor(Color.TRANSPARENT); + mIsDrawerLocked = true; + } else { + // set a custom shadow that overlays the main content when the drawer opens + mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); + mIsDrawerLocked = false; + } NavItem mItemIconTexts[] = new NavItem[]{ new NavItem("fa-user", getString(R.string.nav_contacts)), @@ -73,8 +81,11 @@ public class DrawerActivity extends ActionBarActivity { mDrawerList.setOnItemClickListener(new DrawerItemClickListener()); // enable ActionBar app icon to behave as action to toggle nav drawer - getSupportActionBar().setDisplayHomeAsUpEnabled(true); - getSupportActionBar().setHomeButtonEnabled(true); + // if the drawer is not locked + if ( !mIsDrawerLocked ) { + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setHomeButtonEnabled(true); + } // ActionBarDrawerToggle ties together the the proper interactions // between the sliding drawer and the action bar app icon @@ -86,19 +97,8 @@ public class DrawerActivity extends ActionBarActivity { ) { public void onDrawerClosed(View view) { getSupportActionBar().setTitle(mTitle); - // creates call to onPrepareOptionsMenu() - supportInvalidateOptionsMenu(); - // call intent activity if selected - if (mSelectedItem != null) { - finish(); - overridePendingTransition(0, 0); - - Intent intent = new Intent(DrawerActivity.this, mSelectedItem); - startActivity(intent); - // disable animation of activity start - overridePendingTransition(0, 0); - } + callIntentForDrawerItem(mSelectedItem); } public void onDrawerOpened(View drawerView) { @@ -108,13 +108,40 @@ public class DrawerActivity extends ActionBarActivity { supportInvalidateOptionsMenu(); } }; - mDrawerLayout.setDrawerListener(mDrawerToggle); + if ( !mIsDrawerLocked ) { + mDrawerLayout.setDrawerListener(mDrawerToggle); + } else { + // If the drawer is locked open make it un-focusable + // so that it doesn't consume all the Back button presses + mDrawerLayout.setFocusableInTouchMode(false); + } // if (savedInstanceState == null) { // selectItem(0); // } } + /** + * Uses startActivity to call the Intent of the given class + * @param drawerItem the class of the drawer item you want to load. Based on Constants.DrawerItems.* + */ + public void callIntentForDrawerItem(Class drawerItem) { + // creates call to onPrepareOptionsMenu() + supportInvalidateOptionsMenu(); + + // call intent activity if selected + if (drawerItem != null) { + finish(); + overridePendingTransition(0, 0); + + Intent intent = new Intent(this, drawerItem); + startActivity(intent); + + // disable animation of activity start + overridePendingTransition(0, 0); + } + } + @Override public boolean onCreateOptionsMenu(Menu menu) { menu.add(42, MENU_ID_PREFERENCE, 100, R.string.menu_preferences); @@ -185,10 +212,18 @@ public class DrawerActivity extends ActionBarActivity { private void selectItem(int position) { // update selected item and title, then close the drawer mDrawerList.setItemChecked(position, true); - // setTitle(mDrawerTitles[position]); - mDrawerLayout.closeDrawer(mDrawerList); // set selected class - mSelectedItem = mItemsClass[position]; + mSelectedItem = Constants.DrawerItems.ARRAY[position]; + + // setTitle(mDrawerTitles[position]); + // If drawer isn't locked just close the drawer and + // it will move to the selected item by itself (via drawer toggle listener) + if ( !mIsDrawerLocked ) { + mDrawerLayout.closeDrawer(mDrawerList); + // else move to the selected item yourself + } else { + callIntentForDrawerItem(mSelectedItem); + } } /** diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java index edf980773..7edb61b09 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java @@ -322,8 +322,10 @@ public class EditKeyActivity extends ActionBarActivity { cancelClicked(); return true; case R.id.menu_key_edit_export_file: - long[] ids = new long[]{Long.valueOf(mDataUri.getLastPathSegment())}; - mExportHelper.showExportKeysDialog(ids, Id.type.secret_key, Constants.Path.APP_DIR_FILE_SEC); + long masterKeyId = ProviderHelper.getMasterKeyId(this, mDataUri); + long[] ids = new long[]{masterKeyId}; + mExportHelper.showExportKeysDialog(ids, Id.type.secret_key, Constants.Path.APP_DIR_FILE_SEC, + null); return true; case R.id.menu_key_edit_delete: { // Message is received after key is deleted 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 078b998e1..06df6f12d 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,13 +53,11 @@ public class KeyListActivity extends DrawerActivity { public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_key_list_import: - Intent intentImport = new Intent(this, ImportKeysActivity.class); - startActivityForResult(intentImport, 0); + callIntentForDrawerItem(Constants.DrawerItems.IMPORT_KEYS); return true; case R.id.menu_key_list_export: - // TODO fix this for unified keylist - mExportHelper.showExportKeysDialog(null, Id.type.public_key, Constants.Path.APP_DIR_FILE_PUB); + mExportHelper.showExportKeysDialog(null, Id.type.public_key, Constants.Path.APP_DIR_FILE_PUB, null); return true; case R.id.menu_key_list_create: @@ -71,7 +69,7 @@ public class KeyListActivity extends DrawerActivity { return true; case R.id.menu_key_list_secret_export: - mExportHelper.showExportKeysDialog(null, Id.type.secret_key, Constants.Path.APP_DIR_FILE_SEC); + mExportHelper.showExportKeysDialog(null, Id.type.secret_key, Constants.Path.APP_DIR_FILE_SEC, null); return true; default: 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 5ac59965d..cac8b7046 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 @@ -49,6 +49,7 @@ import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings; import org.sufficientlysecure.keychain.provider.KeychainContract.KeyTypes; import org.sufficientlysecure.keychain.provider.KeychainContract.UserIds; import org.sufficientlysecure.keychain.provider.KeychainDatabase; +import org.sufficientlysecure.keychain.provider.ProviderHelper; import org.sufficientlysecure.keychain.ui.adapter.HighlightQueryCursorAdapter; import org.sufficientlysecure.keychain.ui.dialog.DeleteKeyDialogFragment; import org.sufficientlysecure.keychain.util.Log; @@ -183,13 +184,22 @@ public class KeyListFragment extends Fragment break; } case R.id.menu_key_list_multi_export: { - // todo: public/secret needs to be handled differently here ids = mStickyList.getWrappedList().getCheckedItemIds(); + long[] masterKeyIds = new long[2*ids.length]; + ArrayList<Long> allPubRowIds = + ProviderHelper.getPublicKeyRingsRowIds(getActivity()); + for (int i = 0; i < ids.length; i++) { + if (allPubRowIds.contains(ids[i])) { + masterKeyIds[i] = ProviderHelper.getPublicMasterKeyId(getActivity(), ids[i]); + } else { + masterKeyIds[i] = ProviderHelper.getSecretMasterKeyId(getActivity(), ids[i]); + } + } ExportHelper mExportHelper = new ExportHelper((ActionBarActivity) getActivity()); mExportHelper - .showExportKeysDialog(ids, - Id.type.public_key, - Constants.Path.APP_DIR_FILE_PUB); + .showExportKeysDialog(masterKeyIds, Id.type.public_key, + Constants.Path.APP_DIR_FILE_PUB, + getString(R.string.also_export_secret_keys)); 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 93bb83003..c4097403c 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 @@ -124,8 +124,11 @@ public class ViewKeyActivity extends ActionBarActivity { uploadToKeyserver(mDataUri); return true; case R.id.menu_key_view_export_file: - long[] ids = new long[]{Long.valueOf(mDataUri.getLastPathSegment())}; - mExportHelper.showExportKeysDialog(ids, Id.type.public_key, Constants.Path.APP_DIR_FILE_PUB); + long masterKeyId = + ProviderHelper.getPublicMasterKeyId(this, Long.valueOf(mDataUri.getLastPathSegment())); + long[] ids = new long[]{masterKeyId}; + mExportHelper.showExportKeysDialog(ids, Id.type.public_key, + Constants.Path.APP_DIR_FILE_PUB, null); return true; case R.id.menu_key_view_share_default_fingerprint: shareKey(mDataUri, true); diff --git a/OpenPGP-Keychain/src/main/res/layout-large/api_apps_list_activity.xml b/OpenPGP-Keychain/src/main/res/layout-large/api_apps_list_activity.xml new file mode 100644 index 000000000..c0021261e --- /dev/null +++ b/OpenPGP-Keychain/src/main/res/layout-large/api_apps_list_activity.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="utf-8"?> +<FrameLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="horizontal" > + <android.support.v4.widget.DrawerLayout + android:id="@+id/drawer_layout" + + android:layout_width="match_parent" + android:layout_height="match_parent"> + + + <include layout="@layout/drawer_list"/> + + </android.support.v4.widget.DrawerLayout> + + <include layout="@layout/api_apps_list_content"/> + +</FrameLayout>
\ No newline at end of file diff --git a/OpenPGP-Keychain/src/main/res/layout-large/decrypt_activity.xml b/OpenPGP-Keychain/src/main/res/layout-large/decrypt_activity.xml new file mode 100644 index 000000000..26aed0831 --- /dev/null +++ b/OpenPGP-Keychain/src/main/res/layout-large/decrypt_activity.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<FrameLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="horizontal" + android:layout_width="match_parent" + android:layout_height="match_parent"> + <android.support.v4.widget.DrawerLayout + xmlns:bootstrapbutton="http://schemas.android.com/apk/res-auto" + android:id="@+id/drawer_layout" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <include layout="@layout/drawer_list"/> + + </android.support.v4.widget.DrawerLayout> + + <include layout="@layout/decrypt_content"/> + +</FrameLayout>
\ No newline at end of file diff --git a/OpenPGP-Keychain/src/main/res/layout-large/encrypt_activity.xml b/OpenPGP-Keychain/src/main/res/layout-large/encrypt_activity.xml new file mode 100644 index 000000000..7d0d44074 --- /dev/null +++ b/OpenPGP-Keychain/src/main/res/layout-large/encrypt_activity.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<FrameLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="horizontal" + android:layout_width="match_parent" + android:layout_height="match_parent"> + <android.support.v4.widget.DrawerLayout + xmlns:bootstrapbutton="http://schemas.android.com/apk/res-auto" + xmlns:fontawesometext="http://schemas.android.com/apk/res-auto" + android:id="@+id/drawer_layout" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <include layout="@layout/drawer_list"/> + + </android.support.v4.widget.DrawerLayout> + + <include layout="@layout/encrypt_content"/> +</FrameLayout>
\ No newline at end of file diff --git a/OpenPGP-Keychain/src/main/res/layout-large/import_keys_activity.xml b/OpenPGP-Keychain/src/main/res/layout-large/import_keys_activity.xml new file mode 100644 index 000000000..2cb408441 --- /dev/null +++ b/OpenPGP-Keychain/src/main/res/layout-large/import_keys_activity.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<FrameLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="horizontal" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <android.support.v4.widget.DrawerLayout + xmlns:bootstrapbutton="http://schemas.android.com/apk/res-auto" + android:id="@+id/drawer_layout" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + + <include layout="@layout/drawer_list"/> + + </android.support.v4.widget.DrawerLayout> + + <include layout="@layout/import_keys_content"/> + +</FrameLayout>
\ No newline at end of file diff --git a/OpenPGP-Keychain/src/main/res/layout-large/key_list_activity.xml b/OpenPGP-Keychain/src/main/res/layout-large/key_list_activity.xml new file mode 100644 index 000000000..6636f12ff --- /dev/null +++ b/OpenPGP-Keychain/src/main/res/layout-large/key_list_activity.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="utf-8"?> +<FrameLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="horizontal" + android:layout_width="match_parent" + android:layout_height="match_parent"> + <android.support.v4.widget.DrawerLayout + android:id="@+id/drawer_layout" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <include layout="@layout/drawer_list"/> + + </android.support.v4.widget.DrawerLayout> + + <include layout="@layout/key_list_content"/> + +</FrameLayout>
\ No newline at end of file diff --git a/OpenPGP-Keychain/src/main/res/layout/api_apps_list_activity.xml b/OpenPGP-Keychain/src/main/res/layout/api_apps_list_activity.xml index 71fbcfb12..9f95e9f3b 100644 --- a/OpenPGP-Keychain/src/main/res/layout/api_apps_list_activity.xml +++ b/OpenPGP-Keychain/src/main/res/layout/api_apps_list_activity.xml @@ -4,16 +4,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" > - <FrameLayout - android:layout_width="match_parent" - android:layout_height="match_parent" > - - <fragment - android:id="@+id/crypto_consumers_list_fragment" - android:name="org.sufficientlysecure.keychain.service.remote.RegisteredAppsListFragment" - android:layout_width="match_parent" - android:layout_height="match_parent" /> - </FrameLayout> + <include layout="@layout/api_apps_list_content"/> <include layout="@layout/drawer_list" /> diff --git a/OpenPGP-Keychain/src/main/res/layout/api_apps_list_content.xml b/OpenPGP-Keychain/src/main/res/layout/api_apps_list_content.xml new file mode 100644 index 000000000..b8606b929 --- /dev/null +++ b/OpenPGP-Keychain/src/main/res/layout/api_apps_list_content.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<FrameLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/content_frame" + android:layout_marginLeft="@dimen/drawer_content_padding" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <fragment + android:id="@+id/crypto_consumers_list_fragment" + android:name="org.sufficientlysecure.keychain.service.remote.RegisteredAppsListFragment" + android:layout_width="match_parent" + android:layout_height="match_parent"/> +</FrameLayout>
\ No newline at end of file diff --git a/OpenPGP-Keychain/src/main/res/layout/decrypt_activity.xml b/OpenPGP-Keychain/src/main/res/layout/decrypt_activity.xml index 25c7c000c..c4709a67e 100644 --- a/OpenPGP-Keychain/src/main/res/layout/decrypt_activity.xml +++ b/OpenPGP-Keychain/src/main/res/layout/decrypt_activity.xml @@ -5,206 +5,7 @@ android:layout_width="match_parent" android:layout_height="match_parent"> - <ScrollView - android:layout_width="match_parent" - android:layout_height="match_parent" - android:fillViewport="true" - android:orientation="vertical"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - android:paddingTop="4dp" - android:paddingLeft="10dp" - android:paddingRight="10dp"> - - <RelativeLayout - android:id="@+id/signature" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:clickable="true" - android:orientation="horizontal" - android:padding="4dp" - android:paddingLeft="10dp" - android:paddingRight="10dp"> - - <RelativeLayout - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:id="@+id/relativeLayout"> - - <ImageView - android:id="@+id/ic_signature" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:src="@drawable/signed_large" /> - - <ImageView - android:id="@+id/ic_signature_status" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:src="@drawable/overlay_error" /> - </RelativeLayout> - - <com.beardedhen.androidbootstrap.BootstrapButton - android:id="@+id/lookup_key" - android:visibility="gone" - android:layout_width="wrap_content" - android:layout_height="50dp" - android:padding="4dp" - android:text="@string/btn_lookup_key" - bootstrapbutton:bb_icon_left="fa-download" - bootstrapbutton:bb_type="info" - bootstrapbutton:bb_size="small" - android:layout_alignParentTop="true" - android:layout_alignParentRight="true" - android:layout_alignParentEnd="true" /> - - <TextView - android:id="@+id/mainUserId" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="left" - android:text="@string/label_main_user_id" - android:textAppearance="?android:attr/textAppearanceMedium" - android:layout_toRightOf="@+id/relativeLayout" /> - - <TextView - android:id="@+id/mainUserIdRest" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="left" - android:text="Main User Id Rest" - android:textAppearance="?android:attr/textAppearanceSmall" - android:layout_below="@+id/mainUserId" - android:layout_toRightOf="@+id/relativeLayout" /> - </RelativeLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal"> - - <ImageView - android:id="@+id/sourcePrevious" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:src="@drawable/ic_previous" /> - - <TextView - android:id="@+id/sourceLabel" - style="@style/SectionHeader" - android:layout_width="0dip" - android:layout_height="match_parent" - android:layout_weight="1" - android:gravity="center_horizontal|center_vertical" - android:text="@string/label_message" - android:textAppearance="?android:attr/textAppearanceMedium" /> - - <ImageView - android:id="@+id/sourceNext" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:src="@drawable/ic_next" /> - </LinearLayout> - - <ViewFlipper - android:id="@+id/source" - android:layout_width="match_parent" - android:layout_height="0dip" - android:layout_weight="1"> - - <LinearLayout - android:id="@+id/sourceMessage" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical" - android:padding="4dp"> - - <EditText - android:id="@+id/message" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:gravity="top" - android:inputType="text|textCapSentences|textMultiLine|textLongMessage" - android:scrollHorizontally="true" /> - </LinearLayout> - - <LinearLayout - android:id="@+id/sourceFile" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical" - android:padding="4dp"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal"> - - <EditText - android:id="@+id/filename" - android:layout_width="0dip" - android:layout_height="wrap_content" - android:layout_weight="1" - android:gravity="top|left" - android:inputType="textMultiLine|textUri" - android:lines="4" - android:maxLines="10" - android:minLines="2" - android:scrollbars="vertical" /> - - <com.beardedhen.androidbootstrap.BootstrapButton - android:id="@+id/btn_browse" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_margin="4dp" - bootstrapbutton:bb_icon_left="fa-folder-open" - bootstrapbutton:bb_roundedCorners="true" - bootstrapbutton:bb_size="default" - bootstrapbutton:bb_type="default" /> - </LinearLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal"> - - <CheckBox - android:id="@+id/deleteAfterDecryption" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:text="@string/label_delete_after_decryption" /> - </LinearLayout> - </LinearLayout> - </ViewFlipper> - - <TextView - style="@style/SectionHeader" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginBottom="4dp" - android:text="@string/section_decrypt_verify" /> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal" - android:padding="4dp"> - - <com.beardedhen.androidbootstrap.BootstrapButton - android:id="@+id/action_decrypt" - android:layout_width="match_parent" - android:layout_height="60dp" - android:padding="4dp" - android:text="@string/btn_decrypt_verify" - bootstrapbutton:bb_icon_left="fa-unlock" - bootstrapbutton:bb_type="info" /> - </LinearLayout> - </LinearLayout> - </ScrollView> + <include layout="@layout/decrypt_content"/> <include layout="@layout/drawer_list" /> diff --git a/OpenPGP-Keychain/src/main/res/layout/decrypt_content.xml b/OpenPGP-Keychain/src/main/res/layout/decrypt_content.xml new file mode 100644 index 000000000..a847d9e46 --- /dev/null +++ b/OpenPGP-Keychain/src/main/res/layout/decrypt_content.xml @@ -0,0 +1,205 @@ +<?xml version="1.0" encoding="utf-8"?> +<ScrollView + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:bootstrapbutton="http://schemas.android.com/apk/res-auto" + android:id="@+id/content_frame" + android:layout_marginLeft="@dimen/drawer_content_padding" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:fillViewport="true" + android:orientation="vertical"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:paddingTop="4dp" + android:paddingLeft="10dp" + android:paddingRight="10dp"> + + <RelativeLayout + android:id="@+id/signature" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:clickable="true" + android:orientation="horizontal" + android:padding="4dp" + android:paddingLeft="10dp" + android:paddingRight="10dp"> + + <RelativeLayout + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/relativeLayout"> + + <ImageView + android:id="@+id/ic_signature" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:src="@drawable/signed_large"/> + + <ImageView + android:id="@+id/ic_signature_status" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:src="@drawable/overlay_error"/> + </RelativeLayout> + + <com.beardedhen.androidbootstrap.BootstrapButton + android:id="@+id/lookup_key" + android:visibility="gone" + android:layout_width="wrap_content" + android:layout_height="50dp" + android:padding="4dp" + android:text="@string/btn_lookup_key" + bootstrapbutton:bb_icon_left="fa-download" + bootstrapbutton:bb_type="info" + bootstrapbutton:bb_size="small" + android:layout_alignParentTop="true" + android:layout_alignParentRight="true" + android:layout_alignParentEnd="true"/> + + <TextView + android:id="@+id/mainUserId" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="left" + android:text="@string/label_main_user_id" + android:textAppearance="?android:attr/textAppearanceMedium" + android:layout_toRightOf="@+id/relativeLayout"/> + + <TextView + android:id="@+id/mainUserIdRest" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="left" + android:text="Main User Id Rest" + android:textAppearance="?android:attr/textAppearanceSmall" + android:layout_below="@+id/mainUserId" + android:layout_toRightOf="@+id/relativeLayout"/> + </RelativeLayout> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal"> + + <ImageView + android:id="@+id/sourcePrevious" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:src="@drawable/ic_previous"/> + + <TextView + android:id="@+id/sourceLabel" + style="@style/SectionHeader" + android:layout_width="0dip" + android:layout_height="match_parent" + android:layout_weight="1" + android:gravity="center_horizontal|center_vertical" + android:text="@string/label_message" + android:textAppearance="?android:attr/textAppearanceMedium"/> + + <ImageView + android:id="@+id/sourceNext" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:src="@drawable/ic_next"/> + </LinearLayout> + + <ViewFlipper + android:id="@+id/source" + android:layout_width="match_parent" + android:layout_height="0dip" + android:layout_weight="1"> + + <LinearLayout + android:id="@+id/sourceMessage" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical" + android:padding="4dp"> + + <EditText + android:id="@+id/message" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:gravity="top" + android:inputType="text|textCapSentences|textMultiLine|textLongMessage" + android:scrollHorizontally="true"/> + </LinearLayout> + + <LinearLayout + android:id="@+id/sourceFile" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical" + android:padding="4dp"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal"> + + <EditText + android:id="@+id/filename" + android:layout_width="0dip" + android:layout_height="wrap_content" + android:layout_weight="1" + android:gravity="top|left" + android:inputType="textMultiLine|textUri" + android:lines="4" + android:maxLines="10" + android:minLines="2" + android:scrollbars="vertical"/> + + <com.beardedhen.androidbootstrap.BootstrapButton + android:id="@+id/btn_browse" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_margin="4dp" + bootstrapbutton:bb_icon_left="fa-folder-open" + bootstrapbutton:bb_roundedCorners="true" + bootstrapbutton:bb_size="default" + bootstrapbutton:bb_type="default"/> + </LinearLayout> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal"> + + <CheckBox + android:id="@+id/deleteAfterDecryption" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" + android:text="@string/label_delete_after_decryption"/> + </LinearLayout> + </LinearLayout> + </ViewFlipper> + + <TextView + style="@style/SectionHeader" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginBottom="4dp" + android:text="@string/section_decrypt_verify"/> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:padding="4dp"> + + <com.beardedhen.androidbootstrap.BootstrapButton + android:id="@+id/action_decrypt" + android:layout_width="match_parent" + android:layout_height="60dp" + android:padding="4dp" + android:text="@string/btn_decrypt_verify" + bootstrapbutton:bb_icon_left="fa-unlock" + bootstrapbutton:bb_type="info"/> + </LinearLayout> + </LinearLayout> +</ScrollView>
\ No newline at end of file diff --git a/OpenPGP-Keychain/src/main/res/layout/drawer_list.xml b/OpenPGP-Keychain/src/main/res/layout/drawer_list.xml index 81ceba20c..ab00c0073 100644 --- a/OpenPGP-Keychain/src/main/res/layout/drawer_list.xml +++ b/OpenPGP-Keychain/src/main/res/layout/drawer_list.xml @@ -9,7 +9,7 @@ --> <ListView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/left_drawer" - android:layout_width="240dp" + android:layout_width="@dimen/drawer_size" android:layout_height="match_parent" android:layout_gravity="start" android:background="@color/white" diff --git a/OpenPGP-Keychain/src/main/res/layout/encrypt_activity.xml b/OpenPGP-Keychain/src/main/res/layout/encrypt_activity.xml index 4fe65e341..6484c9b7b 100644 --- a/OpenPGP-Keychain/src/main/res/layout/encrypt_activity.xml +++ b/OpenPGP-Keychain/src/main/res/layout/encrypt_activity.xml @@ -6,399 +6,7 @@ android:layout_width="match_parent" android:layout_height="match_parent"> - <ScrollView - android:layout_width="match_parent" - android:layout_height="match_parent" - android:fillViewport="true"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - android:paddingLeft="10dp" - android:paddingRight="10dp"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal" - android:padding="4dp"> - - <ImageView - android:id="@+id/modePrevious" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:src="@drawable/ic_previous" /> - - <TextView - android:id="@+id/modeLabel" - style="@style/SectionHeader" - android:layout_width="0dip" - android:layout_height="match_parent" - android:layout_weight="1" - android:gravity="center_horizontal|center_vertical" - android:text="@string/label_asymmetric" /> - - <ImageView - android:id="@+id/modeNext" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:src="@drawable/ic_next" /> - </LinearLayout> - - <ViewFlipper - android:id="@+id/mode" - android:layout_width="match_parent" - android:layout_height="wrap_content"> - - <LinearLayout - android:id="@+id/modeAsymmetric" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - android:padding="4dp"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal"> - - <CheckBox - android:id="@+id/sign" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:text="@string/label_sign" /> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - android:paddingLeft="16dp"> - - <TextView - android:id="@+id/mainUserId" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="right" - android:ellipsize="end" - android:singleLine="true" - android:text="@string/label_sign_user_id" - android:textAppearance="?android:attr/textAppearanceMedium" /> - - <TextView - android:id="@+id/mainUserIdRest" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="right" - android:ellipsize="end" - android:singleLine="true" - android:text="@string/label_sign_email" - android:textAppearance="?android:attr/textAppearanceSmall" /> - </LinearLayout> - </LinearLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal" - android:paddingBottom="3dip"> - - <TextView - android:id="@+id/label_selectPublicKeys" - android:layout_width="0dip" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:layout_weight="1" - android:text="@string/label_select_public_keys" - android:textAppearance="?android:attr/textAppearanceMedium" /> - - <com.beardedhen.androidbootstrap.BootstrapButton - android:id="@+id/btn_selectEncryptKeys" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:layout_margin="4dp" - android:text="@string/btn_select_encrypt_keys" - bootstrapbutton:bb_icon_left="fa-user" - bootstrapbutton:bb_size="default" - bootstrapbutton:bb_type="default" /> - </LinearLayout> - </LinearLayout> - - <TableLayout - android:id="@+id/modeSymmetric" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:padding="4dp" - android:stretchColumns="1"> - - <TableRow> - - <TextView - android:id="@+id/label_passphrase" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:paddingRight="10dip" - android:text="@string/label_passphrase" - android:textAppearance="?android:attr/textAppearanceMedium" /> - - <EditText - android:id="@+id/passphrase" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:inputType="textPassword" /> - </TableRow> - - <TableRow> - - <TextView - android:id="@+id/label_passphraseAgain" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:paddingRight="10dip" - android:text="@string/label_passphrase_again" - android:textAppearance="?android:attr/textAppearanceMedium" /> - - <EditText - android:id="@+id/passphraseAgain" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:inputType="textPassword" /> - </TableRow> - </TableLayout> - </ViewFlipper> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal" - android:padding="4dp"> - - <ImageView - android:id="@+id/sourcePrevious" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:src="@drawable/ic_previous" /> - - <TextView - android:id="@+id/sourceLabel" - style="@style/SectionHeader" - android:layout_width="0dip" - android:layout_height="match_parent" - android:layout_weight="1" - android:gravity="center_horizontal|center_vertical" - android:text="@string/label_message" - android:textAppearance="?android:attr/textAppearanceMedium" /> - - <ImageView - android:id="@+id/sourceNext" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:src="@drawable/ic_next" /> - </LinearLayout> - - <ViewFlipper - android:id="@+id/source" - android:layout_width="match_parent" - android:layout_height="0dip" - android:layout_weight="1"> - - <LinearLayout - android:id="@+id/sourceMessage" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical" - android:padding="4dp"> - - <EditText - android:id="@+id/message" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:gravity="top" - android:inputType="text|textCapSentences|textMultiLine|textLongMessage" /> - </LinearLayout> - - <LinearLayout - android:id="@+id/sourceFile" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical" - android:padding="4dp"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal"> - - <EditText - android:id="@+id/filename" - android:layout_width="0dip" - android:layout_height="wrap_content" - android:layout_weight="1" - android:gravity="top|left" - android:inputType="textMultiLine|textUri" - android:lines="4" - android:maxLines="10" - android:minLines="2" - android:scrollbars="vertical" /> - - <com.beardedhen.androidbootstrap.BootstrapButton - android:id="@+id/btn_browse" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_margin="4dp" - bootstrapbutton:bb_icon_left="fa-folder-open" - bootstrapbutton:bb_roundedCorners="true" - bootstrapbutton:bb_size="default" - bootstrapbutton:bb_type="default" /> - </LinearLayout> - - <LinearLayout - android:id="@+id/advancedSettingsControl" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal" - android:clickable="true"> - - <com.beardedhen.androidbootstrap.FontAwesomeText - android:id="@+id/advancedSettingsIcon" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginRight="10dp" - android:textSize="12sp" - android:paddingTop="@dimen/padding_medium" - android:paddingBottom="@dimen/padding_medium" - fontawesometext:fa_icon="fa-chevron-right" /> - - <TextView - android:id="@+id/advancedSettings" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/btn_encryption_advanced_settings_show" - android:paddingTop="@dimen/padding_medium" - android:paddingBottom="@dimen/padding_medium" - android:textColor="@color/emphasis" /> - </LinearLayout> - - <LinearLayout - android:id="@+id/fileAdvancedSettingsContainer" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - android:visibility="gone"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal"> - - <TextView - android:id="@+id/label_fileCompression" - android:layout_width="0dip" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:layout_weight="1" - android:paddingRight="10dip" - android:text="@string/label_file_compression" - android:textAppearance="?android:attr/textAppearanceSmall" /> - - <Spinner - android:id="@+id/fileCompression" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical" /> - </LinearLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal"> - - <CheckBox - android:id="@+id/deleteAfterEncryption" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:text="@string/label_delete_after_encryption" /> - </LinearLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal"> - - <CheckBox - android:id="@+id/shareAfterEncryption" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:text="@string/label_share_after_encryption" /> - </LinearLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal"> - - <CheckBox - android:id="@+id/asciiArmour" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:text="@string/label_ascii_armor" /> - </LinearLayout> - </LinearLayout> - </LinearLayout> - </ViewFlipper> - - <TextView - style="@style/SectionHeader" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginBottom="4dp" - android:text="@string/section_encrypt_and_or_sign" /> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal" - android:padding="4dp"> - - <com.beardedhen.androidbootstrap.BootstrapButton - android:id="@+id/action_encrypt_share" - android:layout_width="match_parent" - android:layout_height="60dp" - android:padding="4dp" - android:layout_weight="1" - android:text="@string/btn_share" - bootstrapbutton:bb_icon_left="fa-lock" - bootstrapbutton:bb_type="info" /> - - <com.beardedhen.androidbootstrap.BootstrapButton - android:id="@+id/action_encrypt_clipboard" - android:layout_width="match_parent" - android:layout_height="60dp" - android:padding="4dp" - android:layout_weight="1" - android:text="@string/btn_clipboard" - bootstrapbutton:bb_icon_left="fa-lock" - bootstrapbutton:bb_type="info" /> - - <com.beardedhen.androidbootstrap.BootstrapButton - android:id="@+id/action_encrypt_file" - android:layout_width="match_parent" - android:layout_height="60dp" - android:padding="4dp" - android:visibility="gone" - android:text="@string/btn_encrypt_file" - bootstrapbutton:bb_icon_left="fa-lock" - bootstrapbutton:bb_type="info" /> - </LinearLayout> - </LinearLayout> - </ScrollView> + <include layout="@layout/encrypt_content"/> <include layout="@layout/drawer_list" /> diff --git a/OpenPGP-Keychain/src/main/res/layout/encrypt_content.xml b/OpenPGP-Keychain/src/main/res/layout/encrypt_content.xml new file mode 100644 index 000000000..d6a05f0d4 --- /dev/null +++ b/OpenPGP-Keychain/src/main/res/layout/encrypt_content.xml @@ -0,0 +1,398 @@ +<?xml version="1.0" encoding="utf-8"?> +<ScrollView + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:fontawesometext="http://schemas.android.com/apk/res-auto" + xmlns:bootstrapbutton="http://schemas.android.com/apk/res-auto" android:id="@+id/content_frame" + android:layout_marginLeft="@dimen/drawer_content_padding" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:fillViewport="true"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:paddingLeft="10dp" + android:paddingRight="10dp"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:padding="4dp"> + + <ImageView + android:id="@+id/modePrevious" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:src="@drawable/ic_previous"/> + + <TextView + android:id="@+id/modeLabel" + style="@style/SectionHeader" + android:layout_width="0dip" + android:layout_height="match_parent" + android:layout_weight="1" + android:gravity="center_horizontal|center_vertical" + android:text="@string/label_asymmetric"/> + + <ImageView + android:id="@+id/modeNext" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:src="@drawable/ic_next"/> + </LinearLayout> + + <ViewFlipper + android:id="@+id/mode" + android:layout_width="match_parent" + android:layout_height="wrap_content"> + + <LinearLayout + android:id="@+id/modeAsymmetric" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:padding="4dp"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal"> + + <CheckBox + android:id="@+id/sign" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" + android:text="@string/label_sign"/> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:paddingLeft="16dp"> + + <TextView + android:id="@+id/mainUserId" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="right" + android:ellipsize="end" + android:singleLine="true" + android:text="@string/label_sign_user_id" + android:textAppearance="?android:attr/textAppearanceMedium"/> + + <TextView + android:id="@+id/mainUserIdRest" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="right" + android:ellipsize="end" + android:singleLine="true" + android:text="@string/label_sign_email" + android:textAppearance="?android:attr/textAppearanceSmall"/> + </LinearLayout> + </LinearLayout> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:paddingBottom="3dip"> + + <TextView + android:id="@+id/label_selectPublicKeys" + android:layout_width="0dip" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" + android:layout_weight="1" + android:text="@string/label_select_public_keys" + android:textAppearance="?android:attr/textAppearanceMedium"/> + + <com.beardedhen.androidbootstrap.BootstrapButton + android:id="@+id/btn_selectEncryptKeys" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" + android:layout_margin="4dp" + android:text="@string/btn_select_encrypt_keys" + bootstrapbutton:bb_icon_left="fa-user" + bootstrapbutton:bb_size="default" + bootstrapbutton:bb_type="default"/> + </LinearLayout> + </LinearLayout> + + <TableLayout + android:id="@+id/modeSymmetric" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:padding="4dp" + android:stretchColumns="1"> + + <TableRow> + + <TextView + android:id="@+id/label_passphrase" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" + android:paddingRight="10dip" + android:text="@string/label_passphrase" + android:textAppearance="?android:attr/textAppearanceMedium"/> + + <EditText + android:id="@+id/passphrase" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:inputType="textPassword"/> + </TableRow> + + <TableRow> + + <TextView + android:id="@+id/label_passphraseAgain" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" + android:paddingRight="10dip" + android:text="@string/label_passphrase_again" + android:textAppearance="?android:attr/textAppearanceMedium"/> + + <EditText + android:id="@+id/passphraseAgain" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:inputType="textPassword"/> + </TableRow> + </TableLayout> + </ViewFlipper> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:padding="4dp"> + + <ImageView + android:id="@+id/sourcePrevious" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:src="@drawable/ic_previous"/> + + <TextView + android:id="@+id/sourceLabel" + style="@style/SectionHeader" + android:layout_width="0dip" + android:layout_height="match_parent" + android:layout_weight="1" + android:gravity="center_horizontal|center_vertical" + android:text="@string/label_message" + android:textAppearance="?android:attr/textAppearanceMedium"/> + + <ImageView + android:id="@+id/sourceNext" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:src="@drawable/ic_next"/> + </LinearLayout> + + <ViewFlipper + android:id="@+id/source" + android:layout_width="match_parent" + android:layout_height="0dip" + android:layout_weight="1"> + + <LinearLayout + android:id="@+id/sourceMessage" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical" + android:padding="4dp"> + + <EditText + android:id="@+id/message" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:gravity="top" + android:inputType="text|textCapSentences|textMultiLine|textLongMessage"/> + </LinearLayout> + + <LinearLayout + android:id="@+id/sourceFile" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical" + android:padding="4dp"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal"> + + <EditText + android:id="@+id/filename" + android:layout_width="0dip" + android:layout_height="wrap_content" + android:layout_weight="1" + android:gravity="top|left" + android:inputType="textMultiLine|textUri" + android:lines="4" + android:maxLines="10" + android:minLines="2" + android:scrollbars="vertical"/> + + <com.beardedhen.androidbootstrap.BootstrapButton + android:id="@+id/btn_browse" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_margin="4dp" + bootstrapbutton:bb_icon_left="fa-folder-open" + bootstrapbutton:bb_roundedCorners="true" + bootstrapbutton:bb_size="default" + bootstrapbutton:bb_type="default"/> + </LinearLayout> + + <LinearLayout + android:id="@+id/advancedSettingsControl" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:clickable="true"> + + <com.beardedhen.androidbootstrap.FontAwesomeText + android:id="@+id/advancedSettingsIcon" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginRight="10dp" + android:textSize="12sp" + android:paddingTop="@dimen/padding_medium" + android:paddingBottom="@dimen/padding_medium" + fontawesometext:fa_icon="fa-chevron-right"/> + + <TextView + android:id="@+id/advancedSettings" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/btn_encryption_advanced_settings_show" + android:paddingTop="@dimen/padding_medium" + android:paddingBottom="@dimen/padding_medium" + android:textColor="@color/emphasis"/> + </LinearLayout> + + <LinearLayout + android:id="@+id/fileAdvancedSettingsContainer" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:visibility="gone"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal"> + + <TextView + android:id="@+id/label_fileCompression" + android:layout_width="0dip" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" + android:layout_weight="1" + android:paddingRight="10dip" + android:text="@string/label_file_compression" + android:textAppearance="?android:attr/textAppearanceSmall"/> + + <Spinner + android:id="@+id/fileCompression" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical"/> + </LinearLayout> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal"> + + <CheckBox + android:id="@+id/deleteAfterEncryption" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" + android:text="@string/label_delete_after_encryption"/> + </LinearLayout> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal"> + + <CheckBox + android:id="@+id/shareAfterEncryption" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" + android:text="@string/label_share_after_encryption"/> + </LinearLayout> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal"> + + <CheckBox + android:id="@+id/asciiArmour" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" + android:text="@string/label_ascii_armor"/> + </LinearLayout> + </LinearLayout> + </LinearLayout> + </ViewFlipper> + + <TextView + style="@style/SectionHeader" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginBottom="4dp" + android:text="@string/section_encrypt_and_or_sign"/> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:padding="4dp"> + + <com.beardedhen.androidbootstrap.BootstrapButton + android:id="@+id/action_encrypt_share" + android:layout_width="match_parent" + android:layout_height="60dp" + android:padding="4dp" + android:layout_weight="1" + android:text="@string/btn_share" + bootstrapbutton:bb_icon_left="fa-lock" + bootstrapbutton:bb_type="info"/> + + <com.beardedhen.androidbootstrap.BootstrapButton + android:id="@+id/action_encrypt_clipboard" + android:layout_width="match_parent" + android:layout_height="60dp" + android:padding="4dp" + android:layout_weight="1" + android:text="@string/btn_clipboard" + bootstrapbutton:bb_icon_left="fa-lock" + bootstrapbutton:bb_type="info"/> + + <com.beardedhen.androidbootstrap.BootstrapButton + android:id="@+id/action_encrypt_file" + android:layout_width="match_parent" + android:layout_height="60dp" + android:padding="4dp" + android:visibility="gone" + android:text="@string/btn_encrypt_file" + bootstrapbutton:bb_icon_left="fa-lock" + bootstrapbutton:bb_type="info"/> + </LinearLayout> + </LinearLayout> +</ScrollView>
\ No newline at end of file diff --git a/OpenPGP-Keychain/src/main/res/layout/import_keys_activity.xml b/OpenPGP-Keychain/src/main/res/layout/import_keys_activity.xml index d7794ace3..b11f99757 100644 --- a/OpenPGP-Keychain/src/main/res/layout/import_keys_activity.xml +++ b/OpenPGP-Keychain/src/main/res/layout/import_keys_activity.xml @@ -5,58 +5,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" > - <RelativeLayout - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_centerHorizontal="true" > - - <FrameLayout - android:id="@+id/import_navigation_fragment" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_alignParentTop="true" - android:orientation="vertical" - android:paddingLeft="4dp" - android:paddingRight="4dp" /> - - <LinearLayout - android:id="@+id/import_footer" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_alignParentBottom="true" - android:orientation="vertical" - android:paddingLeft="10dp" - android:paddingRight="10dp" > - - <com.beardedhen.androidbootstrap.BootstrapButton - android:id="@+id/import_import" - android:layout_width="match_parent" - android:layout_height="60dp" - android:padding="4dp" - android:text="@string/import_import" - bootstrapbutton:bb_icon_left="fa-download" - bootstrapbutton:bb_type="info" /> - - <!-- <com.beardedhen.androidbootstrap.BootstrapButton --> - <!-- android:id="@+id/import_sign_and_upload" --> - <!-- android:layout_width="match_parent" --> - <!-- android:layout_height="60dp" --> - <!-- android:padding="4dp" --> - <!-- android:text="@string/import_sign_and_upload" --> - <!-- bootstrapbutton:bb_type="info" /> --> - </LinearLayout> - - <FrameLayout - android:id="@+id/import_keys_list_container" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_above="@+id/import_footer" - android:layout_alignParentLeft="true" - android:layout_below="@+id/import_navigation_fragment" - android:orientation="vertical" - android:paddingLeft="4dp" - android:paddingRight="4dp" /> - </RelativeLayout> + <include layout="@layout/import_keys_content"/> <include layout="@layout/drawer_list" /> diff --git a/OpenPGP-Keychain/src/main/res/layout/import_keys_content.xml b/OpenPGP-Keychain/src/main/res/layout/import_keys_content.xml new file mode 100644 index 000000000..fae8147e5 --- /dev/null +++ b/OpenPGP-Keychain/src/main/res/layout/import_keys_content.xml @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:bootstrapbutton="http://schemas.android.com/apk/res-auto" android:id="@+id/content_frame" + android:layout_marginLeft="@dimen/drawer_content_padding" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_centerHorizontal="true"> + + <FrameLayout + android:id="@+id/import_navigation_fragment" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_alignParentTop="true" + android:orientation="vertical" + android:paddingLeft="4dp" + android:paddingRight="4dp"/> + + <LinearLayout + android:id="@+id/import_footer" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_alignParentBottom="true" + android:orientation="vertical" + android:paddingLeft="10dp" + android:paddingRight="10dp"> + + <com.beardedhen.androidbootstrap.BootstrapButton + android:id="@+id/import_import" + android:layout_width="match_parent" + android:layout_height="60dp" + android:padding="4dp" + android:text="@string/import_import" + bootstrapbutton:bb_icon_left="fa-download" + bootstrapbutton:bb_type="info"/> + + <!-- <com.beardedhen.androidbootstrap.BootstrapButton --> + <!-- android:id="@+id/import_sign_and_upload" --> + <!-- android:layout_width="match_parent" --> + <!-- android:layout_height="60dp" --> + <!-- android:padding="4dp" --> + <!-- android:text="@string/import_sign_and_upload" --> + <!-- bootstrapbutton:bb_type="info" /> --> + </LinearLayout> + + <FrameLayout + android:id="@+id/import_keys_list_container" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_above="@+id/import_footer" + android:layout_alignParentLeft="true" + android:layout_below="@+id/import_navigation_fragment" + android:orientation="vertical" + android:paddingLeft="4dp" + android:paddingRight="4dp"/> +</RelativeLayout>
\ No newline at end of file diff --git a/OpenPGP-Keychain/src/main/res/layout/key_list_activity.xml b/OpenPGP-Keychain/src/main/res/layout/key_list_activity.xml index 65d246d7b..fcb376fa8 100644 --- a/OpenPGP-Keychain/src/main/res/layout/key_list_activity.xml +++ b/OpenPGP-Keychain/src/main/res/layout/key_list_activity.xml @@ -4,16 +4,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" > - <FrameLayout - android:layout_width="match_parent" - android:layout_height="match_parent" > - - <fragment - android:id="@+id/key_list_fragment" - android:name="org.sufficientlysecure.keychain.ui.KeyListFragment" - android:layout_width="match_parent" - android:layout_height="match_parent" /> - </FrameLayout> + <include layout="@layout/key_list_content"/> <include layout="@layout/drawer_list" /> diff --git a/OpenPGP-Keychain/src/main/res/layout/key_list_content.xml b/OpenPGP-Keychain/src/main/res/layout/key_list_content.xml new file mode 100644 index 000000000..e58e42961 --- /dev/null +++ b/OpenPGP-Keychain/src/main/res/layout/key_list_content.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<FrameLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/content_frame" + android:layout_marginLeft="@dimen/drawer_content_padding" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <fragment + android:id="@+id/key_list_fragment" + android:name="org.sufficientlysecure.keychain.ui.KeyListFragment" + android:layout_width="match_parent" + android:layout_height="match_parent"/> +</FrameLayout>
\ No newline at end of file diff --git a/OpenPGP-Keychain/src/main/res/raw/help_faq.html b/OpenPGP-Keychain/src/main/res/raw/help_faq.html index b3d5b3a11..bfd43eafd 100644 --- a/OpenPGP-Keychain/src/main/res/raw/help_faq.html +++ b/OpenPGP-Keychain/src/main/res/raw/help_faq.html @@ -5,8 +5,9 @@ And don't add newlines before or after p tags because of transifex --> <head> </head> <body> -<h2>TODO</h2> -<p>text</p> +<h2>How can I specify connection port for Keyserver?</h2> +<p>Add a new Keyserver (or modify existing one) by going to Preferences -> General -> Keyservers. Enter the port number after the Keyserver address and preceded it by a colon. For example, "p80.pool.sks-keyservers.net:80" (without quotation marks) means that server "p80.pool.sks-keyservers.net" is working on a port 80.</p> +<p>Default connection port is 11371 and it doesn't need to be specified.</p> </body> </html> diff --git a/OpenPGP-Keychain/src/main/res/values-large/dimens.xml b/OpenPGP-Keychain/src/main/res/values-large/dimens.xml new file mode 100644 index 000000000..192a4bb99 --- /dev/null +++ b/OpenPGP-Keychain/src/main/res/values-large/dimens.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <dimen name="drawer_content_padding">240dp</dimen> +</resources> diff --git a/OpenPGP-Keychain/src/main/res/values/dimens.xml b/OpenPGP-Keychain/src/main/res/values/dimens.xml new file mode 100644 index 000000000..e1a7749f0 --- /dev/null +++ b/OpenPGP-Keychain/src/main/res/values/dimens.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <dimen name="drawer_size">240dp</dimen> + <dimen name="drawer_content_padding">0dp</dimen> +</resources>
\ No newline at end of file diff --git a/OpenPGP-Keychain/src/main/res/values/strings.xml b/OpenPGP-Keychain/src/main/res/values/strings.xml index 265bcc6db..e26470daf 100644 --- a/OpenPGP-Keychain/src/main/res/values/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values/strings.xml @@ -219,6 +219,7 @@ <string name="key_deletion_confirmation">Do you really want to delete the key \'%s\'?\nYou can\'t undo this!</string> <string name="key_deletion_confirmation_multi">Do you really want to delete all selected keys?\nYou can\'t undo this!</string> <string name="secret_key_deletion_confirmation">Do you really want to delete the SECRET key \'%s\'?\nYou can\'t undo this!</string> + <string name="also_export_secret_keys">Also export secret keys?</string> <plurals name="keys_added_and_updated_1"> <item quantity="one">Successfully added %d key</item> |