2023-03-24 18:21:56 +01:00
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
2023-10-25 11:59:59 +02:00
|
|
|
|
2023-03-24 18:21:56 +01:00
|
|
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
|
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
2023-10-25 11:59:59 +02:00
|
|
|
xmlns:tools="http://schemas.android.com/tools"
|
2023-03-24 18:21:56 +01:00
|
|
|
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"
|
2023-10-25 11:59:59 +02:00
|
|
|
android:contentDescription="@string/post_media_image" />
|
2023-03-24 18:21:56 +01:00
|
|
|
|
|
|
|
<com.google.android.material.textfield.TextInputLayout
|
|
|
|
style="@style/TuskyTextInput"
|
2023-10-25 11:59:59 +02:00
|
|
|
|
2023-03-24 18:21:56 +01:00
|
|
|
android:layout_width="match_parent"
|
|
|
|
android:layout_height="0dp"
|
|
|
|
android:layout_weight="1"
|
|
|
|
android:layout_marginStart="?dialogPreferredPadding"
|
|
|
|
android:layout_marginEnd="?dialogPreferredPadding"
|
2023-10-25 11:59:59 +02:00
|
|
|
android:layout_marginTop="?dialogPreferredPadding"
|
2023-03-24 18:21:56 +01:00
|
|
|
app:counterEnabled="false"
|
2023-10-25 11:59:59 +02:00
|
|
|
app:counterTextColor="?android:textColorTertiary"
|
|
|
|
app:hintEnabled="false">
|
2023-03-24 18:21:56 +01:00
|
|
|
|
|
|
|
<com.google.android.material.textfield.TextInputEditText
|
|
|
|
android:id="@+id/imageDescriptionText"
|
|
|
|
android:layout_width="match_parent"
|
|
|
|
android:layout_height="match_parent"
|
|
|
|
android:gravity="start"
|
2023-10-25 11:59:59 +02:00
|
|
|
tools:hint="Description"
|
|
|
|
android:importantForAutofill="no"
|
|
|
|
android:inputType="textCapSentences|textMultiLine|textAutoCorrect" />
|
2023-03-24 18:21:56 +01:00
|
|
|
|
|
|
|
</com.google.android.material.textfield.TextInputLayout>
|
2023-10-25 11:59:59 +02:00
|
|
|
|
|
|
|
<LinearLayout
|
|
|
|
android:layout_width="match_parent"
|
|
|
|
android:layout_height="wrap_content"
|
|
|
|
android:layout_weight="0"
|
|
|
|
android:orientation="horizontal"
|
|
|
|
android:gravity="end"
|
|
|
|
android:layout_marginStart="?dialogPreferredPadding"
|
|
|
|
android:layout_marginEnd="?dialogPreferredPadding">
|
|
|
|
|
|
|
|
<Button
|
|
|
|
android:id="@+id/cancelButton"
|
|
|
|
style="@style/TuskyButton.TextButton"
|
|
|
|
android:layout_width="wrap_content"
|
|
|
|
android:layout_height="wrap_content"
|
|
|
|
android:text="@android:string/cancel" />
|
|
|
|
|
|
|
|
<Button
|
|
|
|
android:id="@+id/okButton"
|
|
|
|
style="@style/TuskyButton.TextButton"
|
|
|
|
android:layout_width="wrap_content"
|
|
|
|
android:layout_height="wrap_content"
|
|
|
|
android:text="@android:string/ok" />
|
|
|
|
</LinearLayout>
|
2023-03-24 18:21:56 +01:00
|
|
|
</LinearLayout>
|