Type Parameters:
T - The type of the dynamic app theme this preview will handle.
All Implemented Interfaces:
Drawable.Callback, AccessibilityEventSource, KeyEvent.Callback, ViewManager, ViewParent, BaseWidget, DynamicTintWidget, DynamicWidget
Direct Known Subclasses:
DynamicRemoteThemePreview, DynamicThemePreview

public abstract class ThemePreview<T extends DynamicAppTheme> extends DynamicView
A DynamicView to show the theme preview according to the DynamicAppTheme.
  • Constructor Details

  • Method Details

    • onLoadAttributes

      protected void onLoadAttributes(@Nullable AttributeSet attrs)
      Description copied from class: DynamicView
      Load values from the supplied attribute set.
      Overrides:
      onLoadAttributes in class DynamicView
      Parameters:
      attrs - The attribute set to load the values.
    • onEnabled

      protected void onEnabled(boolean enabled)
      Description copied from class: DynamicView
      This method will be called whenever there is a change in the view state.

      Either enabled or disabled, other views like icon, title, color, etc. must be updated here to reflect the overall view state.

      Overrides:
      onEnabled in class DynamicView
      Parameters:
      enabled - true if this view is enabled and can receive click events.
    • getDefaultTheme

      @NonNull public abstract T getDefaultTheme()
      Returns the default dynamic theme used by this preview.
      Returns:
      The default dynamic theme used by this preview.
    • getDynamicTheme

      @NonNull public T getDynamicTheme()
      Get the dynamic theme used by this preview.
      Returns:
      The dynamic theme used by this preview.
    • setDynamicTheme

      public void setDynamicTheme(@NonNull T theme)
      Set the dynamic theme used by this preview.
      Parameters:
      theme - the dynamic theme to be set.
    • getDynamicThemeType

      public int getDynamicThemeType()
      Get the dynamic theme type used by this preview.
      Returns:
      The dynamic theme type used by this preview.
    • getBackgroundView

      @Nullable public View getBackgroundView()
      Description copied from class: DynamicView
      This method will be called to return the optional background view.

      It will be useful in tinting the background according to the contrast with color.

      Specified by:
      getBackgroundView in class DynamicView
      Returns:
      The optional background view.
    • getActionView

      @NonNull public abstract View getActionView()
      Returns the action view used by this preview.
      Returns:
      The action view used by this preview.
    • getOnActionClickListener

      @Nullable public View.OnClickListener getOnActionClickListener()
      Get the on click listener to receive action view click events.
      Returns:
      The on click listener to receive action view click events.
    • setOnActionClickListener

      public void setOnActionClickListener(@Nullable View.OnClickListener onActionClickListener)
      Set the on click listener for action view to receive the click events and to perform edit operation.
      Parameters:
      onActionClickListener - The on click listener to be set.