From c8965e6037273e7c9322478e5ddafd2498e3c334 Mon Sep 17 00:00:00 2001 From: Jeff Boek Date: Tue, 9 Apr 2019 16:26:08 -0700 Subject: [PATCH] [fenix] For https://github.com/mozilla-mobile/fenix/issues/1430 - Adjust snackbar colors for darkmode --- .../java/org/mozilla/fenix/components/FenixSnackbar.kt | 3 +++ app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt | 8 ++++++++ .../java/org/mozilla/fenix/utils/ItsNotBrokenSnack.kt | 3 +-- app/src/main/res/drawable/fenix_snackbar_background.xml | 2 +- app/src/main/res/values-night/colors.xml | 3 +++ app/src/main/res/values/attrs.xml | 3 +++ app/src/main/res/values/colors.xml | 3 ++- app/src/main/res/values/styles.xml | 6 ++++++ 8 files changed, 27 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/mozilla/fenix/components/FenixSnackbar.kt b/app/src/main/java/org/mozilla/fenix/components/FenixSnackbar.kt index 7e5d14a822..da515cf6c8 100644 --- a/app/src/main/java/org/mozilla/fenix/components/FenixSnackbar.kt +++ b/app/src/main/java/org/mozilla/fenix/components/FenixSnackbar.kt @@ -53,6 +53,9 @@ class FenixSnackbar private constructor( companion object { + const val LENGTH_LONG = Snackbar.LENGTH_LONG + const val LENGTH_SHORT = Snackbar.LENGTH_SHORT + private const val minTextSize = 12 private const val maxTextSize = 18 private const val actionButtonIncreaseDps = 16 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 d050fe4552..8e8239fb32 100644 --- a/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt @@ -19,6 +19,7 @@ import androidx.appcompat.app.AppCompatActivity import androidx.fragment.app.Fragment import androidx.lifecycle.Observer import androidx.navigation.Navigation +import com.google.android.material.snackbar.Snackbar import kotlinx.android.synthetic.main.fragment_home.* import kotlinx.android.synthetic.main.fragment_home.view.* import kotlinx.coroutines.CoroutineScope @@ -35,6 +36,7 @@ import org.mozilla.fenix.BrowsingModeManager import org.mozilla.fenix.DefaultThemeManager import org.mozilla.fenix.HomeActivity import org.mozilla.fenix.R +import org.mozilla.fenix.components.FenixSnackbar import org.mozilla.fenix.utils.ItsNotBrokenSnack import org.mozilla.fenix.components.metrics.Event import org.mozilla.fenix.ext.archive @@ -156,6 +158,12 @@ class HomeFragment : Fragment(), CoroutineScope { // We need the shadow to be above the components. homeDividerShadow.bringToFront() + + wordmark.setOnClickListener { + FenixSnackbar.make(it, FenixSnackbar.LENGTH_LONG) + .setText("Testing") + .show() + } } override fun onDestroyView() { diff --git a/app/src/main/java/org/mozilla/fenix/utils/ItsNotBrokenSnack.kt b/app/src/main/java/org/mozilla/fenix/utils/ItsNotBrokenSnack.kt index 8c7e3254b4..ec1dad82cb 100644 --- a/app/src/main/java/org/mozilla/fenix/utils/ItsNotBrokenSnack.kt +++ b/app/src/main/java/org/mozilla/fenix/utils/ItsNotBrokenSnack.kt @@ -7,7 +7,6 @@ package org.mozilla.fenix.utils import android.content.Context import android.view.View import android.view.ViewGroup -import com.google.android.material.snackbar.Snackbar import org.mozilla.fenix.components.FenixSnackbar import org.mozilla.fenix.ext.asActivity import org.mozilla.fenix.ext.components @@ -17,7 +16,7 @@ class ItsNotBrokenSnack(val context: Context) { val rootView = context.asActivity()?.window?.decorView?.findViewById(android.R.id.content) as ViewGroup - FenixSnackbar.make(rootView, Snackbar.LENGTH_SHORT) + FenixSnackbar.make(rootView, FenixSnackbar.LENGTH_SHORT) .setText(message.replace("%", issueNumber)) .setAction("Add Tab to Issue") { context.components.useCases.tabsUseCases.addTab diff --git a/app/src/main/res/drawable/fenix_snackbar_background.xml b/app/src/main/res/drawable/fenix_snackbar_background.xml index 734b6b8f2d..2d7232d11c 100644 --- a/app/src/main/res/drawable/fenix_snackbar_background.xml +++ b/app/src/main/res/drawable/fenix_snackbar_background.xml @@ -4,6 +4,6 @@ - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> - + diff --git a/app/src/main/res/values-night/colors.xml b/app/src/main/res/values-night/colors.xml index 5e11b86f55..b123370763 100644 --- a/app/src/main/res/values-night/colors.xml +++ b/app/src/main/res/values-night/colors.xml @@ -87,4 +87,7 @@ @color/accent_bright_dark_theme + + + #592acb diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml index 7bd71f4716..3fcc87f74f 100644 --- a/app/src/main/res/values/attrs.xml +++ b/app/src/main/res/values/attrs.xml @@ -61,4 +61,7 @@ + + + diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index da73eac038..a5f58c2bf2 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -139,7 +139,8 @@ @color/toolbar_normal_theme @color/toolbar_dark_mode - #232749 + #312a65 + #592acb #1F1B215E diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 91e13939ed..2806b208e0 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -79,6 +79,9 @@ @color/library_list_item_text_color_light_mode + + + @color/fenix_snackbar_background_normal_theme