1
0
Fork 0

For #1430 - Adjust snackbar colors for darkmode

master
Jeff Boek 2019-04-09 16:26:08 -07:00
parent cd75b28b8f
commit b306bc502a
8 changed files with 27 additions and 4 deletions

View File

@ -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

View File

@ -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() {

View File

@ -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<View>(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

View File

@ -4,6 +4,6 @@
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/fenix_snackbar_background" />
<solid android:color="?attr/fenixSnackbarBackground" />
<corners android:radius="8dp" />
</shape>

View File

@ -87,4 +87,7 @@
<!-- Crash Page -->
<color name="crash_page_accent">@color/accent_bright_dark_theme</color>
<!-- Fenix Snackbar -->
<color name="fenix_snackbar_background_normal_theme">#592acb</color>
</resources>

View File

@ -61,4 +61,7 @@
<!-- Library Fragment -->
<attr name="libraryListItemTextColor" format="reference" />
<!-- Fenix Snackbar -->
<attr name="fenixSnackbarBackground" format="reference" />
</resources>

View File

@ -139,7 +139,8 @@
<color name="quick_action_background_normal_theme">@color/toolbar_normal_theme</color>
<color name="quick_action_background_private_theme">@color/toolbar_dark_mode</color>
<color name="fenix_snackbar_background">#232749</color>
<color name="fenix_snackbar_background_normal_theme">#312a65</color>
<color name="fenix_snackbar_background_private_theme">#592acb</color>
<color name="home_header_shadow">#1F1B215E</color>

View File

@ -79,6 +79,9 @@
<!-- Library Fragment -->
<item name="libraryListItemTextColor">@color/library_list_item_text_color_light_mode</item>
<!-- Fenix Snackbar -->
<item name="fenixSnackbarBackground">@color/fenix_snackbar_background_normal_theme</item>
</style>
<style name="NormalTheme" parent="NormalThemeBase">
@ -148,6 +151,9 @@
<!-- Library Fragment -->
<item name="libraryListItemTextColor">@color/off_white</item>
<!-- Fenix Snackbar -->
<item name="fenixSnackbarBackground">@color/fenix_snackbar_background_private_theme</item>
</style>
<style name="PrivateTheme" parent="PrivateThemeBase">