From 494db56ea56020cd2298ff1935da94be24a3ff31 Mon Sep 17 00:00:00 2001 From: Mihai Branescu Date: Wed, 18 Mar 2020 16:41:18 +0200 Subject: [PATCH] For #9207 - changed status bar color in home fragment to match gradient background --- .../org/mozilla/fenix/home/HomeFragment.kt | 29 +++++++++++++++++-- app/src/main/res/values-v23/styles.xml | 8 ----- app/src/main/res/values-v27/styles.xml | 2 -- app/src/main/res/values/styles.xml | 4 +-- 4 files changed, 29 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt b/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt index e0e62356ad..6efa413884 100644 --- a/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt @@ -8,6 +8,7 @@ import android.animation.Animator import android.content.Context import android.content.DialogInterface import android.graphics.drawable.BitmapDrawable +import android.graphics.drawable.ColorDrawable import android.os.Bundle import android.view.Gravity import android.view.LayoutInflater @@ -41,8 +42,19 @@ import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView.SCROLL_STATE_IDLE import com.google.android.material.appbar.AppBarLayout import com.google.android.material.snackbar.Snackbar -import kotlinx.android.synthetic.main.fragment_home.* -import kotlinx.android.synthetic.main.fragment_home.view.* +import kotlinx.android.synthetic.main.fragment_home.homeAppBar +import kotlinx.android.synthetic.main.fragment_home.privateBrowsingButton +import kotlinx.android.synthetic.main.fragment_home.search_engine_icon +import kotlinx.android.synthetic.main.fragment_home.toolbarLayout +import kotlinx.android.synthetic.main.fragment_home.view.add_tab_button +import kotlinx.android.synthetic.main.fragment_home.view.bottomBarShadow +import kotlinx.android.synthetic.main.fragment_home.view.bottom_bar +import kotlinx.android.synthetic.main.fragment_home.view.homeAppBar +import kotlinx.android.synthetic.main.fragment_home.view.menuButton +import kotlinx.android.synthetic.main.fragment_home.view.sessionControlRecyclerView +import kotlinx.android.synthetic.main.fragment_home.view.toolbar +import kotlinx.android.synthetic.main.fragment_home.view.toolbarLayout +import kotlinx.android.synthetic.main.fragment_home.view.toolbar_wrapper import kotlinx.coroutines.Dispatchers.IO import kotlinx.coroutines.Dispatchers.Main import kotlinx.coroutines.ExperimentalCoroutinesApi @@ -486,11 +498,24 @@ class HomeFragment : Fragment() { override fun onResume() { super.onResume() + if (browsingModeManager.mode == BrowsingMode.Private) { + activity?.window?.setBackgroundDrawableResource(R.drawable.private_home_background_gradient) + } hideToolbar() } override fun onPause() { super.onPause() + if (browsingModeManager.mode == BrowsingMode.Private) { + activity?.window?.setBackgroundDrawable( + ColorDrawable( + ContextCompat.getColor( + requireContext(), + R.color.foundation_private_theme + ) + ) + ) + } calculateNewOffset() } diff --git a/app/src/main/res/values-v23/styles.xml b/app/src/main/res/values-v23/styles.xml index 0be0842f84..b7f59960f6 100644 --- a/app/src/main/res/values-v23/styles.xml +++ b/app/src/main/res/values-v23/styles.xml @@ -4,18 +4,10 @@ - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->