AleSpero / ExpandableCardView

Simple expandable CardView for Android.
Apache License 2.0
689 stars 88 forks source link

Added data binding support. #38

Open OtherOfIce opened 5 years ago

OtherOfIce commented 5 years ago

Added a function to the view that allows for databinding to be setup without exposing the view.

https://developer.android.com/topic/libraries/data-binding/

mblasi commented 5 years ago

Hi! I need bind some values to the inner_view, but don't understand how to use it.. I have my ExpandableCardView in a fragment layout, and the inner_view is another layout, with a custom Where is supposed I should bind the value to that variable? I tried to do it in the fragment onCreateView, as docs says, but the resulting view inside the expandablecard, doesn't have it.

I can't figure it out from here

Regards!

mblasi commented 5 years ago

It worked for me! I could catch the syntax for java! Thxs!

        FragmentStartBinding generalFragment = DataBindingUtil.inflate(inflater, R.layout.fragment_start, container, false);

        GeneralLayoutBinding generalLayoutBinding = generalFragment.generalCard.BindToInnerView();
JavaDeveloper08 commented 4 years ago

Hi Mblasi,

I need binding mechanism for expandable card View.

I am using as Java Library, Please would you share ExpandableCardView.java class ?

I couldn't implement data binding.

In layout file, I have 2 expandable cardview like that. How can I use databinding for innerviews.

<com.alespero.expandablecardview.ExpandableCardView android:id="@+id/exampleCardView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="20dp" android:layout_marginRight="20dp" android:layout_marginTop="20dp" android:layout_marginBottom="10dp" app:title="ExpandableCardView1" android:textStyle="bold" app:inner_view="@layout/example1" app:titleColor="@color/colorPrimaryDark" app:headerBackgroundColor="@color/md_blue_100" app:expandOnClick="true" tools:ignore="MissingConstraints" />

    <com.alespero.expandablecardview.ExpandableCardView
    android:id="@+id/exampleCardView2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginLeft="20dp"
    android:layout_marginRight="20dp"
    android:layout_marginTop="10dp"
    android:layout_marginBottom="10dp"
    app:title="ExpandableCardView2"
    android:textStyle="bold"
    app:inner_view="@layout/example2"
    app:titleColor="@color/colorPrimaryDark"
    app:headerBackgroundColor="@color/md_blue_100"
    app:expandOnClick="true"
    tools:ignore="MissingConstraints" />

Thanks.