AndroidSwipeLayout icon indicating copy to clipboard operation
AndroidSwipeLayout copied to clipboard

The draw automatically close in Meizu devices.

Open fuxianwen opened this issue 8 years ago • 8 comments

fuxianwen avatar Mar 03 '17 07:03 fuxianwen

@fuxianwen 我还以为就我这里侧滑自动关闭呢

tortoies avatar Mar 03 '17 08:03 tortoies

@fuxianwen I will try to solve this asap. The main reason i guess is from the CM Rom, they may altered touch event and cause this happened. I need to do a test a CM rom.

daimajia avatar Mar 09 '17 03:03 daimajia

I had a similar issue on a Wiko Sunny as it return wrong values for surfaceView.getLeft(). I solved it by adding this one more check for the Status.Close case in getOpenStatus() :

public Status getOpenStatus() { View surfaceView = getSurfaceView(); if(surfaceView==null){ return Status.Close; } int surfaceLeft = surfaceView.getLeft(); int surfaceTop = surfaceView.getTop(); if (surfaceLeft == getPaddingLeft() && surfaceTop == getPaddingTop() && mIsBeingDragged == false) return Status.Close;

    if (surfaceLeft == (getPaddingLeft() - mDragDistance) || surfaceLeft == (getPaddingLeft() + mDragDistance)
            || surfaceTop == (getPaddingTop() - mDragDistance) || surfaceTop == (getPaddingTop() + mDragDistance))
        return Status.Open;

    return Status.Middle;
}

dankito avatar Mar 29 '17 09:03 dankito

RedMi Note3 also has the problem. #424 seems provide a solution: "找到一个bug,当show_type设置成lay_down的时候,某些机子不能划开bottomview, 即使划开了也是一瞬间关闭。 经过排查, 我发现是safebottomView这个方法导致的, 在滑动开始时调用setVisibility会导致draghelper失效。具体可以看看我另一个项目的issue3 不适配,相同的原因…… 因为那个项目我参考过你的SwipeLayout"

ZhanXuzhao avatar Apr 28 '17 08:04 ZhanXuzhao

The only solution that I found on this issue was the implemented by @dankito here: https://github.com/daimajia/AndroidSwipeLayout/issues/413#issuecomment-290034669

That was the solution for an OS 5 Lollipop that the layout close automatically after open, I had to clone this library and included as a module into my app in Android Studio 2.3.3 in order to modify the code.

Thanks @dankito

Javiergv avatar Aug 10 '17 13:08 Javiergv

Had the same problem on ZTE T660 (Build T660_T04) with Android version: 5.0.2. Solution provided by @dankito fixed the problem.

/**
 * get the open status.
 *
 * @return {@link com.daimajia.swipe.SwipeLayout.Status} Open , Close or
 * Middle.
 */
public Status getOpenStatus() {
    View surfaceView = getSurfaceView();
    if (surfaceView == null) {
        return Status.Close;
    }
    int surfaceLeft = surfaceView.getLeft();
    int surfaceTop = surfaceView.getTop();
    if (surfaceLeft == getPaddingLeft() && surfaceTop == getPaddingTop() && /*➡️*/!mIsBeingDragged/*⬅️*/) return Status.Close;

    if (surfaceLeft == (getPaddingLeft() - mDragDistance) || surfaceLeft == (getPaddingLeft() + mDragDistance)
            || surfaceTop == (getPaddingTop() - mDragDistance) || surfaceTop == (getPaddingTop() + mDragDistance))
        return Status.Open;

    return Status.Middle;
}

rbakhshi avatar Aug 29 '17 04:08 rbakhshi

I got this problem with Meizu MX4(Android 5.1 Flyme 6.2.0.0A),Thanks @dankito

hueyra avatar Nov 10 '17 00:11 hueyra

my problem was in the adapter: Adapter extends RecyclerView.Adapter <Adapter.MyViewHolder> the solution was this Adapter extends RecyclerSwipeAdapter <Adapter.MyViewHolder>

 @Override
 public int getSwipeLayoutResourceId (int position) {
     return R.id.swipe;
 }

and in the onBindViewHolder add method

mItemManger.bindView (holder.itemView, position);

definitely this is not google translator :v

juancamachodev avatar Jun 19 '18 17:06 juancamachodev