appdimens-dynamic

//AppDimens SDP, HDP, WDP: Scalable Width and Height Dimensions/com.appdimens.dynamic.compose.density/DensitySp

DensitySp

class DensitySp(val initialBaseValue: Number, val defaultFontScale: Boolean = true, val sortedCustomEntries: List<CustomSpEntry> = emptyList(), val ignoreMultiWindows: Boolean = false, val applyAspectRatio: Boolean = false, val customSensitivityK: Float? = null)

EN A Stable Compose class that allows defining custom Sp text dimensions based on screen qualifiers (UiModeType, Width, Height, Smallest Width).

The TextUnit is resolved at composition and uses the base value or a custom value, applying dynamic scaling via the existing XML DP resources.

PT Classe Stable do Compose que permite definir dimensões de texto Sp customizadas baseadas em qualificadores de tela (UiModeType, Largura, Altura, Smallest Width).

O TextUnit é resolvido na composição e usa o valor base ou um valor customizado, aplicando o escalonamento dinâmico via os recursos XML de DP existentes.

private constructor(initialBaseValue: Number, defaultFontScale: Boolean = true, sortedCustomEntries: List<CustomSpEntry> = emptyList(), ignoreMultiWindows: Boolean = false, applyAspectRatio: Boolean = false, customSensitivityK: Float? = null)

private val applyAspectRatio: Boolean

private val customSensitivityK: Float?

private val defaultFontScale: Boolean

val dhem: ERROR CLASS: Symbol not found for TextUnit

EN The final TextUnit (Sp) value resolved using Screen Height (WITHOUT FONT SCALE). PT O valor final TextUnit (Sp) resolvido usando Altura da Tela (SEM ESCALA DE FONTE).

val dhemPx: Float

EN The final Pixel (Float) value resolved using Screen Height (WITHOUT FONT SCALE). PT O valor final em Pixels (Float) resolvido usando Altura da Tela (SEM ESCALA DE FONTE).

val dhsp: ERROR CLASS: Symbol not found for TextUnit

EN The final TextUnit (Sp) value resolved using Screen Height (WITH font scale). PT O valor final TextUnit (Sp) resolvido usando Altura da Tela (COM escala de fonte).

val dhspPx: Float

EN The final Pixel (Float) value resolved using Screen Height (WITH font scale). PT O valor final em Pixels (Float) resolvido usando Altura da Tela (COM escala de fonte).

val dsem: ERROR CLASS: Symbol not found for TextUnit

EN The final TextUnit (Sp) value resolved using Smallest Width (WITHOUT FONT SCALE). PT O valor final TextUnit (Sp) resolvido usando Smallest Width (SEM ESCALA DE FONTE).

val dsemPx: Float

EN The final Pixel (Float) value resolved using Smallest Width (WITHOUT FONT SCALE). PT O valor final em Pixels (Float) resolvido usando Smallest Width (SEM ESCALA DE FONTE).

val dssp: ERROR CLASS: Symbol not found for TextUnit

EN The final TextUnit (Sp) value resolved using Smallest Width (WITH font scale). PT O valor final TextUnit (Sp) resolvido usando Smallest Width (COM escala de fonte).

val dsspPx: Float

EN The final Pixel (Float) value resolved using Smallest Width (WITH font scale). PT O valor final em Pixels (Float) resolvido usando Smallest Width (COM escala de fonte).

val dwem: ERROR CLASS: Symbol not found for TextUnit

EN The final TextUnit (Sp) value resolved using Screen Width (WITHOUT FONT SCALE). PT O valor final TextUnit (Sp) resolvido usando Largura da Tela (SEM ESCALA DE FONTE).

val dwemPx: Float

EN The final Pixel (Float) value resolved using Screen Width (WITHOUT FONT SCALE). PT O valor final em Pixels (Float) resolvido usando Largura da Tela (SEM ESCALA DE FONTE).

val dwsp: ERROR CLASS: Symbol not found for TextUnit

EN The final TextUnit (Sp) value resolved using Screen Width (WITH font scale). PT O valor final TextUnit (Sp) resolvido usando Largura da Tela (COM escala de fonte).

val dwspPx: Float

EN The final Pixel (Float) value resolved using Screen Width (WITH font scale). PT O valor final em Pixels (Float) resolvido usando Largura da Tela (COM escala de fonte).

private val ignoreMultiWindows: Boolean

private val initialBaseValue: Number

private val sortedCustomEntries: List<CustomSpEntry>

fun aspectRatio(enable: Boolean = true, sensitivityK: Float? = null): DensitySp

EN Allow applying aspect ratio based constraint scaling. PT Permite aplicar o redimensionamento baseado na proporção da tela.

fun ignoreMultiWindows(ignore: Boolean = true): DensitySp

EN Allow ignoring the constraint scaling based on multi-window resizing properties. PT Permite ignorar o dimensionamento para os layouts de múltiplas janelas (divisão de tela).

private fun reorderEntries(newEntry: CustomSpEntry): List<CustomSpEntry>

EN Adds a new entry and re-sorts the list by priority, then by qualifier value (descending).

private fun resolve(qualifier: DpQualifier): ERROR CLASS: Symbol not found for TextUnit

EN Resolves the matching CustomSpEntry and returns scaled TextUnit (Sp) for qualifier. PT Resolve a CustomSpEntry correspondente e retorna TextUnit (Sp) escalonado para qualifier.

private fun resolveNoFontScale(qualifier: DpQualifier): ERROR CLASS: Symbol not found for TextUnit

EN Like resolve but forces fontScale = false (fixed Sp, same idea as dsem / dwem accessors). PT Como resolve, mas força fontScale = false (Sp fixo, mesmo propósito dos acessores dsem / dwem).

private fun resolveNoFontScalePx(qualifier: DpQualifier): Float

EN Like resolvePx with fontScale = false. PT Como resolvePx com fontScale = false.

private fun resolvePx(qualifier: DpQualifier): Float

EN Same as resolve but returns density-scaled pixels (toDynamicDensityPx). PT Igual a resolve, mas retorna pixels já escalados pela densidade (toDynamicDensityPx).

fun screen(orientation: Orientation = Orientation.DEFAULT, customValue: Number, finalQualifierResolver: DpQualifier? = null, inverter: Inverter = Inverter.DEFAULT, fontScale: Boolean = defaultFontScale): DensitySp

EN Priority 4: Orientation only. PT Prioridade 4: Apenas Orientação.

EN Priority 2: UiModeType qualifier (e.g., TELEVISION, WATCH). PT Prioridade 2: Qualificador de UiModeType (e.g., TELEVISION, WATCH).

EN Priority 3: Dp qualifier (sw, h, w) without UiModeType restriction. PT Prioridade 3: Qualificador de Dp (sw, h, w) sem restrição de UiModeType.

EN Priority 1: Most specific qualifier - Combines UiModeType AND Dp Qualifier (sw, h, w). PT Prioridade 1: Qualificador mais específico - Combina UiModeType E Qualificador de Dp (sw, h, w).

Constructors

Name Summary
DensitySp  

Properties

Name Summary
applyAspectRatio  
customSensitivityK  
defaultFontScale  
dhem  
dhemPx  
dhsp  
dhspPx  
dsem  
dsemPx  
dssp  
dsspPx  
dwem  
dwemPx  
dwsp  
dwspPx  
ignoreMultiWindows  
initialBaseValue  
sortedCustomEntries  

Functions

Name Summary
aspectRatio  
ignoreMultiWindows  
reorderEntries  
resolve  
resolveNoFontScale  
resolveNoFontScalePx  
resolvePx  
screen