sangcomz / StickyTimeLine

:book:StickyTimeLine is timeline view for android.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

some cards are shown not complete

niloofaradibi opened this issue · comments

@sangcomz you see on the picture, the forth top are overlapping with before one
please help me...

6b6d5eec-0ac8-49a7-8e9f-8d187330db82

Is the height of each item different?

Can you show me the code that reproduces this issue?

Is the height of each item different?

Can you show me the code that reproduces this issue?

thanks for answering..
about first question, i should say that the height of all item is same and look like the last complete item that you see.
my code :

`
private void InitEventList(JsonElement data) {
List dataList = Helper.Parse.GetArrayObjectFromJson(data, EventLog[].class);
eventLogList.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
eventLogList.setItemAnimator(new DefaultItemAnimator());
eventLogList.setNestedScrollingEnabled(true);
EventLogAdapter adapter = new EventLogAdapter(dataList);
eventLogList.addItemDecoration(getSectionCallback(dataList));
eventLogList.setAdapter(adapter);
}

private RecyclerSectionItemDecoration.SectionCallback getSectionCallback(final List<EventLog> eventList) {

    int count = eventLogList.getItemDecorationCount();
    if (count  > 0)
        eventLogList.removeItemDecorationAt(count  - 1);

    return new RecyclerSectionItemDecoration.SectionCallback() {

        @Nullable
        @Override
        public SectionInfo getSectionHeader(int position) {
            EventLog event = eventList.get(position);
            Drawable dot;
            switch (event.getAttributeName()) {
                case "وضعیت دستگاه": {
                    dot = activeState;
                    break;
                }
                case "صدا": {
                    dot = volumeState;
                    break;
                }
                default: {
                    dot = other;
                }
            }
            return new SectionInfo(event.getCreateDate(), event.getAttributeName());
        }

        @Override
        public boolean isSection(int position) {
            if (eventList.size() > 0)
                return !eventList.get(position).getCreateDate().equals(eventList.get(position - 1).getCreateDate());
            else
                return false;
        }
    };
}

`

`

<data>

    <variable
        name="eventLog"
        type="adnimo.chilanik.core.models.EventLog" />
</data>

<android.support.v7.widget.CardView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layoutDirection="ltr"
    app:cardCornerRadius="3dp"
    app:cardElevation="1dp"
    android:padding="@dimen/spacing_small">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center_vertical"
        android:layoutDirection="rtl"
        android:orientation="horizontal"
        android:padding="@dimen/spacing_large">

        <com.mikhaellopez.circularimageview.CircularImageView
            android:layout_width="@dimen/spacing_xlarge"
            android:layout_height="@dimen/spacing_xlarge"
            android:foreground="@color/overlay_light_30"
            android:tint="@color/colorPrimary"
            app:civ_border="false"
            app:civ_shadow="true"
            app:civ_shadow_radius="0"
            app:srcCompat="@drawable/ic_help" />

        <View
            android:layout_width="@dimen/spacing_large"
            android:layout_height="0dp" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:gravity="center_vertical"
                    android:text="@{eventLog.userName}"
                    android:textAppearance="@style/TextAppearance.AppCompat.Caption"
                    android:textColor="@color/light_blue_400"
                    android:textDirection="rtl"
                    android:textStyle="bold" />

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:gravity="center_vertical"
                    android:text=" تغییر "
                    android:textAppearance="@style/TextAppearance.AppCompat.Caption"
                    android:textColor="@color/grey_40"
                    android:textDirection="rtl" />

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:gravity="center_vertical"
                    android:text="@{eventLog.attributeName}"
                    android:textAppearance="@style/TextAppearance.AppCompat.Caption"
                    android:textColor="@color/grey_40"
                    android:textDirection="rtl" />

            </LinearLayout>

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:gravity="center_vertical"
                    android:text="از "
                    android:textAppearance="@style/TextAppearance.AppCompat.Caption"
                    android:textColor="@color/light_blue_400"
                    android:textDirection="rtl"
                    android:textStyle="bold" />

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:gravity="center_vertical"
                    android:text="@{eventLog.oldState}"
                    android:textAppearance="@style/TextAppearance.AppCompat.Caption"
                    android:textColor="@color/light_blue_400"
                    android:textDirection="rtl"
                    android:textStyle="bold" />

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:gravity="center_vertical"
                    android:text=" به "
                    android:textAppearance="@style/TextAppearance.AppCompat.Caption"
                    android:textColor="@color/grey_40"
                    android:textDirection="rtl" />

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:gravity="center_vertical"
                    android:text="@{eventLog.newState}"
                    android:textAppearance="@style/TextAppearance.AppCompat.Caption"
                    android:textColor="@color/grey_40"
                    android:textDirection="rtl" />

            </LinearLayout>

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:gravity="center_vertical"
                    android:text=" در ساعت "
                    android:textAppearance="@style/TextAppearance.AppCompat.Caption"
                    android:textColor="@color/light_blue_400"
                    android:textDirection="rtl"
                    android:textStyle="bold" />

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:gravity="center_vertical"
                    android:text="@{eventLog.createTime}"
                    android:textAppearance="@style/TextAppearance.AppCompat.Caption"
                    android:textColor="@color/light_blue_400"
                    android:textDirection="rtl"
                    android:textStyle="bold" />

            </LinearLayout>

        </LinearLayout>

    </LinearLayout>

</android.support.v7.widget.CardView>
`

Is the height of each item different?

Can you show me the code that reproduces this issue?

@sangcomz @carohauta @ehdrms2034
please answer me ... I'm in hurry .
if you know that problem doesn't go away easily please don't leave me at waiting so i should to solve my problem in other way

Sorry for not being able to respond quickly.
I can solve this problem this weekend.
And if I give it as executable project, I can solve it faster.
@niloofar92

Sorry for not being able to respond quickly.
I can solve this problem this weekend.
And if I give it as executable project, I can solve it faster.
@niloofar92

@sangcomz thanks so much ..
i created sample project of that issue in this link https://1drv.ms/u/s!Aq639DpozJOec7V9DoqRhKChLls?e=ogrZNQ

@sangcomz @ehdrms2034 @carohauta
Three days have passed from the weekend and i dont receive answer ...
your support are very very bad

I'm sorry, I'll take care of it quickly. @niloofar92

    private ArrayList<EventLog> getEventList() {
        ArrayList<EventLog> eventLogs = new ArrayList<>();

        eventLogs.add(new EventLog("وضعیت دستگاه", "2", "3", "4", "5", "6", "7", "8", "9"));
        eventLogs.add(new EventLog("وضعیت دستگاه", "2", "3", "4", "5", "6", "7", "8", "9"));
        eventLogs.add(new EventLog("وضعیت دستگاه", "2", "3", "4", "5", "6", "7", "8", "9"));
        eventLogs.add(new EventLog("وضعیت دستگاه", "2", "3", "4", "5", "6", "7", "8", "9"));
        eventLogs.add(new EventLog("وضعیت دستگاه", "2", "3", "4", "5", "6", "7", "8", "9"));
        eventLogs.add(new EventLog("وضعیت دستگاه", "2", "3", "4", "5", "6", "7", "8", "9"));
        eventLogs.add(new EventLog("صدا", "2", "3", "4", "5", "6", "7", "8", "9"));
        eventLogs.add(new EventLog("صدا", "2", "3", "4", "5", "6", "7", "8", "9"));
        eventLogs.add(new EventLog("صدا", "2", "3", "4", "5", "6", "7", "8", "9"));
        eventLogs.add(new EventLog("صدا", "2", "3", "4", "5", "6", "7", "8", "9"));

        return eventLogs;
    }

The api you gave me didn't work, so I created a dataset like this, but I can't reproduce the error. What values ​​should I put in?

My result

image

commented

Please refer the solution in --> #21

I hope it helps.

@sangcomz you should insert more data .. as you see , in your picture that you upload, the sixth card have problem and not complete view

73361577-8b970e80-42e8-11ea-98c5-23c852dd19cc

Okay. I'll put more items.

@niloofar92
It was a problem because I put the wrong data.

Result

image

I think the implementation of isSection is wrong.
Can you provide me with a real dataset?