public class ThemeHelper
extends java.lang.Object
| Constructor and Description |
|---|
ThemeHelper(android.content.Context context,
int globalTheme,
int phoneTheme,
int tabletTheme)
Creates a new helper class, which allows to retrieve resources, depending on a tab switcher's
theme.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getColor(Layout layout,
int resourceId)
Returns the color, which corresponds to a specific theme attribute, regarding the theme,
which is used when using a specific layout.
|
android.content.res.ColorStateList |
getColorStateList(Layout layout,
int resourceId)
Returns the color state list, which corresponds to a specific theme attribute, regarding the
theme, which is used when using a specific layout.
|
android.graphics.drawable.Drawable |
getDrawable(Layout layout,
int resourceId)
Returns the drawable, which corresponds to a specific theme attribute, regarding the
theme, which is used when using a specific layout.
|
int |
getInteger(Layout layout,
int resourceId,
int defaultValue)
Returns the integer value, which corresponds to a specific theme attribute, regarding the
theme, which is used when using a specific layout.
|
int |
getResourceId(Layout layout,
int resourceId,
int defaultValue)
Returns the resource id, which corresponds to a specific theme attribute, regarding the
theme, which is used when using a specific layout.
|
java.lang.CharSequence |
getText(Layout layout,
int resourceId)
Returns the text, which corresponds to a specific theme attribute, regarding the theme, which
is used when using a specific layout.
|
int |
getThemeResourceId(Layout layout)
Returns the resource id of the theme, which is used when using a specific layout.
|
public ThemeHelper(android.content.Context context,
int globalTheme,
int phoneTheme,
int tabletTheme)
context - The context, which is used by the tab switcher, as an instance of the class Context. The context may not be nullglobalTheme - The resource id of the theme, which should be used regardless of the used layout, as
an Integer value or 0, if the theme is not specifiedphoneTheme - The resource id of the theme, which should be used, when using the smartphone layout,
as an Integer value or 0, if the theme is not specifiedtabletTheme - The resource id of the theme, which should be used, when using the tablet layout, as
an Integer value or 0, if the theme is not specifiedpublic final int getThemeResourceId(Layout layout)
layout - The layout as a value of the enum Layout. The layout may not be nullInteger valuepublic int getColor(Layout layout, int resourceId)
layout - The layout as a value of the enum Layout. The layout may not be nullresourceId - The resource id of the theme attribute, the color should be obtained from, as an
Integer value. The resource id must correspond to a valid theme attributeInteger valuepublic android.content.res.ColorStateList getColorStateList(Layout layout, int resourceId)
layout - The layout as a value of the enum Layout. The layout may not be nullresourceId - The resource id of the theme attribute, the color state list should be obtained from,
as an Integer value. The resource id must correspond to a valid theme
attributeColorStateListpublic android.graphics.drawable.Drawable getDrawable(Layout layout, int resourceId)
layout - The layout as a value of the enum Layout. The layout may not be nullresourceId - The resource id of the theme attribute, the drawable should be obtained from, as an
Integer value. The resource id must correspond to a valid theme attributeColorStateListpublic java.lang.CharSequence getText(Layout layout, int resourceId)
layout - The layout as a value of the enum Layout. The layout may not be nullresourceId - The resource id of the theme attribute, the text should be obtained from, as an
Integer value. The resource id must correspond to a valid theme attributeCharSequencepublic int getResourceId(Layout layout, int resourceId, int defaultValue)
layout - The layout as a value of the enum Layout. The layout may not be nullresourceId - The resource id of the theme attribute, the resource id should be obtained from, as
an Integer value. The resource id must correspond to a valid theme attributedefaultValue - The default value, which should be returned, if the given resource id is invalid, as
an Integer valueInteger valuepublic int getInteger(Layout layout, int resourceId, int defaultValue)
layout - The layout as a value of the enum Layout. The layout may not be nullresourceId - The resource id of the theme attribute, the integer value should be obtained from, as
an Integer value. The resource id must correspond to a valid theme attributedefaultValue - The default value, which should be returned, if the given resource id is invalid, as
an Integer valueInteger value