Copione merged onto master
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
commit
7ae961b40a
|
@ -398,7 +398,11 @@ open class FenixApplication : LocaleAwareApplication() {
|
|||
// are not triggered when also using createConfigurationContext like we do in LocaleManager
|
||||
// https://issuetracker.google.com/issues/143570309#comment3
|
||||
applicationContext.resources.configuration.uiMode = config.uiMode
|
||||
super.onConfigurationChanged(config)
|
||||
|
||||
// random StrictMode onDiskRead violation even when Fenix is not running in the background.
|
||||
StrictMode.allowThreadDiskReads().resetPoliciesAfter {
|
||||
super.onConfigurationChanged(config)
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
|
|
@ -7,6 +7,7 @@ package org.mozilla.fenix
|
|||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.os.StrictMode
|
||||
import androidx.annotation.VisibleForTesting
|
||||
import kotlinx.coroutines.MainScope
|
||||
import kotlinx.coroutines.launch
|
||||
|
@ -15,6 +16,7 @@ import org.mozilla.fenix.components.IntentProcessorType
|
|||
import org.mozilla.fenix.components.getType
|
||||
import org.mozilla.fenix.components.metrics.Event
|
||||
import org.mozilla.fenix.ext.components
|
||||
import org.mozilla.fenix.ext.resetPoliciesAfter
|
||||
import org.mozilla.fenix.ext.settings
|
||||
import org.mozilla.fenix.perf.StartupTimeline
|
||||
import org.mozilla.fenix.shortcut.NewTabShortcutIntentProcessor
|
||||
|
@ -26,7 +28,10 @@ class IntentReceiverActivity : Activity() {
|
|||
|
||||
@VisibleForTesting
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
// StrictMode violation on certain devices such as Samsung
|
||||
StrictMode.allowThreadDiskReads().resetPoliciesAfter {
|
||||
super.onCreate(savedInstanceState)
|
||||
}
|
||||
|
||||
MainScope().launch {
|
||||
// The intent property is nullable, but the rest of the code below
|
||||
|
@ -57,8 +62,10 @@ class IntentReceiverActivity : Activity() {
|
|||
intentProcessorType.shouldOpenToBrowser(intent)
|
||||
)
|
||||
}
|
||||
|
||||
startActivity(intent)
|
||||
// StrictMode violation on certain devices such as Samsung
|
||||
StrictMode.allowThreadDiskReads().resetPoliciesAfter {
|
||||
startActivity(intent)
|
||||
}
|
||||
finish() // must finish() after starting the other activity
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ package org.mozilla.fenix.browser
|
|||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.os.StrictMode
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
|
@ -40,6 +41,7 @@ import org.mozilla.fenix.ext.nav
|
|||
import org.mozilla.fenix.ext.navigateSafe
|
||||
import org.mozilla.fenix.ext.requireComponents
|
||||
import org.mozilla.fenix.ext.settings
|
||||
import org.mozilla.fenix.ext.resetPoliciesAfter
|
||||
import org.mozilla.fenix.shortcut.FirstTimePwaObserver
|
||||
import org.mozilla.fenix.trackingprotection.TrackingProtectionOverlay
|
||||
|
||||
|
@ -90,22 +92,24 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler {
|
|||
browserToolbarView.view.addPageAction(readerModeAction)
|
||||
|
||||
readerViewFeature.set(
|
||||
feature = ReaderViewFeature(
|
||||
context,
|
||||
components.core.engine,
|
||||
components.core.store,
|
||||
view.readerViewControlsBar
|
||||
) { available, active ->
|
||||
if (available) {
|
||||
components.analytics.metrics.track(Event.ReaderModeAvailable)
|
||||
}
|
||||
feature = StrictMode.allowThreadDiskReads().resetPoliciesAfter {
|
||||
ReaderViewFeature(
|
||||
context,
|
||||
components.core.engine,
|
||||
components.core.store,
|
||||
view.readerViewControlsBar
|
||||
) { available, active ->
|
||||
if (available) {
|
||||
components.analytics.metrics.track(Event.ReaderModeAvailable)
|
||||
}
|
||||
|
||||
readerModeAvailable = available
|
||||
readerModeAction.setSelected(active)
|
||||
readerModeAvailable = available
|
||||
readerModeAction.setSelected(active)
|
||||
|
||||
runIfFragmentIsAttached {
|
||||
browserToolbarView.view.invalidateActions()
|
||||
browserToolbarView.toolbarIntegration.invalidateMenu()
|
||||
runIfFragmentIsAttached {
|
||||
browserToolbarView.view.invalidateActions()
|
||||
browserToolbarView.toolbarIntegration.invalidateMenu()
|
||||
}
|
||||
}
|
||||
},
|
||||
owner = this,
|
||||
|
|
|
@ -128,18 +128,19 @@ class SearchFragment : Fragment(), UserInteractionHandler {
|
|||
searchController
|
||||
)
|
||||
|
||||
awesomeBarView = AwesomeBarView(view.scrollable_area, searchInteractor)
|
||||
|
||||
awesomeBarView = AwesomeBarView(view.scrollable_area, searchInteractor,
|
||||
view.findViewById(R.id.awesomeBar))
|
||||
view.scrollView.setOnScrollChangeListener {
|
||||
_: NestedScrollView, _: Int, _: Int, _: Int, _: Int ->
|
||||
view.hideKeyboard()
|
||||
}
|
||||
|
||||
toolbarView = ToolbarView(
|
||||
view.toolbar_component_wrapper,
|
||||
requireContext(),
|
||||
searchInteractor,
|
||||
historyStorageProvider(),
|
||||
isPrivate,
|
||||
view.toolbar,
|
||||
requireComponents.core.engine
|
||||
)
|
||||
|
||||
|
|
|
@ -4,14 +4,11 @@
|
|||
|
||||
package org.mozilla.fenix.search.awesomebar
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.appcompat.content.res.AppCompatResources.getDrawable
|
||||
import androidx.core.graphics.BlendModeColorFilterCompat.createBlendModeColorFilterCompat
|
||||
import androidx.core.graphics.BlendModeCompat.SRC_IN
|
||||
import androidx.core.graphics.drawable.toBitmap
|
||||
import kotlinx.android.extensions.LayoutContainer
|
||||
import mozilla.components.browser.awesomebar.BrowserAwesomeBar
|
||||
import mozilla.components.browser.search.SearchEngine
|
||||
import mozilla.components.browser.session.Session
|
||||
|
@ -82,14 +79,9 @@ interface AwesomeBarInteractor {
|
|||
*/
|
||||
class AwesomeBarView(
|
||||
private val container: ViewGroup,
|
||||
val interactor: AwesomeBarInteractor
|
||||
) : LayoutContainer {
|
||||
val view: BrowserAwesomeBar = LayoutInflater.from(container.context)
|
||||
.inflate(R.layout.component_awesomebar, container, true)
|
||||
.findViewById(R.id.awesomeBar)
|
||||
|
||||
override val containerView: View?
|
||||
get() = container
|
||||
val interactor: AwesomeBarInteractor,
|
||||
val view: BrowserAwesomeBar
|
||||
) {
|
||||
|
||||
private val sessionProvider: SessionSuggestionProvider
|
||||
private val historyStorageProvider: HistoryStorageSuggestionProvider
|
||||
|
|
|
@ -4,16 +4,12 @@
|
|||
|
||||
package org.mozilla.fenix.search.toolbar
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.drawable.BitmapDrawable
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.annotation.LayoutRes
|
||||
import androidx.appcompat.content.res.AppCompatResources
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
import androidx.core.content.ContextCompat
|
||||
import kotlinx.android.extensions.LayoutContainer
|
||||
import mozilla.components.browser.domains.autocomplete.ShippedDomainsProvider
|
||||
import mozilla.components.browser.toolbar.BrowserToolbar
|
||||
import mozilla.components.concept.engine.Engine
|
||||
|
@ -23,7 +19,6 @@ import mozilla.components.support.ktx.android.content.getColorFromAttr
|
|||
import mozilla.components.support.ktx.android.util.dpToPx
|
||||
import mozilla.components.support.ktx.android.view.hideKeyboard
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.ext.settings
|
||||
import org.mozilla.fenix.search.SearchFragmentState
|
||||
import org.mozilla.fenix.theme.ThemeManager
|
||||
|
||||
|
@ -55,27 +50,13 @@ interface ToolbarInteractor {
|
|||
* View that contains and configures the BrowserToolbar to only be used in its editing mode.
|
||||
*/
|
||||
class ToolbarView(
|
||||
private val container: ViewGroup,
|
||||
private val context: Context,
|
||||
private val interactor: ToolbarInteractor,
|
||||
private val historyStorage: HistoryStorage?,
|
||||
private val isPrivate: Boolean,
|
||||
val view: BrowserToolbar,
|
||||
engine: Engine
|
||||
) : LayoutContainer {
|
||||
|
||||
override val containerView: View?
|
||||
get() = container
|
||||
|
||||
private val settings = container.context.settings()
|
||||
|
||||
@LayoutRes
|
||||
private val toolbarLayout = when {
|
||||
settings.shouldUseBottomToolbar -> R.layout.component_bottom_browser_toolbar
|
||||
else -> R.layout.component_browser_top_toolbar
|
||||
}
|
||||
|
||||
val view: BrowserToolbar = LayoutInflater.from(container.context)
|
||||
.inflate(toolbarLayout, container, true)
|
||||
.findViewById(R.id.toolbar)
|
||||
) {
|
||||
|
||||
private var isInitialized = false
|
||||
private var hasBeenCanceled = false
|
||||
|
@ -97,7 +78,7 @@ class ToolbarView(
|
|||
|
||||
background =
|
||||
AppCompatResources.getDrawable(
|
||||
container.context, ThemeManager.resolveAttribute(R.attr.foundation, context)
|
||||
context, ThemeManager.resolveAttribute(R.attr.foundation, context)
|
||||
)
|
||||
|
||||
layoutParams.height = CoordinatorLayout.LayoutParams.MATCH_PARENT
|
||||
|
@ -105,17 +86,17 @@ class ToolbarView(
|
|||
edit.hint = context.getString(R.string.search_hint)
|
||||
|
||||
edit.colors = edit.colors.copy(
|
||||
text = container.context.getColorFromAttr(R.attr.primaryText),
|
||||
hint = container.context.getColorFromAttr(R.attr.secondaryText),
|
||||
text = context.getColorFromAttr(R.attr.primaryText),
|
||||
hint = context.getColorFromAttr(R.attr.secondaryText),
|
||||
suggestionBackground = ContextCompat.getColor(
|
||||
container.context,
|
||||
context,
|
||||
R.color.suggestion_highlight_color
|
||||
),
|
||||
clear = container.context.getColorFromAttr(R.attr.primaryText)
|
||||
clear = context.getColorFromAttr(R.attr.primaryText)
|
||||
)
|
||||
|
||||
edit.setUrlBackground(
|
||||
AppCompatResources.getDrawable(container.context, R.drawable.search_url_background))
|
||||
AppCompatResources.getDrawable(context, R.drawable.search_url_background))
|
||||
|
||||
private = isPrivate
|
||||
|
||||
|
@ -163,7 +144,7 @@ class ToolbarView(
|
|||
isInitialized = true
|
||||
}
|
||||
|
||||
val iconSize = container.resources.getDimensionPixelSize(R.dimen.preference_icon_drawable_size)
|
||||
val iconSize = context.resources.getDimensionPixelSize(R.dimen.preference_icon_drawable_size)
|
||||
|
||||
val scaledIcon = Bitmap.createScaledBitmap(
|
||||
searchState.searchEngineSource.searchEngine.icon,
|
||||
|
@ -171,7 +152,7 @@ class ToolbarView(
|
|||
iconSize,
|
||||
true)
|
||||
|
||||
val icon = BitmapDrawable(container.resources, scaledIcon)
|
||||
val icon = BitmapDrawable(context.resources, scaledIcon)
|
||||
|
||||
view.edit.setIcon(icon, searchState.searchEngineSource.searchEngine.name)
|
||||
}
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
<?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/. -->
|
||||
<mozilla.components.browser.awesomebar.BrowserAwesomeBar xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:mozac="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/awesomeBar"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:fadingEdge="horizontal"
|
||||
android:fadingEdgeLength="40dp"
|
||||
android:nestedScrollingEnabled="false"
|
||||
android:requiresFadingEdge="vertical"
|
||||
app:layout_constraintTop_toBottomOf="@id/search_with_shortcuts"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
mozac:awesomeBarDescriptionTextColor="?secondaryText"
|
||||
mozac:awesomeBarTitleTextColor="?primaryText" />
|
|
@ -21,14 +21,26 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/toolbar_component_wrapper"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
<mozilla.components.browser.toolbar.BrowserToolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/browser_toolbar_height"
|
||||
android:layout_gravity="top"
|
||||
android:background="@drawable/toolbar_background_top"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
app:layout_scrollFlags="scroll|enterAlways|snap|exitUntilCollapsed"
|
||||
app:browserToolbarClearColor="?primaryText"
|
||||
app:browserToolbarInsecureColor="?primaryText"
|
||||
app:browserToolbarMenuColor="?primaryText"
|
||||
app:browserToolbarProgressBarGravity="bottom"
|
||||
app:browserToolbarSecureColor="?primaryText"
|
||||
app:browserToolbarTrackingProtectionAndSecurityIndicatorSeparatorColor="?toolbarDivider"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
@ -45,7 +57,20 @@
|
|||
android:id="@+id/scrollable_area"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<mozilla.components.browser.awesomebar.BrowserAwesomeBar
|
||||
xmlns:mozac="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/awesomeBar"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:fadingEdge="horizontal"
|
||||
android:fadingEdgeLength="40dp"
|
||||
android:nestedScrollingEnabled="false"
|
||||
android:requiresFadingEdge="vertical"
|
||||
app:layout_constraintTop_toBottomOf="@id/search_with_shortcuts"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
mozac:awesomeBarDescriptionTextColor="?secondaryText"
|
||||
mozac:awesomeBarTitleTextColor="?primaryText" />
|
||||
<ViewStub
|
||||
android:id="@+id/search_suggestions_onboarding"
|
||||
android:layout_width="match_parent"
|
||||
|
|
Loading…
Reference in New Issue