Commit ac16c3d0 authored by Ricki Hirner's avatar Ricki Hirner

Use TextInputLayout for password field

parent bc0b1d78
Pipeline #24671660 passed with stage
in 4 minutes and 23 seconds
...@@ -55,9 +55,9 @@ class CredentialsFragment: Fragment(), CompoundButton.OnCheckedChangeListener, T ...@@ -55,9 +55,9 @@ class CredentialsFragment: Fragment(), CompoundButton.OnCheckedChangeListener, T
updateViews() updateViews()
} }
var password: String? var password: String?
get() = StringUtils.trimToNull(view?.password?.text.toString()) get() = StringUtils.trimToNull(view?.password?.editText?.text.toString())
set(value) { set(value) {
view?.password?.setText(value) view?.password?.editText?.setText(value)
updateViews() updateViews()
} }
...@@ -67,12 +67,12 @@ class CredentialsFragment: Fragment(), CompoundButton.OnCheckedChangeListener, T ...@@ -67,12 +67,12 @@ class CredentialsFragment: Fragment(), CompoundButton.OnCheckedChangeListener, T
arguments?.let { args -> arguments?.let { args ->
v.requires_authentication.isChecked = args.getBoolean(ARG_AUTH_REQUIRED) v.requires_authentication.isChecked = args.getBoolean(ARG_AUTH_REQUIRED)
v.user_name.setText(args.getString(ARG_USERNAME)) v.user_name.setText(args.getString(ARG_USERNAME))
v.password.setText(args.getString(ARG_PASSWORD)) v.password.editText?.setText(args.getString(ARG_PASSWORD))
} }
v.requires_authentication.setOnCheckedChangeListener(this) v.requires_authentication.setOnCheckedChangeListener(this)
v.user_name.addTextChangedListener(this) v.user_name.addTextChangedListener(this)
v.password.addTextChangedListener(this) v.password.editText?.addTextChangedListener(this)
return v return v
} }
......
...@@ -12,12 +12,14 @@ ...@@ -12,12 +12,14 @@
--> -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:orientation="vertical"
android:layout_height="match_parent"> android:layout_width="match_parent"
android:layout_height="match_parent">
<Switch <Switch
android:layout_marginTop="32dp" android:layout_marginTop="32dp"
android:layout_marginBottom="16dp"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/add_calendar_requires_authentication" android:text="@string/add_calendar_requires_authentication"
...@@ -46,12 +48,16 @@ ...@@ -46,12 +48,16 @@
android:visibility="gone" android:visibility="gone"
android:id="@+id/password_label"/> android:id="@+id/password_label"/>
<EditText <android.support.design.widget.TextInputLayout
android:id="@+id/password"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:inputType="textPassword" app:passwordToggleEnabled="true">
android:visibility="gone" <android.support.design.widget.TextInputEditText
android:id="@+id/password" android:layout_width="match_parent"
android:singleLine="true"/> android:layout_height="wrap_content"
android:inputType="textPassword"
android:maxLines="1" />
</android.support.design.widget.TextInputLayout>
</LinearLayout> </LinearLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment