Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 693e196

Browse files
committed
widgetutils: Add getNativeThemeName() handler
Add a function that returns a theme name to be used by widgets when the theme is "native". This returns "iOS" on iOS and Mac OS X, and "Android" otherwise. For the time being, widgets may use this function to determine how to automatically adapt themselves to the current platform.
1 parent 8175f43 commit 693e196

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

extensions/modules/widget-utils/widget-utils.lcb

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,4 +253,33 @@ public handler stringToColor(in pString as String) returns Color
253253
return color tColor
254254
end handler
255255

256-
end module
256+
/*
257+
Summary: Get the canonical name of the current "native" mobile theme
258+
259+
Example:
260+
variable tNativeTheme as String
261+
put getNativeThemeName() into tNativeTheme
262+
263+
if tNativeTheme is "android" then
264+
-- Draw Android themed UI
265+
else
266+
-- Draw iOS themed UI
267+
end if
268+
269+
Description:
270+
Returns the name of the current theme that should be used when the theme is
271+
"native".
272+
273+
Currently, this will return either "iOS" or "Android".
274+
*/
275+
public handler getNativeThemeName() returns String
276+
variable tOS as String
277+
put the operating system into tOS
278+
if tOS is in ["ios,mac"] then
279+
return "iOS"
280+
else
281+
return "Android"
282+
end if
283+
end handler
284+
285+
end module

0 commit comments

Comments
 (0)