Ramotion/folding-cell-android

After fold/unfold a few time list misaligned

giaur500 opened this issue · 3 comments

Screen:
http://i.imgur.com/Tyk4EV5.png

There is unnecesary extra space. Need to recreate list to get it aligned properly again. Then it works, i can fold/unfold list without an issue. But after some time, I'm getting invalid alignment again.

I am unable to reproduce it with your sample project. Any ideas what could case that? The only difference is I used ConstraintLayout for folded/unfolded layouts, does it matter? And second difference, your sample has latest sources added as module, my app uses jar (maybe outdated?)

cell_tile_layout:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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="wrap_content"
                                             android:background="@color/bgContent"
                                             android:baselineAligned="false"
                                             android:orientation="horizontal"
                                             android:paddingBottom="10dp"
                                             tools:layout_editor_absoluteX="0dp"
                                             tools:layout_editor_absoluteY="81dp">

    <TextView
        android:id="@+id/event_address_text"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginBottom="8dp"
        android:layout_marginEnd="8dp"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp"
        android:layout_marginStart="8dp"
        android:layout_marginTop="5dp"
        android:paddingBottom="8dp"
        android:paddingRight="30dp"
        android:text="adres"
        android:textAppearance="@style/TextAppearance.AppCompat.Body1"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/event_description_text"/>

    <TextView
        android:id="@+id/event_category_text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp"
        android:layout_marginStart="9dp"
        android:layout_marginTop="16dp"
        android:paddingBottom="3dp"
        android:paddingTop="3dp"
        android:text="Komunikacja"
        android:textAppearance="@style/TextAppearance.AppCompat.Body2"
        android:textColor="@color/colorEventCategoryText"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent"/>

    <TextView
        android:id="@+id/event_description_text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp"
        android:layout_marginTop="16dp"
        android:paddingRight="16dp"
        android:text="brak wody"
        android:ellipsize="end"
        android:maxLines="3"
        android:textAppearance="@style/TextAppearance.AppCompat.Body2"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/event_category_text"/>

</android.support.constraint.ConstraintLayout>

cell_content_layout:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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="wrap_content"
                                             android:background="@color/cardview_light_background"
                                             android:minHeight="250dp"
                                             android:orientation="vertical"
                                             android:visibility="gone">


    <TextView
        android:id="@+id/content_request_btn"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginBottom="8dp"
        android:layout_marginEnd="8dp"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp"
        android:layout_marginStart="8dp"
        android:layout_marginTop="16dp"
        android:background="@color/btnRequest"
        android:padding="10dp"
        android:text="Pokaż na mapie"
        android:textAlignment="center"
        android:textColor="@color/mainTextColor"
        android:textSize="20sp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/text_event_details_notes"
        app:layout_constraintVertical_bias="0.0"/>

    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="8dp"
        android:layout_marginStart="8dp"
        android:layout_marginTop="16dp"
        android:text="Kategoria:"
        android:textStyle="bold"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/event_card_title_description"/>


    <TextView
        android:id="@+id/textView3"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginLeft="8dp"
        android:layout_marginStart="8dp"
        android:layout_marginTop="16dp"
        android:text="Lokalizacja:"
        android:textStyle="bold"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/text_event_details_category"/>


    <TextView
        android:id="@+id/textView4"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginLeft="8dp"
        android:layout_marginStart="8dp"
        android:layout_marginTop="16dp"
        android:text="Data zgłoszenia:"
        android:textStyle="bold"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/text_event_details_address"/>


    <TextView
        android:id="@+id/textView5"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginLeft="8dp"
        android:layout_marginStart="8dp"
        android:layout_marginTop="16dp"
        android:text="Uwagi:"
        android:textStyle="bold"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/text_event_details_date"/>

    <TextView
        android:id="@+id/event_card_title_description"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:background="?attr/colorPrimary"
        android:paddingBottom="8dp"
        android:paddingLeft="8dp"
        android:paddingRight="8dp"
        android:paddingTop="8dp"
        android:text="Awaria sygnalizacji świetlnej"
        android:textAlignment="viewStart"
        android:textColor="#ffffff"
        android:textStyle="bold"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent"/>

    <TextView
        android:id="@+id/text_event_details_category"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginEnd="8dp"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp"
        android:layout_marginStart="8dp"
        android:layout_marginTop="5dp"
        android:paddingRight="8dp"
        android:text="Kategoria"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/textView2"/>

    <TextView
        android:id="@+id/text_event_details_address"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginEnd="8dp"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp"
        android:layout_marginStart="8dp"
        android:layout_marginTop="5dp"
        android:paddingRight="8dp"
        android:text="Lokalizacja"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/textView3"/>

    <TextView
        android:id="@+id/text_event_details_date"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginEnd="8dp"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp"
        android:layout_marginStart="8dp"
        android:layout_marginTop="5dp"
        android:paddingRight="8dp"
        android:text="Data"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/textView4"/>

    <TextView
        android:id="@+id/text_event_details_notes"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginEnd="8dp"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp"
        android:layout_marginStart="8dp"
        android:layout_marginTop="5dp"
        android:paddingRight="8dp"
        android:text="Uwagi"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/textView5"/>

</android.support.constraint.ConstraintLayout>

cell:

<?xml version="1.0" encoding="utf-8"?>

<com.ramotion.foldingcell.FoldingCell xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:folding-cell="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:clipChildren="false"
    android:clipToPadding="false"
    folding-cell:additionalFlipsCount="0"
    folding-cell:animationDuration="1300"
    folding-cell:backSideColor="@color/bgBackSideColor"
    folding-cell:cameraHeight="30">

    <!-- CONTENT (UNFOLDED) LAYOUT (MUST BE AT LEAST 2x times BIGGER than content layout bellow)-->
    <include layout="@layout/cell_content_layout" />

    <!-- TITLE (FOLDED) LAYOUT (MUST BE AT LEAST 2x times SMALLER than content layout above) -->
    <include layout="@layout/cell_title_layout" />

</com.ramotion.foldingcell.FoldingCell>

Any ideas? I'm stuck actually, are there any commits not included in released version? (maybe I should recompile latest codes from github?).

I am having the same issue.

If I fold a cell. Sometimes the (unfolded view) is in the background behind the folded view. And then the on-click listener of the folded cell doesn't work anymore.

Yes, I was forced to drop this library from my app and use regular list instead. This issue prevents it from using in the real projects. I hope issues will be fixed, idea is great but this library is not yet ready for real production use.

Hello, guys. This issue was resolved in new version. Please update to the new version of this lib. It is also now migrated to androidX.