use material password toggle (#3261)

use material for track search
This commit is contained in:
MCAxiaz 2020-05-31 15:29:20 -07:00 committed by GitHub
parent 40ab3fe0a6
commit bccb1229c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 26 deletions

View File

@ -2,7 +2,6 @@ package eu.kanade.tachiyomi.widget.preference
import android.app.Dialog
import android.os.Bundle
import android.text.method.PasswordTransformationMethod
import android.view.View
import androidx.annotation.StringRes
import com.afollestad.materialdialogs.MaterialDialog
@ -14,8 +13,6 @@ import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.ui.base.controller.DialogController
import kotlinx.android.synthetic.main.pref_account_login.view.login
import kotlinx.android.synthetic.main.pref_account_login.view.password
import kotlinx.android.synthetic.main.pref_account_login.view.show_password
import kotlinx.android.synthetic.main.pref_account_login.view.username_label
import rx.Subscription
import uy.kohesive.injekt.injectLazy
@ -50,14 +47,6 @@ abstract class LoginDialogPreference(
fun onViewCreated(view: View) {
v = view.apply {
show_password.setOnCheckedChangeListener { _, isChecked ->
if (isChecked) {
password.transformationMethod = null
} else {
password.transformationMethod = PasswordTransformationMethod()
}
}
if (usernameLabelRes != null) {
username_label.hint = context.getString(usernameLabelRes)
}

View File

@ -16,31 +16,25 @@
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/username"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:inputType="text" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/password">
android:hint="@string/password"
app:endIconMode="password_toggle">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textPassword" />
</com.google.android.material.textfield.TextInputLayout>
<CheckBox
android:id="@+id/show_password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@string/show_password" />
<com.dd.processbutton.iml.ActionProcessButton
android:id="@+id/login"
android:layout_width="match_parent"

View File

@ -1,19 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<EditText
android:id="@+id/track_search"
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:hint="@string/title"
android:inputType="text"
android:maxLines="1" />
app:boxBackgroundMode="filled"
app:endIconMode="clear_text"
app:hintEnabled="false">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/track_search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/title"
android:inputType="text" />
</com.google.android.material.textfield.TextInputLayout>
<FrameLayout
android:layout_width="match_parent"