Interface IUiScaleSettings
interface IUiScaleSettings
Extends com.amazon.apmf.IStandard
The IUiScaleSettings interface provides APIs to query UI scale
settings and calculate scaled sizes for UI elements.
Methods
getUiScaleSetting()
UiScaleSetting getUiScaleSetting()
Query the current UI scale setting.
Returns
UiScaleSetting
The current UI scale setting level SCALE_SETTING_1 to SCALE_SETTING_9,
where SCALE_SETTING_1 is default.
addUiScaleSettingListener()
Add a UI scale setting listener.com.amazon.apmf.ISubscription*addUiScaleSettingListener(IUiScaleSettingListener*listener)
Parameters
listener
IUiScaleSettingListener* — Required
the listener’s onUiScaleSettingChanged() method is called when
the UI scale setting changes.
Returns
com.amazon.apmf.ISubscription*
a ISubscription instance representing a registration of an
event listener and can be used to end the delivery of any further events
to the listener.
getScaledSize()
Calculates the scaled size for a UI element based on its original dimensions.i32getScaledSize(i32originalSize,ItemScalingTypeitemScalingType,i32maxSize,i32minSize)
Parameters
originalSize
i32 — Required
The base size of the element in density-independent pixels (DP)
itemScalingType
ItemScalingType — Required
The scaling behavior of the element
maxSize
i32 — Required
Maximum size limit for the scaled result
minSize
i32 — Required
Minimum size limit, primarily for whitespace elements
Returns
i32
The calculated size in DP after applying scaling rules
Throws
InvalidArgumentError— if maxSize < minSize, or if maxSize or minSize are less than 0.
getScalingMultiplier()
Calculates a scaling multiplier for UI elements based on their original size. Use this method rather than getScaledSize() when you need to apply the same scaling rate to related values, like the height and width of an image.floatgetScalingMultiplier(i32originalSize,ItemScalingTypeitemScalingType,i32maxSize,i32minSize)
Parameters
originalSize
i32 — Required
The base size of the element in density-independent pixels (DP)
itemScalingType
ItemScalingType — Required
The scaling behavior of the element
maxSize
i32 — Required
Maximum size limit for scaling calculations
minSize
i32 — Required
Minimum size limit, primarily for whitespace elements
Returns
float
A scaling multiplier to apply to the element’s original size to
calculate the recommended increased size. The multiplier will be a positive floating point
number greater than 0.
Throws
InvalidArgumentError— if maxSize < minSize, or if maxSize or minSize are less than 0.

