Class DynamicScrollUtils

java.lang.Object
com.pranavpandey.android.dynamic.support.util.DynamicScrollUtils

@RestrictTo(LIBRARY_GROUP) public final class DynamicScrollUtils extends Object
Helper class to set EdgeEffect or glow color and scroll bar color for the supported views dynamically by using reflection. It will be used to match the color with the app's theme.
  • Constructor Details

    • DynamicScrollUtils

      public DynamicScrollUtils()
  • Method Details

    • getNavigationMenuView

      @Nullable public static com.google.android.material.internal.NavigationMenuView getNavigationMenuView(@Nullable NavigationView view)
      Returns the navigation menu view associated with the supplied navigation view.
      Parameters:
      view - The navigation view to be used.
      Returns:
      The navigation menu view associated with the supplied navigation view.
    • setEdgeEffectColor

      public static void setEdgeEffectColor(@Nullable NavigationView view, @ColorInt int color)
      Set the edge effect or glow color for the navigation view.
      Parameters:
      view - The navigation view to be used.
      color - The color to be set.
    • setEdgeEffectColor

      public static void setEdgeEffectColor(@Nullable AbsListView view, @ColorInt int color)
      Set the edge effect or glow color for the list view.
      Parameters:
      view - The list view to be used.
      color - The color to be set.
    • setEdgeEffectColor

      public static void setEdgeEffectColor(@Nullable RecyclerView view, @ColorInt int color)
      Set the edge effect or glow color for the recycler view.
      Parameters:
      view - The recycler view to be used.
      color - The color to be set.
    • setEdgeEffectColor

      public static void setEdgeEffectColor(@Nullable RecyclerView view, @ColorInt int color, @Nullable RecyclerView.OnScrollListener scrollListener)
      Set the edge effect or glow color for the recycler view.
      Parameters:
      view - The recycler view to be used.
      color - The color to be set.
      scrollListener - The scroll listener to set the color on over scroll.
    • setEdgeEffectColor

      public static void setEdgeEffectColor(@Nullable ScrollView view, @ColorInt int color)
      Set the edge effect or glow color for the scroll view.
      Parameters:
      view - The scroll view to be used.
      color - The color to be set.
    • setEdgeEffectColor

      public static void setEdgeEffectColor(@Nullable HorizontalScrollView view, @ColorInt int color)
      Set the edge effect or glow color for the horizontal scroll view.
      Parameters:
      view - The horizontal scroll view to be used.
      color - The color to be set.
    • setEdgeEffectColor

      public static void setEdgeEffectColor(@Nullable NestedScrollView view, @ColorInt int color)
      Set the edge effect or glow color for the nested scroll view.
      Parameters:
      view - The nested scroll view to be used.
      color - The color to be set.
    • setEdgeEffectColor

      public static void setEdgeEffectColor(@Nullable ViewPager view, @ColorInt int color)
      Set the edge effect or glow color for the view pager.
      Parameters:
      view - The view pager to be used.
      color - The color to be set.
    • setEdgeEffectColor

      public static void setEdgeEffectColor(@Nullable Object edgeEffect, @ColorInt int color)
      Set color of the supplied edge effect object.
      Parameters:
      edgeEffect - The edge effect object to be used.
      color - The color to be set.
    • setScrollBarColor

      public static void setScrollBarColor(@Nullable View view, @ColorInt int color, boolean drawable, float cornerSize)
      Set the scroll bar color for the view.
      Parameters:
      view - The view to be used.
      color - The color to be set.
      drawable - true to set the thumb drawable.
      cornerSize - The corner size to be considered in dips.
    • setScrollBarColor

      public static void setScrollBarColor(@Nullable View view, @ColorInt int color)
      Set the scroll bar color for the view.
      Parameters:
      view - The view to be used.
      color - The color to be set.
      See Also:
    • setScrollBarColor

      public static void setScrollBarColor(@Nullable NavigationView view, @ColorInt int color)
      Set the scroll bar color for the navigation view.
      Parameters:
      view - The navigation view to be used.
      color - The color to be set.
    • setSelectorColor

      public static void setSelectorColor(@Nullable AbsListView view, @ColorInt int color, @ColorInt int background)
      Set the selector color for the list view.
      Parameters:
      view - The list view to be used.
      color - The selector color to be set.
      background - The background color to be used.
    • setSubHeaderColor

      public static void setSubHeaderColor(@Nullable NavigationView view, @ColorInt int color)
      Set the sub header color for the view.
      Parameters:
      view - The navigation view to be used.
      color - The color to be set.
    • tint

      public static <T> void tint(@Nullable T view, @ColorInt int contrastWithColor)
      Tint view according to the supplied contrast with color.
      Type Parameters:
      T - The type of the view.
      Parameters:
      view - The scrollable to be tinted.
      contrastWithColor - The contrast with color to be considered.
      See Also: