0

I have my RecyclerView with a dynamic content such as add and deleting before it was okay but one day it becomes buggy and weird like this.

enter image description here

Using notifyItemInserted() followed by notifyItemRangeChanged() to update the list is working fine last month. I also tried to update my dependencies to 28.0.0 and not work. This is just a Activity with a RecyclerView. Still I cannot figure it out because back then this is not happening.

Here is my XML

<RelativeLayout 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"
android:background="@color/colorPrimaryDarker"
tools:context=".common.AnnouncementComments"
android:orientation="vertical">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_above="@+id/commentLinear"
    android:orientation="vertical">

    <android.support.v7.widget.Toolbar
        android:id="@id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/colorPrimary"
        android:minHeight="?android:attr/actionBarSize"
        android:popupTheme="@style/ThemeOverlay.AppCompat.Light"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
        tools:targetApi="lollipop">


        <TextView
            android:id="@+id/titleBar"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:text="@string/comment_section"
            android:textColor="@color/icon_selected"
            android:textSize="24sp"
            android:textStyle="bold"
            android:typeface="normal" />

    </android.support.v7.widget.Toolbar>


    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <com.yalantis.phoenix.PullToRefreshView
            android:id="@+id/comment_refresh"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginBottom="2dp">

            <com.bitwise.rotaractclubapp.system.AutoPlayVideoRecyclerView
                android:id="@+id/commentRecycler"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_marginBottom="3dp" />

            </com.yalantis.phoenix.PullToRefreshView>

        <TextView
            android:id="@+id/noComments"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:text="@string/be_the_first_in_this_comment_section"
            android:textColor="@color/not_selected"
            android:layout_centerInParent="true"
            android:textSize="18sp" />
    </RelativeLayout>

</LinearLayout>

<LinearLayout
    android:id="@+id/commentLinear"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:orientation="vertical"
    >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:background="@color/colorPrimaryDark"
        android:padding="5dp"
        android:weightSum="10">

        <com.sackcentury.shinebuttonlib.ShineButton
            android:id="@+id/videoBtn"
            android:layout_width="30dp"
            android:layout_height="35dp"
            android:layout_gravity="center"
            android:layout_marginEnd="5dp"
            android:layout_weight="1"
            android:background="@android:color/transparent"
            android:contentDescription="@string/help"
            app:allow_random_color="true"
            app:big_shine_color="@color/highlighted"
            app:click_animation_duration="350"
            app:enable_flashing="true"
            app:shine_animation_duration="5000"
            app:shine_count="15"
            app:shine_turn_angle="20"
            app:siShape="@drawable/ic_movie_creation_black_24dp"
            app:small_shine_offset_angle="40"
            app:srcCompat="@drawable/ic_movie_creation_black_24dp"
            app:tint="@color/highlighted" />


        <com.sackcentury.shinebuttonlib.ShineButton
            android:id="@+id/imageBtn"
            android:layout_width="30dp"
            android:layout_height="35dp"
            android:layout_gravity="center"
            android:layout_marginEnd="5dp"
            android:layout_weight="1"
            android:background="@android:color/transparent"
            android:contentDescription="@string/help"
            app:allow_random_color="true"
            app:big_shine_color="@color/highlighted"
            app:click_animation_duration="350"
            app:enable_flashing="true"
            app:shine_animation_duration="5000"
            app:shine_count="15"
            app:shine_turn_angle="20"
            app:siShape="@drawable/ic_image_black_24dp"
            app:small_shine_offset_angle="40"
            app:srcCompat="@drawable/ic_image_black_24dp"
            app:tint="@color/highlighted" />

        <EditText
            android:id="@+id/comment"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_weight="7"
            android:background="@drawable/edit_text_background"
            android:ems="10"
            android:hint="@string/your_comment"
            android:inputType="text|textCapSentences|textMultiLine"
            android:padding="10dp"
            android:textColor="@color/icon_selected"
            android:textColorHint="@color/icon_not_selected"
            tools:targetApi="lollipop"
            tools:ignore="Autofill" />

        <com.sackcentury.shinebuttonlib.ShineButton
            android:id="@+id/sendingBtn"
            android:layout_width="30dp"
            android:layout_height="35dp"
            android:layout_gravity="center"
            android:layout_marginStart="5dp"
            android:layout_weight="1"
            android:background="@android:color/transparent"
            android:contentDescription="@string/help"
            app:allow_random_color="true"
            app:big_shine_color="@color/highlighted"
            app:click_animation_duration="350"
            app:enable_flashing="true"
            app:shine_animation_duration="5000"
            app:shine_count="15"
            app:shine_turn_angle="20"
            app:siShape="@drawable/ic_send_white_24dp"
            app:small_shine_offset_angle="40"
            app:srcCompat="@drawable/ic_send_white_24dp"
            app:tint="@color/highlighted" />

    </LinearLayout>

    <android.support.v7.widget.RecyclerView
        android:id="@+id/filesRecycler"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="2dp"
        android:layout_marginBottom="2dp"
        android:layout_marginStart="2dp"
        android:visibility="gone" />

</LinearLayout>

Mihae Kheel
  • 2,441
  • 3
  • 14
  • 38

1 Answers1

0

I solved the issue it was a silly mistake and took me weeks trying to figure out. The cause of the problem is declaring some item to be non-recyclable setIsRecyclable(false).

Mihae Kheel
  • 2,441
  • 3
  • 14
  • 38