Namespaces
ad
const ad: {
collections: {
stringArrayToStringSet: HashSet<string>;
stringSetToStringArray: string[];
};
dismissSoftInput: (nativeView?: View) => void;
getApplication: () => Application;
getApplicationContext: () => Context;
getCurrentActivity: () => any;
getInputMethodManager: () => InputMethodManager;
getPackageName: () => string;
getResources: () => Resources;
getWindow: () => Window;
resources: {
getDrawableId: (name: any) => number;
getId: (name: string) => number;
getPaletteColor: (name: string, context: Context) => number;
getResource: (name: string, type?: string) => number;
getStringId: (name: any) => number;
};
showSoftInput: (nativeView: View) => void;
enableEdgeToEdge: void;
getIgnoreEdgeToEdgeOnOlderDevices: boolean;
setDarkModeHandler: void;
setIgnoreEdgeToEdgeOnOlderDevices: void;
setNavigationBarColor: void;
setStatusBarColor: void;
} = android;Defined in: utils/native-helper.d.ts:172
Type Declaration
collections
collections: {
stringArrayToStringSet: HashSet<string>;
stringSetToStringArray: string[];
};Utilities related to Android collections.
collections.stringArrayToStringSet()
stringArrayToStringSet(str: string[]): HashSet<string>;Converts string array into a String hash set.
Parameters
| Parameter | Type | Description |
|---|---|---|
str | string[] | An array of strings to convert. |
Returns
HashSet<string>
collections.stringSetToStringArray()
stringSetToStringArray(stringSet: any): string[];Converts string hash set into array of strings.
Parameters
| Parameter | Type | Description |
|---|---|---|
stringSet | any | A string hash set to convert. |
Returns
string[]
dismissSoftInput
dismissSoftInput: (nativeView?: View) => void;Hides the soft input method, usually a soft keyboard.
Parameters
| Parameter | Type |
|---|---|
nativeView? | View |
Returns
void
getApplication
getApplication: () => Application;Gets the native Android application instance.
Returns
Application
getApplicationContext
getApplicationContext: () => Context;Gets the Android application context.
Returns
Context
getCurrentActivity
getCurrentActivity: () => any;Get the current native Android activity.
Returns
any
getInputMethodManager
getInputMethodManager: () => InputMethodManager;Gets the native Android input method manager.
Returns
InputMethodManager
getPackageName
getPackageName: () => string;Returns
string
getResources
getResources: () => Resources;Gets the native Android application resources.
Returns
Resources
getWindow
getWindow: () => Window;Returns
Window
application window.
Deprecated
Use Utils.getWindow<android.view.Window>() instead.
resources
resources: {
getDrawableId: (name: any) => number;
getId: (name: string) => number;
getPaletteColor: (name: string, context: Context) => number;
getResource: (name: string, type?: string) => number;
getStringId: (name: any) => number;
};Utilities related to Android resources.
resources.getDrawableId
getDrawableId: (name: any) => number;Gets the drawable id from a given name.
Parameters
| Parameter | Type | Description |
|---|---|---|
name | any | Name of the resource. |
Returns
number
resources.getId
getId: (name: string) => number;Gets the id from a given name.
Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | Name of the resource. |
Returns
number
resources.getPaletteColor
getPaletteColor: (name: string, context: Context) => number;Gets a color from the current theme.
Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | Name of the color resource. |
context | Context | Context to resolve the color. |
Returns
number
resources.getResource
getResource: (name: string, type?: string) => number;Gets the id from a given name with optional type. This sets an explicit package name. https://developer.android.com/reference/android/content/res/Resources#getIdentifier(java.lang.String, java.lang.String, java.lang.String)
Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | Name of the resource. |
type? | string | (Optional) type |
Returns
number
resources.getStringId
getStringId: (name: any) => number;Gets the string id from a given name.
Parameters
| Parameter | Type | Description |
|---|---|---|
name | any | Name of the resource. |
Returns
number
showSoftInput
showSoftInput: (nativeView: View) => void;Shows the soft input method, usually a soft keyboard.
Parameters
| Parameter | Type |
|---|---|
nativeView | View |
Returns
void
enableEdgeToEdge()
Call Signature
enableEdgeToEdge(activityOrWindow: ComponentActivity, options?: {
handleDarkMode?: (bar: "status" | "navigation", resources: Resources) => boolean;
navigationBarDarkColor?: Color;
navigationBarLightColor?: Color;
statusBarDarkColor?: Color;
statusBarLightColor?: Color;
}): void;Enables edge-to-edge navigation for the provided activity.
Parameters
| Parameter | Type | Description |
|---|---|---|
activityOrWindow | ComponentActivity | - |
options? | { handleDarkMode?: (bar: "status" | "navigation", resources: Resources) => boolean; navigationBarDarkColor?: Color; navigationBarLightColor?: Color; statusBarDarkColor?: Color; statusBarLightColor?: Color; } | Optional configuration for status and navigation bar colors. |
options.handleDarkMode? | (bar: "status" | "navigation", resources: Resources) => boolean | - |
options.navigationBarDarkColor? | Color | - |
options.navigationBarLightColor? | Color | - |
options.statusBarDarkColor? | Color | - |
options.statusBarLightColor? | Color | - |
Returns
void
Call Signature
enableEdgeToEdge(
activity: ComponentActivity,
window: Window,
options?: {
handleDarkMode?: (bar: "status" | "navigation", resources: Resources) => boolean;
navigationBarDarkColor?: Color;
navigationBarLightColor?: Color;
statusBarDarkColor?: Color;
statusBarLightColor?: Color;
}): void;Enables edge-to-edge navigation for the provided Window.
Parameters
| Parameter | Type | Description |
|---|---|---|
activity | ComponentActivity | The activity to enable edge-to-edge navigation for. |
window | Window | - |
options? | { handleDarkMode?: (bar: "status" | "navigation", resources: Resources) => boolean; navigationBarDarkColor?: Color; navigationBarLightColor?: Color; statusBarDarkColor?: Color; statusBarLightColor?: Color; } | Optional configuration for status and navigation bar colors. |
options.handleDarkMode? | (bar: "status" | "navigation", resources: Resources) => boolean | - |
options.navigationBarDarkColor? | Color | - |
options.navigationBarLightColor? | Color | - |
options.statusBarDarkColor? | Color | - |
options.statusBarLightColor? | Color | - |
Returns
void
getIgnoreEdgeToEdgeOnOlderDevices()
getIgnoreEdgeToEdgeOnOlderDevices(): boolean;Gets whether edge-to-edge is ignored on older devices (API 34 an older).
Returns
boolean
setDarkModeHandler()
setDarkModeHandler(options?: {
activity?: AppCompatActivity;
handler: (bar: "status" | "navigation", resources: Resources) => boolean;
}): void;Sets the dark mode handler for the application.
Parameters
| Parameter | Type | Description |
|---|---|---|
options? | { activity?: AppCompatActivity; handler: (bar: "status" | "navigation", resources: Resources) => boolean; } | Options to set dark mode handler. |
options.activity? | AppCompatActivity | - |
options.handler? | (bar: "status" | "navigation", resources: Resources) => boolean | - |
Returns
void
setIgnoreEdgeToEdgeOnOlderDevices()
setIgnoreEdgeToEdgeOnOlderDevices(value: boolean): void;Sets whether to ignore edge-to-edge on older devices (API 34 an older).
Parameters
| Parameter | Type |
|---|---|
value | boolean |
Returns
void
setNavigationBarColor()
setNavigationBarColor(options?: {
activity?: AppCompatActivity;
darkColor?: Color;
lightColor?: Color;
}): void;Sets the navigation bar color for the application.
Parameters
| Parameter | Type | Description |
|---|---|---|
options? | { activity?: AppCompatActivity; darkColor?: Color; lightColor?: Color; } | Options to set navigation bar color. |
options.activity? | AppCompatActivity | - |
options.darkColor? | Color | - |
options.lightColor? | Color | - |
Returns
void
setStatusBarColor()
setStatusBarColor(options?: {
activity?: AppCompatActivity;
darkColor?: Color;
lightColor?: Color;
}): void;Sets the status bar color for the application.
Parameters
| Parameter | Type | Description |
|---|---|---|
options? | { activity?: AppCompatActivity; darkColor?: Color; lightColor?: Color; } | Options to set status bar color. |
options.activity? | AppCompatActivity | - |
options.darkColor? | Color | - |
options.lightColor? | Color | - |
Returns
void
Deprecated
use Utils.android instead.
- Previous
- NativeWindow
- Next
- android