DevicePolicyResourcesManager
open class DevicePolicyResourcesManager
| kotlin.Any | |
| ↳ | android.app.admin.DevicePolicyResourcesManager |
Class containing required APIs to set, reset, and get device policy related resources.
Summary
| Public methods | |
|---|---|
| open Drawable? |
getDrawable(drawableId: String, drawableStyle: String, drawableSource: String, defaultDrawableLoader: Supplier<Drawable!>)Similar to |
| open Drawable? |
getDrawable(drawableId: String, drawableStyle: String, defaultDrawableLoader: Supplier<Drawable!>)Returns the appropriate updated drawable for the |
| open Icon? |
getDrawableAsIcon(drawableId: String, drawableStyle: String, defaultIcon: Icon?)Similar to |
| open Icon? |
getDrawableAsIcon(drawableId: String, drawableStyle: String, drawableSource: String, defaultIcon: Icon?)Similar to |
| open Drawable? |
getDrawableForDensity(drawableId: String, drawableStyle: String, density: Int, defaultDrawableLoader: Supplier<Drawable!>)Similar to |
| open Drawable? |
getDrawableForDensity(drawableId: String, drawableStyle: String, drawableSource: String, density: Int, defaultDrawableLoader: Supplier<Drawable!>)Similar to |
| open String? |
Returns the appropriate updated string for the |
| open String? |
Similar to |
Public methods
getDrawable
open fun getDrawable(
drawableId: String,
drawableStyle: String,
drawableSource: String,
defaultDrawableLoader: Supplier<Drawable!>
): Drawable?
Similar to getDrawable(java.lang.String,java.lang.String,java.util.function.Supplier), but also accepts a drawableSource which could result in returning a different drawable than getDrawable(java.lang.String,java.lang.String,java.util.function.Supplier) if an override was set for that specific source.
If drawableSource is DevicePolicyResources.UNDEFINED, it returns the appropriate string for drawableId and drawableStyle similar to getDrawable(java.lang.String,java.lang.String,java.util.function.Supplier).
Calls to this API will not return null unless no updated drawable was found and the call to defaultDrawableLoader returned null.
Callers should register for DevicePolicyManager.ACTION_DEVICE_POLICY_RESOURCE_UPDATED to get notified when a resource has been updated.
| Parameters | |
|---|---|
drawableId |
String: The drawable ID to get the updated resource for. This value cannot be null. |
drawableStyle |
String: The drawable style to use. This value cannot be null. |
drawableSource |
String: The source for the caller. This value cannot be null. |
defaultDrawableLoader |
Supplier<Drawable!>: To get the default drawable if no updated drawable was set for the provided params. This value cannot be null. |
getDrawable
open fun getDrawable(
drawableId: String,
drawableStyle: String,
defaultDrawableLoader: Supplier<Drawable!>
): Drawable?
Returns the appropriate updated drawable for the drawableId with style drawableStyle if one was set using setDrawables, otherwise returns the drawable from defaultDrawableLoader.
Also returns the drawable from defaultDrawableLoader if drawableId is DevicePolicyResources.UNDEFINED.
Calls to this API will not return null unless no updated drawable was found and the call to defaultDrawableLoader returned null.
This API uses the screen density returned from Resources.getConfiguration(), to set a different value use getDrawableForDensity(java.lang.String,java.lang.String,int,java.util.function.Supplier).
Callers should register for DevicePolicyManager.ACTION_DEVICE_POLICY_RESOURCE_UPDATED to get notified when a resource has been updated.
Note that each call to this API loads the resource from the package that called setDrawables to set the updated resource.
| Parameters | |
|---|---|
drawableId |
String: The drawable ID to get the updated resource for. This value cannot be null. |
drawableStyle |
String: The drawable style to use. This value cannot be null. |
defaultDrawableLoader |
Supplier<Drawable!>: To get the default drawable if no updated drawable was set for the provided params. This value cannot be null. |
getDrawableAsIcon
open fun getDrawableAsIcon(
drawableId: String,
drawableStyle: String,
defaultIcon: Icon?
): Icon?
Similar to getDrawable(java.lang.String,java.lang.String,java.util.function.Supplier) but returns an Icon instead of a Drawable.
| Parameters | |
|---|---|
drawableId |
String: The drawable ID to get the updated resource for. This value cannot be null. |
drawableStyle |
String: The drawable style to use. This value cannot be null. |
defaultIcon |
Icon?: Returned if no updated drawable was set for the provided params. This value may be null. |
| Return | |
|---|---|
Icon? |
This value may be null. |
getDrawableAsIcon
open fun getDrawableAsIcon(
drawableId: String,
drawableStyle: String,
drawableSource: String,
defaultIcon: Icon?
): Icon?
Similar to getDrawable(java.lang.String,java.lang.String,java.lang.String,java.util.function.Supplier) but returns an Icon instead of a Drawable.
| Parameters | |
|---|---|
drawableId |
String: The drawable ID to get the updated resource for. This value cannot be null. |
drawableStyle |
String: The drawable style to use. This value cannot be null. |
drawableSource |
String: The source for the caller. This value cannot be null. |
defaultIcon |
Icon?: Returned if no updated drawable was set for the provided params. This value may be null. |
| Return | |
|---|---|
Icon? |
This value may be null. |
getDrawableForDensity
open fun getDrawableForDensity(
drawableId: String,
drawableStyle: String,
density: Int,
defaultDrawableLoader: Supplier<Drawable!>
): Drawable?
Similar to getDrawable(java.lang.String,java.lang.String,java.util.function.Supplier), but also accepts density. See Resources.getDrawableForDensity(int, int, Resources.Theme).
Calls to this API will not return null unless no updated drawable was found and the call to defaultDrawableLoader returned null.
Callers should register for DevicePolicyManager.ACTION_DEVICE_POLICY_RESOURCE_UPDATED to get notified when a resource has been updated.
| Parameters | |
|---|---|
drawableId |
String: The drawable ID to get the updated resource for. This value cannot be null. |
drawableStyle |
String: The drawable style to use. This value cannot be null. |
density |
Int: The desired screen density indicated by the resource as found in DisplayMetrics. A value of 0 means to use the density returned from Resources.getConfiguration(). |
defaultDrawableLoader |
Supplier<Drawable!>: To get the default drawable if no updated drawable was set for the provided params. This value cannot be null. |
getDrawableForDensity
open fun getDrawableForDensity(
drawableId: String,
drawableStyle: String,
drawableSource: String,
density: Int,
defaultDrawableLoader: Supplier<Drawable!>
): Drawable?
Similar to getDrawable(java.lang.String,java.lang.String,java.lang.String,java.util.function.Supplier), but also accepts density. See Resources.getDrawableForDensity(int, int, Resources.Theme).
Calls to this API will not return null unless no updated drawable was found and the call to defaultDrawableLoader returned null.
Callers should register for DevicePolicyManager.ACTION_DEVICE_POLICY_RESOURCE_UPDATED to get notified when a resource has been updated.
| Parameters | |
|---|---|
drawableId |
String: The drawable ID to get the updated resource for. This value cannot be null. |
drawableStyle |
String: The drawable style to use. This value cannot be null. |
drawableSource |
String: The source for the caller. This value cannot be null. |
density |
Int: The desired screen density indicated by the resource as found in DisplayMetrics. A value of 0 means to use the density returned from Resources.getConfiguration(). |
defaultDrawableLoader |
Supplier<Drawable!>: To get the default drawable if no updated drawable was set for the provided params. This value cannot be null. |
getString
open fun getString(
stringId: String,
defaultStringLoader: Supplier<String!>
): String?
Returns the appropriate updated string for the stringId (see DevicePolicyResources.Strings) if one was set using setStrings, otherwise returns the string from defaultStringLoader.
Also returns the string from defaultStringLoader if stringId is DevicePolicyResources.UNDEFINED.
Calls to this API will not return null unless no updated drawable was found and the call to defaultStringLoader returned null.
Callers should register for DevicePolicyManager.ACTION_DEVICE_POLICY_RESOURCE_UPDATED to get notified when a resource has been updated.
Note that each call to this API loads the resource from the package that called setStrings to set the updated resource.
| Parameters | |
|---|---|
stringId |
String: The IDs to get the updated resource for. This value cannot be null. |
defaultStringLoader |
Supplier<String!>: To get the default string if no updated string was set for stringId. This value cannot be null. |
getString
open fun getString(
stringId: String,
defaultStringLoader: Supplier<String!>,
vararg formatArgs: Any!
): String?
Similar to getString(java.lang.String,java.util.function.Supplier) but accepts formatArgs and returns a localized formatted string, substituting the format arguments as defined in java.util.Formatter and java.lang.String#format, (see Resources.getString(int, Object...)).
Calls to this API will not return null unless no updated drawable was found and the call to defaultStringLoader returned null.
| Parameters | |
|---|---|
stringId |
String: The IDs to get the updated resource for. This value cannot be null. |
defaultStringLoader |
Supplier<String!>: To get the default string if no updated string was set for stringId. This value cannot be null. |
formatArgs |
Any!: The format arguments that will be used for substitution. This value cannot be null. |