Commit f6d5db18 authored by Tiger Oakes's avatar Tiger Oakes Committed by Arturo Mejia
Browse files

Fixes #2605 - Replace pxToDp with dpToPx

parent b50d2a22
......@@ -8,6 +8,7 @@ import android.content.Context
import android.util.AttributeSet
import android.util.LruCache
import androidx.annotation.VisibleForTesting
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import kotlinx.coroutines.CoroutineScope
......@@ -19,17 +20,10 @@ import kotlinx.coroutines.withContext
import mozilla.components.browser.awesomebar.layout.SuggestionLayout
import mozilla.components.browser.awesomebar.transform.SuggestionTransformer
import mozilla.components.concept.awesomebar.AwesomeBar
import mozilla.components.support.ktx.android.content.res.pxToDp
import java.lang.IllegalStateException
import java.util.concurrent.Executors
private const val PROVIDER_QUERY_THREADS = 3
private const val DEFAULT_TITLE_TEXT_COLOR = 0xFF272727.toInt()
private const val DEFAULT_DESCRIPTION_TEXT_COLOR = 0xFF737373.toInt()
private const val DEFAULT_CHIP_TEXT_COLOR = 0xFF272727.toInt()
private const val DEFAULT_CHIP_BACKGROUND_COLOR = 0xFFEEEEEE.toInt()
private const val DEFAULT_CHIP_SPACING_DP = 2
internal const val PROVIDER_MAX_SUGGESTIONS = 20
internal const val INITIAL_NUMBER_OF_PROVIDERS = 5
......@@ -71,16 +65,31 @@ class BrowserAwesomeBar @JvmOverloads constructor(
layoutManager = LinearLayoutManager(context, VERTICAL, false)
adapter = suggestionsAdapter
val attr = context.obtainStyledAttributes(attrs, R.styleable.BrowserAwesomeBar, defStyleAttr, 0)
this@BrowserAwesomeBar.styling = BrowserAwesomeBarStyling(
attr.getColor(R.styleable.BrowserAwesomeBar_awesomeBarTitleTextColor, DEFAULT_TITLE_TEXT_COLOR),
attr.getColor(R.styleable.BrowserAwesomeBar_awesomeBarDescriptionTextColor, DEFAULT_DESCRIPTION_TEXT_COLOR),
attr.getColor(R.styleable.BrowserAwesomeBar_awesomeBarChipTextColor, DEFAULT_CHIP_TEXT_COLOR),
attr.getColor(R.styleable.BrowserAwesomeBar_awesomeBarChipBackgroundColor, DEFAULT_CHIP_BACKGROUND_COLOR),
attr.getDimensionPixelSize(R.styleable.BrowserAwesomeBar_awesomeBarChipSpacing, resources.pxToDp(
DEFAULT_CHIP_SPACING_DP))
)
attr.recycle()
context.obtainStyledAttributes(attrs, R.styleable.BrowserAwesomeBar, defStyleAttr, 0).apply {
styling = BrowserAwesomeBarStyling(
getColor(
R.styleable.BrowserAwesomeBar_awesomeBarTitleTextColor,
ContextCompat.getColor(context, R.color.mozac_browser_awesomebar_default_title_text_color)
),
getColor(
R.styleable.BrowserAwesomeBar_awesomeBarDescriptionTextColor,
ContextCompat.getColor(context, R.color.mozac_browser_awesomebar_default_description_text_color)
),
getColor(
R.styleable.BrowserAwesomeBar_awesomeBarChipTextColor,
ContextCompat.getColor(context, R.color.mozac_browser_awesomebar_default_chip_text_color)
),
getColor(
R.styleable.BrowserAwesomeBar_awesomeBarChipBackgroundColor,
ContextCompat.getColor(context, R.color.mozac_browser_awesomebar_default_chip_background_color)
),
getDimensionPixelSize(
R.styleable.BrowserAwesomeBar_awesomeBarChipSpacing,
resources.getDimensionPixelSize(R.dimen.mozac_browser_awesomebar_default_chip_spacing)
)
)
recycle()
}
}
@Synchronized
......
<?xml version="1.0" encoding="utf-8"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<resources>
<color name="mozac_browser_awesomebar_default_title_text_color">#272727</color>
<color name="mozac_browser_awesomebar_default_description_text_color">#737373</color>
<color name="mozac_browser_awesomebar_default_chip_text_color">#272727</color>
<color name="mozac_browser_awesomebar_default_chip_background_color">#EEEEEE</color>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<resources>
<dimen name="mozac_browser_awesomebar_default_chip_spacing">2dp</dimen>
</resources>
......@@ -13,7 +13,7 @@ import mozilla.components.browser.awesomebar.BrowserAwesomeBar
import mozilla.components.browser.awesomebar.R
import mozilla.components.browser.awesomebar.widget.FlowLayout
import mozilla.components.concept.awesomebar.AwesomeBar
import mozilla.components.support.ktx.android.content.res.pxToDp
import mozilla.components.support.ktx.android.util.dpToPx
import mozilla.components.support.test.mock
import mozilla.components.support.test.robolectric.testContext
import org.junit.Assert.assertEquals
......@@ -176,6 +176,6 @@ class DefaultSuggestionViewHolderTest {
val awesomeBar = BrowserAwesomeBar(testContext)
DefaultSuggestionViewHolder.Chips(awesomeBar, view)
assertEquals(testContext.resources.pxToDp(2), flowLayout.spacing)
assertEquals(2.dpToPx(testContext.resources.displayMetrics), flowLayout.spacing)
}
}
......@@ -36,7 +36,7 @@ import mozilla.components.browser.session.utils.AllSessionsObserver
import mozilla.components.concept.engine.Engine
import mozilla.components.concept.fetch.Client
import mozilla.components.support.base.log.logger.Logger
import mozilla.components.support.ktx.android.content.res.pxToDp
import mozilla.components.support.ktx.android.util.dpToPx
import java.util.concurrent.Executors
private const val MAXIMUM_SCALE_FACTOR = 2.0f
......@@ -92,7 +92,7 @@ class BrowserIcons(
private fun loadIconInternal(initialRequest: IconRequest): Icon {
val desiredSize = DesiredSize(
targetSize = context.resources.pxToDp(initialRequest.size.value),
targetSize = initialRequest.size.value.dpToPx(context.resources.displayMetrics),
maxSize = maximumSize,
maxScaleFactor = MAXIMUM_SCALE_FACTOR
)
......
......@@ -14,8 +14,9 @@ import android.net.Uri
import android.util.TypedValue
import mozilla.components.browser.icons.Icon
import mozilla.components.browser.icons.IconRequest
import mozilla.components.support.ktx.android.content.res.pxToDp
import mozilla.components.support.ktx.android.net.hostWithoutCommonPrefixes
import mozilla.components.support.ktx.android.util.dpToFloat
import mozilla.components.support.ktx.android.util.dpToPx
/**
* [IconGenerator] implementation that will generate an icon with a background color, rounded corners and a letter
......@@ -27,11 +28,11 @@ class DefaultIconGenerator(
private val textColor: Int = Color.WHITE,
private val backgroundColors: IntArray = DEFAULT_COLORS
) : IconGenerator {
private val cornerRadius: Float = context.resources.pxToDp(cornerRadius).toFloat()
private val cornerRadius: Float = cornerRadius.dpToFloat(context.resources.displayMetrics)
@Suppress("MagicNumber")
override fun generate(context: Context, request: IconRequest): Icon {
val size = context.resources.pxToDp(request.size.value)
val size = request.size.value.dpToPx(context.resources.displayMetrics)
val bitmap = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888)
val canvas = Canvas(bitmap)
......
......@@ -9,7 +9,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
import kotlinx.coroutines.runBlocking
import mozilla.components.browser.icons.Icon
import mozilla.components.browser.icons.IconRequest
import mozilla.components.support.ktx.android.content.res.pxToDp
import mozilla.components.support.ktx.android.util.dpToPx
import mozilla.components.support.test.robolectric.testContext
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNotEquals
......@@ -101,7 +101,7 @@ class DefaultIconGeneratorTest {
assertNotNull(icon.bitmap)
assertNotNull(icon.color)
val dp32 = testContext.resources.pxToDp(32)
val dp32 = 32.dpToPx(testContext.resources.displayMetrics)
assertEquals(dp32, icon.bitmap.width)
assertEquals(dp32, icon.bitmap.height)
......
......@@ -20,7 +20,6 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import mozilla.components.browser.menu.BrowserMenu.Orientation.DOWN
import mozilla.components.browser.menu.BrowserMenu.Orientation.UP
import mozilla.components.support.ktx.android.content.res.pxToDp
import mozilla.components.support.ktx.android.view.isRTL
/**
......@@ -63,7 +62,7 @@ class BrowserMenu internal constructor(
).apply {
setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
isFocusable = true
elevation = view.resources.pxToDp(MENU_ELEVATION_DP).toFloat()
elevation = view.resources.getDimension(R.dimen.mozac_browser_menu_elevation)
setOnDismissListener {
adapter.menu = null
......@@ -86,8 +85,6 @@ class BrowserMenu internal constructor(
}
companion object {
private const val MENU_ELEVATION_DP = 8
/**
* Determines the orientation to be used for a menu based on the positioning of the [parent] in the layout.
*/
......
......@@ -14,7 +14,6 @@ import androidx.appcompat.widget.AppCompatImageButton
import mozilla.components.browser.menu.BrowserMenu
import mozilla.components.browser.menu.BrowserMenuItem
import mozilla.components.browser.menu.R
import mozilla.components.support.ktx.android.content.res.pxToDp
/**
* A toolbar of buttons to show inside the browser menu.
......@@ -30,18 +29,20 @@ class BrowserMenuItemToolbar(
val layout = view as LinearLayout
layout.removeAllViews()
for (item in items) {
val button = AppCompatImageButton(layout.context)
item.bind(button)
val outValue = TypedValue()
val selectableBackground = TypedValue().also {
layout.context.theme.resolveAttribute(
android.R.attr.selectableItemBackgroundBorderless,
outValue,
it,
true
)
}
val iconHeight = view.resources.getDimensionPixelSize(R.dimen.mozac_browser_menu_item_image_text_icon_height)
for (item in items) {
val button = AppCompatImageButton(layout.context)
item.bind(button)
button.setBackgroundResource(outValue.resourceId)
button.setBackgroundResource(selectableBackground.resourceId)
button.setOnClickListener {
item.listener.invoke()
menu.dismiss()
......@@ -49,7 +50,7 @@ class BrowserMenuItemToolbar(
layout.addView(
button,
LinearLayout.LayoutParams(0, view.resources.pxToDp(ICON_HEIGHT_DP), 1f)
LinearLayout.LayoutParams(0, iconHeight, 1f)
)
}
}
......
......@@ -2,9 +2,9 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<resources xmlns:tools="http://schemas.android.com/tools">
<resources>
<dimen name="mozac_browser_menu_corner_radius">4dp</dimen>
<dimen name="mozac_browser_menu_elevation">4dp</dimen>
<dimen name="mozac_browser_menu_elevation">8dp</dimen>
<dimen name="mozac_browser_menu_width">250dp</dimen>
<dimen name="mozac_browser_menu_padding_vertical">8dp</dimen>
......
......@@ -34,7 +34,6 @@ import mozilla.components.concept.toolbar.AutocompleteResult
import mozilla.components.concept.toolbar.Toolbar
import mozilla.components.support.base.android.Padding
import mozilla.components.support.base.log.logger.Logger
import mozilla.components.support.ktx.android.content.res.pxToDp
import mozilla.components.support.ktx.android.view.forEach
import mozilla.components.support.ktx.android.view.isVisible
import mozilla.components.ui.autocomplete.AutocompleteView
......@@ -385,7 +384,7 @@ class BrowserToolbar @JvmOverloads constructor(
siteSecurityColor = Pair(inSecure, secure)
val fadingEdgeLength = getDimensionPixelSize(
R.styleable.BrowserToolbar_browserToolbarFadingEdgeSize,
resources.pxToDp(DisplayToolbar.URL_FADING_EDGE_SIZE_DP)
resources.getDimensionPixelSize(R.dimen.mozac_browser_toolbar_url_fading_edge_size)
)
displayToolbar.urlView.setFadingEdgeLength(fadingEdgeLength)
displayToolbar.urlView.isHorizontalFadingEdgeEnabled = fadingEdgeLength > 0
......@@ -417,7 +416,7 @@ class BrowserToolbar @JvmOverloads constructor(
val height = if (MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.EXACTLY) {
MeasureSpec.getSize(heightMeasureSpec)
} else {
resources.pxToDp(DEFAULT_TOOLBAR_HEIGHT_DP)
resources.getDimensionPixelSize(R.dimen.mozac_browser_toolbar_default_toolbar_height)
}
setMeasuredDimension(width, height)
......@@ -678,7 +677,6 @@ class BrowserToolbar @JvmOverloads constructor(
}
companion object {
private const val DEFAULT_TOOLBAR_HEIGHT_DP = 56
internal const val ACTION_PADDING_DP = 16
internal val DEFAULT_PADDING =
Padding(ACTION_PADDING_DP, ACTION_PADDING_DP, ACTION_PADDING_DP, ACTION_PADDING_DP)
......
......@@ -25,7 +25,6 @@ import mozilla.components.browser.toolbar.internal.measureActions
import mozilla.components.browser.toolbar.internal.wrapAction
import mozilla.components.concept.toolbar.Toolbar
import mozilla.components.concept.toolbar.Toolbar.SiteSecurity
import mozilla.components.support.ktx.android.content.res.pxToDp
import mozilla.components.support.ktx.android.view.isVisible
import mozilla.components.ui.icons.R.drawable.mozac_ic_globe
import mozilla.components.ui.icons.R.drawable.mozac_ic_lock
......@@ -76,7 +75,7 @@ internal class DisplayToolbar(
set(value) { menuView.menuBuilder = value }
internal val siteSecurityIconView = AppCompatImageView(context).apply {
setPadding(resources.pxToDp(ICON_PADDING_DP))
setPadding(resources.getDimensionPixelSize(R.dimen.mozac_browser_toolbar_icon_padding))
setImageResource(mozac_ic_globe)
......@@ -89,7 +88,7 @@ internal class DisplayToolbar(
internal val titleView = AppCompatTextView(context).apply {
id = R.id.mozac_browser_toolbar_title_view
gravity = Gravity.CENTER_VERTICAL
textSize = URL_TEXT_SIZE
textSize = URL_TEXT_SIZE_SP
visibility = View.GONE
ellipsize = TextUtils.TruncateAt.END
......@@ -99,7 +98,7 @@ internal class DisplayToolbar(
internal val urlView = AppCompatTextView(context).apply {
id = R.id.mozac_browser_toolbar_url_view
gravity = Gravity.CENTER_VERTICAL
textSize = URL_TEXT_SIZE
textSize = URL_TEXT_SIZE_SP
setSingleLine(true)
isClickable = true
......@@ -331,8 +330,9 @@ internal class DisplayToolbar(
urlView.measure(urlWidthSpec, fixedHeightSpec)
}
val progressHeightSpec = MeasureSpec.makeMeasureSpec(resources.pxToDp(PROGRESS_BAR_HEIGHT_DP),
MeasureSpec.EXACTLY)
val progressHeightSpec = MeasureSpec.makeMeasureSpec(
resources.getDimensionPixelSize(R.dimen.mozac_browser_toolbar_progress_bar_height),
MeasureSpec.EXACTLY)
progressView.measure(widthMeasureSpec, progressHeightSpec)
urlBoxView?.let {
......@@ -477,12 +477,9 @@ internal class DisplayToolbar(
companion object {
internal const val MEASURED_HEIGHT_THIRD_DENOMINATOR = 3
internal const val MEASURED_HEIGHT_DENOMINATOR = 2
internal const val URL_FADING_EDGE_SIZE_DP = 24
const val BOTTOM_PROGRESS_BAR = 0
internal const val BOTTOM_PROGRESS_BAR = 0
private const val TOP_PROGRESS_BAR = 1
private const val ICON_PADDING_DP = 16
private const val URL_TEXT_SIZE = 15f
private const val PROGRESS_BAR_HEIGHT_DP = 3
private const val URL_TEXT_SIZE_SP = 15f
}
}
......@@ -18,7 +18,6 @@ import mozilla.components.browser.menu.BrowserMenuBuilder
import mozilla.components.browser.menu.item.BrowserMenuHighlightableItem
import mozilla.components.browser.toolbar.R
import mozilla.components.browser.toolbar.facts.emitOpenMenuFact
import mozilla.components.support.ktx.android.content.res.pxToDp
@Suppress("ViewConstructor") // This view is only instantiated in code
internal class MenuButton(
......@@ -29,7 +28,7 @@ internal class MenuButton(
private var menu: BrowserMenu? = null
private val menuIcon = AppCompatImageView(context).apply {
setPadding(resources.pxToDp(MENU_PADDING_DP))
setPadding(resources.getDimensionPixelSize(R.dimen.mozac_browser_toolbar_menu_padding))
setImageResource(mozilla.components.ui.icons.R.drawable.mozac_ic_menu)
contentDescription = context.getString(R.string.mozac_browser_toolbar_menu_button)
}
......@@ -100,8 +99,4 @@ internal class MenuButton(
fun setColorFilter(@ColorInt color: Int) {
menuIcon.setColorFilter(color)
}
companion object {
private const val MENU_PADDING_DP = 16
}
}
......@@ -24,7 +24,6 @@ import mozilla.components.browser.toolbar.internal.invalidateActions
import mozilla.components.browser.toolbar.internal.measureActions
import mozilla.components.browser.toolbar.internal.wrapAction
import mozilla.components.concept.toolbar.Toolbar
import mozilla.components.support.ktx.android.content.res.pxToDp
import mozilla.components.support.ktx.android.view.showKeyboard
import mozilla.components.ui.autocomplete.InlineAutocompleteEditText
......@@ -51,10 +50,10 @@ internal class EditToolbar(
gravity = Gravity.CENTER_VERTICAL
background = null
setLines(1)
textSize = URL_TEXT_SIZE
textSize = URL_TEXT_SIZE_SP
inputType = InputType.TYPE_TEXT_VARIATION_URI or InputType.TYPE_CLASS_TEXT
setPadding(resources.pxToDp(URL_PADDING_DP))
setPadding(resources.getDimensionPixelSize(R.dimen.mozac_browser_toolbar_url_padding))
setSelectAllOnFocus(true)
setOnCommitListener {
......@@ -93,7 +92,7 @@ internal class EditToolbar(
private val clearView = ImageView(context).apply {
visibility = View.GONE
id = R.id.mozac_browser_toolbar_clear_view
setPadding(resources.pxToDp(CANCEL_PADDING_DP))
setPadding(resources.getDimensionPixelSize(R.dimen.mozac_browser_toolbar_cancel_padding))
setImageResource(mozilla.components.ui.icons.R.drawable.mozac_ic_clear)
contentDescription = context.getString(R.string.mozac_clear_button_description)
scaleType = ImageView.ScaleType.CENTER
......@@ -183,8 +182,6 @@ internal class EditToolbar(
}
companion object {
private const val URL_TEXT_SIZE = 15f
private const val URL_PADDING_DP = 8
private const val CANCEL_PADDING_DP = 16
private const val URL_TEXT_SIZE_SP = 15f
}
}
<?xml version="1.0" encoding="utf-8"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<resources>
<dimen name="mozac_browser_toolbar_default_toolbar_height">56dp</dimen>
<!-- DisplayToolbar -->
<dimen name="mozac_browser_toolbar_progress_bar_height">3dp</dimen>
<dimen name="mozac_browser_toolbar_url_fading_edge_size">24dp</dimen>
<dimen name="mozac_browser_toolbar_icon_padding">16dp</dimen>
<dimen name="mozac_browser_toolbar_menu_padding">16dp</dimen>
<!-- EditToolbar -->
<dimen name="mozac_browser_toolbar_url_padding">8dp</dimen>
<dimen name="mozac_browser_toolbar_cancel_padding">16dp</dimen>
</resources>
......@@ -5,6 +5,9 @@ import android.util.TypedValue
/**
* Converts a value in density independent pixels (pxToDp) to the actual pixel values for the display.
* @deprecated use Int.dpToPx instead.
*/
// @Deprecated("Use Int.dpToPx instead",
// ReplaceWith("pixels.dpToPx(this.displayMetrics)", "mozilla.components.support.ktx.android.util.Int.dpToPx"))
fun Resources.pxToDp(pixels: Int) = TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_DIP, pixels.toFloat(), displayMetrics).toInt()
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package mozilla.components.support.ktx.android.util
import android.util.DisplayMetrics
import android.util.TypedValue
/**
* Converts a value in density independent pixels (dp) to a float value.
*/
fun Int.dpToFloat(displayMetrics: DisplayMetrics) = TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_DIP, this.toFloat(), displayMetrics)
/**
* Converts a value in density independent pixels (dp) to the actual pixel values for the display.
*/
fun Int.dpToPx(displayMetrics: DisplayMetrics) = dpToFloat(displayMetrics).toInt()
......@@ -13,7 +13,7 @@ import android.view.inputmethod.InputMethodManager
import androidx.core.content.getSystemService
import androidx.core.view.ViewCompat
import mozilla.components.support.base.android.Padding
import mozilla.components.support.ktx.android.content.res.pxToDp
import mozilla.components.support.ktx.android.util.dpToPx
import java.lang.ref.WeakReference
/**
......@@ -88,10 +88,10 @@ fun View.getRectWithViewLocation(): Rect {
fun View.setPadding(padding: Padding) {
with(resources) {
setPadding(
pxToDp(padding.left),
pxToDp(padding.top),
pxToDp(padding.right),
pxToDp(padding.bottom)
padding.left.dpToPx(displayMetrics),
padding.top.dpToPx(displayMetrics),
padding.right.dpToPx(displayMetrics),
padding.bottom.dpToPx(displayMetrics)
)
}
}
......
package mozilla.components.support.ktx.android.content.res
package mozilla.components.support.ktx.android.util
import android.util.DisplayMetrics
import androidx.test.ext.junit.runners.AndroidJUnit4
......@@ -8,17 +8,16 @@ import org.junit.Test
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
class ResourcesTest {
class DisplayMetricsTest {
@Test
fun `dp returns same value as manual conversion`() {
val resources = testContext.resources
val metrics = resources.displayMetrics
val metrics = testContext.resources.displayMetrics
for (i in 1..500) {
val px = (i * (metrics.densityDpi.toFloat() / DisplayMetrics.DENSITY_DEFAULT)).toInt()
Assert.assertEquals(px, resources.pxToDp(i))
Assert.assertNotEquals(0, resources.pxToDp(i))
Assert.assertEquals(px, i.dpToPx(metrics))
Assert.assertNotEquals(0, i.dpToPx(metrics))
}
}
}
\ No newline at end of file
}
......@@ -13,7 +13,12 @@ permalink: /changelog/
* [Configuration](https://github.com/mozilla-mobile/android-components/blob/master/buildSrc/src/main/java/Config.kt)
* **lib-state**
* A new component for maintaining application, screen or component state via a redux-style `Store`. This component provides the architectural foundation for the `browser-state` component (in development).
* A new component for maintaining application, screen or component state via a redux-style `Store`. This component provides the architectural foundation for the `browser-state` component (in development).
* **support-ktx**
* Deprecated `Resource.pxToDp`.
* Added `Int.dpToPx` to convert from density independent pixels to an int representing screen pixels.
* Added `Int.dpToFloat` to convert from density independent pixels to a float representing screen pixels.
* **support-ktx**
* Added `Context.isScreenReaderEnabled` extension to check if TalkBack service is enabled.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment