Even more smaller nitpicks

This commit is contained in:
Dominik Schürmann 2014-08-04 15:40:34 +02:00
parent c4311e2f52
commit e87c69647c
2 changed files with 24 additions and 12 deletions

View File

@ -23,6 +23,7 @@ import android.content.Intent;
import android.content.pm.LabeledIntent;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
@ -223,20 +224,22 @@ public class EncryptActivity extends DrawerActivity implements EncryptActivityIn
super.handleMessage(message);
if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) {
Notify.showNotify(EncryptActivity.this, R.string.encrypt_sign_successful, Notify.Style.INFO);
if (!isContentMessage()) {
Notify.showNotify(EncryptActivity.this, R.string.encrypt_sign_successful, Notify.Style.INFO);
if (!isContentMessage() && mDeleteAfterEncrypt) {
for (Uri inputUri : mInputUris) {
DeleteFileDialogFragment deleteFileDialog = DeleteFileDialogFragment.newInstance(inputUri);
deleteFileDialog.show(getSupportFragmentManager(), "deleteDialog");
if (mDeleteAfterEncrypt) {
for (Uri inputUri : mInputUris) {
DeleteFileDialogFragment deleteFileDialog = DeleteFileDialogFragment.newInstance(inputUri);
deleteFileDialog.show(getSupportFragmentManager(), "deleteDialog");
}
mInputUris.clear();
notifyUpdate();
}
mInputUris.clear();
notifyUpdate();
}
if (mShareAfterEncrypt) {
// Share encrypted file
startActivity(sendCreateChooserExcludingOpenKeychain(message));
// Share encrypted message/file
startActivity(sendWithChooserExcludingOpenKeychain(message));
} else if (isContentMessage()) {
// Copy to clipboard
copyToClipboard(message);
@ -305,9 +308,17 @@ public class EncryptActivity extends DrawerActivity implements EncryptActivityIn
* @param message
* @return
*/
private Intent sendCreateChooserExcludingOpenKeychain(Message message) {
private Intent sendWithChooserExcludingOpenKeychain(Message message) {
Intent prototype = createSendIntent(message);
String title = isContentMessage() ? getString(R.string.title_share_message)
: getString(R.string.title_share_file);
// somehow this returns lists with only one entry on Android 2.3
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
return Intent.createChooser(prototype, title);
}
String[] blacklist = new String[]{Constants.PACKAGE_NAME + ".ui.EncryptActivity"};
List<LabeledIntent> targetedShareIntents = new ArrayList<LabeledIntent>();
@ -348,7 +359,7 @@ public class EncryptActivity extends DrawerActivity implements EncryptActivityIn
}
// Create chooser with only one Intent in it
Intent chooserIntent = Intent.createChooser(targetedShareIntents.remove(targetedShareIntents.size() - 1), getString(R.string.title_share_file));
Intent chooserIntent = Intent.createChooser(targetedShareIntents.remove(targetedShareIntents.size() - 1), title);
// append all other Intents
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, targetedShareIntents.toArray(new Parcelable[]{}));
return chooserIntent;
@ -357,7 +368,7 @@ public class EncryptActivity extends DrawerActivity implements EncryptActivityIn
}
// fallback to Android's default chooser
return Intent.createChooser(prototype, getString(R.string.title_share_file));
return Intent.createChooser(prototype, title);
}
private Intent createSendIntent(Message message) {

View File

@ -18,6 +18,7 @@
<string name="title_share_fingerprint_with">Share fingerprint with…</string>
<string name="title_share_key">Share key with…</string>
<string name="title_share_file">Share file with…</string>
<string name="title_share_message">Share message with…</string>
<string name="title_encrypt_to_file">Encrypt To File</string>
<string name="title_decrypt_to_file">Decrypt To File</string>
<string name="title_import_keys">Import Keys</string>