Merge pull request #300 from danielhass/master

Replaced Toast with AppMsg in DecryptActivity
This commit is contained in:
Dominik Schürmann 2014-02-25 07:46:30 +01:00
commit 6dabe9bf7f

View File

@ -66,6 +66,7 @@ import android.widget.Toast;
import android.widget.ViewFlipper;
import com.beardedhen.androidbootstrap.BootstrapButton;
import com.devspark.appmsg.AppMsg;
@SuppressLint("NewApi")
public class DecryptActivity extends DrawerActivity {
@ -233,7 +234,7 @@ public class DecryptActivity extends DrawerActivity {
if (matcher.matches()) {
data = matcher.group(1);
mMessage.setText(data);
Toast.makeText(this, R.string.using_clipboard_content, Toast.LENGTH_SHORT)
AppMsg.makeText(this, R.string.using_clipboard_content, AppMsg.STYLE_INFO)
.show();
}
}
@ -420,17 +421,17 @@ public class DecryptActivity extends DrawerActivity {
}
if (mInputFilename.equals("")) {
Toast.makeText(this, R.string.no_file_selected, Toast.LENGTH_SHORT).show();
AppMsg.makeText(this, R.string.no_file_selected, AppMsg.STYLE_ALERT).show();
return;
}
if (mInputFilename.startsWith("file")) {
File file = new File(mInputFilename);
if (!file.exists() || !file.isFile()) {
Toast.makeText(
AppMsg.makeText(
this,
getString(R.string.error_message,
getString(R.string.error_file_not_found)), Toast.LENGTH_SHORT)
getString(R.string.error_file_not_found)), AppMsg.STYLE_ALERT)
.show();
return;
}
@ -510,14 +511,14 @@ public class DecryptActivity extends DrawerActivity {
inStream = getContentResolver().openInputStream(mContentUri);
} catch (FileNotFoundException e) {
Log.e(Constants.TAG, "File not found!", e);
Toast.makeText(this, getString(R.string.error_file_not_found, e.getMessage()),
Toast.LENGTH_SHORT).show();
AppMsg.makeText(this, getString(R.string.error_file_not_found, e.getMessage()),
AppMsg.STYLE_ALERT).show();
}
} else if (mDecryptTarget == Id.target.file) {
// check if storage is ready
if (!FileHelper.isStorageMounted(mInputFilename)) {
Toast.makeText(this, getString(R.string.error_external_storage_not_ready),
Toast.LENGTH_SHORT).show();
AppMsg.makeText(this, getString(R.string.error_external_storage_not_ready),
AppMsg.STYLE_ALERT).show();
return;
}
@ -525,8 +526,8 @@ public class DecryptActivity extends DrawerActivity {
inStream = new BufferedInputStream(new FileInputStream(mInputFilename));
} catch (FileNotFoundException e) {
Log.e(Constants.TAG, "File not found!", e);
Toast.makeText(this, getString(R.string.error_file_not_found, e.getMessage()),
Toast.LENGTH_SHORT).show();
AppMsg.makeText(this, getString(R.string.error_file_not_found, e.getMessage()),
AppMsg.STYLE_ALERT).show();
}
} else {
inStream = new ByteArrayInputStream(mMessage.getText().toString().getBytes());
@ -556,8 +557,8 @@ public class DecryptActivity extends DrawerActivity {
mAssumeSymmetricEncryption = true;
}
} catch (Exception e) {
Toast.makeText(this, getString(R.string.error_message, e.getMessage()),
Toast.LENGTH_SHORT).show();
AppMsg.makeText(this, getString(R.string.error_message, e.getMessage()),
AppMsg.STYLE_ALERT).show();
}
}
@ -655,8 +656,8 @@ public class DecryptActivity extends DrawerActivity {
mSignatureKeyId = 0;
mSignatureLayout.setVisibility(View.GONE);
Toast.makeText(DecryptActivity.this, R.string.decryption_successful,
Toast.LENGTH_SHORT).show();
AppMsg.makeText(DecryptActivity.this, R.string.decryption_successful,
AppMsg.STYLE_INFO).show();
if (mReturnResult) {
Intent intent = new Intent();
intent.putExtras(returnData);
@ -713,9 +714,9 @@ public class DecryptActivity extends DrawerActivity {
.getBoolean(KeychainIntentService.RESULT_SIGNATURE_UNKNOWN)) {
mSignatureStatusImage.setImageResource(R.drawable.overlay_error);
mLookupKey.setVisibility(View.VISIBLE);
Toast.makeText(DecryptActivity.this,
AppMsg.makeText(DecryptActivity.this,
R.string.unknown_signature,
Toast.LENGTH_LONG).show();
AppMsg.STYLE_ALERT).show();
} else {
mSignatureStatusImage.setImageResource(R.drawable.overlay_error);
mLookupKey.setVisibility(View.GONE);