- Added "Show Password" checkbox to password prompt.
This commit is contained in:
@@ -15,6 +15,8 @@ import android.support.v4.content.LocalBroadcastManager
|
|||||||
import android.view.inputmethod.InputMethodManager
|
import android.view.inputmethod.InputMethodManager
|
||||||
import android.text.InputType
|
import android.text.InputType
|
||||||
import android.text.TextWatcher
|
import android.text.TextWatcher
|
||||||
|
import android.text.method.HideReturnsTransformationMethod
|
||||||
|
import android.text.method.PasswordTransformationMethod
|
||||||
import android.widget.*
|
import android.widget.*
|
||||||
import android.view.*
|
import android.view.*
|
||||||
|
|
||||||
@@ -956,6 +958,13 @@ class MainActivity : AppCompatActivity() {
|
|||||||
.inflate(R.layout.password_dialog, findViewById(android.R.id.content) as ViewGroup,
|
.inflate(R.layout.password_dialog, findViewById(android.R.id.content) as ViewGroup,
|
||||||
false)
|
false)
|
||||||
val input = viewInflated.findViewById(R.id.password) as EditText
|
val input = viewInflated.findViewById(R.id.password) as EditText
|
||||||
|
val checkBox = viewInflated.findViewById(R.id.checkbox) as CheckBox
|
||||||
|
checkBox.setOnCheckedChangeListener { buttonView, isChecked ->
|
||||||
|
if (isChecked)
|
||||||
|
input.transformationMethod = HideReturnsTransformationMethod()
|
||||||
|
else
|
||||||
|
input.transformationMethod = PasswordTransformationMethod()
|
||||||
|
}
|
||||||
builder.setView(viewInflated)
|
builder.setView(viewInflated)
|
||||||
builder.setPositiveButton(android.R.string.ok) { dialog, _ ->
|
builder.setPositiveButton(android.R.string.ok) { dialog, _ ->
|
||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
@@ -986,6 +995,13 @@ class MainActivity : AppCompatActivity() {
|
|||||||
.inflate(R.layout.password_dialog, findViewById(android.R.id.content) as ViewGroup,
|
.inflate(R.layout.password_dialog, findViewById(android.R.id.content) as ViewGroup,
|
||||||
false)
|
false)
|
||||||
val input = viewInflated.findViewById(R.id.password) as EditText
|
val input = viewInflated.findViewById(R.id.password) as EditText
|
||||||
|
val checkBox = viewInflated.findViewById(R.id.checkbox) as CheckBox
|
||||||
|
checkBox.setOnCheckedChangeListener { buttonView, isChecked ->
|
||||||
|
if (isChecked)
|
||||||
|
input.transformationMethod = HideReturnsTransformationMethod()
|
||||||
|
else
|
||||||
|
input.transformationMethod = PasswordTransformationMethod()
|
||||||
|
}
|
||||||
builder.setView(viewInflated)
|
builder.setView(viewInflated)
|
||||||
builder.setPositiveButton(android.R.string.ok) { dialog, _ ->
|
builder.setPositiveButton(android.R.string.ok) { dialog, _ ->
|
||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
|
|||||||
@@ -8,14 +8,22 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<AutoCompleteTextView
|
<EditText
|
||||||
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:hint="@string/password"
|
android:hint="@string/password"
|
||||||
android:imeOptions="actionDone"
|
android:imeOptions="actionDone"
|
||||||
android:inputType="textPassword" />
|
android:inputType="textPassword" />
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/checkbox"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/show_password"
|
||||||
|
android:checked="false"/>
|
||||||
|
|
||||||
</android.support.design.widget.TextInputLayout>
|
</android.support.design.widget.TextInputLayout>
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
@@ -358,4 +358,5 @@
|
|||||||
ilman Mikrofoni-käyttöoikeutta.
|
ilman Mikrofoni-käyttöoikeutta.
|
||||||
</string>
|
</string>
|
||||||
<string name="account_password">Tilin %1$s salasana</string>
|
<string name="account_password">Tilin %1$s salasana</string>
|
||||||
|
<string name="show_password">Näytä salasana</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -317,4 +317,5 @@
|
|||||||
</string>
|
</string>
|
||||||
<string name="no_calls">You are not able to place or answer calls without Microphone permission.</string>
|
<string name="no_calls">You are not able to place or answer calls without Microphone permission.</string>
|
||||||
<string name="account_password">Account %1$s Authentication Password</string>
|
<string name="account_password">Account %1$s Authentication Password</string>
|
||||||
|
<string name="show_password">Show Password</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
Reference in New Issue
Block a user