Import variables referred to by path
parent
55f5c5d049
commit
30930cdc88
|
@ -6,6 +6,8 @@ package org.mozilla.fenix
|
|||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Application
|
||||
import android.os.Build
|
||||
import android.os.Build.VERSION.SDK_INT
|
||||
import androidx.appcompat.app.AppCompatDelegate
|
||||
import io.reactivex.plugins.RxJavaPlugins
|
||||
import kotlinx.coroutines.Deferred
|
||||
|
@ -197,41 +199,40 @@ open class FenixApplication : Application() {
|
|||
@SuppressLint("WrongConstant")
|
||||
// Suppressing erroneous lint warning about using MODE_NIGHT_AUTO_BATTERY, a likely library bug
|
||||
private fun setDayNightTheme() {
|
||||
val settings = Settings.getInstance(this)
|
||||
when {
|
||||
Settings.getInstance(this).shouldUseLightTheme -> {
|
||||
settings.shouldUseLightTheme -> {
|
||||
AppCompatDelegate.setDefaultNightMode(
|
||||
AppCompatDelegate.MODE_NIGHT_NO
|
||||
)
|
||||
}
|
||||
Settings.getInstance(this).shouldUseDarkTheme -> {
|
||||
settings.shouldUseDarkTheme -> {
|
||||
AppCompatDelegate.setDefaultNightMode(
|
||||
AppCompatDelegate.MODE_NIGHT_YES
|
||||
)
|
||||
}
|
||||
android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.P &&
|
||||
Settings.getInstance(this).shouldUseAutoBatteryTheme -> {
|
||||
SDK_INT < Build.VERSION_CODES.P && settings.shouldUseAutoBatteryTheme -> {
|
||||
AppCompatDelegate.setDefaultNightMode(
|
||||
AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY
|
||||
)
|
||||
}
|
||||
android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.P &&
|
||||
Settings.getInstance(this).shouldFollowDeviceTheme -> {
|
||||
SDK_INT >= Build.VERSION_CODES.P && settings.shouldFollowDeviceTheme -> {
|
||||
AppCompatDelegate.setDefaultNightMode(
|
||||
AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
|
||||
)
|
||||
}
|
||||
// First run of app no default set, set the default to Follow System for 28+ and Normal Mode otherwise
|
||||
else -> {
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.P) {
|
||||
if (SDK_INT >= Build.VERSION_CODES.P) {
|
||||
AppCompatDelegate.setDefaultNightMode(
|
||||
AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
|
||||
)
|
||||
Settings.getInstance(this).setFollowDeviceTheme(true)
|
||||
settings.setFollowDeviceTheme(true)
|
||||
} else {
|
||||
AppCompatDelegate.setDefaultNightMode(
|
||||
AppCompatDelegate.MODE_NIGHT_NO
|
||||
)
|
||||
Settings.getInstance(this).setLightTheme(true)
|
||||
settings.setLightTheme(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,8 @@ import android.app.Activity
|
|||
import android.content.Context
|
||||
import android.content.res.Configuration
|
||||
import android.graphics.Color
|
||||
import android.os.Build
|
||||
import android.os.Build.VERSION.SDK_INT
|
||||
import android.util.TypedValue
|
||||
import android.view.View
|
||||
import android.view.Window
|
||||
|
@ -70,7 +72,7 @@ interface ThemeManager {
|
|||
window: Window,
|
||||
context: Context
|
||||
) {
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
|
||||
if (SDK_INT >= Build.VERSION_CODES.M) {
|
||||
window.statusBarColor = ContextCompat
|
||||
.getColor(
|
||||
context, resolveAttribute(android.R.attr.statusBarColor, context)
|
||||
|
@ -83,7 +85,7 @@ interface ThemeManager {
|
|||
window.statusBarColor = Color.BLACK
|
||||
}
|
||||
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
|
||||
if (SDK_INT >= Build.VERSION_CODES.O) {
|
||||
// API level can display handle light navigation bar color
|
||||
window.decorView.systemUiVisibility =
|
||||
window.decorView.systemUiVisibility or
|
||||
|
|
|
@ -4,6 +4,7 @@ package org.mozilla.fenix.collections
|
|||
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/. */
|
||||
|
||||
import android.graphics.PorterDuff.Mode.SRC_IN
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
|
@ -89,7 +90,7 @@ class CollectionViewHolder(
|
|||
view.context,
|
||||
getIconColor(collection.id)
|
||||
),
|
||||
android.graphics.PorterDuff.Mode.SRC_IN
|
||||
SRC_IN
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ import android.widget.FrameLayout
|
|||
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
import androidx.core.widget.TextViewCompat
|
||||
import com.google.android.material.snackbar.BaseTransientBottomBar
|
||||
import com.google.android.material.snackbar.ContentViewCallback
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import kotlinx.android.synthetic.main.fenix_snackbar.view.*
|
||||
import org.mozilla.fenix.R
|
||||
|
@ -110,7 +111,7 @@ class FenixSnackbar private constructor(
|
|||
|
||||
private class FenixSnackbarCallback(
|
||||
private val content: View
|
||||
) : com.google.android.material.snackbar.ContentViewCallback {
|
||||
) : ContentViewCallback {
|
||||
|
||||
override fun animateContentIn(delay: Int, duration: Int) {
|
||||
content.translationY = (content.height).toFloat()
|
||||
|
|
|
@ -13,6 +13,7 @@ import android.content.Context
|
|||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Build.VERSION.SDK_INT
|
||||
import androidx.core.app.NotificationCompat
|
||||
import androidx.core.app.NotificationManagerCompat
|
||||
import androidx.core.content.getSystemService
|
||||
|
@ -33,7 +34,7 @@ class NotificationManager(private val context: Context) {
|
|||
init {
|
||||
// Create the notification channels we are going to use, but only on API 26+ because the NotificationChannel
|
||||
// class is new and not in the support library.
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
if (SDK_INT >= Build.VERSION_CODES.O) {
|
||||
createNotificationChannel(
|
||||
RECEIVE_TABS_CHANNEL_ID,
|
||||
// Pick 'high' because this is a user-triggered action that is expected to be part of a continuity flow.
|
||||
|
@ -68,7 +69,7 @@ class NotificationManager(private val context: Context) {
|
|||
.setPriority(NotificationCompat.PRIORITY_HIGH)
|
||||
.setDefaults(Notification.DEFAULT_VIBRATE or Notification.DEFAULT_SOUND)
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
if (SDK_INT >= Build.VERSION_CODES.M) {
|
||||
builder.setCategory(Notification.CATEGORY_REMINDER)
|
||||
}
|
||||
|
||||
|
|
|
@ -4,8 +4,10 @@
|
|||
|
||||
package org.mozilla.fenix.ext
|
||||
|
||||
import android.content.res.Configuration
|
||||
import android.content.res.Resources
|
||||
import android.os.Build
|
||||
import android.os.Build.VERSION.SDK_INT
|
||||
import android.text.SpannableString
|
||||
import android.text.Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
|
||||
import androidx.annotation.StringRes
|
||||
|
@ -19,13 +21,19 @@ fun Resources.getSpannable(@StringRes id: Int, spanParts: List<Pair<Any, Iterabl
|
|||
val resultCreator = SpannableStringCreator()
|
||||
Formatter(
|
||||
SpannableAppendable(resultCreator, spanParts),
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
configuration.locales[0]
|
||||
} else configuration.locale
|
||||
getLocale(configuration)
|
||||
).format(getString(id), *spanParts.map { it.first }.toTypedArray())
|
||||
return resultCreator.toSpannableString()
|
||||
}
|
||||
|
||||
@Suppress("Deprecation")
|
||||
private fun getLocale(configuration: Configuration) =
|
||||
if (SDK_INT >= Build.VERSION_CODES.N) {
|
||||
configuration.locales[0]
|
||||
} else {
|
||||
configuration.locale
|
||||
}
|
||||
|
||||
class SpannableStringCreator {
|
||||
private val parts = ArrayList<CharSequence>()
|
||||
private var length = 0
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
package org.mozilla.fenix.home
|
||||
|
||||
import android.graphics.PorterDuff
|
||||
import android.graphics.PorterDuff.Mode.SRC_IN
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
|
@ -13,10 +13,10 @@ import androidx.core.content.ContextCompat
|
|||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
||||
import kotlinx.android.extensions.LayoutContainer
|
||||
import kotlinx.android.synthetic.main.session_bottom_sheet.view.*
|
||||
import org.mozilla.fenix.utils.ItsNotBrokenSnack
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.ThemeManager
|
||||
import org.mozilla.fenix.ext.getColorFromAttr
|
||||
import org.mozilla.fenix.utils.ItsNotBrokenSnack
|
||||
|
||||
class SessionBottomSheetFragment : BottomSheetDialogFragment(), LayoutContainer {
|
||||
sealed class SessionType {
|
||||
|
@ -48,7 +48,7 @@ class SessionBottomSheetFragment : BottomSheetDialogFragment(), LayoutContainer
|
|||
ContextCompat.getColor(
|
||||
context!!,
|
||||
ThemeManager.resolveAttribute(R.attr.accent, context!!)
|
||||
), PorterDuff.Mode.SRC_IN
|
||||
), SRC_IN
|
||||
)
|
||||
setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null)
|
||||
setOnClickListener {
|
||||
|
@ -59,7 +59,7 @@ class SessionBottomSheetFragment : BottomSheetDialogFragment(), LayoutContainer
|
|||
view.delete_session_button.apply {
|
||||
val drawable = ContextCompat.getDrawable(context!!, R.drawable.ic_delete)
|
||||
drawable?.setColorFilter(
|
||||
R.attr.destructive.getColorFromAttr(context), PorterDuff.Mode.SRC_IN
|
||||
R.attr.destructive.getColorFromAttr(context), SRC_IN
|
||||
)
|
||||
setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null)
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ class SessionBottomSheetFragment : BottomSheetDialogFragment(), LayoutContainer
|
|||
ContextCompat.getColor(
|
||||
context!!,
|
||||
ThemeManager.resolveAttribute(R.attr.primaryText, context!!)
|
||||
), PorterDuff.Mode.SRC_IN
|
||||
), SRC_IN
|
||||
)
|
||||
setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null)
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
package org.mozilla.fenix.home.sessioncontrol.viewholders
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.PorterDuff.Mode.SRC_IN
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.content.ContextCompat
|
||||
|
@ -104,7 +105,7 @@ class CollectionViewHolder(
|
|||
view.context,
|
||||
getIconColor(collection.id)
|
||||
),
|
||||
android.graphics.PorterDuff.Mode.SRC_IN
|
||||
SRC_IN
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
package org.mozilla.fenix.home.sessioncontrol.viewholders.onboarding
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import android.os.Build.VERSION.SDK_INT
|
||||
import android.view.View
|
||||
import androidx.appcompat.app.AppCompatDelegate
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
|
@ -29,7 +31,7 @@ class OnboardingThemePickerViewHolder(private val view: View) : RecyclerView.Vie
|
|||
val radioDarkTheme = view.theme_dark_radio_button
|
||||
val radioFollowDeviceTheme = view.theme_automatic_radio_button
|
||||
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.P) {
|
||||
if (SDK_INT >= Build.VERSION_CODES.P) {
|
||||
radioFollowDeviceTheme?.key = R.string.pref_key_follow_device_theme
|
||||
} else {
|
||||
radioFollowDeviceTheme?.key = R.string.pref_key_auto_battery_theme
|
||||
|
@ -69,7 +71,7 @@ class OnboardingThemePickerViewHolder(private val view: View) : RecyclerView.Vie
|
|||
}
|
||||
|
||||
radioFollowDeviceTheme.onClickListener {
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.P) {
|
||||
if (SDK_INT >= Build.VERSION_CODES.P) {
|
||||
setNewTheme(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
|
||||
} else {
|
||||
setNewTheme(AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY)
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
package org.mozilla.fenix.library
|
||||
|
||||
import android.graphics.PorterDuff
|
||||
import android.graphics.PorterDuff.Mode.SRC_IN
|
||||
import android.graphics.PorterDuffColorFilter
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
|
@ -97,6 +97,6 @@ class LibraryFragment : Fragment() {
|
|||
toolbar.setBackgroundColor(backgroundColor)
|
||||
toolbar.setTitleTextColor(foregroundColor)
|
||||
toolbar.navigationIcon?.colorFilter =
|
||||
PorterDuffColorFilter(foregroundColor, PorterDuff.Mode.SRC_IN)
|
||||
PorterDuffColorFilter(foregroundColor, SRC_IN)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ package org.mozilla.fenix.library.bookmarks
|
|||
import android.content.ClipData
|
||||
import android.content.ClipboardManager
|
||||
import android.content.Context
|
||||
import android.graphics.PorterDuff
|
||||
import android.graphics.PorterDuff.Mode.SRC_IN
|
||||
import android.graphics.PorterDuffColorFilter
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
|
@ -158,7 +158,7 @@ class BookmarkFragment : Fragment(), BackHandler, AccountObserver {
|
|||
isVisible = mode.selectedItems.size == 1
|
||||
icon.colorFilter = PorterDuffColorFilter(
|
||||
ContextCompat.getColor(context!!, R.color.white_color),
|
||||
PorterDuff.Mode.SRC_IN
|
||||
SRC_IN
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
package org.mozilla.fenix.library.bookmarks
|
||||
|
||||
import android.graphics.PorterDuff
|
||||
import android.graphics.PorterDuff.Mode.SRC_IN
|
||||
import android.graphics.PorterDuffColorFilter
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
|
@ -90,7 +90,7 @@ class BookmarkUIView(
|
|||
private fun setToolbarColors(foreground: Int, background: Int) {
|
||||
val toolbar = activity?.findViewById<Toolbar>(R.id.navigationToolbar)
|
||||
val colorFilter = PorterDuffColorFilter(
|
||||
ContextCompat.getColor(context, foreground), PorterDuff.Mode.SRC_IN
|
||||
ContextCompat.getColor(context, foreground), SRC_IN
|
||||
)
|
||||
toolbar?.run {
|
||||
setBackgroundColor(ContextCompat.getColor(context, background))
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
package org.mozilla.fenix.library.bookmarks.addfolder
|
||||
|
||||
import android.graphics.PorterDuff
|
||||
import android.graphics.PorterDuff.Mode.SRC_IN
|
||||
import android.graphics.PorterDuffColorFilter
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
|
@ -71,7 +71,7 @@ class AddBookmarkFolderFragment : Fragment() {
|
|||
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
|
||||
inflater.inflate(R.menu.bookmarks_add_folder, menu)
|
||||
menu.findItem(R.id.confirm_add_folder_button).icon.colorFilter =
|
||||
PorterDuffColorFilter(R.attr.primaryText.getColorFromAttr(context!!), PorterDuff.Mode.SRC_IN)
|
||||
PorterDuffColorFilter(R.attr.primaryText.getColorFromAttr(context!!), SRC_IN)
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
|
|
|
@ -6,7 +6,7 @@ package org.mozilla.fenix.library.bookmarks.edit
|
|||
|
||||
import android.content.Context
|
||||
import android.content.DialogInterface
|
||||
import android.graphics.PorterDuff
|
||||
import android.graphics.PorterDuff.Mode.SRC_IN
|
||||
import android.graphics.PorterDuffColorFilter
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
|
@ -142,7 +142,7 @@ class EditBookmarkFragment : Fragment() {
|
|||
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
|
||||
inflater.inflate(R.menu.bookmarks_edit, menu)
|
||||
menu.findItem(R.id.delete_bookmark_button).icon.colorFilter =
|
||||
PorterDuffColorFilter(R.attr.primaryText.getColorFromAttr(context!!), PorterDuff.Mode.SRC_IN)
|
||||
PorterDuffColorFilter(R.attr.primaryText.getColorFromAttr(context!!), SRC_IN)
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
package org.mozilla.fenix.library.bookmarks.selectfolder
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.PorterDuff
|
||||
import android.graphics.PorterDuff.Mode.SRC_IN
|
||||
import android.graphics.PorterDuffColorFilter
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
|
@ -131,7 +131,7 @@ class SelectBookmarkFolderFragment : Fragment(), AccountObserver {
|
|||
if (!visitedAddBookmark) {
|
||||
inflater.inflate(R.menu.bookmarks_select_folder, menu)
|
||||
menu.findItem(R.id.add_folder_button).icon.colorFilter =
|
||||
PorterDuffColorFilter(R.attr.primaryText.getColorFromAttr(context!!), PorterDuff.Mode.SRC_IN)
|
||||
PorterDuffColorFilter(R.attr.primaryText.getColorFromAttr(context!!), SRC_IN)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
package org.mozilla.fenix.library.history
|
||||
|
||||
import android.content.DialogInterface
|
||||
import android.graphics.PorterDuff
|
||||
import android.graphics.PorterDuff.Mode.SRC_IN
|
||||
import android.graphics.PorterDuffColorFilter
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
|
@ -107,7 +107,7 @@ class HistoryFragment : Fragment(), BackHandler {
|
|||
isVisible = mode.selectedItems.isNotEmpty()
|
||||
icon.colorFilter = PorterDuffColorFilter(
|
||||
ContextCompat.getColor(context!!, R.color.white_color),
|
||||
PorterDuff.Mode.SRC_IN
|
||||
SRC_IN
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
|
||||
package org.mozilla.fenix.library.history
|
||||
|
||||
import android.graphics.PorterDuff
|
||||
import android.graphics.PorterDuff.Mode.SRC_IN
|
||||
import android.graphics.PorterDuffColorFilter
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.appcompat.widget.Toolbar
|
||||
import android.widget.ImageButton
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.appcompat.widget.Toolbar
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
|
@ -97,9 +97,7 @@ class HistoryUIView(
|
|||
|
||||
private fun setToolbarColors(foreground: Int, background: Int) {
|
||||
val toolbar = (activity as AppCompatActivity).findViewById<Toolbar>(R.id.navigationToolbar)
|
||||
val colorFilter = PorterDuffColorFilter(
|
||||
ContextCompat.getColor(context, foreground), PorterDuff.Mode.SRC_IN
|
||||
)
|
||||
val colorFilter = PorterDuffColorFilter(ContextCompat.getColor(context, foreground), SRC_IN)
|
||||
toolbar.setBackgroundColor(ContextCompat.getColor(context, background))
|
||||
toolbar.setTitleTextColor(ContextCompat.getColor(context, foreground))
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ package org.mozilla.fenix.search.awesomebar
|
|||
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/. */
|
||||
|
||||
import android.graphics.PorterDuff
|
||||
import android.graphics.PorterDuff.Mode.SRC_IN
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.content.ContextCompat
|
||||
|
@ -93,13 +93,13 @@ class AwesomeBarUIView(
|
|||
|
||||
init {
|
||||
with(container.context) {
|
||||
val draw = getDrawable(R.drawable.ic_link)
|
||||
draw?.setColorFilter(
|
||||
ContextCompat.getColor(
|
||||
this,
|
||||
ThemeManager.resolveAttribute(R.attr.primaryText, this)
|
||||
), PorterDuff.Mode.SRC_IN
|
||||
val primaryTextColor = ContextCompat.getColor(
|
||||
this,
|
||||
ThemeManager.resolveAttribute(R.attr.primaryText, this)
|
||||
)
|
||||
|
||||
val draw = getDrawable(R.drawable.ic_link)
|
||||
draw?.setColorFilter(primaryTextColor, SRC_IN)
|
||||
clipboardSuggestionProvider = ClipboardSuggestionProvider(
|
||||
this,
|
||||
loadUrlUseCase,
|
||||
|
@ -130,12 +130,7 @@ class AwesomeBarUIView(
|
|||
|
||||
if (Settings.getInstance(container.context).showSearchSuggestions) {
|
||||
val searchDrawable = getDrawable(R.drawable.ic_search)
|
||||
searchDrawable?.setColorFilter(
|
||||
ContextCompat.getColor(
|
||||
this,
|
||||
ThemeManager.resolveAttribute(R.attr.primaryText, this)
|
||||
), PorterDuff.Mode.SRC_IN
|
||||
)
|
||||
searchDrawable?.setColorFilter(primaryTextColor, SRC_IN)
|
||||
defaultSearchSuggestionProvider =
|
||||
SearchSuggestionProvider(
|
||||
searchEngine = components.search.searchEngineManager.getDefaultSearchEngine(
|
||||
|
@ -199,7 +194,7 @@ class AwesomeBarUIView(
|
|||
ContextCompat.getColor(
|
||||
this,
|
||||
ThemeManager.resolveAttribute(R.attr.primaryText, this)
|
||||
), PorterDuff.Mode.SRC_IN
|
||||
), SRC_IN
|
||||
)
|
||||
|
||||
searchSuggestionFromShortcutProvider =
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
package org.mozilla.fenix.settings
|
||||
|
||||
import android.content.pm.PackageManager
|
||||
import android.os.Build
|
||||
import android.os.Build.VERSION.SDK_INT
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
|
@ -27,9 +29,10 @@ class AboutFragment : Fragment() {
|
|||
|
||||
val appName = requireContext().resources.getString(R.string.app_name)
|
||||
(activity as AppCompatActivity).title = getString(R.string.preferences_about, appName)
|
||||
var maybeGecko = " \uD83E\uDD8E "
|
||||
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.N) {
|
||||
maybeGecko = "GV: "
|
||||
val maybeGecko = if (SDK_INT < Build.VERSION_CODES.N) {
|
||||
"GV: "
|
||||
} else {
|
||||
" \uD83E\uDD8E "
|
||||
}
|
||||
|
||||
val aboutText = try {
|
||||
|
|
|
@ -11,12 +11,12 @@ import android.content.Context
|
|||
import mozilla.components.feature.sitepermissions.SitePermissions
|
||||
import mozilla.components.support.ktx.android.content.isPermissionGranted
|
||||
import org.mozilla.fenix.utils.Settings
|
||||
import android.Manifest.permission.CAMERA as CAMERA_PERMISSION
|
||||
|
||||
const val ID_CAMERA_PERMISSION = 0
|
||||
const val ID_LOCATION_PERMISSION = 1
|
||||
const val ID_MICROPHONE_PERMISSION = 2
|
||||
const val ID_NOTIFICATION_PERMISSION = 3
|
||||
private const val CAMERA_PERMISSION = android.Manifest.permission.CAMERA
|
||||
|
||||
enum class PhoneFeature(val id: Int, val androidPermissionsList: Array<String>) {
|
||||
CAMERA(ID_CAMERA_PERMISSION, arrayOf(CAMERA_PERMISSION)),
|
||||
|
|
|
@ -9,6 +9,8 @@ import android.content.Context
|
|||
import android.content.Intent
|
||||
import android.content.SharedPreferences
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Build.VERSION.SDK_INT
|
||||
import android.os.Bundle
|
||||
import android.provider.Settings
|
||||
import android.widget.Toast
|
||||
|
@ -86,7 +88,7 @@ class SettingsFragment : PreferenceFragmentCompat(), AccountObserver {
|
|||
|
||||
preferenceManager.sharedPreferences.registerOnSharedPreferenceChangeListener(preferenceChangeListener)
|
||||
|
||||
if (android.os.Build.VERSION.SDK_INT <= android.os.Build.VERSION_CODES.M) {
|
||||
if (SDK_INT <= Build.VERSION_CODES.M) {
|
||||
findPreference<DefaultBrowserPreference>(getString(R.string.pref_key_make_default_browser))?.apply {
|
||||
isVisible = false
|
||||
}
|
||||
|
@ -259,7 +261,7 @@ class SettingsFragment : PreferenceFragmentCompat(), AccountObserver {
|
|||
}
|
||||
|
||||
private fun getClickListenerForMakeDefaultBrowser(): OnPreferenceClickListener {
|
||||
return if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
|
||||
return if (SDK_INT >= Build.VERSION_CODES.N) {
|
||||
OnPreferenceClickListener {
|
||||
val intent = Intent(
|
||||
Settings.ACTION_MANAGE_DEFAULT_APPS_SETTINGS
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
package org.mozilla.fenix.settings
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.os.Build
|
||||
import android.os.Build.VERSION.SDK_INT
|
||||
import android.os.Bundle
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.appcompat.app.AppCompatDelegate
|
||||
|
@ -42,7 +44,7 @@ class ThemeFragment : PreferenceFragmentCompat() {
|
|||
|
||||
radioDarkTheme.addToRadioGroup(radioLightTheme)
|
||||
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.P) {
|
||||
if (SDK_INT >= Build.VERSION_CODES.P) {
|
||||
radioLightTheme.addToRadioGroup(radioFollowDeviceTheme)
|
||||
radioDarkTheme.addToRadioGroup(radioFollowDeviceTheme)
|
||||
|
||||
|
@ -86,7 +88,7 @@ class ThemeFragment : PreferenceFragmentCompat() {
|
|||
private fun bindFollowDeviceTheme() {
|
||||
val keyDeviceTheme = getString(R.string.pref_key_follow_device_theme)
|
||||
radioFollowDeviceTheme = requireNotNull(findPreference(keyDeviceTheme))
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.P) {
|
||||
if (SDK_INT >= Build.VERSION_CODES.P) {
|
||||
radioFollowDeviceTheme.onClickListener {
|
||||
setNewTheme(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
package org.mozilla.fenix.share
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.PorterDuff
|
||||
import android.graphics.PorterDuff.Mode.SRC_IN
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
|
@ -143,7 +143,7 @@ class AccountDeviceViewHolder(
|
|||
|
||||
itemView.device_icon.apply {
|
||||
setImageResource(drawableRes)
|
||||
background.setColorFilter(ContextCompat.getColor(context, colorRes), PorterDuff.Mode.SRC_IN)
|
||||
background.setColorFilter(ContextCompat.getColor(context, colorRes), SRC_IN)
|
||||
drawable.setTint(ContextCompat.getColor(context, R.color.device_foreground))
|
||||
}
|
||||
itemView.device_name.text = name
|
||||
|
|
|
@ -6,7 +6,7 @@ package org.mozilla.fenix.utils
|
|||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.graphics.PorterDuff
|
||||
import android.graphics.PorterDuff.Mode.SRC_IN
|
||||
import android.graphics.PorterDuffColorFilter
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.util.AttributeSet
|
||||
|
@ -16,8 +16,7 @@ import androidx.core.content.ContextCompat.getColor
|
|||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.ThemeManager
|
||||
|
||||
class ClearableEditText @JvmOverloads
|
||||
constructor(
|
||||
class ClearableEditText @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = R.attr.editTextStyle
|
||||
|
@ -41,7 +40,7 @@ constructor(
|
|||
setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_clear, 0)
|
||||
for (drawable: Drawable in compoundDrawables.filterNotNull()) {
|
||||
val color = ThemeManager.resolveAttribute(R.attr.primaryText, context!!)
|
||||
drawable.colorFilter = PorterDuffColorFilter(getColor(context, color), PorterDuff.Mode.SRC_IN)
|
||||
drawable.colorFilter = PorterDuffColorFilter(getColor(context, color), SRC_IN)
|
||||
}
|
||||
} else {
|
||||
setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0)
|
||||
|
|
Loading…
Reference in New Issue