From 18f664f477e8e1484bb4bfcfac9e3c33cddc253b Mon Sep 17 00:00:00 2001 From: Jeff Boek Date: Wed, 20 May 2020 22:11:26 -0700 Subject: [PATCH] [fenix] For https://github.com/mozilla-mobile/fenix/issues/10504 - cleans up tabLayout colors --- .../org/mozilla/fenix/browser/BaseBrowserFragment.kt | 4 +++- app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt | 3 ++- .../org/mozilla/fenix/tabtray/TabTrayDialogFragment.kt | 4 ++-- app/src/main/res/color/tab_icon.xml | 8 ++++++++ app/src/main/res/layout/component_tabstray.xml | 9 ++++++--- app/src/main/res/layout/component_tabstray_fab.xml | 2 +- app/src/main/res/values/styles.xml | 4 +++- 7 files changed, 25 insertions(+), 9 deletions(-) create mode 100644 app/src/main/res/color/tab_icon.xml diff --git a/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt b/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt index 8c3978c578..5c7c6d959b 100644 --- a/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt @@ -70,6 +70,7 @@ import org.mozilla.fenix.HomeActivity import org.mozilla.fenix.IntentReceiverActivity import org.mozilla.fenix.NavGraphDirections import org.mozilla.fenix.R +import org.mozilla.fenix.browser.browsingmode.BrowsingMode import org.mozilla.fenix.browser.readermode.DefaultReaderModeController import org.mozilla.fenix.components.FenixSnackbar import org.mozilla.fenix.components.FindInPageIntegration @@ -219,7 +220,8 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session tabTrayDialog.dismiss() } - override fun onNewTabTapped() { + override fun onNewTabTapped(private: Boolean) { + (activity as HomeActivity).browsingModeManager.mode = BrowsingMode.fromBoolean(private) tabTrayDialog.dismiss() findNavController().navigate(BrowserFragmentDirections.actionGlobalHome()) } 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 2d78a6108a..5accf6449f 100644 --- a/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt @@ -366,7 +366,8 @@ class HomeFragment : Fragment() { (activity as HomeActivity).openToBrowser(BrowserDirection.FromHome) } - override fun onNewTabTapped() { + override fun onNewTabTapped(private: Boolean) { + (activity as HomeActivity).browsingModeManager.mode = BrowsingMode.fromBoolean(private) tabTrayDialog.dismiss() } } diff --git a/app/src/main/java/org/mozilla/fenix/tabtray/TabTrayDialogFragment.kt b/app/src/main/java/org/mozilla/fenix/tabtray/TabTrayDialogFragment.kt index ea65204129..a165cdc1b6 100644 --- a/app/src/main/java/org/mozilla/fenix/tabtray/TabTrayDialogFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/tabtray/TabTrayDialogFragment.kt @@ -19,7 +19,7 @@ import org.mozilla.fenix.R class TabTrayDialogFragment : AppCompatDialogFragment(), TabTrayInteractor { interface Interactor { fun onTabSelected(tab: Tab) - fun onNewTabTapped() + fun onNewTabTapped(private: Boolean) } private lateinit var tabTrayView: TabTrayView @@ -62,7 +62,7 @@ class TabTrayDialogFragment : AppCompatDialogFragment(), TabTrayInteractor { } override fun onNewTabTapped(private: Boolean) { - interactor?.onNewTabTapped() + interactor?.onNewTabTapped(private) } override fun onTabTrayDismissed() { diff --git a/app/src/main/res/color/tab_icon.xml b/app/src/main/res/color/tab_icon.xml new file mode 100644 index 0000000000..e7f94f10ce --- /dev/null +++ b/app/src/main/res/color/tab_icon.xml @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/component_tabstray.xml b/app/src/main/res/layout/component_tabstray.xml index dc0fac45fc..9f02923742 100644 --- a/app/src/main/res/layout/component_tabstray.xml +++ b/app/src/main/res/layout/component_tabstray.xml @@ -11,8 +11,8 @@ android:layout_height="match_parent" android:layout_width="match_parent" android:layout_marginTop="40dp" - android:background="?foundation" style="@style/BottomSheetModal" + android:backgroundTint="?foundation" app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior"> diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index e8101c16e0..df907190bc 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -546,7 +546,9 @@ rounded 16dp 16dp - ?foundation + @color/photonPurple50 + @color/photonPurple50 + @color/photonPurple50