Skip to content

Commit

Permalink
fix caption dialog (#4799)
Browse files Browse the repository at this point in the history
The Material 3 redesign seems to have broken the dialog when very small
images where used.
Also removes the weird background behind the context menu (seen in the
before screenshot)

Before / after:
<img
src="https://github.com/user-attachments/assets/c418125d-ef80-458f-9d94-fde428a2f59f"
width="280"/> <img
src="https://github.com/user-attachments/assets/b832b16d-0c18-4bf1-a263-de4fe0362854"
width="280"/>
  • Loading branch information
connyduck authored Dec 10, 2024
1 parent 2573649 commit 328aca7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class CaptionDialog : DialogFragment() {
dialog?.apply {
window?.setLayout(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT
LinearLayout.LayoutParams.WRAP_CONTENT
)
window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE)
}
Expand Down
17 changes: 10 additions & 7 deletions app/src/main/res/layout/dialog_image_description.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,28 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="0dp">
android:layout_height="wrap_content"
android:minHeight="400dp"
android:orientation="vertical">

<com.ortiz.touchview.TouchImageView
android:id="@+id/imageDescriptionView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginStart="?dialogPreferredPadding"
android:layout_marginTop="?dialogPreferredPadding"
android:layout_marginEnd="?dialogPreferredPadding"
android:layout_weight="1"
android:contentDescription="@string/post_media_image" />

<com.google.android.material.textfield.TextInputLayout
style="@style/TuskyTextInput"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_marginStart="?dialogPreferredPadding"
android:layout_marginEnd="?dialogPreferredPadding"
android:layout_marginTop="?dialogPreferredPadding"
android:layout_marginEnd="?dialogPreferredPadding"
android:layout_weight="1"
app:counterEnabled="false"
app:counterTextColor="?android:textColorTertiary"
app:hintEnabled="false">
Expand All @@ -31,9 +34,9 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="start"
tools:hint="Description"
android:importantForAutofill="no"
android:inputType="textCapSentences|textMultiLine|textAutoCorrect" />
android:inputType="textCapSentences|textMultiLine|textAutoCorrect"
tools:hint="Description" />

</com.google.android.material.textfield.TextInputLayout>

Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@

<style name="TuskyDialogOverlay" parent="@style/ThemeOverlay.Material3.MaterialAlertDialog">
<item name="alertDialogStyle">@style/TuskyDialog</item>
<item name="android:background">@color/colorBackground</item>
<item name="android:backgroundDimAmount">0.5</item>
</style>

Expand Down

0 comments on commit 328aca7

Please sign in to comment.