Skip to content
Snippets Groups Projects
Commit 0a5ab8fb authored by Emma Falkiewitz's avatar Emma Falkiewitz Committed by Adrien Béraud
Browse files

Scroll and validate buttons working when setting new password

GitLab: #1267
Change-Id: I72abcd75e1842f3cb64a86ca595273bfe7bd93ad
parent 1b5222fb
No related branches found
No related tags found
No related merge requests found
...@@ -25,6 +25,7 @@ import android.view.WindowManager ...@@ -25,6 +25,7 @@ import android.view.WindowManager
import android.view.inputmethod.EditorInfo import android.view.inputmethod.EditorInfo
import android.widget.TextView import android.widget.TextView
import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AlertDialog
import androidx.core.view.isVisible
import androidx.fragment.app.DialogFragment import androidx.fragment.app.DialogFragment
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
import cx.ring.R import cx.ring.R
...@@ -38,11 +39,12 @@ class ChangePasswordDialog : DialogFragment() { ...@@ -38,11 +39,12 @@ class ChangePasswordDialog : DialogFragment() {
} }
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
binding = DialogSetPasswordBinding.inflate(requireActivity().layoutInflater)
val hasPassword = arguments?.getBoolean(AccountEditionFragment.ACCOUNT_HAS_PASSWORD_KEY, true) ?: true val hasPassword = arguments?.getBoolean(AccountEditionFragment.ACCOUNT_HAS_PASSWORD_KEY, true) ?: true
val passwordMessage = if (hasPassword) R.string.account_password_change else R.string.account_password_set val passwordMessage = if (hasPassword) R.string.account_password_change else R.string.account_password_set
binding!!.oldPasswordTxtBox.visibility = if (hasPassword) View.VISIBLE else View.GONE
binding!!.newPasswordRepeatTxt.setOnEditorActionListener { v: TextView?, actionId: Int, event: KeyEvent? -> binding = DialogSetPasswordBinding.inflate(requireActivity().layoutInflater).apply {
oldPasswordTxtBox.isVisible = hasPassword
newPasswordRepeatTxt.setOnEditorActionListener { v: TextView?, actionId: Int, event: KeyEvent? ->
if (actionId == EditorInfo.IME_ACTION_DONE) { if (actionId == EditorInfo.IME_ACTION_DONE) {
if (validate()) { if (validate()) {
dialog!!.dismiss() dialog!!.dismiss()
...@@ -51,6 +53,7 @@ class ChangePasswordDialog : DialogFragment() { ...@@ -51,6 +53,7 @@ class ChangePasswordDialog : DialogFragment() {
} }
false false
} }
}
val result = MaterialAlertDialogBuilder(requireContext()) val result = MaterialAlertDialogBuilder(requireContext())
.setView(binding!!.root) .setView(binding!!.root)
.setMessage(R.string.help_password_choose) .setMessage(R.string.help_password_choose)
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" <androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:fadeScrollbars="false" android:fadeScrollbars="false"
android:scrollIndicators="top|bottom"> android:scrollIndicators="top|bottom">
...@@ -71,4 +71,4 @@ ...@@ -71,4 +71,4 @@
</LinearLayout> </LinearLayout>
</ScrollView> </androidx.core.widget.NestedScrollView>
\ No newline at end of file \ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment