GithubHelp home page GithubHelp logo

ramotion / folding-cell-android Goto Github PK

View Code? Open in Web Editor NEW
4.9K 154.0 844.0 25.72 MB

:octocat: πŸ“ƒ FoldingCell is a material design expanding content cell inspired by folding paper material made by @Ramotion

Home Page: https://www.ramotion.com/agency/app-development/

License: MIT License

Java 100.00%
android java library component material-design

folding-cell-android's People

Contributors

aleksei1000000 avatar alexmik89 avatar davyskiba avatar dvg4000 avatar golovin47 avatar juriv avatar oleg-vasiliev avatar olegv-ramotion avatar ramotiondev avatar ravidsrk avatar ronnielsen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

folding-cell-android's Issues

changing cell content size

I would like to make the content layout fill the size of the screen but everytime i change size the app just crashes when i click any item in listview.
Any Help or Suggestions ?

Question: Start with cells unfolded

Hi, brilliant work first of all!

Question, is it possible to start with the cells unfolded?

I cant seem to find any documentation on the matter..

Many Thanks

Wrong behavior expand and collapse on recyclerview

I got problem while using recyclerview because recyclerview is recycle it make item collapse and expand in wrong position while you scroll with recyclerview have alot item... are there any idea I could solve this problem ? @Pakhaliuk

Recyclerlistview

after setting the folding cell to recycler view ...and clicked on 2 or more than 2 item in then list in less time given to animation whole activity view stuck and stop responding but app doesn't crash

Problem with toggle in RecyclerView.ViewHolder

I use FoldingCell with RecyclerView. When i onClick, fc is toggled. But every 9th element at the list toogled too.
How fix this?

 View_Holder(View itemView) {

            super(itemView);

            final FoldingCell fc = (FoldingCell)itemView.findViewById(R.id.folding_celll);
            fc.initialize(1000, Color.DKGRAY, 2);
            fc.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    fc.toggle(false);
                }
            });
........

Adding folding cell dynamically (with PHP script)

Hi,
First thanks for this awesome component. But my question is if it's possible to add to a LinearLayout some folding cell with some various content depending on my result of my request PHP script (i have already made it with some ImageView, getting data from database is not a problem).
Thanks for your consideration and sorry for my bad english i'm french.

Foldingcell not working on Fragment

I tried to use the Folding-cell on my Fragment , but it won t work ...
Here`s my xml :
<com.ramotion.foldingcell.FoldingCell
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/folding_cell"
android:layout_width="0dp"
android:layout_height="wrap_content"
tools:layout_editor_absoluteY="75dp"
tools:layout_editor_absoluteX="8dp">
​



​

</com.ramotion.foldingcell.FoldingCell>

Here is my Fragment Java Class :

@OverRide
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {

View view = inflater.inflate(R.layout.fragment_orders_layout,container,false);

final FoldingCell fc = (FoldingCell) view.findViewById(R.id.folding_cell);
fc.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        fc.toggle(false);
    }
});

return view;

}

I`d be glad to use help..
Tnx..

Prospective error with recycleview

I used this lib without problem for a normal listview. Now I need to use recycleview. Animation work weel, but the size of border of fold raming the same. Instead border of view should increase of some dp to give a 3d sensation to the user.

Bad folding animation

I imported and run your example of folding-cell-listview-example. Unfortunately it seems that there is a strange folding animation. When the animation of unfolding starts there is always a bug with the first fold (or the last if folding). It looks like the animation starts from the top of the screen and not from the point it's in. Any way of fixing it?

Here is a sample ( second list option was clicked btw ):
untitled

Weird folding animation

I'm currently using the folding cell examples + one with a layout of my own, no behavior problems but in all the projects, including the example you provide, while expanding or collapsing the cell edges tent to cover a good portion of the screen in a completely unnatural way. I'm using normal Listviews and android 6.0 on a Nexus 5.
I attached a link to a screenshot to make the problem clear, in my opinion, while folding, the cell should never overlap with other listview elements, this 3D effect almost give the sensation that the user is being hit. I'd like to know if there is something that could be done to solve this issue

Screenshot link:
https://www.dropbox.com/s/2wdfcxc06k5log8/Screenshot_20160916-153314.png?dl=0

After fold/unfold a few time list misaligned

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?).

GLES20RecordingCanvas

I run the latest update avilable on github repo of folding-cell-listview-example in Api 15, Android 4.0.4 and i get this error:
01-13 15:00:33.467 4646-4646/com.ramotion.foldingcell.examples.listview E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.NullPointerException
at android.view.GLES20RecordingCanvas.drawBitmap(GLES20RecordingCanvas.java:118)
at android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:393)
at android.widget.ImageView.onDraw(ImageView.java:892)
at android.view.View.draw(View.java:10978)
at android.view.ViewGroup.drawChild(ViewGroup.java:2887)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.ViewGroup.drawChild(ViewGroup.java:2885)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.getDisplayList(View.java:10415)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.getDisplayList(View.java:10415)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.widget.ListView.drawChild(ListView.java:3223)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.widget.AbsListView.dispatchDraw(AbsListView.java:2092)
at android.widget.ListView.dispatchDraw(ListView.java:3218)
at android.view.View.draw(View.java:10981)
at android.widget.AbsListView.draw(AbsListView.java:3398)
at android.view.View.getDisplayList(View.java:10417)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.draw(View.java:10981)
at android.widget.FrameLayout.draw(FrameLayout.java:450)
at android.view.View.getDisplayList(View.java:10417)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.draw(View.java:10981)
at android.support.v7.widget.ActionBarOverlayLayout.draw(ActionBarOverlayLayout.java:442)
at android.view.View.getDisplayList(View.java:10417)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.getDisplayList(View.java:10415)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.getDisplayList(View.java:10415)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.draw(View.java:10981)
at android.widget.FrameLayout.draw(FrameLayout.java:450)
at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2134)
at android.view.View.getDisplayList(View.java:10417)
at android.view.HardwareRenderer$GlRenderer.draw(HardwareRenderer.java:875)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:1918)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1642)
at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2450)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4444)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)
at dalvik.system.NativeStart.main(Native Method)
01-13 15:00:33.487 309-496/? E/hubo_EventLog: OnException

java.lang.IllegalArgumentException: width and height must be > 0 in RecyclerView

I am using folding cell in RecyclerView.

My FoldingCell click view setup in RecyclerAdapter like below:

mViewHolder.itemView.setOnClickListener(new View.OnClickListener() {
@OverRide
public void onClick(View v) {
((FoldingCell) v).toggle(false);
// register in adapter that state for selected cell is toggled
contentAdapter.registerToggle(mViewHolder.getAdapterPosition());
}

I get following error whenever scroll up or scroll down & that Item is not visible in RecyclerView.

Java.lang.IllegalArgumentException: width and height must be > 0
at android.graphics.Bitmap.createBitmap(Bitmap.java:1001)
at android.graphics.Bitmap.createBitmap(Bitmap.java:968)
at android.graphics.Bitmap.createBitmap(Bitmap.java:918)
at android.graphics.Bitmap.createBitmap(Bitmap.java:879)
at com.ramotion.foldingcell.FoldingCell.measureViewAndGetBitmap(FoldingCell.java:346)
at com.ramotion.foldingcell.FoldingCell.unfold(FoldingCell.java:121)
at com.ramotion.foldingcell.FoldingCell.toggle(FoldingCell.java:224)
at com.test.$ContentAdapter.onBindViewHolder(AFragment.java:409)
at com.test..AFragment$ContentAdapter.onBindViewHolder(AFragment.java:252)
at android.support.v7.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:6354)
at android.support.v7.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:6387)
at android.support.v7.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:5343)
at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5606)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5448)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5444)
at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2224)
at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1551)
at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1511)
at android.support.v7.widget.LinearLayoutManager.scrollBy(LinearLayoutManager.java:1325)
at android.support.v7.widget.LinearLayoutManager.scrollVerticallyBy(LinearLayoutManager.java:1061)
at android.support.v7.widget.RecyclerView$ViewFlinger.run(RecyclerView.java:4734)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:966)
at android.view.Choreographer.doCallbacks(Choreographer.java:778)
at android.view.Choreographer.doFrame(Choreographer.java:710)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:952)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6809)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

My requirement is, want to show previous folding cell state (either folded / unfolded) when ever data set is changed or scroll up or scroll down.

I am using Android Studio 3.0 & Folding Cell 1.2.1

Thanks in advance.

Dynamic Height For Content_view

I am trying to add dynamic content in Content_View, So it can varies ex. For some there will be only 3 lines and another has 5 or you can say 6 7 lines so i want Folding cell to dynamically adjust to the height of content. Is it possible??

folding cell in CardView with elevation and radius corner

Hi, I have a RecyclerView in my activity. I used folding-cell library to expand each CardView. but because my CardView has elevation and cardCornerRadius it gets ugly. because when it wants to unfold list_item_feed_expand first it doesn't have radius corner and shadow and when animation get completed it gets shadow and corner. it is the same for folding. it first removes radius corner and shadow and then it fold it
can you tell me how to correct this? is there anyway to solve it?

Calling toggle(true) o unfold(true) makes the cell disappear

I'm having trouble with the folding cell on a recycler view. After trying to deal for hours with animation problems, and for testing purposes, I set to true the skip animation booleans to at least try to mitigate the issues I'm having (most of them already reported on other issues). Doing that I found that when I call toggle(true) or unfold(true) on a cell it disappear, but fold(true) does not.

Folding Cell title question

Hi!
Thanks for this lib!

How can I "unfold" my cell without hiding title? Ie: it now works this way:
title shown, content hidden -> click -> title hidden, content shown.

How can I reach this behaviour?
title shown, content hidden -> click -> title shown, content shown.

Thanks!

In RecyclerView bug

When you expand the item in the list, the fast slider list will cause item error to be resumed.I does not see callbacks that are executed after folding animation.

Unfold cell programmatically

How to unfold or fold cell in specific index of list view programmatically without click on it?
when I called cell.unfold(true) returns NullPointerException:
Attempt to write to field 'int android.view.ViewGroup$LayoutParams.height' on a null object reference

when use cell.toggle(false);
registerToggle(position);
returns FATAL EXCEPTION: main
Process: PID: 30807
java.lang.IllegalArgumentException: width and height must be > 0
at android.graphics.Bitmap.createBitmap(Bitmap.java:967)
at android.graphics.Bitmap.createBitmap(Bitmap.java:946)
at android.graphics.Bitmap.createBitmap(Bitmap.java:913)
at com.ramotion.foldingcell.FoldingCell.getBitmapFromView(FoldingCell.java:343)
at com.ramotion.foldingcell.FoldingCell.unfold(FoldingCell.java:130)
at com.ramotion.foldingcell.FoldingCell.toggle(FoldingCell.java:222)

Bug in Fold Animation

When folding a folding cell in a recycler view with more than 50% of the top portion of the unfolded cell not visible on the screen, the folding does not happen properly and the folding cell becomes unresponsive.

Unfolded View:

whatsapp image 2017-04-12 at 8 15 08 pm 1

View with more than 50% of to part out of screen:

whatsapp image 2017-04-12 at 8 15 08 pm 2

Bug on Folding the View:

whatsapp image 2017-04-12 at 8 15 08 pm

Layout:

    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical">

    <com.ramotion.foldingcell.FoldingCell
        android:id="@+id/coupon_folding_cell"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="16dp"
        app:backSideColor="@color/cardColorBackground">

        <android.support.v7.widget.CardView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:visibility="gone"
            app:cardBackgroundColor="#414141">

            <android.support.constraint.ConstraintLayout
                android:layout_width="match_parent"
                android:layout_height="364dp"
                android:background="#414141">

                <ImageView
                    android:id="@+id/coupon_barcode"
                    android:layout_width="250dp"
                    android:layout_height="250dp"
                    android:layout_marginBottom="57dp"
                    android:layout_marginEnd="8dp"
                    android:layout_marginLeft="8dp"
                    android:layout_marginRight="8dp"
                    android:layout_marginStart="8dp"
                    android:layout_marginTop="57dp"
                    app:layout_constraintBottom_toBottomOf="parent"
                    app:layout_constraintLeft_toLeftOf="parent"
                    app:layout_constraintRight_toRightOf="parent"
                    app:layout_constraintTop_toTopOf="parent"
                    app:srcCompat="@drawable/abhinav" />
            </android.support.constraint.ConstraintLayout>

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

        <android.support.v7.widget.CardView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:cardBackgroundColor="#414141">

            <android.support.constraint.ConstraintLayout
                android:layout_width="match_parent"
                android:layout_height="182dp"
                android:background="#414141">

                <ImageView
                    android:id="@+id/coupon_primary_image"
                    android:layout_width="100dp"
                    android:layout_height="100dp"
                    app:layout_constraintBottom_toBottomOf="parent"
                    app:layout_constraintLeft_toRightOf="@+id/linearLayout"
                    app:layout_constraintRight_toRightOf="parent"
                    app:layout_constraintTop_toTopOf="parent"
                    app:srcCompat="@drawable/ic_coffee" />

                <LinearLayout
                    android:id="@+id/linearLayout"
                    android:layout_width="60dp"
                    android:layout_height="182dp"
                    android:layout_marginLeft="8dp"
                    android:background="@color/colorAccent"
                    android:orientation="vertical"
                    app:layout_constraintBottom_toBottomOf="parent"
                    app:layout_constraintLeft_toLeftOf="parent"
                    app:layout_constraintTop_toTopOf="parent">

                    <TextView
                        android:id="@+id/coupon_title"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:layout_margin="5dp"
                        android:gravity="center"
                        android:text="@string/dinner"
                        android:textAlignment="center"
                        android:textColor="@color/textColorPrimary"
                        android:textSize="12sp"
                        android:textStyle="bold" />
                </LinearLayout>
            </android.support.constraint.ConstraintLayout>
        </android.support.v7.widget.CardView>
    </com.ramotion.foldingcell.FoldingCell>
</LinearLayout>

Holder:

    public ImageView barcode, primaryImage;
    public TextView title;
    public FoldingCell foldingCell;

    public CouponsHolder(View itemView) {
        super(itemView);
        barcode = (ImageView) itemView.findViewById(R.id.coupon_barcode);
        primaryImage = (ImageView) itemView.findViewById(R.id.coupon_primary_image);
        title = (TextView) itemView.findViewById(R.id.coupon_title);
        foldingCell = (FoldingCell) itemView.findViewById(R.id.coupon_folding_cell);
        foldingCell.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                foldingCell.toggle(false);
            }
        });
    }
}

Adapter:

    ArrayList<String> couponTitles;
    ArrayList<Integer> primaryimages;
    ArrayList<Bitmap> qrCodes;

    public CouponsAdapter(ArrayList<String> couponTitles, ArrayList<Integer> primaryimages, ArrayList<Bitmap> qrCodes) {
        this.couponTitles = couponTitles;
        this.primaryimages = primaryimages;
        this.qrCodes = qrCodes;
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new CouponsHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.fragment_coupons_item, parent, false));
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
        CouponsHolder couponsHolder = (CouponsHolder) holder;
        couponsHolder.foldingCell.fold(true);
        couponsHolder.title.setText(couponTitles.get(position));
        couponsHolder.primaryImage.setImageResource(primaryimages.get(position));
        couponsHolder.barcode.setImageBitmap(qrCodes.get(position));
    }

    @Override
    public int getItemCount() {
        return couponTitles.size();
    }
};

Update content view height

I want to update content view height after performing some operations (adding some text or images). But height still stays fixed.

But calling foldingCell.contentView.requestLayout() does not do anything.

Where is the trick?

Please, help me.

Gradle 3.0 Alpha 2 throwing exception

When using gradle build tool 3.0.0-alpha2 in Android studio preview

dependencies {
       classpath 'com.android.tools.build:gradle:3.0.0-alpha2'
}

I got this error:

ERROR: 
...\app\build\intermediates\manifests\full\debug\AndroidManifest.xml:15 unknown element <library> found

Failed to execute aapt
com.android.ide.common.process.ProcessException: Failed to execute aapt
	at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:803)
	at com.android.build.gradle.tasks.ProcessAndroidResources.invokeAaptForSplit(ProcessAndroidResources.java:548)
...

Issues:
 - ERROR: C:\Users\Jonas\Projects\Android\Hey\app\build\intermediates\manifests\full\debug\AndroidManifest.xml:15 unknown element <library> found
	at com.android.builder.internal.aapt.v2.AaptV2Jni.buildException(AaptV2Jni.java:136)
	at com.android.builder.internal.aapt.v2.AaptV2Jni.makeValidatedPackage(AaptV2Jni.java:80)
	at com.android.builder.internal.aapt.AbstractAapt.link(AbstractAapt.java:40)
	... 48 more

 FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugResources'.
> Failed to execute aapt

It seems that the library element in AndroidManifest.xml has problem in this gradle version.

<library
        android:name="@string/app_name"
        android:label="@string/app_name" />

can't upload application to Google Play store

I have tried to publish my application to Google Play store but when i include the
'com.ramotion.foldingcell:folding-cell:1.0.0' I get the following error when trying to upload
apk file.
the dependency causes the next Issue:
Multiple APK: Version 1 is not served to any device configuration.

Glitched animation when unfolded for first time

Hi, I'm trying to solve an issue with Folding Cell element. When I unfold it for the first time, next items jump to their final position for a fraction of second and only then is their position animated according to the folding anim. It seems as if the whole layout does not have infomation about the final size of unfolded item so it needs one unfolding to compute it first. If I collapse the same item and then unfold it second time, it all works perfectly. Any idea what can I do about it ?

Help

Is it possible to show us an example with Recycleview ?

java.lang.IllegalStateException: Content View height is too small

at com.ramotion.foldingcell.FoldingCell.calculateHeightsForAnimationParts(FoldingCell.java:257)
04-22 13:21:00.109 6283-6283/com.broadamptechnologies.bricks W/System.err: at com.ramotion.foldingcell.FoldingCell.unfold(FoldingCell.java:118)
04-22 13:21:00.109 6283-6283/com.broadamptechnologies.bricks W/System.err: at com.ramotion.foldingcell.FoldingCell.toggle(FoldingCell.java:206)
04-22 13:21:00.109 6283-6283/com.broadamptechnologies.bricks W/System.err: at com.broadamptechnologies.bricks.NewsFragment$2.onClick(NewsFragment.java:97)
04-22 13:21:00.109 6283-6283/com.broadamptechnologies.bricks W/System.err: at android.view.View.performClick(View.java:5198)
04-22 13:21:00.109 6283-6283/com.broadamptechnologies.bricks W/System.err: at android.view.View$PerformClick.run(View.java:21147)
04-22 13:21:00.109 6283-6283/com.broadamptechnologies.bricks W/System.err: at android.os.Handler.handleCallback(Handler.java:739)
04-22 13:21:00.109 6283-6283/com.broadamptechnologies.bricks W/System.err: at android.os.Handler.dispatchMessage(Handler.java:95)
04-22 13:21:00.109 6283-6283/com.broadamptechnologies.bricks W/System.err: at android.os.Looper.loop(Looper.java:148)
04-22 13:21:00.109 6283-6283/com.broadamptechnologies.bricks W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5417)
04-22 13:21:00.110 6283-6283/com.broadamptechnologies.bricks W/System.err: at java.lang.reflect.Method.invoke(Native Method)
04-22 13:21:00.110 6283-6283/com.broadamptechnologies.bricks W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
04-22 13:21:00.110 6283-6283/com.broadamptechnologies.bricks W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Open Two Item On RecyclerView When Click on One Of Items

Hi Every Body i Have an issue with folding-cell and that is some thing like this when i click on one of recyclerView Items in that it open truely but it open another one at the buttom of list i mean when i click on item 0 it open item 0 and item 10 (maybe recycler view loaded items at once) and reaptly item 20 30 and like this what can i do for this?
sorry for my bad english.

here is my adapter code

`
public class LessonShowAdapter extends RecyclerView.Adapter<LessonShowAdapter.LessonShowViewHolder> {

Context context;
List<LessonShowStruct> structs = new ArrayList<>();

public LessonShowAdapter(Context context, List<LessonShowStruct> structs) {
    this.context = context;
    this.structs = structs;
}

@NonNull
@Override
public LessonShowViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
    return new LessonShowViewHolder(LayoutInflater.from(context).inflate(R.layout.model_lesson_show, parent, false));
}

@Override
public void onBindViewHolder(@NonNull final LessonShowViewHolder holder, int position) {

    final LessonShowStruct struct = structs.get(position);

    holder.Id = struct.getId();
    holder.Name.setText(struct.getName());
    holder.Number.setText(struct.getNumber());
    //Glide.with(context).load(R.drawable.cell).into(holder.IMG);
    holder.FoldName.setText(struct.getName());
    holder.FoldDesc.setText(struct.getDesc());

    if (struct.getIsLiked().equals("1")) {
        holder.Like.setImageResource(R.drawable.ic_favorite_red);
    }

    holder.Open.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(context, OneLessonShowActivity.class);
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            context.startActivity(intent);
        }
    });
    holder.Like.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (struct.getIsLiked().equals("1"))
                G.updateData("0");
            else {
                G.updateData("1");
            }
        }
    });
    holder.Options.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            showPopUpOptionMenu(v);
        }
    });
    holder.fc.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            holder.fc.toggle(false);
        }
    });

/* holder.FramNotFold.setOnClickListener(new View.OnClickListener() {
@OverRide
public void onClick(View v) {
holder.fc.toggle(true);
}
});*/

}

private void showPopUpOptionMenu(View v) {

}

@Override
public int getItemCount() {
    return structs.size();
}

class LessonShowViewHolder extends RecyclerView.ViewHolder {

String Id;
TextView Number, Name, FoldName, FoldDesc;
ImageView IMG, Like, Options;
Button Open;
FoldingCell fc;
FrameLayout FrameFold, FramNotFold;

LessonShowViewHolder(View itemView) {
    super(itemView);
    fc = itemView.findViewById(R.id.folding_cell);
    Number = itemView.findViewById(R.id.lesson_show_number);
    Name = itemView.findViewById(R.id.lesson_show_title);
    Like = itemView.findViewById(R.id.lesson_show_fav);
    Options = itemView.findViewById(R.id.lesson_show_more);
    IMG = itemView.findViewById(R.id.lesson_show_image);
    Open = itemView.findViewById(R.id.lesson_show_open);
    FoldDesc = itemView.findViewById(R.id.lesson_show_descc);
    FoldName = itemView.findViewById(R.id.lesson_show_tit);
    FrameFold = itemView.findViewById(R.id.cell_title_view);
    FramNotFold = itemView.findViewById(R.id.cell_content_view);
}

}
}`

java.lang.IllegalStateException: Content View height is too small

** i have added this to my project and implemented it with recyclerview**
error generate when i click on itemview
mainxml is pendingrequest_item.xml
`
<com.ramotion.foldingcell.FoldingCell xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:folding-cell="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
folding-cell:additionalFlipsCount="2"
folding-cell:animationDuration="1300"
folding-cell:backSideColor="@color/bgBackSideColor"
folding-cell:cameraHeight="30">

<include layout="@layout/pending_titleview" />

<include layout="@layout/pendingrequest_detail" />

</com.ramotion.foldingcell.FoldingCell>`

contentview.xml
`

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:scrollbarThumbVertical="@android:color/transparent"
    android:scrollbars="vertical">

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

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

            <ImageView
                android:id="@+id/car_image"
                android:layout_width="match_parent"
                android:layout_height="170dp"
                android:rotation="0"
                android:scaleType="centerInside"
                android:src="@drawable/car" />

            <TextView
                android:id="@+id/title"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="15dp"
                android:text="TexiGO"
                android:textColor="@color/black" />

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="10dp"
                android:text="Affordable,everyday rides"
                android:textColor="@color/black"
                android:textStyle="bold" />

            <View
                android:layout_width="match_parent"
                android:layout_height="1dp"
                android:layout_marginTop="1dp"
                android:background="@color/liner" />
        </LinearLayout>


        <LinearLayout
            android:id="@+id/linear_child1"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_below="@+id/linear"
            android:layout_marginTop="5dp"

            android:gravity="center_horizontal"
            android:orientation="vertical">

            <TableLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <TableRow
                    android:id="@+id/capacity_row"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_margin="0dp"
                    android:padding="10dp">

                    <TextView
                        android:id="@+id/capacity"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Capacity       "
                        android:textAppearance="?android:attr/textAppearanceSmall" />

                    <TextView
                        android:id="@+id/txt_capacity"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:maxLines="1"
                        android:text="1-4 Persons"
                        android:textAppearance="?android:attr/textAppearanceSmall" />

                </TableRow>

                <TableRow
                    android:id="@+id/basefare_row"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_margin="0dp"
                    android:padding="10dp">

                    <TextView
                        android:id="@+id/basefare"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Base Fare       "
                        android:textAppearance="?android:attr/textAppearanceSmall" />

                    <TextView
                        android:id="@+id/txt_basefare"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:maxLines="1"
                        android:text="5 $"
                        android:textAppearance="?android:attr/textAppearanceSmall" />

                </TableRow>

                <TableRow
                    android:id="@+id/pickuplocation_row"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_margin="0dp"
                    android:padding="10dp">

                    <TextView
                        android:id="@+id/pickuplocation"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Pickup Location       "
                        android:textAppearance="?android:attr/textAppearanceSmall" />

                    <TextView
                        android:id="@+id/txt_pickuplocation"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:maxLines="2"
                        android:text="W90th ,Newyork ,NY 10025"
                        android:textAppearance="?android:attr/textAppearanceSmall" />

                </TableRow>

                <TableRow
                    android:id="@+id/droplocation_row"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_margin="0dp"
                    android:padding="10dp">

                    <TextView
                        android:id="@+id/droplocation"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Drop Location       "
                        android:textAppearance="?android:attr/textAppearanceSmall" />

                    <TextView
                        android:id="@+id/txt_droplocation"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:maxLines="2"
                        android:text="46th Ave,Woodside Ny 11101"
                        android:textAppearance="?android:attr/textAppearanceSmall" />

                </TableRow>

                <TableRow
                    android:id="@+id/name_row"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_margin="0dp"
                    android:padding="10dp">

                    <TextView
                        android:id="@+id/name"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Name       "
                        android:textAppearance="?android:attr/textAppearanceSmall" />

                    <TextView
                        android:id="@+id/txt_drivername"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:maxLines="1"
                        android:text="John Doe"
                        android:textAppearance="?android:attr/textAppearanceSmall" />

                </TableRow>

                <TableRow
                    android:id="@+id/mobilenumber_row"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_margin="0dp"
                    android:padding="10dp">

                    <TextView
                        android:id="@+id/mobilenumber"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Mobile Number       "
                        android:textAppearance="?android:attr/textAppearanceSmall" />

                    <TextView
                        android:id="@+id/txt_mobilenumber"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:maxLines="1"
                        android:text="+919924580789"
                        android:textAppearance="?android:attr/textAppearanceSmall" />

                </TableRow>

                <TableRow
                    android:id="@+id/paymentstatus_row"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_margin="0dp"
                    android:padding="10dp">

                    <TextView
                        android:id="@+id/paymentstatus"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Payment Status       "
                        android:textAppearance="?android:attr/textAppearanceSmall" />

                    <TextView
                        android:id="@+id/txt_paymentstatus"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:maxLines="1"
                        android:text="NO STATUS"
                        android:textAppearance="?android:attr/textAppearanceSmall" />

                </TableRow>

            </TableLayout>

            <View
                android:layout_width="match_parent"
                android:layout_height="1dp"
                android:background="#DDE4E8" />
            <!--
                        <android.support.v7.widget.AppCompatButton
                            android:id="@+id/btn_accept"
                            style="@style/Base.TextAppearance.AppCompat.Widget.Button.Borderless.Colored"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_below="@+id/linear_child1"
                            android:layout_marginBottom="@dimen/detail_bottom_margin"
                            android:layout_marginTop="@dimen/detail_bottom_margin"
                            android:background="@drawable/detail_button"
                            android:text="ACCEPT" />

                        <android.support.v7.widget.AppCompatButton
                            android:id="@+id/btn_cancel"
                            style="@style/Base.TextAppearance.AppCompat.Widget.Button.Borderless.Colored"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_below="@+id/linear_child1"
                            android:layout_marginBottom="@dimen/detail_bottom_margin"
                            android:layout_marginTop="@dimen/detail_bottom_margin"
                            android:background="@drawable/detail_button"
                            android:text="CANCEL" />-->

            <LinearLayout
                android:layout_width="match_parent"

                android:layout_height="match_parent"
                android:layout_marginTop="@dimen/detail_bottom_margin"
                android:orientation="horizontal"
                android:weightSum="2">

                <android.support.v7.widget.AppCompatButton

                    android:id="@+id/btn_accept"
                    style="@style/Base.TextAppearance.AppCompat.Widget.Button.Borderless.Colored"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/linear_child1"
                    android:layout_marginEnd="@dimen/five_dp"
                    android:layout_marginRight="@dimen/five_dp"
                    android:layout_weight="1"
                    android:background="@drawable/ripple_effect"
                    android:text="ACCEPT" />

                <android.support.v7.widget.AppCompatButton

                    android:id="@+id/btn_cancel"
                    style="@style/Base.TextAppearance.AppCompat.Widget.Button.Borderless.Colored"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/linear_child1"
                    android:layout_marginBottom="@dimen/detail_bottom_margin"
                    android:layout_marginLeft="@dimen/five_dp"
                    android:layout_marginStart="@dimen/five_dp"
                    android:layout_weight="1"
                    android:background="@drawable/ripple_effect"
                    android:text="CANCEL" />
            </LinearLayout>
        </LinearLayout>
    </RelativeLayout>
</ScrollView>
` **titleview.xml** `
<android.support.v7.widget.CardView

    android:id="@+id/cardView"
    app:cardBackgroundColor="@color/colorPrimary"
    app:cardCornerRadius="10dp"
    app:cardPreventCornerOverlap="false"
    app:cardUseCompatPadding="true"
    app:contentPadding="0dp"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_margin="5dp">

    <RelativeLayout

        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginLeft="6dp"
        android:background="@color/white">

        <RelativeLayout
            android:id="@+id/relative_parent"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/five"
                android:orientation="horizontal"
                android:weightSum="0">

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentLeft="true"
                    android:layout_toLeftOf="@+id/img_arrow"
                    android:orientation="vertical">


                    <TextView
                        android:id="@+id/from"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_gravity="left|start"
                        android:layout_marginLeft="5dp"
                        android:layout_marginStart="5dp"
                        android:gravity="left|start"
                        android:text="FROM" />

                    <TextView
                        android:id="@+id/txt_from_add"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentLeft="true"
                        android:layout_gravity="left|start"
                        android:layout_marginLeft="5dp"
                        android:layout_marginStart="5dp"
                        android:layout_weight="1"
                        android:gravity="left|start"
                        android:maxLines="1"
                        android:padding="1dp"
                        android:text="NewYork NY 10025" />

                </LinearLayout>


                <ImageView
                    android:id="@+id/img_arrow"
                    android:layout_width="@dimen/arrow"
                    android:layout_height="@dimen/arrow"
                    android:layout_centerInParent="true"
                    android:layout_gravity="center"
                    android:layout_marginBottom="@dimen/five_dp"
                    android:src="@drawable/arrow1" />

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentRight="true"
                    android:layout_toRightOf="@+id/img_arrow"
                    android:orientation="vertical">

                    <TextView
                        android:id="@+id/to"
                        tools:gravity="right|end"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginEnd="5dp"
                        android:layout_marginRight="5dp"
                        android:gravity="right|end"
                        android:text="TO" />


                    <TextView
                        android:id="@+id/txt_to_add"
                        tools:gravity="right|end"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_alignParentRight="true"
                        android:layout_marginEnd="5dp"
                        android:layout_marginRight="5dp"
                        android:layout_weight="1"
                        android:gravity="right|end"
                        android:maxLines="1"
                        android:padding="1dp"
                        android:text="Wooside NY 11104" />
                </LinearLayout>


            </RelativeLayout>


        </RelativeLayout>

        <View
            android:id="@+id/view"
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:layout_below="@+id/relative_parent"
            android:background="@android:color/darker_gray" />


        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/view"
            android:layout_marginTop="@dimen/five"
            android:orientation="horizontal"
            android:weightSum="0">

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_toLeftOf="@+id/img"
                android:orientation="vertical">

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


                    <TextView
                        android:id="@+id/datee"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_alignParentLeft="true"
                        android:layout_gravity="left|start"
                        android:layout_marginLeft="5dp"
                        android:layout_marginStart="5dp"
                        android:gravity="left|start"
                        android:padding="1dp"
                        android:text="DATE" />

                    <TextView
                        android:id="@+id/time"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_alignParentLeft="true"
                        android:layout_gravity="left|start"
                        android:layout_marginLeft="5dp"
                        android:layout_marginStart="5dp"
                        android:gravity="left|start"
                        android:padding="1dp"
                        android:text="TIME"
                        android:textStyle="bold" />
                </LinearLayout>

                <TextView
                    android:id="@+id/date"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentLeft="true"
                    android:layout_gravity="left|start"
                    android:layout_marginLeft="5dp"
                    android:layout_marginStart="5dp"
                    android:gravity="left|start"
                    android:padding="1dp"
                    android:text="March 7th,2017" />
            </LinearLayout>


            <View
                android:id="@+id/img"
                android:layout_width="@dimen/arrow"
                android:layout_height="@dimen/arrow"
                android:layout_centerInParent="true"
                android:layout_gravity="center"
                android:padding="@dimen/five"

                android:src="@drawable/arrow1" />

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:layout_toRightOf="@+id/img"
                android:orientation="vertical">

                <TextView
                    android:id="@+id/drivername"
                    tools:gravity="right|end"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"

                    android:layout_alignParentRight="true"
                    android:layout_marginEnd="5dp"

                    android:layout_marginRight="5dp"
                    android:gravity="right|end"
                    android:padding="1dp"
                    android:text="CUSTOMER NAME" />


                <TextView
                    tools:gravity="right|end"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_alignParentRight="true"

                    android:layout_marginEnd="5dp"
                    android:layout_marginRight="5dp"

                    android:gravity="right|end"
                    android:padding="1dp"
                    android:text="CUSTOMER NAME"
                    android:visibility="invisible" />


                <TextView
                    android:id="@+id/txt_drivername"
                    tools:gravity="right|end"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_alignParentRight="true"
                    android:layout_marginEnd="5dp"
                    android:layout_marginRight="5dp"
                    android:layout_toRightOf="@+id/date"
                    android:gravity="right|end"
                    android:padding="1dp"
                    android:text="John Doe"
                    android:textStyle="bold" />
            </LinearLayout>


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

`

above i have posted three xml file which are as main.xml (to hold items of recyclerview)
pending_titleview is title view which will shown to user at the begining when data gets binded
pendingrequest_detail is the contentview which is not visible to user at the begining and will be shown to user when the user click on

adapter.class
`package "";

public class PendingRequestAdapter extends RecyclerView.Adapter<PendingRequestAdapter.Holder> {
List list;
private HashSet unfoldedIndexes = new HashSet<>();

public PendingRequestAdapter(List<PendingRequestPojo> list) {
    this.list = list;
}

@Override
public Holder onCreateViewHolder(ViewGroup parent, int viewType) {


    return new Holder(LayoutInflater.from(parent.getContext()).inflate(R.layout.pendingrequest_item, parent, false));
}

@Override
public void onBindViewHolder(Holder holder, final int position) {
    final FoldingCell cell = (FoldingCell) holder.itemView;
    cell.setTag(holder);

    holder.from_add.setText(list.get(holder.getAdapterPosition()).getPickup_adress());
    holder.to_add.setText(list.get(holder.getAdapterPosition()).getDrop_address());
    holder.drivername.setText(list.get(holder.getAdapterPosition()).getUser_name());
    holder.time.setText(CheckConnection.getformattedTime(list.get(holder.getAdapterPosition()).getTime()));
    CheckConnection checkConnection = new CheckConnection();
    holder.date.setText(checkConnection.getCurrentDateInSpecificFormat(list.get(holder.getAdapterPosition()).getTime()));

    //details items setting datas

    holder.fare.setText(list.get(position).getAmount() + " $ ");
    holder.pickup_location.setText(list.get(holder.getAdapterPosition()).getPickup_adress());
    holder.drop_location.setText(list.get(holder.getAdapterPosition()).getDrop_address());
    holder.drivername1.setText(list.get(holder.getAdapterPosition()).getUser_name());
    holder.mobilenumber.setText(list.get(holder.getAdapterPosition()).getUser_mobile());
    if (list.get(holder.getAdapterPosition()).getPayment_status().equals("") || !list.get(holder.getAdapterPosition()).getPayment_status().equals("")) {
        holder.payment_status.setText(list.get(holder.getAdapterPosition()).getPayment_status());
    } else {
        holder.payment_status.setText("UNPAID");
    }
    if (unfoldedIndexes.contains(position)) {
        cell.unfold(true);
    } else {
        cell.fold(true);
    }
    holder = (Holder) cell.getTag();


    holder.itemView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {


            //((FoldingCell) v).toggle(false);
            // register in adapter that state for selected cell is toggled
            try {
                cell.toggle(false);
                registerToggle(position);

            } catch (Exception e) {
                Log.e("catch", e.toString());

            }

        }
    });
    BookFont(holder, holder.f);
    BookFont(holder, holder.t);
    BookFont(holder, holder.dn);
    BookFont(holder, holder.dt);

    MediumFont(holder, holder.from_add);
    MediumFont(holder, holder.to_add);
    MediumFont(holder, holder.date);


}

public void registerToggle(int position) {
    if (unfoldedIndexes.contains(position))
        registerFold(position);
    else
        registerUnfold(position);
}

public void registerFold(int position) {
    unfoldedIndexes.remove(position);
}

public void registerUnfold(int position) {
    unfoldedIndexes.add(position);
}


@Override
public int getItemCount() {
    return list.size();
}

public class Holder extends RecyclerView.ViewHolder {

    AppCompatButton acceptButton, cancelButton;
    TextView t1, t2, t3, t4, t5, faret6 t7;
    TextView t8, t9, t10, t11, t12;
    TextView f, t, dn, dt;

    public Holder(View itemView) {
        super(itemView);

        ////pendinfg details views intializations

        t1 = (TextView) itemView.findViewById(R.id.t1);
        t2 = (TextView) itemView.findViewById(R.id.t2);
        t3 = (TextView) itemView.findViewById(R.id.t3);
        t4 = (TextView) itemView.findViewById(R.id.t4);
        t5 = (TextView) itemView.findViewById(R.id.t5);
        t6 = (TextView) itemView.findViewById(R.id.t6);
        t7 = (TextView) itemView.findViewById(R.id.t7);
        t8 = (AppCompatButton) itemView.findViewById(R.id.t8);
        t9 = (AppCompatButton) itemView.findViewById(R.id.t9);

        f = (TextView) itemView.findViewById(R.id.from);
        t = (TextView) itemView.findViewById(R.id.to);

        dn = (TextView) itemView.findViewById(R.id.drivername);
        dt = (TextView) itemView.findViewById(R.id.datee);
		
        t10 = (TextView) itemView.findViewById(R.id.t10);
        t11 = (TextView) itemView.findViewById(R.id.t11);
        t12 = (TextView) itemView.findViewById(R.id.t12);
        t13 = (TextView) itemView.findViewById(R.id.t13);
        t14 = (TextView) itemView.findViewById(R.id.t14);


    }

}



public void BookFont(Holder holder, TextView view1) {
    Typeface font1 = Typeface.createFromAsset(holder.itemView.getContext().getAssets(), "font/font1.otf");
    view1.setTypeface(font1);
}

public void MediumFont(Holder holder, TextView view) {
    Typeface font = Typeface.createFromAsset(holder.itemView.getContext().getAssets(), "font/font2.otf");
    view.setTypeface(font);
}

public interface DetailClick {

    void onclick(Bundle bundle);
}

}
`
main class(i set adapter)

PendingRequestAdapter pendingRequestAdapter = new PendingRequestAdapter(list); recyclerView.setAdapter(pendingRequestAdapter); pendingRequestAdapter.notifyDataSetChanged();

Item strange scroll

Hello there!

I have a problem when I unfold my items. If the items are in the lower half of the screen there is no problem, but if the items are in the upper half of the screen, the item "auto scroll" to keep the position.

Check this gif:
nzbvi1a

https://i.imgur.com/NzbVI1A.gifv

i get this error : java.lang.IllegalStateException: Additional flips count is too small

Process: sinadalvand.a30nama.co.a30nama, PID: 4943 java.lang.IllegalStateException: Additional flips count is too small at com.ramotion.foldingcell.FoldingCell.calculateHeightsForAnimationParts(FoldingCell.java:292) at com.ramotion.foldingcell.FoldingCell.unfold(FoldingCell.java:134) at com.ramotion.foldingcell.FoldingCell.toggle(FoldingCell.java:224) at sinadalvand.a30nama.co.a30nama.Recycle.PostPageRecycleAdapter$DownloadHolder$3.onItemClick(PostPageRecycleAdapter.java:134)

i use this list view in Recycle view when i touch card i receive this error .

what is this meaning?

The first flip is very big.

Thanks for great work
I run the demo on my galaxy s6 edge with Android 6
the first flip is very big. it takes the whole screen. it is not like the gif displayed in repository where flip size should match displayed layout size.
the only parameter to configure is "cell:additionalFlipsCount" which control additional flips. my issue with first flip size

Pass info throw a listener

I'm trying to pass a info contained on the item (like price) to a new activity when press the Request button, so i need get first the info using something like "items.get(i).getBoxID()" the problem is when i do
for(int i = 0; i< items.size(); i++) {
final ArrayList idboxes = new ArrayList<>();
final int finalI = i;
items.get(i).setRequestBtnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                Toast.makeText(getApplicationContext(), "CUSTOM HANDLER FOR FIRST BUTTON", Toast.LENGTH_SHORT).show();
                System.out.println(items.get(i).getBoxID());
            }
        });

}

on the println there is a error with the i variable the code need to be final but that doesn't do what i need
any idea?

folding does not work, if i use switch or toggle switch

Dear sir,
I use your example of folding list view. If i put a switch on title view then it does not unfold at all. You are using textview as button in your code. Sir but i need to use switch or toggle. help me please.
thank you,
Khemraj
I am using title layout code as below:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/title_layout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/content_layout"
    android:background="@color/bgContent"
    android:baselineAligned="false"
    android:orientation="horizontal"
    android:visibility="visible">

    <!-- LEFT TITLE PART -->
    <!-- min 130 max 250 -->
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:background="@color/colorPrimary"
        android:orientation="horizontal"
        android:paddingBottom="5dp"
        android:paddingLeft="5dp"
        android:paddingRight="5dp"
        android:paddingTop="5dp">

        <TextView
            android:id="@+id/name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:layout_weight="5"
            android:text="KHEMRAJ SHARMA"
            android:textColor="@android:color/white"
            android:textSize="20sp" />

        <Switch
            android:id="@+id/switch_mlatch"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_gravity="center_vertical"
            android:layout_weight="1"
             />


    </LinearLayout>
</LinearLayout>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.