Skip to content

Commit

Permalink
improve CaptionDialog for small screens
Browse files Browse the repository at this point in the history
  • Loading branch information
connyduck committed Dec 25, 2024
1 parent 9d853bd commit 61ec547
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,13 @@ class CaptionDialog : DialogFragment() {

override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val localId = arguments?.getInt(LOCAL_ID_ARG) ?: error("Missing localId")
val inset = requireContext().resources.getDimensionPixelSize(R.dimen.caption_dialog_inset)
return MaterialAlertDialogBuilder(requireContext())
.setView(createView(savedInstanceState))
.setBackgroundInsetTop(inset)
.setBackgroundInsetEnd(inset)
.setBackgroundInsetBottom(inset)
.setBackgroundInsetStart(inset)
.setPositiveButton(android.R.string.ok) { _, _ ->
listener.onUpdateDescription(localId, binding.imageDescriptionText.text.toString())
}
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,6 @@
<dimen name="recyclerview_bottom_padding_actionbutton">88dp</dimen>
<dimen name="recyclerview_bottom_padding_no_actionbutton">32dp</dimen>

<dimen name="caption_dialog_inset">24dp</dimen>

</resources>

0 comments on commit 61ec547

Please sign in to comment.