From 4c13f45e9e7e93eaca97c0bc3072e52f83056eea Mon Sep 17 00:00:00 2001 From: Amaan Marfatia Date: Mon, 29 Jul 2019 18:00:48 -0400 Subject: [PATCH] Fixes #4192: Private keyboard in private browsing (#4345) Sets compliant keyboards to private mode when in private browsing. --- CHANGELOG.md | 1 + .../main/java/org/mozilla/fenix/search/SearchFragment.kt | 7 ++++++- .../java/org/mozilla/fenix/search/toolbar/ToolbarView.kt | 5 ++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a2ebc540ec..dc1a0046c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -76,5 +76,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - #3750 - Crash when tapping "Blocked" on Google Maps after disabling location requests - #2945 - Fixed "Launches to blank screen and hangs on Nexus 10" - #3869 - Creates a SearchLocalizationProvider that sets the region to get the correct default search engine based on a locale +- #4192 - Sets keyboard to private mode in private browsing - #2142 - Fixed "When launching Fenix, Enable private browsing button is focused instead of Search or address" ### Removed diff --git a/app/src/main/java/org/mozilla/fenix/search/SearchFragment.kt b/app/src/main/java/org/mozilla/fenix/search/SearchFragment.kt index 0f6c79c622..e925464a2f 100644 --- a/app/src/main/java/org/mozilla/fenix/search/SearchFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/search/SearchFragment.kt @@ -89,8 +89,13 @@ class SearchFragment : Fragment(), BackHandler { searchStore ) - toolbarView = ToolbarView(view.toolbar_component_wrapper, searchInteractor, historyStorageProvider()) awesomeBarView = AwesomeBarView(view.search_layout, searchInteractor) + toolbarView = ToolbarView( + view.toolbar_component_wrapper, + searchInteractor, + historyStorageProvider(), + (activity as HomeActivity).browsingModeManager.isPrivate + ) return view } diff --git a/app/src/main/java/org/mozilla/fenix/search/toolbar/ToolbarView.kt b/app/src/main/java/org/mozilla/fenix/search/toolbar/ToolbarView.kt index 1ee6ae223c..87f69496e3 100644 --- a/app/src/main/java/org/mozilla/fenix/search/toolbar/ToolbarView.kt +++ b/app/src/main/java/org/mozilla/fenix/search/toolbar/ToolbarView.kt @@ -49,7 +49,8 @@ interface ToolbarInteractor { class ToolbarView( private val container: ViewGroup, private val interactor: ToolbarInteractor, - private val historyStorage: HistoryStorage? + private val historyStorage: HistoryStorage?, + private val isPrivate: Boolean ) : LayoutContainer { override val containerView: View? @@ -87,6 +88,8 @@ class ToolbarView( R.color.suggestion_highlight_color ) + private = isPrivate + setOnEditListener(object : mozilla.components.concept.toolbar.Toolbar.OnEditListener { override fun onCancelEditing(): Boolean { interactor.onEditingCanceled()