Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Commit

Permalink
PasswordDialog: request focus on the password entry input
Browse files Browse the repository at this point in the history
  • Loading branch information
msfjarvis committed Jan 20, 2022
1 parent b46c486 commit 1c02a9b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import android.app.Dialog
import android.content.DialogInterface
import android.os.Bundle
import android.view.KeyEvent
import android.view.WindowManager
import androidx.core.widget.doOnTextChanged
import androidx.fragment.app.DialogFragment
import com.google.android.material.dialog.MaterialAlertDialogBuilder
Expand All @@ -33,6 +34,7 @@ class PasswordDialog : DialogFragment() {
builder.setTitle(R.string.password)
builder.setPositiveButton(android.R.string.ok) { _, _ -> tryEmitPassword() }
val dialog = builder.create()
dialog.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
dialog.setOnShowListener {
if (isError) {
binding.passwordField.error = getString(R.string.git_operation_wrong_password)
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/dialog_password_entry.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword" />
<requestFocus />
</com.google.android.material.textfield.TextInputLayout>

</LinearLayout>

0 comments on commit 1c02a9b

Please sign in to comment.