Skip to content

API reference

alexvasilkov edited this page May 11, 2014 · 4 revisions

Fold shading

You can implement custom fold shading using FoldShading interface, or you can use SimpleFoldShading (used by default) or GlanceFoldShading implementations.

GlanceFoldShading usage example:

Bitmap glance = ((BitmapDrawable) getResources().getDrawable(R.drawable.unfold_glance)).getBitmap();
mUnfoldableView.setFoldShading(new GlanceFoldShading(this, glance));

Note that setFoldShading() method should be called before setAdapter() (or before unfold() in case of UnfoldableView)

FoldableListLayout methods

Set up adapter:

setAdapter(BaseAdapter adapter)

Smooth scroll to item:

scrollToPosition(int index)

UnfoldableView methods

Start details view unfolding

unfold(View coverView, View detailsView)

Folding back from details view to cover view

foldBack()

Checking if unfolding animation is in place

isUnfolding()

Checking if folding back animation is in place

isFoldingBack()

Checking if details view is fully unfolded

isUnfolded()

Setting up folding listener

setOnFoldingListener(OnFoldingListener listener)

If your list adapter may be invalidated during details unfolding, you should ensure UnfoldableView is still using correct coverView. That mean you should find correct coverView (scrolling to it if necessary) and update UnfoldableView using:

changeCoverView(View coverView)

Folding listener

UnfoldableView.OnFoldingListener (or UnfoldableView.SimpleFoldingListener) provides next methods:

void onUnfolding(UnfoldableView unfoldableView);
void onUnfolded(UnfoldableView unfoldableView);
void onFoldingBack(UnfoldableView unfoldableView);
void onFoldedBack(UnfoldableView unfoldableView);
void onFoldProgress(UnfoldableView unfoldableView, float progress);

Where progress parameter changes from 0 (folded state, only cover view is visible) to 1 (unfolded state, only details view is visible).

Clone this wiki locally