One of the often requested features in LWUIT's themes has been the addition of constants for themes. Constants allow the theme designer to "hint" of desired functionality to the application code, e.g. a particular theme might have a constant indicating that it wants the scrollbar to fadeout when unused.
The LWUIT resource editor now includes an additional tab for creating such constants which can be used to add constant values. These can be added in the ant task by prepending the @ sign before the constant key in the theme and setting the value to the appropriate string.
Constants are always strings, they have some conventions where a constant ending with Bool is treated as a boolean true/false value and a constant ending with Int or Image (for image the string name of the image is stored but the image instance will be returned).
To use a constant one can use the UIManager's methods to get the appropriate constant type specifically:
getThemeConstant
isThemeConstant
getThemeImageConstant
Internally LWUIT has several builtin constants and the list is constantly growing as we add features to LWUIT, we will try to keep this list up to date when possible.
|
|
| . | LWUIT Constant | Description | . | centeredPopupBool | Popup of the combo box will appear in the center of the screen | . | checkBoxCheckDisImage | CheckBox image to use instead of LWUIT drawing it on its own | . | checkBoxCheckedImage | CheckBox image to use instead of LWUIT drawing it on its own | . | checkBoxUncheckDisImage | CheckBox image to use instead of LWUIT drawing it on its own | . | checkBoxUncheckedImage | CheckBox image to use instead of LWUIT drawing it on its own | . | comboImage | Combo image to use instead of LWUIT drawing it on its own | . | commandBehavior | Indicates how commands should act, as a touch menu, native menu etc. Possible values: SoftKey, Touch, Bar, Title, Right, Native | . | defaultCommandImage | Image to give a command with no icon | . | dialogButtonCommandsBool | Place commands in the dialogs as buttons | . | dialogPosition | Place the dialog in an arbitrary border layout position (e.g. North, South, Center etc.) | . | dialogTransitionIn | Default transition for dialog | . | dialogTransitionInImage | Default transition Image for dialog, causes a Timeline transition effect | . | dialogTransitionOut | Default transition for dialog | . | dialogTransitionOutImage | Default transition Image for dialog, causes a Timeline transition effect | . | disabledColor | Color to use when disabling entries by default | . | dlgCommandButtonSizeInt | Minimum size to give to command buttons in the dialog | . | dlgSlideDirection | Slide hints | . | dlgSlideInDirBool | Slide hints | . | dlgSlideOutDirBool | Slide hints |
|
|
|
| . | fadeScrollBarBool | Fade transition hints | . | fadeScrollEdgeBool | Fade transition hints | . | fadeScrollEdgeInt | Fade transition hints | . | firstCharRTLBool | Indicates the GenericListCellRenderer should determine RTL status based on the first character in the sentence | . | fixedSelectionInt | Number corresponding to the fixed selection constants in List | . | formTransitionIn | Default transition for form | . | formTransitionInImage | Default transition Image for form, causes a Timeline transition effect | . | formTransitionOut | Default transition for form | . | formTransitionOutImage | Default transition Image for form, causes a Timeline transition effect | . | hideEmptyTitleBool | Indicates that a title with no content should be hidden even if the border for the title occupies space | . | ignorListFocusBool | Hide the focus component of the list when the list doesn't have focus | . | listItemGapInt | Builtin item gap in the list, this defaults to 2 which predated padding/margin in LWUIT | . | menuHeightPercent | Allows positioning and sizing the menu | . | menuPrefSizeBool | Allows positioning and sizing the menu | . | menuSlideDirection | Defines menu entrance effect | . | menuSlideInDirBool | Defines menu entrance effect | . | menuSlideOutDirBool | Defines menu entrance effect | . | menuTransitionIn | Defines menu entrance effect | . | menuTransitionInImage | Defines menu entrance effect | . | menuTransitionOut | Defines menu entrance effect |
|
|
|
| . | menuTransitionOutImage | Defines menu entrance effect | . | menuWidthPercent | Allows positioning and sizing the menu | . | otherPopupRendererBool | Indicates that a separate renderer UIID/instance should be used to the list within the combo box popup | . | popupCancelBodyBool | Indicates that a cancel button should appear within the combo box popup | . | popupTitleBool | Indicates that a title should appear within the combo box popup | . | pureTouchBool | Indicates the pure touch mode | . | radioSelectedDisImage | Radio button image | . | radioSelectedImage | Radio button image | . | radioUnselectedDisImage | Radio button image | . | radioUnselectedImage | Radio button image | . | rendererShowsNumbersBool | Indicates whether renderers should render the entry number | . | reverseSoftButtonsBool | Swaps the softbutton positions | . | slideDirection | Default slide transition settings | . | slideInDirBool | Default slide transition settings | . | slideOutDirBool | Default slide transition settings | . | snapGridBool | Snap to grid toggle | . | tabsFillRowsBool | Indicates if the tabs should fill the row using flow layout | . | tabsGridBool | Indicates whether tabs should use a grid layout thus forcing all tabs to have identical sizes | . | tickerSpeedInt | The speed of label/button etc. tickering in ms. | . | tintColor | The aarrggbb hex color to tint the screen when a dialog is shown |
|
|
|
| . | touchCommandFillBool | Indicates how the touch menu should layout the commands within | . | touchCommandFlowBool | Indicates how the touch menu should layout the commands within | . | touchMenuBool | Force the touch menu | . | transitionSpeedInt | Indicates the default speed for transitions |
|
One "odd" behavior of constants is that once they are set by a theme they don't get "lost" when replacing the theme. E.g. if one would set the comboImage constant to a specific value in theme A and then switch to theme B that doesn't define the comboImage, the original theme A comboImage might remain. The reason for this is simple, when extracting the constant values components keep the values in cache locally and just don't track the change in value. Furthermore, since the components allow manually setting values its impractical for them to track whether a value was set by a constant or explicitly by the user.
The solution for this is to either manually reset undesired values before replacing a theme (e.g. for the case above by calling the default look and feel method for setting the combo image with a null value) or defining a constant value to replace the existing value.
BTW I haven't been blogging or posting videos as often as I should both because I have been a bit under the weather and because I have been quite swamped with work (checkout the SVN changes). Hopefully I'll feel a bit better next week and increase my blogging a bit.
the resource editor isnt working ! after the new update.1282
ReplyDeleteThanks that's my fault entirely :-(
ReplyDeleteI fixed this right now, but for this to work for me I had to clear up the old version in the javaws -viewer cache.
Thanks I fixed the post, too much copy and paste late into the night.
ReplyDeleteI have been searching to find a comfort or effective procedure to complete this process and I think this is the most suitable way to do it effectively. https://www.miuiupdates.com/2021/03/best-miui-ios-theme-for-xiaomi.html
ReplyDeleteCapCut mod App provides a comprehensive and intuitive video editing solution for content creators. With its easy-to-use interface and access to premium features for free, this app is a must-try for anyone looking to edit their videos on their mobile devices. It's an Video Editor: For Android.
ReplyDeleteRealX Legacy is a fully compatible: MIUI theme that works just awesome on all Xiaomi Redmi and Poco devices.
ReplyDelete