2019-02-07 22:39:33 +01:00
|
|
|
package com.beemdevelopment.aegis.helpers;
|
2017-08-13 23:38:38 +02:00
|
|
|
|
|
|
|
import android.text.Editable;
|
|
|
|
import android.widget.EditText;
|
|
|
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
2018-02-13 21:17:21 +01:00
|
|
|
public class EditTextHelper {
|
|
|
|
private EditTextHelper() {
|
2017-08-13 23:38:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public static char[] getEditTextChars(EditText text) {
|
2020-10-24 14:21:49 +02:00
|
|
|
Editable editable = text.getText();
|
|
|
|
char[] chars = new char[editable.length()];
|
|
|
|
editable.getChars(0, editable.length(), chars, 0);
|
2017-08-13 23:38:38 +02:00
|
|
|
return chars;
|
|
|
|
}
|
|
|
|
|
2018-02-13 21:17:21 +01:00
|
|
|
public static boolean areEditTextsEqual(EditText text1, EditText text2) {
|
2017-08-13 23:38:38 +02:00
|
|
|
char[] password = getEditTextChars(text1);
|
|
|
|
char[] passwordConfirm = getEditTextChars(text2);
|
2018-02-13 21:01:27 +01:00
|
|
|
return password.length != 0 && Arrays.equals(password, passwordConfirm);
|
2017-08-13 23:38:38 +02:00
|
|
|
}
|
|
|
|
}
|