2023-03-24 18:21:56 +01:00
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
|
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
|
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
|
|
android:layout_width="match_parent"
|
|
|
|
android:layout_height="match_parent"
|
|
|
|
android:orientation="vertical"
|
|
|
|
android:paddingBottom="0dp">
|
|
|
|
|
Fix image zoom / pan / scroll / swipe (#3894)
Migrate to touchimageview from photoview, and adjust the touch logic to correctly handle single finger drag, two finger pinch/stretch, flings, taps, and swipes.
As before, the features are:
- Single tap, show/hide controls and media description
- Double tap, zoom in/out
- Single finger drag up/down, scale/translate image, dismiss if scrolled too far
- Single finger drag left/right
- When not zoomed, swipe to next image if multiple images present
- When zoomed, scroll to edge of image, then to next image if multiple images present
- Two finger pinch/zoom, zoom in/out on the image
Behaviour differences to previous code
1. Bug fix: The image can't get "stuck" when zoomed, and impossible to scroll
2. Bug fix: Pinching is not mis-interpreted as a fling, closing the image
3. Bug fix: The zoom state of images is not lost or misinterpreted when the user swipes through multiple images
4. Bug fix: Double-tap zooms all the way, instead of stopping
5. Tapping outside the image does not dismiss it, controls and description show/hide
Fixes https://github.com/tuskyapp/Tusky/issues/3562, https://github.com/tuskyapp/Tusky/issues/2297
2023-07-31 12:44:01 +02:00
|
|
|
<com.ortiz.touchview.TouchImageView
|
2023-03-24 18:21:56 +01:00
|
|
|
android:id="@+id/imageDescriptionView"
|
|
|
|
android:layout_width="match_parent"
|
|
|
|
android:layout_height="0dp"
|
|
|
|
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_marginTop="?dialogPreferredPadding"
|
|
|
|
android:layout_marginEnd="?dialogPreferredPadding"
|
|
|
|
app:hintEnabled="false"
|
|
|
|
app:counterEnabled="false"
|
|
|
|
app:counterTextColor="?android:textColorTertiary">
|
|
|
|
|
|
|
|
<com.google.android.material.textfield.TextInputEditText
|
|
|
|
android:id="@+id/imageDescriptionText"
|
|
|
|
android:inputType="textCapSentences|textMultiLine|textAutoCorrect"
|
|
|
|
android:layout_width="match_parent"
|
|
|
|
android:layout_height="match_parent"
|
|
|
|
android:hint="@string/hint_description"
|
|
|
|
android:gravity="start"
|
|
|
|
android:importantForAutofill="no" />
|
|
|
|
|
|
|
|
</com.google.android.material.textfield.TextInputLayout>
|
|
|
|
</LinearLayout>
|