Download Latest Version Fix Constructor Not Found and Proguard Rules Addition source code.zip (295.4 kB)
Email in envelope

Get an email when there's a new version of PlaceHolderView

Home / 0.7.2
Name Modified Size InfoDownloads / Week
Parent folder
PlaceHolderView sort, Swipe Stack Head Callback, Fix Expand ChildView Order source code.tar.gz 2017-12-01 162.2 kB
PlaceHolderView sort, Swipe Stack Head Callback, Fix Expand ChildView Order source code.zip 2017-12-01 258.7 kB
README.md 2017-12-01 1.7 kB
Totals: 3 Items   422.6 kB 0

PlaceHolderView Sort

Now we can apply sort to the views added to the PlaceHolderView. This will refresh the views with new sort order.

Example: If the View Items added to the PlaceHolderView is of class ItemView, then we have to supply a Comparator that defines the comparison between the itemView objects. Here the itemView's title string is being compared for the sorting.

NOTE: Check item1 and item2 are of type ItemView for this example. This is required because any type of View Item class can be added into the PlaceHolderView

:::java
placeHolderView.sort(new Comparator<Object>() {
    @Override
    public int compare(Object item1, Object item2) {
        if (item1 instanceof ItemView && item2 instanceof ItemView) {
            ItemView view1 = (ItemView) item1;
            ItemView view2 = (ItemView) item2;
            return view1.getTitle().compareTo(view2.getTitle());
        }
        return 0;
    }
});

SwipeHead Callback

SwipePlaceHolderView will now provide SwipeHead annotation for callback when a card comes on top of the stack.

:::java
@SwipeHead
private void onSwipeHeadCard() {
    // do something when the card comes on the top
}

Example: In the below example link, the cards below the top card are blurred and when a card come on the top then it's blur removed. Link: TinderCard

ExpandabePlaceHolderView Reverse Add Fix

The child views were getting added in reverse order and hence it is fixed now.

Source: README.md, updated 2017-12-01