Skip to content

SwipeLayout is not working properly on AllView devices.. #203

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
moldovanpeter89 opened this issue Aug 12, 2015 · 14 comments
Open

SwipeLayout is not working properly on AllView devices.. #203

moldovanpeter89 opened this issue Aug 12, 2015 · 14 comments

Comments

@moldovanpeter89
Copy link

Hi,
I had made an application and I am having a bug and also tested your demo with:

Device: ALLVIEW X2_Soul
Android version: 4.4.2

Device: ALLVIEW V1_VIPER_I
Android version: 4.4.2

And the problem is when I tap or swipe the item row, the items that are in the background (comes from the right side of the screen) and the items that are in the foreground(they go to the left side of the screen) are not staying there, they go back instantly, like its remaking the whole row, or listview..

A part of my code how is used in the getView()

LayoutInflater inflater = LayoutInflater.from(parent.getContext());
if (convertView == null) {
convertView = inflater.inflate(R.layout.list_item_command, parent, false);
}

    final SwipeLayout swipeLayout = ViewHolder.get(convertView, R.id.list_item_command_swipe);
    swipeLayout.setShowMode(SwipeLayout.ShowMode.PullOut);
    swipeLayout.setClickable(true);
    swipeLayout.setClickToClose(true);

    LinearLayout fgLinear = ViewHolder.get(convertView, R.id.list_item_command_fg_linear);

    ImageView addProduct = ViewHolder.get(convertView, R.id.list_item_order_add_img);
    ImageView removeProduct = ViewHolder.get(convertView, R.id.list_item_order_remove_img);
    ImageView eraseProduct = ViewHolder.get(convertView, R.id.list_item_order_erase_img);

    fgLinear.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            swipeLayout.open(true);
        }
    });

How it is in the list item xml:

<com.daimajia.swipe.SwipeLayout
    android:id="@+id/list_item_command_swipe"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <!--BACKGROUND LAYOUT-->
    <LinearLayout
        android:id="@+id/bottom_wrapper"
        android:layout_width="wrap_content"
        android:layout_height="match_parent">

        <ImageView
            android:id="@+id/list_item_order_add_img"
            android:layout_width="wrap_content"
            android:layout_height="40dp"
            android:layout_marginLeft="@dimen/list_item_command_count_margin_right"
            android:layout_marginRight="@dimen/list_item_command_general_margin_right"
            android:adjustViewBounds="true"
            android:contentDescription="@string/content_description"
            android:src="@drawable/selector_add_more_product_btn" />

        <ImageView
            android:id="@+id/list_item_order_remove_img"
            android:layout_width="wrap_content"
            android:layout_height="40dp"
            android:layout_marginRight="@dimen/list_item_command_general_margin_right"
            android:adjustViewBounds="true"
            android:contentDescription="@string/content_description"
            android:src="@drawable/selector_less_product_btn" />

        <ImageView
            android:id="@+id/list_item_order_erase_img"
            android:layout_width="wrap_content"
            android:layout_height="40dp"
            android:layout_marginRight="@dimen/list_item_command_general_margin_right"
            android:adjustViewBounds="true"
            android:contentDescription="@string/content_description"
            android:src="@drawable/selector_remove_product_btn" />
    </LinearLayout>

    <!--FOREGROUND LAYOUT-->
    <LinearLayout
        android:id="@+id/list_item_command_fg_linear"
        android:layout_width="match_parent"
        android:layout_height="40dp"
        android:gravity="center_vertical"
        android:orientation="horizontal"
        android:weightSum="10">

        <TextView
            android:id="@+id/list_item_order_product_name_tv"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginRight="@dimen/list_item_command_general_margin_right"
            android:layout_weight="5"
            android:ellipsize="end"
            android:singleLine="false"
            android:textColor="@color/white"
            android:textSize="@dimen/list_item_command_product_price_tv_size" />

        <TextView
            android:id="@+id/list_item_order_product_qunatity_et"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:ellipsize="end"
            android:gravity="left"
            android:textColor="@color/white"
            android:textSize="@dimen/list_item_command_product_price_tv_size" />


        <TextView
            android:id="@+id/list_item_order_price_tv"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="3"
            android:gravity="right"
            android:textColor="@color/white"
            android:textSize="@dimen/list_item_command_product_price_tv_size"
            android:textStyle="bold" />

        <ImageView
            android:id="@+id/list_item_order_dot_menu_IV"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_gravity="center"
            android:layout_weight="1"
            android:src="@drawable/ic_three_dots_menu_white"
            android:visibility="gone" />
    </LinearLayout>
</com.daimajia.swipe.SwipeLayout>
@balighbelgacem
Copy link

I have the same problem on the device Acer Iconia A3 with Android 4.4.2. I tried the demo up, I can swipe the front view but once swiped it comes back.

@sata73
Copy link

sata73 commented Aug 27, 2015

This may have a dependency to issue #36 ?

@abhishek-ucreate
Copy link

I am also facing this issue

@Zhuinden
Copy link

Zhuinden commented Jan 4, 2016

Same problem on a Lenovo A5500-H.

@smhmh
Copy link

smhmh commented May 4, 2016

@daimajia
The problem reported on many devices running Android 4.4.2!
HTC Desire 620
Lenovo A7
....

Any suggesstion?

@Zhuinden
Copy link

Zhuinden commented May 4, 2016

@smhmh there was a method call in onLayoutChildren() called safeBottomView() or something like that, commenting it out fixed it.

private void updateBottomViews() {
    View currentBottomView = getCurrentBottomView();
    if(currentBottomView != null) {
        if(mCurrentDragEdge == DragEdge.Left || mCurrentDragEdge == DragEdge.Right) {
            mDragDistance = currentBottomView.getMeasuredWidth() - dp2px(getCurrentOffset());
        } else {
            mDragDistance = currentBottomView.getMeasuredHeight() - dp2px(getCurrentOffset());
        }
    }

    if(mShowMode == ShowMode.PullOut) {
        layoutPullOut();
    } else if(mShowMode == ShowMode.LayDown) {
        layoutLayDown();
    }

    //safeBottomView();
}

@smhmh
Copy link

smhmh commented May 4, 2016

Thanks @Zhuinden , You save my time!
Commenting that line work on all version of Android?
Why original code didn't update?

@Zhuinden
Copy link

Zhuinden commented May 4, 2016

I haven't had issues since I commented it out, but I had issues with it not commented out. It definitely fixes the Lenovo bug.

As for original code? Who knows.

@haoshili
Copy link

In my 4.x devices ,it works;but in my 5.x devices ,it has some bugs!

@smhmh
Copy link

smhmh commented May 20, 2016

@haoshili Yes, The suggested line should be commented just on KitKat android like this:
if (Build.VERSION.SDK_INT != Build.VERSION_CODES.KITKAT) safeBottomView();
This solve my problem!

@JackyDuong
Copy link

I have the same problem on Wiko Birdy 4.4.2. I tried your solution but it still not work...
The demo with this project works fine on my Wiko Birdy 4.4.2... maybe I code something wrong...
It still work on my 5.x device so... I will spent time to see where is the issue.

@JackyDuong
Copy link

Guys, I just use the BaseSwipeAdapter and it works for me for my Wiko Birdy 4.4.2. Try it out ! Cheers

@filipebezerra
Copy link

Actually guys, I guess this library isn't maintained anymore. A lot of issues reported lastly and no replies from the author.

@NoNews
Copy link

NoNews commented Nov 7, 2016

@smhmh work like a clockwork)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants