fixed enabling trust toggle. unknown->untrusted

This commit is contained in:
Daniel Gultsch 2016-11-15 15:14:21 +01:00
parent 05fc15be3d
commit d61b00604d
2 changed files with 7 additions and 4 deletions

View File

@ -74,7 +74,11 @@ public class FingerprintStatus {
} }
public boolean isTrusted() { public boolean isTrusted() {
return trust == Trust.TRUSTED || trust == Trust.VERIFIED || trust == Trust.VERIFIED_X509; return trust == Trust.TRUSTED || isVerified();
}
public boolean isVerified() {
return trust == Trust.VERIFIED || trust == Trust.VERIFIED_X509;
} }
public boolean isCompromised() { public boolean isCompromised() {

View File

@ -795,7 +795,7 @@ public abstract class XmppActivity extends Activity {
new View.OnClickListener() { new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
account.getAxolotlService().setFingerprintTrust(fingerprint,FingerprintStatus.createActive(true)); account.getAxolotlService().setFingerprintTrust(fingerprint,FingerprintStatus.createActive(false));
v.setEnabled(true); v.setEnabled(true);
} }
}, },
@ -835,6 +835,7 @@ public abstract class XmppActivity extends Activity {
keyType.setOnLongClickListener(purge); keyType.setOnLongClickListener(purge);
boolean x509 = Config.X509_VERIFICATION && status.getTrust() == FingerprintStatus.Trust.VERIFIED_X509; boolean x509 = Config.X509_VERIFICATION && status.getTrust() == FingerprintStatus.Trust.VERIFIED_X509;
final View.OnClickListener toast; final View.OnClickListener toast;
trustToggle.setChecked(status.isTrusted(), false);
if (status.isActive()) { if (status.isActive()) {
key.setTextColor(getPrimaryTextColor()); key.setTextColor(getPrimaryTextColor());
keyType.setTextColor(getSecondaryTextColor()); keyType.setTextColor(getSecondaryTextColor());
@ -844,7 +845,6 @@ public abstract class XmppActivity extends Activity {
trustToggle.setEnabled(false); trustToggle.setEnabled(false);
} else { } else {
trustToggle.setOnClickListener(null); trustToggle.setOnClickListener(null);
trustToggle.setChecked(status.isTrusted(), false);
trustToggle.setEnabled(true); trustToggle.setEnabled(true);
} }
toast = new View.OnClickListener() { toast = new View.OnClickListener() {
@ -858,7 +858,6 @@ public abstract class XmppActivity extends Activity {
keyType.setTextColor(getTertiaryTextColor()); keyType.setTextColor(getTertiaryTextColor());
trustToggle.setOnClickListener(null); trustToggle.setOnClickListener(null);
trustToggle.setEnabled(false); trustToggle.setEnabled(false);
trustToggle.setChecked(status.isTrusted(), false);
toast = new View.OnClickListener() { toast = new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {