mirror of
https://github.com/moparisthebest/k-9
synced 2025-01-06 19:28:11 -05:00
Code style fixes
This commit is contained in:
parent
7b67d054a4
commit
9e47686277
@ -92,6 +92,8 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF
|
|||||||
private static final int LOCAL_MESSAGE_LOADER_ID = 1;
|
private static final int LOCAL_MESSAGE_LOADER_ID = 1;
|
||||||
private static final int DECODE_MESSAGE_LOADER_ID = 2;
|
private static final int DECODE_MESSAGE_LOADER_ID = 2;
|
||||||
|
|
||||||
|
private static final int INVALID_OPENPGP_RESULT_CODE = -1;
|
||||||
|
|
||||||
|
|
||||||
public static MessageViewFragment newInstance(MessageReference reference) {
|
public static MessageViewFragment newInstance(MessageReference reference) {
|
||||||
MessageViewFragment fragment = new MessageViewFragment();
|
MessageViewFragment fragment = new MessageViewFragment();
|
||||||
@ -400,50 +402,52 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void onDecryptionConverge (DecryptedBodyPart decryptedPart) {
|
private void onDecryptionConverge (DecryptedBodyPart decryptedPart) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (currentDecryptingResult == null) {
|
if (currentDecryptingResult == null) {
|
||||||
Log.e(K9.LOG_TAG, "internal error, we should have a result here!");
|
Log.e(K9.LOG_TAG, "Internal error: we should have a result here!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int resultCode = currentDecryptingResult.getIntExtra(OpenPgpApi.RESULT_CODE, -1);
|
int resultCode = currentDecryptingResult.getIntExtra(OpenPgpApi.RESULT_CODE, INVALID_OPENPGP_RESULT_CODE);
|
||||||
Log.d(K9.LOG_TAG, "result: " + resultCode);
|
if (K9.DEBUG) {
|
||||||
|
Log.d(K9.LOG_TAG, "OpenPGP API decryptVerify result code: " + resultCode);
|
||||||
|
}
|
||||||
|
|
||||||
switch (resultCode) {
|
switch (resultCode) {
|
||||||
case -1:
|
case INVALID_OPENPGP_RESULT_CODE: {
|
||||||
Log.e(K9.LOG_TAG, "internal error: no result code!");
|
Log.e(K9.LOG_TAG, "Internal error: no result code!");
|
||||||
return;
|
break;
|
||||||
|
}
|
||||||
case OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED: {
|
case OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED: {
|
||||||
PendingIntent pendingIntent = currentDecryptingResult.getParcelableExtra(OpenPgpApi.RESULT_INTENT);
|
PendingIntent pendingIntent = currentDecryptingResult.getParcelableExtra(OpenPgpApi.RESULT_INTENT);
|
||||||
if (pendingIntent == null) {
|
if (pendingIntent == null) {
|
||||||
throw new AssertionError("Expecting PendingIntent on USER_INTERACTION_REQUIRED!");
|
throw new AssertionError("Expecting PendingIntent on USER_INTERACTION_REQUIRED!");
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
getActivity().startIntentSenderForResult(pendingIntent.getIntentSender(),
|
getActivity().startIntentSenderForResult(pendingIntent.getIntentSender(),
|
||||||
MessageList.REQUEST_CODE_CRYPTO, null, 0, 0, 0);
|
MessageList.REQUEST_CODE_CRYPTO, null, 0, 0, 0);
|
||||||
} catch (SendIntentException e) {
|
} catch (SendIntentException e) {
|
||||||
Log.e(K9.LOG_TAG, "internal error on starting pendingintent!", e);
|
Log.e(K9.LOG_TAG, "Internal error on starting pendingintent!", e);
|
||||||
}
|
}
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case OpenPgpApi.RESULT_CODE_ERROR: {
|
case OpenPgpApi.RESULT_CODE_ERROR: {
|
||||||
Log.e(K9.LOG_TAG, "error msg: " + currentDecryptingResult.getStringExtra(OpenPgpApi.RESULT_ERROR));
|
if (K9.DEBUG) {
|
||||||
|
String errorMessage = currentDecryptingResult.getStringExtra(OpenPgpApi.RESULT_ERROR);
|
||||||
|
Log.w(K9.LOG_TAG, "OpenPGP API error: " + errorMessage);
|
||||||
|
}
|
||||||
onDecryptionFailed();
|
onDecryptionFailed();
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case OpenPgpApi.RESULT_CODE_SUCCESS: {
|
case OpenPgpApi.RESULT_CODE_SUCCESS: {
|
||||||
onDecryptionSuccess(decryptedPart);
|
onDecryptionSuccess(decryptedPart);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
currentDecryptingResult = null;
|
currentDecryptingResult = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleCryptoResult(int resultCode, Intent data) {
|
public void handleCryptoResult(int resultCode, Intent data) {
|
||||||
|
Loading…
Reference in New Issue
Block a user