MikeOrtiz / TouchImageView

Adds touch functionality to Android ImageView.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

On zoom problem with BottomSheetBehavior

JorisBodin opened this issue · comments

Hello,

If zoom with my TouchImageView, the "onTouch" get all event and disable my BottomSheetBehavior in CoordinatorLayout :(

<androidx.coordinatorlayout.widget.CoordinatorLayout 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:background="@color/previewBackground">

    <androidx.viewpager2.widget.ViewPager2
        android:id="@+id/viewPager"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior" />
  
    <FileInfoActionsView
        android:id="@+id/bottomSheetFileInfos"
        style="?attr/bottomSheetStyle"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/bottom_sheet_behavior" />

</androidx.coordinatorlayout.widget.CoordinatorLayout>

And the PreviewFragment:

<RelativeLayout 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:id="@+id/previewLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".ui.filelist.preview.PreviewFragment">

    <com.ortiz.touchview.TouchImageView
        android:id="@+id/imageView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_centerInParent="true"
        tools:src="@drawable/ic_images" />

</RelativeLayout>
device-2021-01-25-181758.mp4

Is there a solution for this case? Thank you in advance :)

Without running example, I can't debug issue.
I recommend to have a look on override fun onTouch(v: View, event: MotionEvent): Boolean {
maybe changing somewhere the boolean result may help

I found the problem.
I use viewpage2 and for zoom, move the photo and slider, I followed your example here: https://github.com/MikeOrtiz/TouchImageView/blob/master/app/src/main/java/info/touchimage/demo/custom/AdapterImages.kt
But it is incompatible with BottomSheetBehavior

The exemple is here: https://github.com/JorisBodin/TouchImageView/tree/bug-viewpager2