Profile cover photo
Profile photo
Aman Nepid
321 followers -
Break Some Rules ... Make Some Noise ... Stay Silly ... Stay Alive
Break Some Rules ... Make Some Noise ... Stay Silly ... Stay Alive

321 followers
About
Aman's posts

Post has shared content
#androidDev , The Design Support Library includes some great pre-built CoordinatorLayout Behaviors for free, like the SwypeToDismissBehavior<T> which is really easy to implement:

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_swipe_behavior);
    mCardView = (CardView) findViewById(R.id.swype_card);

    final SwipeDismissBehavior<CardView>
          swipe = new SwipeDismissBehavior();

    swipe.setSwipeDirection(
         SwipeDismissBehavior.SWIPE_DIRECTION_ANY);

    swipe.setListener(
         new SwipeDismissBehavior.OnDismissListener() {

         @Override
         public void onDismiss(View view) {
               Toast.makeText(Activity.this,
                      "Card swiped !!", Toast.LENGTH_SHORT).show();
         }
      );

      LayoutParams coordinatorParams =
           (LayoutParams) mCardView.getLayoutParams();

       coordinatorParams.setBehavior(swipe);
}
Animated Photo
Wait while more posts are being loaded