Check if label OR issuer are empty in the manual entry

This commit is contained in:
Jakob Nixdorf 2020-05-06 06:51:25 +02:00
parent 57ab645314
commit 8c01eb54b8
No known key found for this signature in database
GPG key ID: BE99BF86574A7DBC

View file

@ -276,8 +276,10 @@ public class ManualEntryDialog {
@Override
public void afterTextChanged(Editable editable) {
if (TextUtils.isEmpty(labelInput.getText()) || TextUtils.isEmpty(secretInput.getText())
|| TextUtils.isEmpty(digitsInput.getText()) || Integer.parseInt(digitsInput.getText().toString()) == 0) {
if ((TextUtils.isEmpty(labelInput.getText()) && TextUtils.isEmpty(issuerInput.getText())) ||
TextUtils.isEmpty(secretInput.getText()) ||
TextUtils.isEmpty(digitsInput.getText()) ||
Integer.parseInt(digitsInput.getText().toString()) == 0) {
positiveButton.setEnabled(false);
} else {
Entry.OTPType type = (Entry.OTPType) typeInput.getSelectedItem();
@ -301,6 +303,7 @@ public class ManualEntryDialog {
};
labelInput.addTextChangedListener(watcher);
issuerInput.addTextChangedListener(watcher);
secretInput.addTextChangedListener(watcher);
periodInput.addTextChangedListener(watcher);
digitsInput.addTextChangedListener(watcher);