mirror of
https://github.com/element-hq/element-android
synced 2024-11-27 11:59:12 +03:00
Add "show password" in import Megolm keys dialog
This commit is contained in:
parent
0e85a3d59f
commit
4b66ffcd5b
3 changed files with 41 additions and 8 deletions
|
@ -5,7 +5,7 @@ Features ✨:
|
|||
-
|
||||
|
||||
Improvements 🙌:
|
||||
-
|
||||
- Add "show password" in import Megolm keys dialog
|
||||
|
||||
Bugfix 🐛:
|
||||
-
|
||||
|
|
|
@ -24,6 +24,7 @@ import android.os.Bundle
|
|||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Button
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.core.content.ContextCompat
|
||||
|
@ -38,6 +39,7 @@ import im.vector.app.R
|
|||
import im.vector.app.core.di.ActiveSessionHolder
|
||||
import im.vector.app.core.dialogs.ExportKeysDialog
|
||||
import im.vector.app.core.extensions.queryExportKeys
|
||||
import im.vector.app.core.extensions.showPassword
|
||||
import im.vector.app.core.intent.ExternalIntentData
|
||||
import im.vector.app.core.intent.analyseIntent
|
||||
import im.vector.app.core.intent.getFilenameFromUri
|
||||
|
@ -458,6 +460,15 @@ class VectorSettingsSecurityPrivacyFragment @Inject constructor(
|
|||
val passPhraseEditText = dialogLayout.findViewById<TextInputEditText>(R.id.dialog_e2e_keys_passphrase_edit_text)
|
||||
val importButton = dialogLayout.findViewById<Button>(R.id.dialog_e2e_keys_import_button)
|
||||
|
||||
val showPassword = dialogLayout.findViewById<ImageView>(R.id.importDialogShowPassword)
|
||||
var passwordVisible = false
|
||||
|
||||
showPassword.setOnClickListener {
|
||||
passwordVisible = !passwordVisible
|
||||
passPhraseEditText.showPassword(passwordVisible)
|
||||
showPassword.setImageResource(if (passwordVisible) R.drawable.ic_eye_closed else R.drawable.ic_eye)
|
||||
}
|
||||
|
||||
passPhraseEditText.addTextChangedListener(object : SimpleTextWatcher() {
|
||||
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {
|
||||
importButton.isEnabled = !passPhraseEditText.text.isNullOrEmpty()
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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:id="@+id/layout_root"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="?dialogPreferredPadding"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingEnd="?dialogPreferredPadding"
|
||||
|
@ -19,14 +19,20 @@
|
|||
android:textColor="?riotx_text_primary"
|
||||
android:textSize="16sp"
|
||||
android:visibility="gone"
|
||||
tools:text="filename.txt"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="@string/import_e2e_keys_from_file"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/importDialogTil"
|
||||
style="@style/VectorTextInputLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColorHint="?attr/vctr_default_text_hint_color">
|
||||
android:textColorHint="?attr/vctr_default_text_hint_color"
|
||||
app:layout_constraintEnd_toStartOf="@+id/importDialogShowPassword"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/dialog_e2e_keys_passphrase_filename">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/dialog_e2e_keys_passphrase_edit_text"
|
||||
|
@ -38,6 +44,19 @@
|
|||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/importDialogShowPassword"
|
||||
android:layout_width="@dimen/layout_touch_size"
|
||||
android:layout_height="@dimen/layout_touch_size"
|
||||
android:layout_marginTop="8dp"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_eye"
|
||||
android:tint="?attr/colorAccent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/importDialogTil"
|
||||
app:layout_constraintTop_toTopOf="@id/importDialogTil" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/dialog_e2e_keys_import_button"
|
||||
style="@style/VectorButtonStyle"
|
||||
|
@ -46,5 +65,8 @@
|
|||
android:layout_gravity="end"
|
||||
android:layout_marginTop="10dp"
|
||||
android:enabled="false"
|
||||
android:text="@string/encryption_import_import" />
|
||||
</LinearLayout>
|
||||
android:text="@string/encryption_import_import"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/importDialogTil" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
Loading…
Reference in a new issue