From d3c587635a22d6adaa895acc6ed024f626f328c8 Mon Sep 17 00:00:00 2001 From: DreVla Date: Mon, 7 Nov 2022 11:38:17 +0200 Subject: [PATCH] [fenix] For https://github.com/mozilla-mobile/fenix/issues/27697 - Load icon for browser and history search immediately. The icon was set after the screen was visible leading to a flicker. With this solution, the icon will be set before the screen is visible eliminating any visible artefacts. --- .../mozilla/fenix/library/bookmarks/toolbar/ToolbarView.kt | 4 ++++ .../org/mozilla/fenix/library/history/toolbar/ToolbarView.kt | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/app/src/main/java/org/mozilla/fenix/library/bookmarks/toolbar/ToolbarView.kt b/app/src/main/java/org/mozilla/fenix/library/bookmarks/toolbar/ToolbarView.kt index eaa8b3ddbf..3c1d02eae6 100644 --- a/app/src/main/java/org/mozilla/fenix/library/bookmarks/toolbar/ToolbarView.kt +++ b/app/src/main/java/org/mozilla/fenix/library/bookmarks/toolbar/ToolbarView.kt @@ -81,6 +81,8 @@ class ToolbarView( false } + setDefaultIcon() + setOnEditListener( object : mozilla.components.concept.toolbar.Toolbar.OnEditListener { override fun onCancelEditing(): Boolean { @@ -110,7 +112,9 @@ class ToolbarView( view.editMode() isInitialized = true } + } + private fun setDefaultIcon() { val bookmarkSearchIcon = AppCompatResources.getDrawable(context, R.drawable.ic_bookmarks_menu) diff --git a/app/src/main/java/org/mozilla/fenix/library/history/toolbar/ToolbarView.kt b/app/src/main/java/org/mozilla/fenix/library/history/toolbar/ToolbarView.kt index e6679e1c41..1b7a807799 100644 --- a/app/src/main/java/org/mozilla/fenix/library/history/toolbar/ToolbarView.kt +++ b/app/src/main/java/org/mozilla/fenix/library/history/toolbar/ToolbarView.kt @@ -81,6 +81,8 @@ class ToolbarView( false } + setDefaultIcon() + setOnEditListener( object : mozilla.components.concept.toolbar.Toolbar.OnEditListener { override fun onCancelEditing(): Boolean { @@ -110,7 +112,9 @@ class ToolbarView( view.editMode() isInitialized = true } + } + private fun setDefaultIcon() { val historySearchIcon = AppCompatResources.getDrawable(context, R.drawable.ic_history) historySearchIcon?.let {