public class SmartSwipe
extends java.lang.Object
SwipeConsumer
classic usage:
SmartSwipe.wrap(view) //specific the view to wrap
.addConsumer(new StretchConsumer()) // add consumer to consume swipe event
.enableVertical(); //enable consumer`s direction(s)
| 限定符和类型 | 类和说明 |
|---|---|
static interface |
SmartSwipe.IWrapperFactory |
| 构造器和说明 |
|---|
SmartSwipe() |
| 限定符和类型 | 方法和说明 |
|---|---|
static int |
dp2px(int dp,
android.content.Context context) |
static double |
ensureBetween(double origin,
double min,
double max) |
static float |
ensureBetween(float origin,
float min,
float max) |
static int |
ensureBetween(int origin,
int min,
int max) |
static SmartSwipeWrapper |
peekWrapperFor(android.app.Activity activity)
peek wrapper for the specific activity, return the origin
SmartSwipeWrapper if exists, else return null |
static SmartSwipeWrapper |
peekWrapperFor(android.view.View view)
get wrapper of the specific view
|
static void |
setFactory(SmartSwipe.IWrapperFactory factory)
set the factory of
SmartSwipeWrapper
by default, create the SmartSwipeWrapper instance to wrap if factory is null |
static void |
switchDirectionEnable(android.app.Activity activity,
boolean enable,
int direction) |
static void |
switchDirectionEnable(android.view.View view,
boolean enable,
int direction)
switch direction enable for all
SwipeConsumer that already added to the wrapper |
static SmartSwipeWrapper |
wrap(android.app.Activity activity)
wrap an activity
the content view is: android.R.id.content
|
static SmartSwipeWrapper |
wrap(android.app.Activity activity,
int viewId)
wrap a view in activity, view id is specified
if already wrapped, returns the original wrapper
|
static SmartSwipeWrapper |
wrap(android.view.View view)
wrap a view
|
public static SmartSwipeWrapper wrap(android.app.Activity activity)
activity - activitypublic static SmartSwipeWrapper peekWrapperFor(android.app.Activity activity)
SmartSwipeWrapper if exists, else return nullactivity - activitypublic static SmartSwipeWrapper wrap(android.app.Activity activity, int viewId)
activity - activityviewId - the id of view to be wrappedpublic static SmartSwipeWrapper wrap(android.view.View view)
view - the view to be wrappedpublic static SmartSwipeWrapper peekWrapperFor(android.view.View view)
view - view to find wrapperpublic static void switchDirectionEnable(android.view.View view,
boolean enable,
int direction)
SwipeConsumer that already added to the wrapperview - the view which be wrappedenable - true: to enable, false: to disabledirection - direction to enable or disablepublic static void switchDirectionEnable(android.app.Activity activity,
boolean enable,
int direction)
public static int dp2px(int dp,
android.content.Context context)
public static int ensureBetween(int origin,
int min,
int max)
public static float ensureBetween(float origin,
float min,
float max)
public static double ensureBetween(double origin,
double min,
double max)
public static void setFactory(SmartSwipe.IWrapperFactory factory)
SmartSwipeWrapper
by default, create the SmartSwipeWrapper instance to wrap if factory is nullfactory - the factorycreateNewWrapper(Context)