Class ViewConfiguration

java.lang.Object
icyllis.modernui.view.ViewConfiguration

public class ViewConfiguration extends Object
Contains methods to standard constants used in the UI for timeouts, sizes, and distances.
  • Field Details

    • SCROLL_BAR_SIZE

      public static final int SCROLL_BAR_SIZE
      Defines the width of the horizontal scrollbar and the height of the vertical scrollbar in dips
      See Also:
    • TOUCH_SLOP

      public static final int TOUCH_SLOP
      Distance a touch can wander before we think the user is scrolling in dips. Note that this value defined here is only used as a fallback by legacy/misbehaving applications that do not provide a Context for determining density/configuration-dependent values.
      See Also:
    • MIN_SCROLLBAR_TOUCH_TARGET

      public static final int MIN_SCROLLBAR_TOUCH_TARGET
      Defines the minimum size of the touch target for a scrollbar in dips
      See Also:
    • MINIMUM_FLING_VELOCITY

      public static final int MINIMUM_FLING_VELOCITY
      Minimum velocity to initiate a fling, as measured in dips per second
      See Also:
    • MAXIMUM_FLING_VELOCITY

      public static final int MAXIMUM_FLING_VELOCITY
      Maximum velocity to initiate a fling, as measured in dips per second
      See Also:
    • OVERSCROLL_DISTANCE

      public static final int OVERSCROLL_DISTANCE
      Max distance in dips to overscroll for edge effects
      See Also:
    • OVERFLING_DISTANCE

      public static final int OVERFLING_DISTANCE
      Max distance in dips to overfling for edge effects
      See Also:
    • HORIZONTAL_SCROLL_FACTOR

      public static final float HORIZONTAL_SCROLL_FACTOR
      Amount to scroll in response to a horizontal MotionEvent.ACTION_SCROLL event, in dips per axis value.
      See Also:
    • VERTICAL_SCROLL_FACTOR

      public static final float VERTICAL_SCROLL_FACTOR
      Amount to scroll in response to a vertical MotionEvent.ACTION_SCROLL event, in dips per axis value.
      See Also:
  • Method Details

    • get

      @NonNull public static ViewConfiguration get(@NonNull Context context)
      Returns a configuration for the specified visual Context. The configuration depends on various parameters of the Context, like the dimension of the display or the density of the display.
      Returns:
      the view configuration
    • getScrollBarFadeDuration

      public static int getScrollBarFadeDuration()
      Returns:
      Duration of the fade when scrollbars fade away in milliseconds
    • getScrollDefaultDelay

      public static int getScrollDefaultDelay()
      Returns:
      Default delay before the scrollbars fade in milliseconds
    • getPressedStateDuration

      public static int getPressedStateDuration()
      Returns:
      the duration in milliseconds of the pressed state in child components.
    • getLongPressTimeout

      public static int getLongPressTimeout()
      Returns:
      the duration in milliseconds before a press turns into a long press
    • getTapTimeout

      public static int getTapTimeout()
      Returns:
      the duration in milliseconds we will wait to see if a touch event is a tap or a scroll. If the user does not move within this interval, it is considered to be a tap.
    • getScaledScrollbarSize

      public int getScaledScrollbarSize()
      Returns:
      The width of the horizontal scrollbar and the height of the vertical scrollbar in pixels
    • getScaledEdgeSlop

      public int getScaledEdgeSlop()
      Returns:
      Inset in pixels to look for touchable content when the user touches the edge of the screen
    • getScaledFadingEdgeLength

      public int getScaledFadingEdgeLength()
      Returns:
      the length of the fading edges in pixels
    • getScaledTouchSlop

      public int getScaledTouchSlop()
      Returns:
      Distance in pixels a touch can wander before we think the user is scrolling
    • getScaledHoverSlop

      public int getScaledHoverSlop()
      Returns:
      Distance in pixels a hover can wander while it is still considered "stationary".
    • getScaledMinScrollbarTouchTarget

      public int getScaledMinScrollbarTouchTarget()
      Returns:
      the minimum size of the scrollbar thumb's touch target in pixels
    • getScaledMinimumFlingVelocity

      public int getScaledMinimumFlingVelocity()
      Returns:
      Minimum velocity to initiate a fling, as measured in pixels per second.
    • getScaledMaximumFlingVelocity

      public int getScaledMaximumFlingVelocity()
      Returns:
      Maximum velocity to initiate a fling, as measured in pixels per second.
    • getScaledOverscrollDistance

      public int getScaledOverscrollDistance()
      Returns:
      The maximum distance a View should overscroll by when showing edge effects (in pixels).
    • getScaledOverflingDistance

      public int getScaledOverflingDistance()
      Returns:
      The maximum distance a View should overfling by when showing edge effects (in pixels).
    • getScaledVerticalScrollFactor

      public float getScaledVerticalScrollFactor()
      Returns:
      Amount to scroll in response to a vertical MotionEvent.ACTION_SCROLL event. Multiply this by the event's axis value to obtain the number of pixels to be scrolled.
    • getScaledHorizontalScrollFactor

      public float getScaledHorizontalScrollFactor()
      Returns:
      Amount to scroll in response to a horizontal MotionEvent.ACTION_SCROLL event. Multiply this by the event's axis value to obtain the number of pixels to be scrolled.
    • getLongPressTooltipHideTimeout

      @Internal public static int getLongPressTooltipHideTimeout()
      Returns:
      the duration in milliseconds before an end of a long press causes a tooltip to be hidden
    • getHoverTooltipShowTimeout

      @Internal public static int getHoverTooltipShowTimeout()
      Returns:
      the duration in milliseconds before a hover event causes a tooltip to be shown
    • getHoverTooltipHideTimeout

      @Internal public static int getHoverTooltipHideTimeout()
      Returns:
      the duration in milliseconds before mouse inactivity causes a tooltip to be hidden.