mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-27 11:12:15 -05:00
Merge pull request #300 from danielhass/master
Replaced Toast with AppMsg in DecryptActivity
This commit is contained in:
commit
6dabe9bf7f
@ -66,6 +66,7 @@ import android.widget.Toast;
|
|||||||
import android.widget.ViewFlipper;
|
import android.widget.ViewFlipper;
|
||||||
|
|
||||||
import com.beardedhen.androidbootstrap.BootstrapButton;
|
import com.beardedhen.androidbootstrap.BootstrapButton;
|
||||||
|
import com.devspark.appmsg.AppMsg;
|
||||||
|
|
||||||
@SuppressLint("NewApi")
|
@SuppressLint("NewApi")
|
||||||
public class DecryptActivity extends DrawerActivity {
|
public class DecryptActivity extends DrawerActivity {
|
||||||
@ -233,7 +234,7 @@ public class DecryptActivity extends DrawerActivity {
|
|||||||
if (matcher.matches()) {
|
if (matcher.matches()) {
|
||||||
data = matcher.group(1);
|
data = matcher.group(1);
|
||||||
mMessage.setText(data);
|
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();
|
.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -420,17 +421,17 @@ public class DecryptActivity extends DrawerActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mInputFilename.equals("")) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mInputFilename.startsWith("file")) {
|
if (mInputFilename.startsWith("file")) {
|
||||||
File file = new File(mInputFilename);
|
File file = new File(mInputFilename);
|
||||||
if (!file.exists() || !file.isFile()) {
|
if (!file.exists() || !file.isFile()) {
|
||||||
Toast.makeText(
|
AppMsg.makeText(
|
||||||
this,
|
this,
|
||||||
getString(R.string.error_message,
|
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();
|
.show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -510,14 +511,14 @@ public class DecryptActivity extends DrawerActivity {
|
|||||||
inStream = getContentResolver().openInputStream(mContentUri);
|
inStream = getContentResolver().openInputStream(mContentUri);
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
Log.e(Constants.TAG, "File not found!", e);
|
Log.e(Constants.TAG, "File not found!", e);
|
||||||
Toast.makeText(this, getString(R.string.error_file_not_found, e.getMessage()),
|
AppMsg.makeText(this, getString(R.string.error_file_not_found, e.getMessage()),
|
||||||
Toast.LENGTH_SHORT).show();
|
AppMsg.STYLE_ALERT).show();
|
||||||
}
|
}
|
||||||
} else if (mDecryptTarget == Id.target.file) {
|
} else if (mDecryptTarget == Id.target.file) {
|
||||||
// check if storage is ready
|
// check if storage is ready
|
||||||
if (!FileHelper.isStorageMounted(mInputFilename)) {
|
if (!FileHelper.isStorageMounted(mInputFilename)) {
|
||||||
Toast.makeText(this, getString(R.string.error_external_storage_not_ready),
|
AppMsg.makeText(this, getString(R.string.error_external_storage_not_ready),
|
||||||
Toast.LENGTH_SHORT).show();
|
AppMsg.STYLE_ALERT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -525,8 +526,8 @@ public class DecryptActivity extends DrawerActivity {
|
|||||||
inStream = new BufferedInputStream(new FileInputStream(mInputFilename));
|
inStream = new BufferedInputStream(new FileInputStream(mInputFilename));
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
Log.e(Constants.TAG, "File not found!", e);
|
Log.e(Constants.TAG, "File not found!", e);
|
||||||
Toast.makeText(this, getString(R.string.error_file_not_found, e.getMessage()),
|
AppMsg.makeText(this, getString(R.string.error_file_not_found, e.getMessage()),
|
||||||
Toast.LENGTH_SHORT).show();
|
AppMsg.STYLE_ALERT).show();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
inStream = new ByteArrayInputStream(mMessage.getText().toString().getBytes());
|
inStream = new ByteArrayInputStream(mMessage.getText().toString().getBytes());
|
||||||
@ -556,8 +557,8 @@ public class DecryptActivity extends DrawerActivity {
|
|||||||
mAssumeSymmetricEncryption = true;
|
mAssumeSymmetricEncryption = true;
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Toast.makeText(this, getString(R.string.error_message, e.getMessage()),
|
AppMsg.makeText(this, getString(R.string.error_message, e.getMessage()),
|
||||||
Toast.LENGTH_SHORT).show();
|
AppMsg.STYLE_ALERT).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -655,8 +656,8 @@ public class DecryptActivity extends DrawerActivity {
|
|||||||
mSignatureKeyId = 0;
|
mSignatureKeyId = 0;
|
||||||
mSignatureLayout.setVisibility(View.GONE);
|
mSignatureLayout.setVisibility(View.GONE);
|
||||||
|
|
||||||
Toast.makeText(DecryptActivity.this, R.string.decryption_successful,
|
AppMsg.makeText(DecryptActivity.this, R.string.decryption_successful,
|
||||||
Toast.LENGTH_SHORT).show();
|
AppMsg.STYLE_INFO).show();
|
||||||
if (mReturnResult) {
|
if (mReturnResult) {
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
intent.putExtras(returnData);
|
intent.putExtras(returnData);
|
||||||
@ -713,9 +714,9 @@ public class DecryptActivity extends DrawerActivity {
|
|||||||
.getBoolean(KeychainIntentService.RESULT_SIGNATURE_UNKNOWN)) {
|
.getBoolean(KeychainIntentService.RESULT_SIGNATURE_UNKNOWN)) {
|
||||||
mSignatureStatusImage.setImageResource(R.drawable.overlay_error);
|
mSignatureStatusImage.setImageResource(R.drawable.overlay_error);
|
||||||
mLookupKey.setVisibility(View.VISIBLE);
|
mLookupKey.setVisibility(View.VISIBLE);
|
||||||
Toast.makeText(DecryptActivity.this,
|
AppMsg.makeText(DecryptActivity.this,
|
||||||
R.string.unknown_signature,
|
R.string.unknown_signature,
|
||||||
Toast.LENGTH_LONG).show();
|
AppMsg.STYLE_ALERT).show();
|
||||||
} else {
|
} else {
|
||||||
mSignatureStatusImage.setImageResource(R.drawable.overlay_error);
|
mSignatureStatusImage.setImageResource(R.drawable.overlay_error);
|
||||||
mLookupKey.setVisibility(View.GONE);
|
mLookupKey.setVisibility(View.GONE);
|
||||||
|
Loading…
Reference in New Issue
Block a user