Class SmartUtil
-
- All Implemented Interfaces:
-
android.animation.TimeInterpolator,android.view.animation.Interpolator
public class SmartUtil implements InterpolatorSmartUtil.
-
-
Field Summary
Fields Modifier and Type Field Description public static intINTERPOLATOR_VISCOUS_FLUIDpublic static intINTERPOLATOR_DECELERATE
-
Constructor Summary
Constructors Constructor Description SmartUtil(int type)
-
Method Summary
Modifier and Type Method Description static intmeasureViewHeight(View view)static voidscrollListBy(@NonNull() AbsListView listView, int y)static booleanisScrollableView(View view)static booleanisContentView(View view)static voidfling(View scrollableView, int velocity)static booleancanRefresh(@NonNull() View targetView, PointF touch)Determine whether the content can be refreshed. static booleancanLoadMore(@NonNull() View targetView, PointF touch, boolean contentFull)Determine whether the content view can load more. static booleanisTransformedTouchPointInView(@NonNull() View group, @NonNull() View child, float x, float y, PointF outLocalPoint)static intdp2px(float dpValue)Convert dp to px based on device resolution. static floatpx2dp(int pxValue)Convert px to dp based on device resolution. floatgetInterpolation(float input)-
-
Method Detail
-
measureViewHeight
static int measureViewHeight(View view)
-
scrollListBy
static void scrollListBy(@NonNull() AbsListView listView, int y)
-
isScrollableView
static boolean isScrollableView(View view)
-
isContentView
static boolean isContentView(View view)
-
fling
static void fling(View scrollableView, int velocity)
-
canRefresh
static boolean canRefresh(@NonNull() View targetView, PointF touch)
Determine whether the content can be refreshed.
- Parameters:
targetView- Content viewtouch- Touch event position- Returns:
Whether refresh is possible
-
canLoadMore
static boolean canLoadMore(@NonNull() View targetView, PointF touch, boolean contentFull)
Determine whether the content view can load more.
- Parameters:
targetView- Content viewtouch- Touch event positioncontentFull- Whether content fills the page (when not full, auto-determined via canScrollUp)- Returns:
Whether refresh is possible
-
isTransformedTouchPointInView
static boolean isTransformedTouchPointInView(@NonNull() View group, @NonNull() View child, float x, float y, PointF outLocalPoint)
-
dp2px
static int dp2px(float dpValue)
Convert dp to px based on device resolution.
- Parameters:
dpValue- Density-independent pixels- Returns:
Pixels
-
px2dp
static float px2dp(int pxValue)
Convert px to dp based on device resolution.
- Parameters:
pxValue- Pixels- Returns:
Density-independent pixels
-
getInterpolation
float getInterpolation(float input)
-
-
-
-