Improved password dialog
This commit is contained in:
@@ -1343,13 +1343,6 @@ class MainActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
val input = layout.findViewById(R.id.password) as EditText
|
val input = layout.findViewById(R.id.password) as EditText
|
||||||
input.requestFocus()
|
input.requestFocus()
|
||||||
val checkBox = layout.findViewById(R.id.checkbox) as CheckBox
|
|
||||||
checkBox.setOnCheckedChangeListener { _, isChecked ->
|
|
||||||
if (isChecked)
|
|
||||||
input.transformationMethod = HideReturnsTransformationMethod()
|
|
||||||
else
|
|
||||||
input.transformationMethod = PasswordTransformationMethod()
|
|
||||||
}
|
|
||||||
val context = this
|
val context = this
|
||||||
val builder = AlertDialog.Builder(this, R.style.AlertDialog)
|
val builder = AlertDialog.Builder(this, R.style.AlertDialog)
|
||||||
with(builder) {
|
with(builder) {
|
||||||
@@ -1399,13 +1392,6 @@ class MainActivity : AppCompatActivity() {
|
|||||||
messageView.text = message
|
messageView.text = message
|
||||||
val input = layout.findViewById(R.id.password) as EditText
|
val input = layout.findViewById(R.id.password) as EditText
|
||||||
input.requestFocus()
|
input.requestFocus()
|
||||||
val checkBox = layout.findViewById(R.id.checkbox) as CheckBox
|
|
||||||
checkBox.setOnCheckedChangeListener { _, isChecked ->
|
|
||||||
if (isChecked)
|
|
||||||
input.transformationMethod = HideReturnsTransformationMethod()
|
|
||||||
else
|
|
||||||
input.transformationMethod = PasswordTransformationMethod()
|
|
||||||
}
|
|
||||||
val context = this
|
val context = this
|
||||||
val builder = AlertDialog.Builder(this, R.style.AlertDialog)
|
val builder = AlertDialog.Builder(this, R.style.AlertDialog)
|
||||||
with(builder) {
|
with(builder) {
|
||||||
|
|||||||
@@ -1,7 +1,14 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:isScrollContainer="true"
|
||||||
android:orientation="vertical" >
|
android:orientation="vertical" >
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@@ -17,34 +24,30 @@
|
|||||||
android:id="@+id/message"
|
android:id="@+id/message"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingTop="15dp"
|
||||||
android:textSize="15sp"
|
android:textSize="15sp"
|
||||||
android:paddingTop="20dp"
|
|
||||||
android:paddingStart="?dialogPreferredPadding"
|
android:paddingStart="?dialogPreferredPadding"
|
||||||
android:paddingEnd="?dialogPreferredPadding" />
|
android:paddingEnd="?dialogPreferredPadding" />
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingTop="20dp"
|
|
||||||
android:paddingStart="?dialogPreferredPadding"
|
android:paddingStart="?dialogPreferredPadding"
|
||||||
android:paddingEnd="?dialogPreferredPadding" >
|
android:paddingEnd="?dialogPreferredPadding"
|
||||||
|
app:hintEnabled="false"
|
||||||
|
app:endIconMode="password_toggle">
|
||||||
|
|
||||||
<EditText
|
<androidx.appcompat.widget.AppCompatEditText
|
||||||
android:id="@+id/password"
|
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:importantForAutofill="no"
|
android:imeOptions="actionDone|flagNoExtractUi"
|
||||||
android:hint="@string/password"
|
android:inputType="textPassword"
|
||||||
android:imeOptions="actionDone"
|
android:maxLines="1">
|
||||||
android:inputType="textPassword" />
|
</androidx.appcompat.widget.AppCompatEditText>
|
||||||
|
|
||||||
<CheckBox
|
|
||||||
android:id="@+id/checkbox"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/show_password"
|
|
||||||
android:checked="false"/>
|
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
</ScrollView>
|
||||||
|
|||||||
Reference in New Issue
Block a user