Class SystemBarTintManager
-
- All Implemented Interfaces:
public class SystemBarTintManager
Class to manage status and navigation bar tint effects when using KitKat translucent system UI modes.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public class
SystemBarTintManager.SystemBarConfig
Class which describes system bar sizing and other characteristics for the current device configuration.
-
Field Summary
Fields Modifier and Type Field Description public final static int
DEFAULT_TINT_COLOR
-
Constructor Summary
Constructors Constructor Description SystemBarTintManager(Activity activity)
Constructor.
-
Method Summary
Modifier and Type Method Description void
setNavigationBarTintEnabled(boolean enabled)
Enable tinting of the system navigation bar. void
setTintColor(int color)
Apply the specified color tint to all system UI bars. void
setTintResource(int res)
Apply the specified drawable or color resource to all system UI bars. void
setTintDrawable(Drawable drawable)
Apply the specified drawable to all system UI bars. void
setTintAlpha(float alpha)
Apply the specified alpha to all system UI bars. void
setStatusBarTintColor(int color)
Apply the specified color tint to the system status bar. void
setStatusBarTintResource(int res)
Apply the specified drawable or color resource to the system status bar. void
setStatusBarTintDrawable(Drawable drawable)
Apply the specified drawable to the system status bar. void
setStatusBarAlpha(float alpha)
Apply the specified alpha to the system status bar. void
setNavigationBarTintColor(int color)
Apply the specified color tint to the system navigation bar. void
setNavigationBarTintResource(int res)
Apply the specified drawable or color resource to the system navigation bar. void
setNavigationBarTintDrawable(Drawable drawable)
Apply the specified drawable to the system navigation bar. void
setNavigationBarAlpha(float alpha)
Apply the specified alpha to the system navigation bar. SystemBarTintManager.SystemBarConfig
getConfig()
Get the system bar configuration. boolean
isStatusBarTintEnabled()
Is tinting enabled for the system status bar? void
setStatusBarTintEnabled(boolean enabled)
Enable tinting of the system status bar. boolean
isNavBarTintEnabled()
Is tinting enabled for the system navigation bar? -
-
Method Detail
-
setNavigationBarTintEnabled
void setNavigationBarTintEnabled(boolean enabled)
Enable tinting of the system navigation bar.
If the platform does not have soft navigation keys, is running Jelly Bean or earlier, or translucent system UI modes have not been enabled in either the theme or via window flags, then this method does nothing.
- Parameters:
enabled
- True to enable tinting, false to disable it (default).
-
setTintColor
void setTintColor(int color)
Apply the specified color tint to all system UI bars.
- Parameters:
color
- The color of the background tint.
-
setTintResource
void setTintResource(int res)
Apply the specified drawable or color resource to all system UI bars.
- Parameters:
res
- The identifier of the resource.
-
setTintDrawable
void setTintDrawable(Drawable drawable)
Apply the specified drawable to all system UI bars.
- Parameters:
drawable
- The drawable to use as the background, or null to remove it.
-
setTintAlpha
void setTintAlpha(float alpha)
Apply the specified alpha to all system UI bars.
- Parameters:
alpha
- The alpha to use
-
setStatusBarTintColor
void setStatusBarTintColor(int color)
Apply the specified color tint to the system status bar.
- Parameters:
color
- The color of the background tint.
-
setStatusBarTintResource
void setStatusBarTintResource(int res)
Apply the specified drawable or color resource to the system status bar.
- Parameters:
res
- The identifier of the resource.
-
setStatusBarTintDrawable
void setStatusBarTintDrawable(Drawable drawable)
Apply the specified drawable to the system status bar.
- Parameters:
drawable
- The drawable to use as the background, or null to remove it.
-
setStatusBarAlpha
void setStatusBarAlpha(float alpha)
Apply the specified alpha to the system status bar.
- Parameters:
alpha
- The alpha to use
-
setNavigationBarTintColor
void setNavigationBarTintColor(int color)
Apply the specified color tint to the system navigation bar.
- Parameters:
color
- The color of the background tint.
-
setNavigationBarTintResource
void setNavigationBarTintResource(int res)
Apply the specified drawable or color resource to the system navigation bar.
- Parameters:
res
- The identifier of the resource.
-
setNavigationBarTintDrawable
void setNavigationBarTintDrawable(Drawable drawable)
Apply the specified drawable to the system navigation bar.
- Parameters:
drawable
- The drawable to use as the background, or null to remove it.
-
setNavigationBarAlpha
void setNavigationBarAlpha(float alpha)
Apply the specified alpha to the system navigation bar.
- Parameters:
alpha
- The alpha to use
-
getConfig
SystemBarTintManager.SystemBarConfig getConfig()
Get the system bar configuration.
- Returns:
The system bar configuration for the current device configuration.
-
isStatusBarTintEnabled
boolean isStatusBarTintEnabled()
Is tinting enabled for the system status bar?
- Returns:
True if enabled, False otherwise.
-
setStatusBarTintEnabled
void setStatusBarTintEnabled(boolean enabled)
Enable tinting of the system status bar.
If the platform is running Jelly Bean or earlier, or translucent system UI modes have not been enabled in either the theme or via window flags, then this method does nothing.
- Parameters:
enabled
- True to enable tinting, false to disable it (default).
-
isNavBarTintEnabled
boolean isNavBarTintEnabled()
Is tinting enabled for the system navigation bar?
- Returns:
True if enabled, False otherwise.
-
-
-
-