ed2918da2e
* Increase character limit for media descriptions to 1500 It was increased in Mastodon 3.0.0 which was released in October 2019. * Improve image description view Since media descriptions can be longer now, we need to adjust the UI. It is a common problem that description takes up the whole screen, it's hard for readers and also discourages people from adding descriptions. This commit uses bottom sheet to hide most of the description. Since we know how much screen space it will cover, we can use darker background which makes reading text easier. * Adjust description handle * Fix unable to dismiss image caption
79 lines
No EOL
3.6 KiB
XML
79 lines
No EOL
3.6 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
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:clickable="true"
|
|
android:focusable="true">
|
|
|
|
<com.github.chrisbanes.photoview.PhotoView
|
|
android:id="@+id/photoView"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="match_parent" />
|
|
|
|
<ProgressBar
|
|
android:id="@+id/progressBar"
|
|
android:layout_width="wrap_content"
|
|
android:layout_height="wrap_content"
|
|
android:layout_centerHorizontal="true"
|
|
android:layout_centerVertical="true"
|
|
android:layout_gravity="center"
|
|
app:layout_constraintBottom_toBottomOf="parent"
|
|
app:layout_constraintLeft_toLeftOf="parent"
|
|
app:layout_constraintRight_toRightOf="parent"
|
|
app:layout_constraintTop_toTopOf="parent" />
|
|
|
|
<!-- This should be inside CoordinatorLayout for two reasons:
|
|
|
|
1. TouchImageView really wants some constraints ans has no size otherwise
|
|
2. We don't want sheet to overlap with appbar but the only way to do it with autosizing
|
|
is to gibe parent some margin. -->
|
|
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
|
android:layout_width="match_parent"
|
|
android:layout_height="0dp"
|
|
android:layout_marginTop="70dp"
|
|
app:layout_constraintBottom_toBottomOf="parent"
|
|
app:layout_constraintLeft_toLeftOf="parent"
|
|
app:layout_constraintRight_toRightOf="parent"
|
|
app:layout_constraintTop_toTopOf="parent">
|
|
|
|
<LinearLayout
|
|
android:id="@+id/captionSheet"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:background="@drawable/description_bg_expanded"
|
|
android:orientation="vertical"
|
|
app:behavior_peekHeight="90dp"
|
|
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">
|
|
|
|
<View
|
|
android:layout_width="24dp"
|
|
android:layout_height="3dp"
|
|
android:layout_marginTop="10dp"
|
|
android:layout_marginBottom="10dp"
|
|
android:layout_gravity="center_horizontal"
|
|
android:importantForAccessibility="no"
|
|
android:background="@drawable/ic_drag_indicator_horiz_24dp" />
|
|
|
|
<androidx.core.widget.NestedScrollView
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content">
|
|
|
|
<TextView
|
|
android:id="@+id/mediaDescription"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:hyphenationFrequency="full"
|
|
android:lineSpacingMultiplier="1.1"
|
|
android:paddingLeft="8dp"
|
|
android:paddingRight="8dp"
|
|
android:paddingBottom="8dp"
|
|
android:textAlignment="center"
|
|
android:textColor="#eee"
|
|
android:textSize="?attr/status_text_medium"
|
|
tools:text="Some media description which might get quite long so that it won't easily fit in one line" />
|
|
</androidx.core.widget.NestedScrollView>
|
|
</LinearLayout>
|
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
|
</androidx.constraintlayout.widget.ConstraintLayout> |