daimajia / AndroidSwipeLayout

The Most Powerful Swipe Layout!
MIT License
12.38k stars 2.67k forks source link

The draw automatically close in Meizu devices. #413

Open fuxianwen opened 7 years ago

tortoies commented 7 years ago

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

daimajia commented 7 years ago

@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.

dankito commented 7 years ago

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;
}
ZhanXuzhao commented 7 years ago

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

Javiergv commented 7 years ago

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

rbakhshi commented 7 years ago

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;
}
hueyra commented 6 years ago

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

juancamachodev commented 6 years ago

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

 @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