End icon mode cannot be changed dynamically

Due to a 2 year old bug in material components:

https://github.com/material-components/material-components-android/issues/503
This commit is contained in:
M66B 2021-08-15 17:56:19 +02:00
parent 5f43b00a9c
commit de53031696
6 changed files with 11 additions and 11 deletions

View File

@ -337,8 +337,9 @@ public class FragmentAccount extends FragmentBase {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (TextUtils.isEmpty(s))
tilPassword.setEndIconMode(END_ICON_PASSWORD_TOGGLE);
// https://github.com/material-components/material-components-android/issues/503
//if (TextUtils.isEmpty(s))
// tilPassword.setEndIconMode(END_ICON_PASSWORD_TOGGLE);
}
@Override

View File

@ -316,8 +316,9 @@ public class FragmentIdentity extends FragmentBase {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (TextUtils.isEmpty(s))
tilPassword.setEndIconMode(END_ICON_PASSWORD_TOGGLE);
// https://github.com/material-components/material-components-android/issues/503
//if (TextUtils.isEmpty(s))
// tilPassword.setEndIconMode(END_ICON_PASSWORD_TOGGLE);
}
@Override
@ -511,7 +512,7 @@ public class FragmentIdentity extends FragmentBase {
btnAutoConfig.setEnabled(false);
pbAutoConfig.setVisibility(View.GONE);
cbInsecure.setVisibility(View.GONE);
tilPassword.setEndIconMode(Helper.isSecure(getContext()) ? END_ICON_PASSWORD_TOGGLE : END_ICON_NONE);
tilPassword.setEndIconMode(id < 0 || Helper.isSecure(getContext()) ? END_ICON_PASSWORD_TOGGLE : END_ICON_NONE);
btnAdvanced.setVisibility(View.GONE);
@ -539,7 +540,7 @@ public class FragmentIdentity extends FragmentBase {
etEmail.setText(account.user);
etUser.setText(account.user);
tilPassword.getEditText().setText(account.password);
tilPassword.setEndIconMode(Helper.isSecure(getContext()) ? END_ICON_PASSWORD_TOGGLE : END_ICON_NONE);
//tilPassword.setEndIconMode(Helper.isSecure(getContext()) ? END_ICON_PASSWORD_TOGGLE : END_ICON_NONE);
certificate = account.certificate_alias;
tvCertificate.setText(certificate == null ? getString(R.string.title_optional) : certificate);
etRealm.setText(account.realm);

View File

@ -192,8 +192,9 @@ public class FragmentPop extends FragmentBase {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (TextUtils.isEmpty(s))
tilPassword.setEndIconMode(END_ICON_PASSWORD_TOGGLE);
// https://github.com/material-components/material-components-android/issues/503
//if (TextUtils.isEmpty(s))
// tilPassword.setEndIconMode(END_ICON_PASSWORD_TOGGLE);
}
@Override

View File

@ -264,7 +264,6 @@
android:id="@+id/tilPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:endIconMode="password_toggle"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvPassword">

View File

@ -417,7 +417,6 @@
android:id="@+id/tilPassword"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:endIconMode="password_toggle"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvPassword">

View File

@ -195,7 +195,6 @@
android:id="@+id/tilPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:endIconMode="password_toggle"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvPassword">