mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-09 19:10:42 +00:00
Replace deprecated pxToDp (#3932)
This commit is contained in:
parent
0bf8b96790
commit
9901514766
@ -14,7 +14,8 @@ import io.reactivex.Observer
|
||||
import io.reactivex.functions.Consumer
|
||||
import mozilla.components.browser.domains.autocomplete.ShippedDomainsProvider
|
||||
import mozilla.components.browser.toolbar.BrowserToolbar
|
||||
import mozilla.components.support.ktx.android.content.res.pxToDp
|
||||
import mozilla.components.support.ktx.android.util.dpToFloat
|
||||
import mozilla.components.support.ktx.android.util.dpToPx
|
||||
import org.jetbrains.anko.backgroundDrawable
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.customtabs.CustomTabToolbarMenu
|
||||
@ -53,7 +54,7 @@ class ToolbarUIView(
|
||||
editMode()
|
||||
}
|
||||
|
||||
elevation = resources.pxToDp(TOOLBAR_ELEVATION).toFloat()
|
||||
elevation = TOOLBAR_ELEVATION.dpToFloat(resources.displayMetrics)
|
||||
|
||||
setOnUrlCommitListener {
|
||||
actionEmitter.onNext(SearchAction.UrlCommitted(it, sessionId, state?.engine))
|
||||
@ -64,7 +65,7 @@ class ToolbarUIView(
|
||||
false
|
||||
}
|
||||
|
||||
browserActionMargin = resources.pxToDp(browserActionMarginDp)
|
||||
browserActionMargin = browserActionMarginDp.dpToPx(resources.displayMetrics)
|
||||
|
||||
val isCustomTabSession = (session?.isCustomTabSession() == true)
|
||||
|
||||
|
@ -7,10 +7,10 @@ package org.mozilla.fenix.ext
|
||||
import android.graphics.Rect
|
||||
import android.view.TouchDelegate
|
||||
import android.view.View
|
||||
import mozilla.components.support.ktx.android.content.res.pxToDp
|
||||
import mozilla.components.support.ktx.android.util.dpToPx
|
||||
|
||||
fun View?.increaseTapArea(extraDps: Int) {
|
||||
val dips = this!!.resources.pxToDp(extraDps)
|
||||
fun View.increaseTapArea(extraDps: Int) {
|
||||
val dips = extraDps.dpToPx(resources.displayMetrics)
|
||||
val parent = this.parent as View
|
||||
parent.post {
|
||||
val touchRect = Rect()
|
||||
|
@ -17,7 +17,7 @@ import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.launch
|
||||
import mozilla.components.browser.icons.IconRequest
|
||||
import mozilla.components.support.ktx.android.content.res.pxToDp
|
||||
import mozilla.components.support.ktx.android.util.dpToFloat
|
||||
import org.jetbrains.anko.backgroundColor
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.ext.components
|
||||
@ -50,13 +50,13 @@ class TabInCollectionViewHolder(
|
||||
init {
|
||||
collection_tab_icon.clipToOutline = true
|
||||
collection_tab_icon.outlineProvider = object : ViewOutlineProvider() {
|
||||
override fun getOutline(view: View?, outline: Outline?) {
|
||||
override fun getOutline(view: View, outline: Outline?) {
|
||||
outline?.setRoundRect(
|
||||
0,
|
||||
0,
|
||||
view!!.width,
|
||||
view.width,
|
||||
view.height,
|
||||
view.context.resources.pxToDp(TabViewHolder.favIconBorderRadiusInPx).toFloat()
|
||||
TabViewHolder.favIconBorderRadiusInPx.dpToFloat(view.context.resources.displayMetrics)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ import kotlinx.coroutines.launch
|
||||
import mozilla.components.browser.icons.IconRequest
|
||||
import mozilla.components.browser.menu.BrowserMenuBuilder
|
||||
import mozilla.components.browser.menu.item.SimpleBrowserMenuItem
|
||||
import mozilla.components.support.ktx.android.content.res.pxToDp
|
||||
import mozilla.components.support.ktx.android.util.dpToFloat
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.ext.components
|
||||
import org.mozilla.fenix.ext.increaseTapArea
|
||||
@ -76,7 +76,7 @@ class TabViewHolder(
|
||||
0,
|
||||
view!!.width,
|
||||
view.height,
|
||||
view.context.resources.pxToDp(favIconBorderRadiusInPx).toFloat()
|
||||
favIconBorderRadiusInPx.dpToFloat(view.context.resources.displayMetrics)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ import kotlinx.android.extensions.LayoutContainer
|
||||
import kotlinx.android.synthetic.main.bookmark_row.*
|
||||
import mozilla.components.concept.storage.BookmarkNode
|
||||
import mozilla.components.concept.storage.BookmarkNodeType
|
||||
import mozilla.components.support.ktx.android.content.res.pxToDp
|
||||
import mozilla.components.support.ktx.android.util.dpToPx
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.ext.getColorIntFromAttr
|
||||
import org.mozilla.fenix.library.bookmarks.BookmarksSharedViewModel
|
||||
@ -110,8 +110,8 @@ class SelectBookmarkFolderAdapter(private val sharedViewModel: BookmarksSharedVi
|
||||
bookmark_layout.setOnClickListener {
|
||||
selectionInterface.itemSelected(folder.node)
|
||||
}
|
||||
val padding =
|
||||
containerView.resources.pxToDp(dpsToIndent) * (if (folder.depth > maxDepth) maxDepth else folder.depth)
|
||||
val pxToIndent = dpsToIndent.dpToPx(containerView.resources.displayMetrics)
|
||||
val padding = pxToIndent * if (folder.depth > maxDepth) maxDepth else folder.depth
|
||||
bookmark_layout.setPadding(padding, 0, 0, 0)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user