FloatingActionButtonSpeedDial icon indicating copy to clipboard operation
FloatingActionButtonSpeedDial copied to clipboard

Snackbar behaviour breaks clicks, scrolling and similar for one touch

Open MFlisar opened this issue 5 years ago • 1 comments

Step 2: Describe your environment

  • Library version: 3.1.1
  • Android version: 9

Step 3: Describe the problem:

Steps to reproduce:

What I do is following:

  • I add a simply view like following:
<com.leinardi.android.speeddial.SpeedDialView
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:layout_margin="@dimen/fab_margin"
        app:backgroundTint="?colorAccent"
        app:layout_behavior="@string/speeddial_scrolling_view_snackbar_behavior"
        app:sdMainFabClosedIconColor="@android:color/white"
        app:sdMainFabClosedSrc="@drawable/ic_add_black_24dp" />
  • I add a few items to my RecyclerView
  • the items are not scrollable yet because they all fit on the screen
  • now I try to scroll down
  • afterwards I see what I describe under Observed Results
  • I remove the layout behaviour and everything works fine again

Observed Results:

As soon as I add the app:layout_behavior="@string/speeddial_scrolling_view_snackbar_behavior" behaviour to the SpeedDialView I see that I can break the touch handling of the RecyclerViewfor at least one click / touch. This means the RecyclerView is not responding to a scroll or click once and will only respond when I try it the second time.

MFlisar avatar Jul 22 '20 11:07 MFlisar

Example layout looks like following in my case:

<?xml version="1.0" encoding="utf-8"?>
<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"
    tools:context=".activities.MainActivity">

    <com.google.android.material.appbar.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/AppTheme.AppBarOverlay">

        <androidx.appcompat.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:popupTheme="@style/AppTheme.PopupOverlay" />

    </com.google.android.material.appbar.AppBarLayout>
    
    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/rvContent"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior" />

    <com.leinardi.android.speeddial.SpeedDialView
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:layout_margin="@dimen/fab_margin"
        app:backgroundTint="?colorAccent"
        app:layout_behavior="@string/speeddial_scrolling_view_snackbar_behavior"
        app:sdMainFabClosedIconColor="@android:color/white"
        app:sdMainFabClosedSrc="@drawable/ic_add_black_24dp" />

</androidx.coordinatorlayout.widget.CoordinatorLayout>

MFlisar avatar Jul 22 '20 11:07 MFlisar