Skip to content

Commit

Permalink
Add support for host theme
Browse files Browse the repository at this point in the history
  • Loading branch information
pranavpandey committed Feb 7, 2022
1 parent bf404ad commit 8df9f88
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,7 @@
*/
@Retention(RetentionPolicy.SOURCE)
@StringDef(value = { Key.BRACKETS, Key.QUOTE, Key.SPLIT, Key.DARK,
Key.INVERSE, Key.SHARE, Key.SHARE_ALT, Key.RES, Key.WIDGET_ID,
Key.INVERSE, Key.SHARE, Key.SHARE_ALT, Key.HOST, Key.RES, Key.WIDGET_ID,
Key.BACKGROUND, Key.TINT_BACKGROUND, Key.SURFACE, Key.TINT_SURFACE,
Key.PRIMARY, Key.TINT_PRIMARY, Key.PRIMARY_DARK, Key.TINT_PRIMARY_DARK,
Key.ACCENT, Key.TINT_ACCENT, Key.ACCENT_DARK, Key.TINT_ACCENT_DARK,
Expand Down Expand Up @@ -957,6 +957,11 @@
*/
String SHARE_ALT = "dynamic-theme-alt";

/**
* Serialized name for the host.
*/
String HOST = "host";

/**
* Serialized name for the theme resource.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,28 @@

package com.pranavpandey.android.dynamic.theme.base;

import androidx.annotation.NonNull;

/**
* An interface to implement the base theme.
*
* @param <T> The type of the dynamic theme.
*/
public interface BaseTheme<T extends BaseTheme<T>> { }
public interface BaseTheme<T extends BaseTheme<T>> {

/**
* Returns whether this theme is host and can have child themes.
*
* @return {@code true} if this theme is host and can have child themes.
*/
boolean isHost();

/**
* Sets whether this theme is host and can have child themes.
*
* @param host {@code true} to set the theme as host.
*
* @return The {@link T} object to allow for chaining of calls to set methods.
*/
@NonNull T setHost(boolean host);
}

0 comments on commit 8df9f88

Please sign in to comment.