mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-11 13:11:01 +00:00
For #3252: Reader mode appearance buttons are not visible in PB
Co-authored-by: Jonathan Almeida <jalmeida@mozilla.com> Co-authored-by: Sawyer Blatz <sdblatz@gmail.com>
This commit is contained in:
parent
d2c3427f1e
commit
ccc7c70967
@ -13,8 +13,11 @@ import android.view.Gravity
|
|||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
import android.widget.Button
|
||||||
|
import android.widget.RadioButton
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.core.content.getSystemService
|
import androidx.core.content.getSystemService
|
||||||
import androidx.core.net.toUri
|
import androidx.core.net.toUri
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
@ -356,6 +359,12 @@ class BrowserFragment : Fragment(), BackHandler, CoroutineScope {
|
|||||||
view.swipeRefresh.setOnChildScrollUpCallback { _, _ -> true }
|
view.swipeRefresh.setOnChildScrollUpCallback { _, _ -> true }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((activity as HomeActivity).browsingModeManager.isPrivate) {
|
||||||
|
// We need to update styles for private mode programmatically for now:
|
||||||
|
// https://github.com/mozilla-mobile/android-components/issues/3400
|
||||||
|
themeReaderViewControlsForPrivateMode(view.readerViewControlsBar)
|
||||||
|
}
|
||||||
|
|
||||||
readerViewFeature.set(
|
readerViewFeature.set(
|
||||||
feature = ReaderViewFeature(
|
feature = ReaderViewFeature(
|
||||||
requireContext(),
|
requireContext(),
|
||||||
@ -399,6 +408,26 @@ class BrowserFragment : Fragment(), BackHandler, CoroutineScope {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun themeReaderViewControlsForPrivateMode(view: View) = with(view) {
|
||||||
|
listOf(
|
||||||
|
R.id.mozac_feature_readerview_font_size_decrease,
|
||||||
|
R.id.mozac_feature_readerview_font_size_increase
|
||||||
|
).map {
|
||||||
|
findViewById<Button>(it)
|
||||||
|
}.forEach {
|
||||||
|
it.setTextColor(ContextCompat.getColorStateList(context, R.color.readerview_private_button_color))
|
||||||
|
}
|
||||||
|
|
||||||
|
listOf(
|
||||||
|
R.id.mozac_feature_readerview_font_serif,
|
||||||
|
R.id.mozac_feature_readerview_font_sans_serif
|
||||||
|
).map {
|
||||||
|
findViewById<RadioButton>(it)
|
||||||
|
}.forEach {
|
||||||
|
it.setTextColor(ContextCompat.getColorStateList(context, R.color.readerview_private_radio_color))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun changeEngineMargins(swipeRefresh: View, inFullScreen: Boolean) {
|
private fun changeEngineMargins(swipeRefresh: View, inFullScreen: Boolean) {
|
||||||
swipeRefresh.apply {
|
swipeRefresh.apply {
|
||||||
val toolbarAndQASSize = resources.getDimension(R.dimen.toolbar_and_qab_height).toInt()
|
val toolbarAndQASSize = resources.getDimension(R.dimen.toolbar_and_qab_height).toInt()
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:state_enabled="true" android:color="@color/primary_text_private_theme" />
|
||||||
|
<item android:state_enabled="false" android:color="@color/mozac_feature_readerview_text_color_disabled" />
|
||||||
|
</selector>
|
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:state_checked="true" android:color="@color/mozac_feature_readerview_selected" />
|
||||||
|
<item android:state_checked="false" android:color="@color/primary_text_private_theme" />
|
||||||
|
</selector>
|
@ -148,6 +148,7 @@
|
|||||||
|
|
||||||
<!-- Reader View colors -->
|
<!-- Reader View colors -->
|
||||||
<color name="mozac_feature_readerview_text_color">@color/primary_text_light_theme</color>
|
<color name="mozac_feature_readerview_text_color">@color/primary_text_light_theme</color>
|
||||||
|
<color name="mozac_feature_readerview_selected">@color/accent_high_contrast_dark_theme</color>
|
||||||
|
|
||||||
<!-- Onboarding colors -->
|
<!-- Onboarding colors -->
|
||||||
<color name="onboarding_card_background_dark">#20123A</color>
|
<color name="onboarding_card_background_dark">#20123A</color>
|
||||||
|
Loading…
Reference in New Issue
Block a user