content: package com.google.android.material.textfield;
  
  import android.text.TextWatcher;
  import android.text.method.PasswordTransformationMethod;
  import android.text.method.TransformationMethod;
  import android.view.View;
  import android.widget.EditText;
  import com.google.android.material.R;
  import com.google.android.material.internal.TextWatcherAdapter;
  import com.google.android.material.textfield.TextInputLayout;
  
  class PasswordToggleEndIconDelegate extends EndIconDelegate {
      private final TextInputLayout.OnEditTextAttachedListener onEditTextAttachedListener = new TextInputLayout.OnEditTextAttachedListener() {
          public void onEditTextAttached(TextInputLayout textInputLayout) {
              EditText editText = textInputLayout.getEditText();
              PasswordToggleEndIconDelegate.this.endIconView.setChecked(!PasswordToggleEndIconDelegate.this.hasPasswordTransformation());
              editText.removeTextChangedListener(PasswordToggleEndIconDelegate.this.textWatcher);
              editText.addTextChangedListener(PasswordToggleEndIconDelegate.this.textWatcher);
          }
      };
      private final TextInputLayout.OnEndIconChangedListener onEndIconChangedListener = new TextInputLayout.OnEndIconChangedListener() {
          public void onEndIconChanged(TextInputLayout textInputLayout, int previousIcon) {
              final EditText editText = textInputLayout.getEditText();
              if (editText != null && previousIcon == 1) {
                  editText.setTransformationMethod(PasswordTransformationMethod.getInstance());
                  editText.post(new Runnable() {
                      public void run() {
                          editText.removeTextChangedListener(PasswordToggleEndIconDelegate.this.textWatcher);
                      }
                  });
              }
          }
      };
      /* access modifiers changed from: private */
      public final TextWatcher textWatcher = new TextWatcherAdapter() {
          public void beforeTextChanged(CharSequence s, int start, int count, int after) {
              PasswordToggleEndIconDelegate.this.endIconView.setChecked(!PasswordToggleEndIconDelegate.this.hasPasswordTransformation());
          }
      };
  
      PasswordToggleEndIconDelegate(TextInputLayout textInputLayout, int customEndIcon) {
          super(textInputLayout, customEndIcon);
      }
  
      /* access modifiers changed from: private */
      public boolean hasPasswordTransformation() {
          EditText editText = this.textInputLayout.getEditText();
          return editText != null && (editText.getTransformationMethod() instanceof PasswordTransformationMethod);
      }
  
      private static boolean isInputTypePassword(EditText editText) {
          return editText != null && (editText.getInputType() == 16 || editText.getInputType() == 128 || editText.getInputType() == 144 || editText.getInputType() == 224);
      }
  
      /* access modifiers changed from: package-private */
      public void initialize() {
          this.textInputLayout.setEndIconDrawable(this.customEndIcon == 0 ? R.drawable.design_password_eye : this.customEndIcon);
          this.textInputLayout.setEndIconContentDescription(this.textInputLayout.getResources().getText(R.string.password_toggle_content_description));
          this.textInputLayout.setEndIconVisible(true);
          this.textInputLayout.setEndIconCheckable(true);
          this.textInputLayout.setEndIconOnClickListener(new View.OnClickListener() {
              public void onClick(View v) {
                  EditText editText = PasswordToggleEndIconDelegate.this.textInputLayout.getEditText();
                  if (editText != null) {
                      int selectionEnd = editText.getSelectionEnd();
                      if (PasswordToggleEndIconDelegate.this.hasPasswordTransformation()) {
                          editText.setTransformationMethod((TransformationMethod) null);
                      } else {
                          editText.setTransformationMethod(PasswordTransformationMethod.getInstance());
                      }
                      if (selectionEnd >= 0) {
                          editText.setSelection(selectionEnd);
                      }
                      PasswordToggleEndIconDelegate.this.textInputLayout.refreshEndIconDrawableState();
                  }
              }
          });
          this.textInputLayout.addOnEditTextAttachedListener(this.onEditTextAttachedListener);
          this.textInputLayout.addOnEndIconChangedListener(this.onEndIconChangedListener);
          EditText editText = this.textInputLayout.getEditText();
          if (isInputTypePassword(editText)) {
              editText.setTransformationMethod(PasswordTransformationMethod.getInstance());
          }
      }
  }
  