Resolve crashes on Android 2.3 due to ActionBarCompat conversion
This commit is contained in:
@@ -55,6 +55,8 @@ import android.os.Bundle;
|
|||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.os.Messenger;
|
import android.os.Messenger;
|
||||||
|
import android.support.v4.view.MenuCompat;
|
||||||
|
import android.support.v4.view.MenuItemCompat;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@@ -127,12 +129,12 @@ public class DecryptActivity extends DrawerActivity {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
if (mDecryptEnabled) {
|
if (mDecryptEnabled) {
|
||||||
menu.add(1, Id.menu.option.decrypt, 0, mDecryptString).setShowAsAction(
|
MenuItem item = menu.add(1, Id.menu.option.decrypt, 0, mDecryptString);
|
||||||
MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
|
MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_ALWAYS | MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT);
|
||||||
}
|
}
|
||||||
if (mReplyEnabled) {
|
if (mReplyEnabled) {
|
||||||
menu.add(1, Id.menu.option.reply, 1, mReplyString).setShowAsAction(
|
MenuItem item = menu.add(1, Id.menu.option.reply, 1, mReplyString);
|
||||||
MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
|
MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_ALWAYS | MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -281,7 +283,7 @@ public class DecryptActivity extends DrawerActivity {
|
|||||||
mReplyEnabled = false;
|
mReplyEnabled = false;
|
||||||
|
|
||||||
// build new actionbar
|
// build new actionbar
|
||||||
invalidateOptionsMenu();
|
supportInvalidateOptionsMenu();
|
||||||
|
|
||||||
if (mReturnResult) {
|
if (mReturnResult) {
|
||||||
mSourcePrevious.setClickable(false);
|
mSourcePrevious.setClickable(false);
|
||||||
@@ -372,7 +374,7 @@ public class DecryptActivity extends DrawerActivity {
|
|||||||
|
|
||||||
mDecryptString = getString(R.string.btn_verify);
|
mDecryptString = getString(R.string.btn_verify);
|
||||||
// build new action bar
|
// build new action bar
|
||||||
invalidateOptionsMenu();
|
supportInvalidateOptionsMenu();
|
||||||
} else {
|
} else {
|
||||||
Log.d(Constants.TAG, "Nothing matched!");
|
Log.d(Constants.TAG, "Nothing matched!");
|
||||||
}
|
}
|
||||||
@@ -421,7 +423,7 @@ public class DecryptActivity extends DrawerActivity {
|
|||||||
mDecryptString = getString(R.string.btn_decrypt);
|
mDecryptString = getString(R.string.btn_decrypt);
|
||||||
|
|
||||||
// build new action bar
|
// build new action bar
|
||||||
invalidateOptionsMenu();
|
supportInvalidateOptionsMenu();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -430,7 +432,7 @@ public class DecryptActivity extends DrawerActivity {
|
|||||||
mDecryptString = getString(R.string.btn_decrypt);
|
mDecryptString = getString(R.string.btn_decrypt);
|
||||||
|
|
||||||
// build new action bar
|
// build new action bar
|
||||||
invalidateOptionsMenu();
|
supportInvalidateOptionsMenu();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -723,7 +725,7 @@ public class DecryptActivity extends DrawerActivity {
|
|||||||
mReplyEnabled = false;
|
mReplyEnabled = false;
|
||||||
|
|
||||||
// build new action bar
|
// build new action bar
|
||||||
invalidateOptionsMenu();
|
supportInvalidateOptionsMenu();
|
||||||
|
|
||||||
Toast.makeText(DecryptActivity.this, R.string.decryption_successful,
|
Toast.makeText(DecryptActivity.this, R.string.decryption_successful,
|
||||||
Toast.LENGTH_SHORT).show();
|
Toast.LENGTH_SHORT).show();
|
||||||
@@ -744,7 +746,7 @@ public class DecryptActivity extends DrawerActivity {
|
|||||||
mReplyEnabled = false;
|
mReplyEnabled = false;
|
||||||
|
|
||||||
// build new action bar
|
// build new action bar
|
||||||
invalidateOptionsMenu();
|
supportInvalidateOptionsMenu();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Id.target.file:
|
case Id.target.file:
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ import android.os.Bundle;
|
|||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.os.Messenger;
|
import android.os.Messenger;
|
||||||
|
import android.support.v4.view.MenuItemCompat;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@@ -131,18 +132,16 @@ public class EncryptActivity extends DrawerActivity {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* ActionBar menu is created based on class variables to change it at runtime
|
* ActionBar menu is created based on class variables to change it at runtime
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
if (mEncryptToClipboardEnabled) {
|
if (mEncryptToClipboardEnabled) {
|
||||||
menu.add(1, Id.menu.option.encrypt_to_clipboard, 0, mEncryptToClipboardString)
|
MenuItem item = menu.add(1, Id.menu.option.encrypt_to_clipboard, 0, mEncryptToClipboardString);
|
||||||
.setShowAsAction(
|
MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_ALWAYS | MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT);
|
||||||
MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
|
|
||||||
}
|
}
|
||||||
if (mEncryptEnabled) {
|
if (mEncryptEnabled) {
|
||||||
menu.add(1, Id.menu.option.encrypt, 1, mEncryptString).setShowAsAction(
|
MenuItem item = menu.add(1, Id.menu.option.encrypt, 1, mEncryptString);
|
||||||
MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
|
MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_ALWAYS | MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -152,18 +151,18 @@ public class EncryptActivity extends DrawerActivity {
|
|||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
|
|
||||||
case Id.menu.option.encrypt_to_clipboard:
|
case Id.menu.option.encrypt_to_clipboard:
|
||||||
encryptToClipboardClicked();
|
encryptToClipboardClicked();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case Id.menu.option.encrypt:
|
case Id.menu.option.encrypt:
|
||||||
encryptClicked();
|
encryptClicked();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -193,7 +192,7 @@ public class EncryptActivity extends DrawerActivity {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles all actions with this intent
|
* Handles all actions with this intent
|
||||||
*
|
*
|
||||||
* @param intent
|
* @param intent
|
||||||
*/
|
*/
|
||||||
private void handleActions(Intent intent) {
|
private void handleActions(Intent intent) {
|
||||||
@@ -285,7 +284,7 @@ public class EncryptActivity extends DrawerActivity {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* If an Intent gives a signatureKeyId and/or encryptionKeyIds, preselect those!
|
* If an Intent gives a signatureKeyId and/or encryptionKeyIds, preselect those!
|
||||||
*
|
*
|
||||||
* @param preselectedSignatureKeyId
|
* @param preselectedSignatureKeyId
|
||||||
* @param preselectedEncryptionKeyIds
|
* @param preselectedEncryptionKeyIds
|
||||||
*/
|
*/
|
||||||
@@ -335,7 +334,7 @@ public class EncryptActivity extends DrawerActivity {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Guess output filename based on input path
|
* Guess output filename based on input path
|
||||||
*
|
*
|
||||||
* @param path
|
* @param path
|
||||||
* @return Suggestion for output filename
|
* @return Suggestion for output filename
|
||||||
*/
|
*/
|
||||||
@@ -350,26 +349,26 @@ public class EncryptActivity extends DrawerActivity {
|
|||||||
|
|
||||||
private void updateSource() {
|
private void updateSource() {
|
||||||
switch (mSource.getCurrentView().getId()) {
|
switch (mSource.getCurrentView().getId()) {
|
||||||
case R.id.sourceFile: {
|
case R.id.sourceFile: {
|
||||||
mSourceLabel.setText(R.string.label_file);
|
mSourceLabel.setText(R.string.label_file);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case R.id.sourceMessage: {
|
case R.id.sourceMessage: {
|
||||||
mSourceLabel.setText(R.string.label_message);
|
mSourceLabel.setText(R.string.label_message);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateActionBarButtons();
|
updateActionBarButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set ActionBar buttons based on parameters
|
* Set ActionBar buttons based on parameters
|
||||||
*
|
*
|
||||||
* @param encryptEnabled
|
* @param encryptEnabled
|
||||||
* @param encryptStringRes
|
* @param encryptStringRes
|
||||||
* @param encryptToClipboardEnabled
|
* @param encryptToClipboardEnabled
|
||||||
@@ -377,7 +376,7 @@ public class EncryptActivity extends DrawerActivity {
|
|||||||
*/
|
*/
|
||||||
@SuppressLint("NewApi")
|
@SuppressLint("NewApi")
|
||||||
private void setActionbarButtons(boolean encryptEnabled, int encryptStringRes,
|
private void setActionbarButtons(boolean encryptEnabled, int encryptStringRes,
|
||||||
boolean encryptToClipboardEnabled, int encryptToClipboardStringRes) {
|
boolean encryptToClipboardEnabled, int encryptToClipboardStringRes) {
|
||||||
mEncryptEnabled = encryptEnabled;
|
mEncryptEnabled = encryptEnabled;
|
||||||
if (encryptEnabled) {
|
if (encryptEnabled) {
|
||||||
mEncryptString = getString(encryptStringRes);
|
mEncryptString = getString(encryptStringRes);
|
||||||
@@ -388,7 +387,7 @@ public class EncryptActivity extends DrawerActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// build new action bar based on these class variables
|
// build new action bar based on these class variables
|
||||||
invalidateOptionsMenu();
|
supportInvalidateOptionsMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -396,56 +395,56 @@ public class EncryptActivity extends DrawerActivity {
|
|||||||
*/
|
*/
|
||||||
private void updateActionBarButtons() {
|
private void updateActionBarButtons() {
|
||||||
switch (mSource.getCurrentView().getId()) {
|
switch (mSource.getCurrentView().getId()) {
|
||||||
case R.id.sourceFile: {
|
case R.id.sourceFile: {
|
||||||
setActionbarButtons(true, R.string.btn_encrypt_file, false, 0);
|
setActionbarButtons(true, R.string.btn_encrypt_file, false, 0);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case R.id.sourceMessage: {
|
case R.id.sourceMessage: {
|
||||||
mSourceLabel.setText(R.string.label_message);
|
mSourceLabel.setText(R.string.label_message);
|
||||||
|
|
||||||
if (mMode.getCurrentView().getId() == R.id.modeSymmetric) {
|
if (mMode.getCurrentView().getId() == R.id.modeSymmetric) {
|
||||||
setActionbarButtons(true, R.string.btn_encrypt_and_send, true,
|
|
||||||
R.string.btn_encrypt_to_clipboard);
|
|
||||||
} else {
|
|
||||||
if (mEncryptionKeyIds == null || mEncryptionKeyIds.length == 0) {
|
|
||||||
if (mSecretKeyId == 0) {
|
|
||||||
setActionbarButtons(false, 0, false, 0);
|
|
||||||
} else {
|
|
||||||
setActionbarButtons(true, R.string.btn_sign_and_send, true,
|
|
||||||
R.string.btn_sign_to_clipboard);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
setActionbarButtons(true, R.string.btn_encrypt_and_send, true,
|
setActionbarButtons(true, R.string.btn_encrypt_and_send, true,
|
||||||
R.string.btn_encrypt_to_clipboard);
|
R.string.btn_encrypt_to_clipboard);
|
||||||
|
} else {
|
||||||
|
if (mEncryptionKeyIds == null || mEncryptionKeyIds.length == 0) {
|
||||||
|
if (mSecretKeyId == 0) {
|
||||||
|
setActionbarButtons(false, 0, false, 0);
|
||||||
|
} else {
|
||||||
|
setActionbarButtons(true, R.string.btn_sign_and_send, true,
|
||||||
|
R.string.btn_sign_to_clipboard);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
setActionbarButtons(true, R.string.btn_encrypt_and_send, true,
|
||||||
|
R.string.btn_encrypt_to_clipboard);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateMode() {
|
private void updateMode() {
|
||||||
switch (mMode.getCurrentView().getId()) {
|
switch (mMode.getCurrentView().getId()) {
|
||||||
case R.id.modeAsymmetric: {
|
case R.id.modeAsymmetric: {
|
||||||
mModeLabel.setText(R.string.label_asymmetric);
|
mModeLabel.setText(R.string.label_asymmetric);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case R.id.modeSymmetric: {
|
case R.id.modeSymmetric: {
|
||||||
mModeLabel.setText(R.string.label_symmetric);
|
mModeLabel.setText(R.string.label_symmetric);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateActionBarButtons();
|
updateActionBarButtons();
|
||||||
}
|
}
|
||||||
@@ -675,50 +674,52 @@ public class EncryptActivity extends DrawerActivity {
|
|||||||
|
|
||||||
String output;
|
String output;
|
||||||
switch (mEncryptTarget) {
|
switch (mEncryptTarget) {
|
||||||
case Id.target.clipboard:
|
case Id.target.clipboard:
|
||||||
output = data.getString(KeychainIntentService.RESULT_ENCRYPTED_STRING);
|
output = data.getString(KeychainIntentService.RESULT_ENCRYPTED_STRING);
|
||||||
Log.d(Constants.TAG, "output: " + output);
|
Log.d(Constants.TAG, "output: " + output);
|
||||||
ClipboardReflection.copyToClipboard(EncryptActivity.this, output);
|
ClipboardReflection.copyToClipboard(EncryptActivity.this, output);
|
||||||
Toast.makeText(EncryptActivity.this,
|
Toast.makeText(EncryptActivity.this,
|
||||||
R.string.encryption_to_clipboard_successful, Toast.LENGTH_SHORT)
|
R.string.encryption_to_clipboard_successful, Toast.LENGTH_SHORT)
|
||||||
.show();
|
.show();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Id.target.email:
|
case Id.target.email:
|
||||||
|
|
||||||
output = data.getString(KeychainIntentService.RESULT_ENCRYPTED_STRING);
|
output = data.getString(KeychainIntentService.RESULT_ENCRYPTED_STRING);
|
||||||
Log.d(Constants.TAG, "output: " + output);
|
Log.d(Constants.TAG, "output: " + output);
|
||||||
|
|
||||||
Intent sendIntent = new Intent(Intent.ACTION_SEND);
|
Intent sendIntent = new Intent(Intent.ACTION_SEND);
|
||||||
|
|
||||||
// Type is set to text/plain so that encrypted messages can
|
// Type is set to text/plain so that encrypted messages can
|
||||||
// be sent with Whatsapp, Hangouts, SMS etc...
|
// be sent with Whatsapp, Hangouts, SMS etc...
|
||||||
sendIntent.setType("text/plain");
|
sendIntent.setType("text/plain");
|
||||||
|
|
||||||
sendIntent.putExtra(Intent.EXTRA_TEXT, output);
|
sendIntent.putExtra(Intent.EXTRA_TEXT, output);
|
||||||
startActivity(Intent.createChooser(sendIntent,
|
startActivity(Intent.createChooser(sendIntent,
|
||||||
getString(R.string.title_send_email)));
|
getString(R.string.title_send_email)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Id.target.file:
|
case Id.target.file:
|
||||||
Toast.makeText(EncryptActivity.this, R.string.encryption_successful,
|
Toast.makeText(EncryptActivity.this, R.string.encryption_successful,
|
||||||
Toast.LENGTH_SHORT).show();
|
Toast.LENGTH_SHORT).show();
|
||||||
|
|
||||||
if (mDeleteAfter.isChecked()) {
|
if (mDeleteAfter.isChecked()) {
|
||||||
// Create and show dialog to delete original file
|
// Create and show dialog to delete original file
|
||||||
DeleteFileDialogFragment deleteFileDialog = DeleteFileDialogFragment
|
DeleteFileDialogFragment deleteFileDialog = DeleteFileDialogFragment
|
||||||
.newInstance(mInputFilename);
|
.newInstance(mInputFilename);
|
||||||
deleteFileDialog.show(getSupportFragmentManager(), "deleteDialog");
|
deleteFileDialog.show(getSupportFragmentManager(), "deleteDialog");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// shouldn't happen
|
// shouldn't happen
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
|
;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Create a new Messenger for the communication back
|
// Create a new Messenger for the communication back
|
||||||
@@ -734,7 +735,7 @@ public class EncryptActivity extends DrawerActivity {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Fixes bad message characters for gmail
|
* Fixes bad message characters for gmail
|
||||||
*
|
*
|
||||||
* @param message
|
* @param message
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -844,7 +845,7 @@ public class EncryptActivity extends DrawerActivity {
|
|||||||
});
|
});
|
||||||
|
|
||||||
mFileCompression = (Spinner) findViewById(R.id.fileCompression);
|
mFileCompression = (Spinner) findViewById(R.id.fileCompression);
|
||||||
Choice[] choices = new Choice[] {
|
Choice[] choices = new Choice[]{
|
||||||
new Choice(Id.choice.compression.none, getString(R.string.choice_none) + " ("
|
new Choice(Id.choice.compression.none, getString(R.string.choice_none) + " ("
|
||||||
+ getString(R.string.compression_fast) + ")"),
|
+ getString(R.string.compression_fast) + ")"),
|
||||||
new Choice(Id.choice.compression.zip, "ZIP ("
|
new Choice(Id.choice.compression.zip, "ZIP ("
|
||||||
@@ -852,7 +853,7 @@ public class EncryptActivity extends DrawerActivity {
|
|||||||
new Choice(Id.choice.compression.zlib, "ZLIB ("
|
new Choice(Id.choice.compression.zlib, "ZLIB ("
|
||||||
+ getString(R.string.compression_fast) + ")"),
|
+ getString(R.string.compression_fast) + ")"),
|
||||||
new Choice(Id.choice.compression.bzip2, "BZIP2 ("
|
new Choice(Id.choice.compression.bzip2, "BZIP2 ("
|
||||||
+ getString(R.string.compression_very_slow) + ")"), };
|
+ getString(R.string.compression_very_slow) + ")"),};
|
||||||
ArrayAdapter<Choice> adapter = new ArrayAdapter<Choice>(this,
|
ArrayAdapter<Choice> adapter = new ArrayAdapter<Choice>(this,
|
||||||
android.R.layout.simple_spinner_item, choices);
|
android.R.layout.simple_spinner_item, choices);
|
||||||
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
@@ -957,44 +958,44 @@ public class EncryptActivity extends DrawerActivity {
|
|||||||
@Override
|
@Override
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
switch (requestCode) {
|
switch (requestCode) {
|
||||||
case Id.request.filename: {
|
case Id.request.filename: {
|
||||||
if (resultCode == RESULT_OK && data != null) {
|
if (resultCode == RESULT_OK && data != null) {
|
||||||
try {
|
try {
|
||||||
String path = FileHelper.getPath(this, data.getData());
|
String path = FileHelper.getPath(this, data.getData());
|
||||||
Log.d(Constants.TAG, "path=" + path);
|
Log.d(Constants.TAG, "path=" + path);
|
||||||
|
|
||||||
mFilename.setText(path);
|
mFilename.setText(path);
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
Log.e(Constants.TAG, "Nullpointer while retrieving path!");
|
Log.e(Constants.TAG, "Nullpointer while retrieving path!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
case Id.request.public_keys: {
|
case Id.request.public_keys: {
|
||||||
if (resultCode == RESULT_OK) {
|
if (resultCode == RESULT_OK) {
|
||||||
Bundle bundle = data.getExtras();
|
Bundle bundle = data.getExtras();
|
||||||
mEncryptionKeyIds = bundle
|
mEncryptionKeyIds = bundle
|
||||||
.getLongArray(SelectPublicKeyActivity.RESULT_EXTRA_MASTER_KEY_IDS);
|
.getLongArray(SelectPublicKeyActivity.RESULT_EXTRA_MASTER_KEY_IDS);
|
||||||
|
}
|
||||||
|
updateView();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
updateView();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case Id.request.secret_keys: {
|
case Id.request.secret_keys: {
|
||||||
if (resultCode == RESULT_OK) {
|
if (resultCode == RESULT_OK) {
|
||||||
Bundle bundle = data.getExtras();
|
Bundle bundle = data.getExtras();
|
||||||
mSecretKeyId = bundle.getLong(SelectSecretKeyActivity.RESULT_EXTRA_MASTER_KEY_ID);
|
mSecretKeyId = bundle.getLong(SelectSecretKeyActivity.RESULT_EXTRA_MASTER_KEY_ID);
|
||||||
} else {
|
} else {
|
||||||
mSecretKeyId = Id.key.none;
|
mSecretKeyId = Id.key.none;
|
||||||
|
}
|
||||||
|
updateView();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
updateView();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginLeft="16dp"
|
android:paddingLeft="16dp"
|
||||||
android:layout_marginRight="16dp"
|
android:paddingRight="16dp"
|
||||||
android:orientation="vertical" >
|
android:orientation="vertical" >
|
||||||
|
|
||||||
<fragment
|
<fragment
|
||||||
|
|||||||
@@ -1,20 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!--
|
|
||||||
Copyright (C) 2010 Thialfihar <thi@thialfihar.org>
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:bootstrapbutton="http://schemas.android.com/apk/res-auto"
|
xmlns:bootstrapbutton="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_api_settings_revoke"
|
android:id="@+id/menu_api_settings_revoke"
|
||||||
android:showAsAction="never"
|
android:title="@string/api_settings_revoke"
|
||||||
android:title="@string/api_settings_revoke"/>
|
app:showAsAction="never" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_api_settings_cancel"
|
android:id="@+id/menu_api_settings_cancel"
|
||||||
android:showAsAction="never"
|
android:title="@string/api_settings_cancel"
|
||||||
android:title="@string/api_settings_cancel"/>
|
app:showAsAction="never" />
|
||||||
|
|
||||||
</menu>
|
</menu>
|
||||||
@@ -1,17 +1,18 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_key_edit_export_file"
|
android:id="@+id/menu_key_edit_export_file"
|
||||||
android:showAsAction="never"
|
app:showAsAction="never"
|
||||||
android:title="@string/menu_export_key"/>
|
android:title="@string/menu_export_key" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_key_edit_delete"
|
android:id="@+id/menu_key_edit_delete"
|
||||||
android:showAsAction="never"
|
app:showAsAction="never"
|
||||||
android:title="@string/menu_delete_key"/>
|
android:title="@string/menu_delete_key" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_key_edit_cancel"
|
android:id="@+id/menu_key_edit_cancel"
|
||||||
android:showAsAction="never"
|
app:showAsAction="never"
|
||||||
android:title="@string/menu_key_edit_cancel"/>
|
android:title="@string/menu_key_edit_cancel" />
|
||||||
|
|
||||||
</menu>
|
</menu>
|
||||||
@@ -1,14 +1,15 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_key_list_public_import"
|
android:id="@+id/menu_key_list_public_import"
|
||||||
android:showAsAction="always|withText"
|
app:showAsAction="always|withText"
|
||||||
android:icon="@drawable/ic_action_add_person"
|
android:icon="@drawable/ic_action_add_person"
|
||||||
android:title="@string/menu_import"/>
|
android:title="@string/menu_import" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_key_list_public_export"
|
android:id="@+id/menu_key_list_public_export"
|
||||||
android:showAsAction="never"
|
app:showAsAction="never"
|
||||||
android:title="@string/menu_export_keys"/>
|
android:title="@string/menu_export_keys" />
|
||||||
|
|
||||||
</menu>
|
</menu>
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_key_list_public_multi_encrypt"
|
android:id="@+id/menu_key_list_public_multi_encrypt"
|
||||||
android:title="@string/menu_encrypt_to"/>
|
android:title="@string/menu_encrypt_to" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_key_list_public_multi_delete"
|
android:id="@+id/menu_key_list_public_multi_delete"
|
||||||
android:icon="@drawable/ic_action_discard"
|
android:icon="@drawable/ic_action_discard"
|
||||||
android:title="@string/menu_delete_key"/>
|
android:title="@string/menu_delete_key" />
|
||||||
|
|
||||||
</menu>
|
</menu>
|
||||||
@@ -1,21 +1,22 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_key_list_secret_create"
|
android:id="@+id/menu_key_list_secret_create"
|
||||||
android:showAsAction="always|withText"
|
app:showAsAction="always|withText"
|
||||||
android:title="@string/menu_create_key"/>
|
android:title="@string/menu_create_key" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_key_list_secret_create_expert"
|
android:id="@+id/menu_key_list_secret_create_expert"
|
||||||
android:showAsAction="never"
|
app:showAsAction="never"
|
||||||
android:title="@string/menu_create_key_expert"/>
|
android:title="@string/menu_create_key_expert" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_key_list_secret_import"
|
android:id="@+id/menu_key_list_secret_import"
|
||||||
android:showAsAction="never"
|
app:showAsAction="never"
|
||||||
android:title="@string/menu_import"/>
|
android:title="@string/menu_import" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_key_list_secret_export"
|
android:id="@+id/menu_key_list_secret_export"
|
||||||
android:showAsAction="never"
|
app:showAsAction="never"
|
||||||
android:title="@string/menu_export_keys"/>
|
android:title="@string/menu_export_keys" />
|
||||||
|
|
||||||
</menu>
|
</menu>
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_key_list_public_multi_delete"
|
android:id="@+id/menu_key_list_public_multi_delete"
|
||||||
android:icon="@drawable/ic_action_discard"
|
android:icon="@drawable/ic_action_discard"
|
||||||
android:title="@string/menu_delete_key"/>
|
android:title="@string/menu_delete_key" />
|
||||||
|
|
||||||
</menu>
|
</menu>
|
||||||
@@ -1,48 +1,49 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_key_view_share"
|
android:id="@+id/menu_key_view_share"
|
||||||
android:icon="@drawable/ic_action_share"
|
android:icon="@drawable/ic_action_share"
|
||||||
android:showAsAction="always"
|
app:showAsAction="always"
|
||||||
android:title="@string/menu_share">
|
android:title="@string/menu_share">
|
||||||
<menu>
|
<menu>
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_key_view_share_fingerprint_title"
|
android:id="@+id/menu_key_view_share_fingerprint_title"
|
||||||
android:showAsAction="never"
|
app:showAsAction="never"
|
||||||
android:title="@string/menu_share_title_fingerprint">
|
android:title="@string/menu_share_title_fingerprint">
|
||||||
<menu>
|
<menu>
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_key_view_share_default_fingerprint"
|
android:id="@+id/menu_key_view_share_default_fingerprint"
|
||||||
android:showAsAction="never"
|
app:showAsAction="never"
|
||||||
android:title="@string/menu_share_default_fingerprint"/>
|
android:title="@string/menu_share_default_fingerprint" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_key_view_share_qr_code_fingerprint"
|
android:id="@+id/menu_key_view_share_qr_code_fingerprint"
|
||||||
android:showAsAction="never"
|
app:showAsAction="never"
|
||||||
android:title="@string/menu_share_qr_code_fingerprint"/>
|
android:title="@string/menu_share_qr_code_fingerprint" />
|
||||||
</menu>
|
</menu>
|
||||||
</item>
|
</item>
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_key_view_share_title"
|
android:id="@+id/menu_key_view_share_title"
|
||||||
android:showAsAction="never"
|
app:showAsAction="never"
|
||||||
android:title="@string/menu_share_title">
|
android:title="@string/menu_share_title">
|
||||||
<menu>
|
<menu>
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_key_view_share_default"
|
android:id="@+id/menu_key_view_share_default"
|
||||||
android:showAsAction="never"
|
app:showAsAction="never"
|
||||||
android:title="@string/menu_share_default"/>
|
android:title="@string/menu_share_default" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_key_view_share_qr_code"
|
android:id="@+id/menu_key_view_share_qr_code"
|
||||||
android:showAsAction="never"
|
app:showAsAction="never"
|
||||||
android:title="@string/menu_share_qr_code"/>
|
android:title="@string/menu_share_qr_code" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_key_view_share_nfc"
|
android:id="@+id/menu_key_view_share_nfc"
|
||||||
android:showAsAction="never"
|
app:showAsAction="never"
|
||||||
android:title="@string/menu_share_nfc"/>
|
android:title="@string/menu_share_nfc" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_key_view_share_clipboard"
|
android:id="@+id/menu_key_view_share_clipboard"
|
||||||
android:showAsAction="never"
|
app:showAsAction="never"
|
||||||
android:title="@string/menu_copy_to_clipboard"/>
|
android:title="@string/menu_copy_to_clipboard" />
|
||||||
</menu>
|
</menu>
|
||||||
</item>
|
</item>
|
||||||
</menu>
|
</menu>
|
||||||
@@ -50,30 +51,30 @@
|
|||||||
<item
|
<item
|
||||||
android:id="@+id/menu_key_keyserver"
|
android:id="@+id/menu_key_keyserver"
|
||||||
android:icon="@drawable/ic_action_import_export"
|
android:icon="@drawable/ic_action_import_export"
|
||||||
android:showAsAction="always"
|
app:showAsAction="always"
|
||||||
android:title="@string/menu_share">
|
android:title="@string/menu_share">
|
||||||
<menu>
|
<menu>
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_key_view_update"
|
android:id="@+id/menu_key_view_update"
|
||||||
android:showAsAction="never"
|
app:showAsAction="never"
|
||||||
android:title="@string/menu_update_key"/>
|
android:title="@string/menu_update_key" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_key_view_export_keyserver"
|
android:id="@+id/menu_key_view_export_keyserver"
|
||||||
android:showAsAction="never"
|
app:showAsAction="never"
|
||||||
android:title="@string/menu_export_key_to_server"/>
|
android:title="@string/menu_export_key_to_server" />
|
||||||
</menu>
|
</menu>
|
||||||
</item>
|
</item>
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_key_view_sign"
|
android:id="@+id/menu_key_view_sign"
|
||||||
android:showAsAction="ifRoom"
|
app:showAsAction="ifRoom"
|
||||||
android:title="@string/menu_sign_key"/>
|
android:title="@string/menu_sign_key" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_key_view_export_file"
|
android:id="@+id/menu_key_view_export_file"
|
||||||
android:showAsAction="never"
|
app:showAsAction="never"
|
||||||
android:title="@string/menu_export_key"/>
|
android:title="@string/menu_export_key" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_key_view_delete"
|
android:id="@+id/menu_key_view_delete"
|
||||||
android:showAsAction="never"
|
app:showAsAction="never"
|
||||||
android:title="@string/menu_delete_key"/>
|
android:title="@string/menu_delete_key" />
|
||||||
|
|
||||||
</menu>
|
</menu>
|
||||||
Reference in New Issue
Block a user