title: Using endIconMode in a TextInputLayout the end icon is enabled (the visible icon) by default
body: <p>I'm building a password field using TextInputLayout in Android (Kotlin) and when I use the endIconMode attribute the icon in the end is enabled (more to say it shows the visible eye icon) and whenever I click on it for the password to be visible, on the end it shows the visibility off icon even though the password is visible. How can I solve this?
  This is my XML code:</p>
  <pre><code>&lt;com.google.android.material.textfield.TextInputLayout
          android:id=&quot;@+id/password_field&quot;
          style=&quot;@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:layout_below=&quot;@id/password&quot;
          android:layout_marginHorizontal=&quot;30dp&quot;
          android:layout_marginTop=&quot;5dp&quot;
          android:hint=&quot;Enter your password&quot;
          app:boxBackgroundColor=&quot;#1AC4C4C4&quot;
          app:boxCornerRadiusBottomEnd=&quot;20dp&quot;
          app:boxCornerRadiusBottomStart=&quot;20dp&quot;
          app:boxCornerRadiusTopEnd=&quot;20dp&quot;
          app:boxCornerRadiusTopStart=&quot;20dp&quot;
          app:boxStrokeColor=&quot;@color/text_field_stroke&quot;
          app:boxStrokeWidth=&quot;0.5dp&quot;
          app:endIconMode=&quot;password_toggle&quot;&gt;
  
          &lt;com.google.android.material.textfield.TextInputEditText
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:fontFamily=&quot;@font/roboto&quot;
              android:inputType=&quot;textPassword&quot; /&gt;
      &lt;/com.google.android.material.textfield.TextInputLayout&gt; 
  </code></pre>
  <p><a href="https://i.stack.imgur.com/xgamD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xgamD.png" alt="enter image description here" /></a></p>
  <p><a href="https://i.stack.imgur.com/BmtjS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BmtjS.png" alt="enter image description here" /></a></p>