Skip to content

Commit

Permalink
[Fix] Make file job conflict dialog resize with IME.
Browse files Browse the repository at this point in the history
And clear alt focusable im earlier to be conceptually better.
  • Loading branch information
zhanghai committed Sep 26, 2023
1 parent 0d7deff commit d3b9b90
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,10 @@ class FileJobConflictDialogFragment : AppCompatDialogFragment() {
.setNegativeButton(R.string.skip, ::onDialogButtonClick)
.setNeutralButton(android.R.string.cancel, ::onDialogButtonClick)
.create()
.apply { setCanceledOnTouchOutside(false) }
.apply {
setCanceledOnTouchOutside(false)
window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE)
}
}

/** @see me.zhanghai.android.files.filelist.FileListAdapter.onBindViewHolder */
Expand Down Expand Up @@ -250,10 +253,10 @@ class FileJobConflictDialogFragment : AppCompatDialogFragment() {

if (binding.root.parent == null) {
val dialog = requireDialog() as AlertDialog
dialog.window!!.clearFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM)
val scrollView = dialog.requireViewByIdCompat<NestedScrollView>(R.id.scrollView)
val linearLayout = scrollView.getChildAt(0) as LinearLayout
linearLayout.addView(binding.root)
dialog.window!!.clearFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM)
}
}

Expand Down

0 comments on commit d3b9b90

Please sign in to comment.