mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-05-14 14:02:49 +00:00
Merge pull request #1293 from alexbakker/disable-unlock-button
Disable the unlock button until the slot decryption task is done
This commit is contained in:
commit
b59350337f
1 changed files with 7 additions and 3 deletions
|
@ -57,6 +57,7 @@ public class AuthActivity extends AegisActivity {
|
||||||
private SecretKey _bioKey;
|
private SecretKey _bioKey;
|
||||||
private BiometricSlot _bioSlot;
|
private BiometricSlot _bioSlot;
|
||||||
private BiometricPrompt _bioPrompt;
|
private BiometricPrompt _bioPrompt;
|
||||||
|
private Button _decryptButton;
|
||||||
|
|
||||||
private int _failedUnlockAttempts;
|
private int _failedUnlockAttempts;
|
||||||
|
|
||||||
|
@ -70,14 +71,14 @@ public class AuthActivity extends AegisActivity {
|
||||||
setContentView(R.layout.activity_auth);
|
setContentView(R.layout.activity_auth);
|
||||||
_textPassword = findViewById(R.id.text_password);
|
_textPassword = findViewById(R.id.text_password);
|
||||||
LinearLayout boxBiometricInfo = findViewById(R.id.box_biometric_info);
|
LinearLayout boxBiometricInfo = findViewById(R.id.box_biometric_info);
|
||||||
Button decryptButton = findViewById(R.id.button_decrypt);
|
_decryptButton = findViewById(R.id.button_decrypt);
|
||||||
TextView biometricsButton = findViewById(R.id.button_biometrics);
|
TextView biometricsButton = findViewById(R.id.button_biometrics);
|
||||||
|
|
||||||
getOnBackPressedDispatcher().addCallback(this, new BackPressHandler());
|
getOnBackPressedDispatcher().addCallback(this, new BackPressHandler());
|
||||||
|
|
||||||
_textPassword.setOnEditorActionListener((v, actionId, event) -> {
|
_textPassword.setOnEditorActionListener((v, actionId, event) -> {
|
||||||
if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) || (actionId == EditorInfo.IME_ACTION_DONE)) {
|
if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) || (actionId == EditorInfo.IME_ACTION_DONE)) {
|
||||||
decryptButton.performClick();
|
_decryptButton.performClick();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
@ -148,7 +149,7 @@ public class AuthActivity extends AegisActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
decryptButton.setOnClickListener(v -> {
|
_decryptButton.setOnClickListener(v -> {
|
||||||
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
|
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
|
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
|
||||||
|
|
||||||
|
@ -157,6 +158,8 @@ public class AuthActivity extends AegisActivity {
|
||||||
PasswordSlotDecryptTask.Params params = new PasswordSlotDecryptTask.Params(slots, password);
|
PasswordSlotDecryptTask.Params params = new PasswordSlotDecryptTask.Params(slots, password);
|
||||||
PasswordSlotDecryptTask task = new PasswordSlotDecryptTask(AuthActivity.this, new PasswordDerivationListener());
|
PasswordSlotDecryptTask task = new PasswordSlotDecryptTask(AuthActivity.this, new PasswordDerivationListener());
|
||||||
task.execute(getLifecycle(), params);
|
task.execute(getLifecycle(), params);
|
||||||
|
|
||||||
|
_decryptButton.setEnabled(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
biometricsButton.setOnClickListener(v -> {
|
biometricsButton.setOnClickListener(v -> {
|
||||||
|
@ -337,6 +340,7 @@ public class AuthActivity extends AegisActivity {
|
||||||
|
|
||||||
finish(result.getKey(), result.isSlotRepaired());
|
finish(result.getKey(), result.isSlotRepaired());
|
||||||
} else {
|
} else {
|
||||||
|
_decryptButton.setEnabled(true);
|
||||||
onInvalidPassword();
|
onInvalidPassword();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue