Fixes #4005 - Move getColorFromAttr to Context
parent
c8148e61d5
commit
c2e6e25bef
@ -1,23 +0,0 @@
|
||||
/* 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 org.mozilla.fenix.ext
|
||||
|
||||
import android.content.Context
|
||||
import androidx.annotation.ColorInt
|
||||
import androidx.annotation.ColorRes
|
||||
import androidx.core.content.ContextCompat
|
||||
import org.mozilla.fenix.ThemeManager
|
||||
|
||||
/**
|
||||
* Returns the color resource corresponding to the attribute.
|
||||
*/
|
||||
@ColorRes
|
||||
fun Int.getColorIntFromAttr(context: Context): Int = ThemeManager.resolveAttribute(this, context)
|
||||
|
||||
/**
|
||||
* Returns the color int corresponding to the attribute.
|
||||
*/
|
||||
@ColorInt
|
||||
fun Int.getColorFromAttr(context: Context): Int = ContextCompat.getColor(context, this.getColorIntFromAttr(context))
|
Loading…
Reference in New Issue