mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-17 15:26:23 +00:00
[fenix] For https://github.com/mozilla-mobile/fenix/issues/1430 - Adjust snackbar colors for darkmode
This commit is contained in:
parent
5f479b96ac
commit
c8965e6037
@ -53,6 +53,9 @@ class FenixSnackbar private constructor(
|
|||||||
|
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
const val LENGTH_LONG = Snackbar.LENGTH_LONG
|
||||||
|
const val LENGTH_SHORT = Snackbar.LENGTH_SHORT
|
||||||
|
|
||||||
private const val minTextSize = 12
|
private const val minTextSize = 12
|
||||||
private const val maxTextSize = 18
|
private const val maxTextSize = 18
|
||||||
private const val actionButtonIncreaseDps = 16
|
private const val actionButtonIncreaseDps = 16
|
||||||
|
@ -19,6 +19,7 @@ import androidx.appcompat.app.AppCompatActivity
|
|||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.lifecycle.Observer
|
import androidx.lifecycle.Observer
|
||||||
import androidx.navigation.Navigation
|
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.*
|
||||||
import kotlinx.android.synthetic.main.fragment_home.view.*
|
import kotlinx.android.synthetic.main.fragment_home.view.*
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
@ -35,6 +36,7 @@ import org.mozilla.fenix.BrowsingModeManager
|
|||||||
import org.mozilla.fenix.DefaultThemeManager
|
import org.mozilla.fenix.DefaultThemeManager
|
||||||
import org.mozilla.fenix.HomeActivity
|
import org.mozilla.fenix.HomeActivity
|
||||||
import org.mozilla.fenix.R
|
import org.mozilla.fenix.R
|
||||||
|
import org.mozilla.fenix.components.FenixSnackbar
|
||||||
import org.mozilla.fenix.utils.ItsNotBrokenSnack
|
import org.mozilla.fenix.utils.ItsNotBrokenSnack
|
||||||
import org.mozilla.fenix.components.metrics.Event
|
import org.mozilla.fenix.components.metrics.Event
|
||||||
import org.mozilla.fenix.ext.archive
|
import org.mozilla.fenix.ext.archive
|
||||||
@ -156,6 +158,12 @@ class HomeFragment : Fragment(), CoroutineScope {
|
|||||||
|
|
||||||
// We need the shadow to be above the components.
|
// We need the shadow to be above the components.
|
||||||
homeDividerShadow.bringToFront()
|
homeDividerShadow.bringToFront()
|
||||||
|
|
||||||
|
wordmark.setOnClickListener {
|
||||||
|
FenixSnackbar.make(it, FenixSnackbar.LENGTH_LONG)
|
||||||
|
.setText("Testing")
|
||||||
|
.show()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroyView() {
|
override fun onDestroyView() {
|
||||||
|
@ -7,7 +7,6 @@ package org.mozilla.fenix.utils
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import com.google.android.material.snackbar.Snackbar
|
|
||||||
import org.mozilla.fenix.components.FenixSnackbar
|
import org.mozilla.fenix.components.FenixSnackbar
|
||||||
import org.mozilla.fenix.ext.asActivity
|
import org.mozilla.fenix.ext.asActivity
|
||||||
import org.mozilla.fenix.ext.components
|
import org.mozilla.fenix.ext.components
|
||||||
@ -17,7 +16,7 @@ class ItsNotBrokenSnack(val context: Context) {
|
|||||||
val rootView =
|
val rootView =
|
||||||
context.asActivity()?.window?.decorView?.findViewById<View>(android.R.id.content) as ViewGroup
|
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))
|
.setText(message.replace("%", issueNumber))
|
||||||
.setAction("Add Tab to Issue") {
|
.setAction("Add Tab to Issue") {
|
||||||
context.components.useCases.tabsUseCases.addTab
|
context.components.useCases.tabsUseCases.addTab
|
||||||
|
@ -4,6 +4,6 @@
|
|||||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:shape="rectangle">
|
android:shape="rectangle">
|
||||||
<solid android:color="@color/fenix_snackbar_background" />
|
<solid android:color="?attr/fenixSnackbarBackground" />
|
||||||
<corners android:radius="8dp" />
|
<corners android:radius="8dp" />
|
||||||
</shape>
|
</shape>
|
||||||
|
@ -87,4 +87,7 @@
|
|||||||
|
|
||||||
<!-- Crash Page -->
|
<!-- Crash Page -->
|
||||||
<color name="crash_page_accent">@color/accent_bright_dark_theme</color>
|
<color name="crash_page_accent">@color/accent_bright_dark_theme</color>
|
||||||
|
|
||||||
|
<!-- Fenix Snackbar -->
|
||||||
|
<color name="fenix_snackbar_background_normal_theme">#592acb</color>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -61,4 +61,7 @@
|
|||||||
|
|
||||||
<!-- Library Fragment -->
|
<!-- Library Fragment -->
|
||||||
<attr name="libraryListItemTextColor" format="reference" />
|
<attr name="libraryListItemTextColor" format="reference" />
|
||||||
|
|
||||||
|
<!-- Fenix Snackbar -->
|
||||||
|
<attr name="fenixSnackbarBackground" format="reference" />
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -139,7 +139,8 @@
|
|||||||
<color name="quick_action_background_normal_theme">@color/toolbar_normal_theme</color>
|
<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="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>
|
<color name="home_header_shadow">#1F1B215E</color>
|
||||||
|
|
||||||
|
@ -79,6 +79,9 @@
|
|||||||
|
|
||||||
<!-- Library Fragment -->
|
<!-- Library Fragment -->
|
||||||
<item name="libraryListItemTextColor">@color/library_list_item_text_color_light_mode</item>
|
<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>
|
||||||
|
|
||||||
<style name="NormalTheme" parent="NormalThemeBase">
|
<style name="NormalTheme" parent="NormalThemeBase">
|
||||||
@ -148,6 +151,9 @@
|
|||||||
|
|
||||||
<!-- Library Fragment -->
|
<!-- Library Fragment -->
|
||||||
<item name="libraryListItemTextColor">@color/off_white</item>
|
<item name="libraryListItemTextColor">@color/off_white</item>
|
||||||
|
|
||||||
|
<!-- Fenix Snackbar -->
|
||||||
|
<item name="fenixSnackbarBackground">@color/fenix_snackbar_background_private_theme</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="PrivateTheme" parent="PrivateThemeBase">
|
<style name="PrivateTheme" parent="PrivateThemeBase">
|
||||||
|
Loading…
Reference in New Issue
Block a user