Fixed warnings

pull/156/head
M66B 5 years ago
parent d34833fc8a
commit 26216a88d5

@ -87,6 +87,8 @@ import javax.mail.Session;
import javax.mail.Store; import javax.mail.Store;
import static android.accounts.AccountManager.newChooseAccountIntent; import static android.accounts.AccountManager.newChooseAccountIntent;
import static com.google.android.material.textfield.TextInputLayout.END_ICON_NONE;
import static com.google.android.material.textfield.TextInputLayout.END_ICON_PASSWORD_TOGGLE;
public class FragmentAccount extends FragmentBase { public class FragmentAccount extends FragmentBase {
private ViewGroup view; private ViewGroup view;
@ -312,7 +314,7 @@ public class FragmentAccount extends FragmentBase {
auth_type = ConnectionHelper.AUTH_TYPE_PASSWORD; auth_type = ConnectionHelper.AUTH_TYPE_PASSWORD;
tilPassword.getEditText().setText(null); tilPassword.getEditText().setText(null);
tilPassword.setEnabled(true); tilPassword.setEnabled(true);
tilPassword.setPasswordVisibilityToggleEnabled(true); tilPassword.setEndIconMode(END_ICON_PASSWORD_TOGGLE);
etRealm.setEnabled(true); etRealm.setEnabled(true);
} }
} }
@ -443,7 +445,7 @@ public class FragmentAccount extends FragmentBase {
tvAuthorizeOptional.setVisibility(View.GONE); tvAuthorizeOptional.setVisibility(View.GONE);
rgEncryption.setVisibility(View.GONE); rgEncryption.setVisibility(View.GONE);
cbInsecure.setVisibility(View.GONE); cbInsecure.setVisibility(View.GONE);
tilPassword.setPasswordVisibilityToggleEnabled(id < 0); tilPassword.setEndIconMode(id < 0 ? END_ICON_PASSWORD_TOGGLE : END_ICON_NONE);
btnAdvanced.setVisibility(View.GONE); btnAdvanced.setVisibility(View.GONE);
@ -1349,7 +1351,8 @@ public class FragmentAccount extends FragmentBase {
btnAuthorize.setEnabled(true); btnAuthorize.setEnabled(true);
etUser.setEnabled(true); etUser.setEnabled(true);
tilPassword.setEnabled(auth_type == ConnectionHelper.AUTH_TYPE_PASSWORD); tilPassword.setEnabled(auth_type == ConnectionHelper.AUTH_TYPE_PASSWORD);
tilPassword.setPasswordVisibilityToggleEnabled(auth_type == ConnectionHelper.AUTH_TYPE_PASSWORD); tilPassword.setEndIconMode(auth_type == ConnectionHelper.AUTH_TYPE_PASSWORD
? END_ICON_PASSWORD_TOGGLE : END_ICON_NONE);
etRealm.setEnabled(auth_type == ConnectionHelper.AUTH_TYPE_PASSWORD); etRealm.setEnabled(auth_type == ConnectionHelper.AUTH_TYPE_PASSWORD);
btnCheck.setEnabled(true); btnCheck.setEnabled(true);
btnSave.setEnabled(true); btnSave.setEnabled(true);

@ -71,6 +71,9 @@ import javax.mail.AuthenticationFailedException;
import javax.mail.Session; import javax.mail.Session;
import javax.mail.Transport; import javax.mail.Transport;
import static com.google.android.material.textfield.TextInputLayout.END_ICON_NONE;
import static com.google.android.material.textfield.TextInputLayout.END_ICON_PASSWORD_TOGGLE;
public class FragmentIdentity extends FragmentBase { public class FragmentIdentity extends FragmentBase {
private ViewGroup view; private ViewGroup view;
private ScrollView scroll; private ScrollView scroll;
@ -202,7 +205,7 @@ public class FragmentIdentity extends FragmentBase {
tvError.setVisibility(View.GONE); tvError.setVisibility(View.GONE);
grpAdvanced.setVisibility(View.GONE); grpAdvanced.setVisibility(View.GONE);
} }
tilPassword.setPasswordVisibilityToggleEnabled(position == 0); tilPassword.setEndIconMode(position == 0 ? END_ICON_PASSWORD_TOGGLE : END_ICON_NONE);
Integer tag = (Integer) adapterView.getTag(); Integer tag = (Integer) adapterView.getTag();
if (Objects.equals(tag, position)) if (Objects.equals(tag, position))
@ -438,7 +441,7 @@ public class FragmentIdentity extends FragmentBase {
Helper.setViewsEnabled(view, false); Helper.setViewsEnabled(view, false);
btnAutoConfig.setEnabled(false); btnAutoConfig.setEnabled(false);
cbInsecure.setVisibility(View.GONE); cbInsecure.setVisibility(View.GONE);
tilPassword.setPasswordVisibilityToggleEnabled(id < 0); tilPassword.setEndIconMode(id < 0 ? END_ICON_PASSWORD_TOGGLE : END_ICON_NONE);
btnAdvanced.setVisibility(View.GONE); btnAdvanced.setVisibility(View.GONE);

@ -73,6 +73,8 @@ import javax.mail.Transport;
import static android.accounts.AccountManager.newChooseAccountIntent; import static android.accounts.AccountManager.newChooseAccountIntent;
import static android.app.Activity.RESULT_OK; import static android.app.Activity.RESULT_OK;
import static com.google.android.material.textfield.TextInputLayout.END_ICON_NONE;
import static com.google.android.material.textfield.TextInputLayout.END_ICON_PASSWORD_TOGGLE;
public class FragmentQuickSetup extends FragmentBase { public class FragmentQuickSetup extends FragmentBase {
private ViewGroup view; private ViewGroup view;
@ -142,7 +144,7 @@ public class FragmentQuickSetup extends FragmentBase {
auth_type = ConnectionHelper.AUTH_TYPE_PASSWORD; auth_type = ConnectionHelper.AUTH_TYPE_PASSWORD;
tilPassword.getEditText().setText(null); tilPassword.getEditText().setText(null);
tilPassword.setEnabled(true); tilPassword.setEnabled(true);
tilPassword.setPasswordVisibilityToggleEnabled(true); tilPassword.setEndIconMode(END_ICON_PASSWORD_TOGGLE);
} }
} }
@ -523,7 +525,8 @@ public class FragmentQuickSetup extends FragmentBase {
} finally { } finally {
etEmail.setEnabled(true); etEmail.setEnabled(true);
tilPassword.setEnabled(auth_type == ConnectionHelper.AUTH_TYPE_PASSWORD); tilPassword.setEnabled(auth_type == ConnectionHelper.AUTH_TYPE_PASSWORD);
tilPassword.setPasswordVisibilityToggleEnabled(auth_type == ConnectionHelper.AUTH_TYPE_PASSWORD); tilPassword.setEndIconMode(auth_type == ConnectionHelper.AUTH_TYPE_PASSWORD
? END_ICON_PASSWORD_TOGGLE : END_ICON_NONE);
btnAuthorize.setEnabled(true); btnAuthorize.setEnabled(true);
btnCheck.setEnabled(true); btnCheck.setEnabled(true);
new Handler().postDelayed(new Runnable() { new Handler().postDelayed(new Runnable() {

Loading…
Cancel
Save