Skip to content

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

Open
@moldovanpeter89

Description

@moldovanpeter89

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>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions