Class SmartUtil

  • All Implemented Interfaces:

    
    public class SmartUtil
    
                        

    SmartUtil Created by scwang on 2018/3/5.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Constructor Summary

      Constructors 
      Constructor Description
      SmartUtil(int type)
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      static int measureViewHeight(View view)
      static void scrollListBy(AbsListView listView, int y)
      static boolean isScrollableView(View view)
      static boolean isContentView(View view)
      static void fling(View scrollableView, int velocity)
      static boolean canRefresh(View targetView, PointF touch) 判断内容是否可以刷新
      static boolean canLoadMore(View targetView, PointF touch, boolean contentFull) 判断内容视图是否可以加载更多
      static boolean isTransformedTouchPointInView(View group, View child, float x, float y, PointF outLocalPoint)
      static int dp2px(float dpValue) 根据手机的分辨率从 dp 的单位 转成为 px(像素)
      static float px2dp(int pxValue) 根据手机的分辨率从 px(像素) 的单位 转成为 dp
      float getInterpolation(float input)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SmartUtil

        SmartUtil(int type)
    • Method Detail

      • scrollListBy

         static void scrollListBy(AbsListView listView, int y)
      • fling

         static void fling(View scrollableView, int velocity)
      • canRefresh

         static boolean canRefresh(View targetView, PointF touch)

        判断内容是否可以刷新

        Parameters:
        targetView - 内容视图
        touch - 按压事件位置
        Returns:

        是否可以刷新

      • canLoadMore

         static boolean canLoadMore(View targetView, PointF touch, boolean contentFull)

        判断内容视图是否可以加载更多

        Parameters:
        targetView - 内容视图
        touch - 按压事件位置
        contentFull - 内容是否填满页面 (未填满时,会通过canScrollUp自动判断)
        Returns:

        是否可以刷新

      • isTransformedTouchPointInView

         static boolean isTransformedTouchPointInView(View group, View child, float x, float y, PointF outLocalPoint)
      • dp2px

         static int dp2px(float dpValue)

        根据手机的分辨率从 dp 的单位 转成为 px(像素)

        Parameters:
        dpValue - 虚拟像素
        Returns:

        像素

      • px2dp

         static float px2dp(int pxValue)

        根据手机的分辨率从 px(像素) 的单位 转成为 dp

        Parameters:
        pxValue - 像素
        Returns:

        虚拟像素