Code cleanup

This commit is contained in:
cketti 2015-12-16 23:35:20 +01:00
parent 5d2de3b193
commit 9ef7a4c8f1

View file

@ -17,9 +17,7 @@ import android.widget.LinearLayout;
import android.widget.TextView;
import com.fsck.k9.R;
import com.fsck.k9.mailstore.OpenPgpResultAnnotation;
import org.openintents.openpgp.OpenPgpDecryptionResult;
import org.openintents.openpgp.OpenPgpError;
import org.openintents.openpgp.OpenPgpSignatureResult;
@ -49,6 +47,8 @@ public class OpenPgpHeaderView extends LinearLayout {
@Override
public void onFinishInflate() {
super.onFinishInflate();
resultEncryptionIcon = (ImageView) findViewById(R.id.result_encryption_icon);
resultEncryptionText = (TextView) findViewById(R.id.result_encryption_text);
resultSignatureIcon = (ImageView) findViewById(R.id.result_signature_icon);
@ -131,7 +131,6 @@ public class OpenPgpHeaderView extends LinearLayout {
resultEncryptionText.setText(R.string.openpgp_result_decryption_insecure);
}
private void displayEncryptionError() {
setEncryptionImageAndTextColor(CryptoState.INVALID);
@ -161,7 +160,7 @@ public class OpenPgpHeaderView extends LinearLayout {
switch (cryptoAnnotation.getErrorType()) {
case CRYPTO_API_RETURNED_ERROR:
displayEncryptionError();
dontDisplayVerification();
hideVerificationState();
break;
case NONE: {
displayVerificationResult();
@ -174,7 +173,8 @@ public class OpenPgpHeaderView extends LinearLayout {
}
}
}
private void dontDisplayVerification(){
private void hideVerificationState() {
hideSignatureLayout();
resultSignatureText.setVisibility(View.GONE);
resultSignatureIcon.setVisibility(View.GONE);
@ -222,8 +222,9 @@ public class OpenPgpHeaderView extends LinearLayout {
displaySignatureInsecure();
break;
}
default:
default: {
throw new RuntimeException("OpenPgpSignatureResult result not handled!");
}
}
}