Class SmartUtil

  • All Implemented Interfaces:

    
    public class SmartUtil
    
                        

    SmartUtil.

    • 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) Determine whether the content can be refreshed.
      static boolean canLoadMore(View targetView, PointF touch, boolean contentFull) Determine whether the content view can load more.
      static boolean isTransformedTouchPointInView(View group, View child, float x, float y, PointF outLocalPoint)
      static int dp2px(float dpValue) Convert dp to px based on device resolution.
      static float px2dp(int pxValue) Convert px to dp based on device resolution.
      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)

        Determine whether the content can be refreshed.

        Parameters:
        targetView - Content view
        touch - Touch event position
        Returns:

        Whether refresh is possible

      • canLoadMore

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

        Determine whether the content view can load more.

        Parameters:
        targetView - Content view
        touch - Touch event position
        contentFull - Whether content fills the page (when not full, auto-determined via canScrollUp)
        Returns:

        Whether refresh is possible

      • isTransformedTouchPointInView

         static boolean isTransformedTouchPointInView(View group, 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