Skip to content

Swipe edge to exit

JingYeoh edited this page Aug 3, 2018 · 1 revision

Swipe edge to exit support for Activity/Fragment, the supported feature is below.

  • Support multi-edge to exit (top/left/right/bottom)
  • Option to config scrim
  • Option to config shadow
  • Option to config parallax
  • Support multi-Fragment
  • Support Activity

If you find the feature the Swiper does not support , please post issue

Usage

Add Swiper annotation on Activity/Fragment.

Note: Swiper Annotation can only used with Puppet.

@Swiper
@Puppet
public class TestFragment extends Fragment{
}

Swiper is support extend, the class can be swiped as the parent class is added Swiper annotation.

Params config

Support java code and Annotation params, the java code is

return function default describe
boolean enable() true Allow or not to exit Activity/Fragment by swipe edge.
SwipeEdge[] edgeSide() SwipeEdge.LEFT The edge that can be swiped.
float parallaxOffset() 1.0f Allow or not to show the parallax effect.
int scrimColor() black The scrim color as the view is swiping.
int scrimMaxAlpha() 128 The scrim max alpha.
int[] shadowDrawable() 0 The shadow drawable res for content view.
int shadowWidth 20 The shadow width.

You can set those params params by java code.

SwipeLayout swipeLayout = Rigger.getRigger(this).getSwipeLayout();
swipeLayout.setEnableSwipe();
// ...