Merge pull request #7199 from thundernest/message_view_theme
Use theme background color in message view and compose screens
This commit is contained in:
commit
52959a4d42
7 changed files with 18 additions and 15 deletions
|
@ -27,8 +27,9 @@ class DisplayHtml(private val settings: HtmlSettings) : HtmlHeadProvider {
|
|||
|
||||
private fun cssStyleTheme(): String {
|
||||
return if (settings.useDarkMode) {
|
||||
// TODO: Don't hardcode these values. Inject them via HtmlSettings.
|
||||
"<style type=\"text/css\">" +
|
||||
"* { background: black ! important; color: #F3F3F3 !important }" +
|
||||
"* { background: #121212 ! important; color: #F3F3F3 !important }" +
|
||||
":link, :link * { color: #CCFF33 !important }" +
|
||||
":visited, :visited * { color: #551A8B !important }</style> "
|
||||
} else {
|
||||
|
|
|
@ -266,15 +266,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
|||
|
||||
LayoutInflater themedLayoutInflater = LayoutInflater.from(themeContext);
|
||||
contentContainer.setLayoutInflater(themedLayoutInflater);
|
||||
|
||||
View contentView = contentContainer.inflate();
|
||||
|
||||
// background color needs to be forced
|
||||
//TODO: Change themes to use appropriate background colors that don't need overriding.
|
||||
TypedValue outValue = new TypedValue();
|
||||
themeContext.getTheme().resolveAttribute(R.attr.messageViewBackgroundColor, outValue, true);
|
||||
|
||||
contentView.setBackgroundColor(outValue.data);
|
||||
contentContainer.inflate();
|
||||
|
||||
initializeActionBar();
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.fsck.k9.view
|
|||
import android.content.Context
|
||||
import android.content.pm.PackageManager
|
||||
import android.util.AttributeSet
|
||||
import android.util.TypedValue
|
||||
import android.webkit.WebSettings.LayoutAlgorithm
|
||||
import android.webkit.WebSettings.RenderPriority
|
||||
import android.webkit.WebView
|
||||
|
@ -34,7 +35,10 @@ class MessageWebView : WebView, KoinComponent {
|
|||
isLongClickable = true
|
||||
|
||||
if (config.useDarkMode) {
|
||||
setBackgroundColor(0xff000000L.toInt())
|
||||
val typedValue = TypedValue()
|
||||
context.theme.resolveAttribute(android.R.attr.windowBackground, typedValue, true)
|
||||
val backgroundColor = typedValue.data
|
||||
setBackgroundColor(backgroundColor)
|
||||
}
|
||||
|
||||
with(settings) {
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
We explicitly set the background color in case this layout is inflated using a theme different from the app theme (via
|
||||
the 'message view theme' setting).
|
||||
-->
|
||||
<com.fsck.k9.ui.messageview.MessageTopView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
|
@ -8,7 +12,7 @@
|
|||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:layout_weight="1"
|
||||
android:background="?attr/messageViewBackgroundColor"
|
||||
android:background="?android:attr/windowBackground"
|
||||
tools:context=".messageview.MessageViewFragment">
|
||||
|
||||
<com.fsck.k9.view.NonLockingScrollView
|
||||
|
|
|
@ -1,9 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
We explicitly set the background color in case this layout is inflated using a theme different from the app theme (via
|
||||
the 'composer theme' setting).
|
||||
-->
|
||||
<ScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?android:attr/windowBackground"
|
||||
android:scrollbarStyle="insideOverlay"
|
||||
android:fillViewport="true">
|
||||
|
||||
|
|
|
@ -107,7 +107,6 @@
|
|||
<attr name="messageListSwipeMoveIcon" format="reference"/>
|
||||
<attr name="messageListSwipeMoveBackgroundColor" format="reference|color"/>
|
||||
<attr name="messageStarColor" format="color"/>
|
||||
<attr name="messageViewBackgroundColor" format="reference|color"/>
|
||||
<attr name="messageDetailsAddContactIcon" format="reference"/>
|
||||
<attr name="messageDetailsDividerColor" format="reference|color"/>
|
||||
<attr name="attachmentCardBackground" format="reference|color"/>
|
||||
|
|
|
@ -129,7 +129,6 @@
|
|||
<item name="messageListSwipeMoveBackgroundColor">@color/material_purple_500</item>
|
||||
|
||||
<item name="messageStarColor">#fbbc04</item>
|
||||
<item name="messageViewBackgroundColor">#ffffffff</item>
|
||||
<item name="messageDetailsAddContactIcon">@drawable/ic_person_add</item>
|
||||
<item name="messageDetailsDividerColor">#ffcccccc</item>
|
||||
<item name="attachmentCardBackground">#e8e8e8</item>
|
||||
|
@ -296,7 +295,6 @@
|
|||
<item name="messageListSwipeMoveBackgroundColor">@color/material_purple_600</item>
|
||||
|
||||
<item name="messageStarColor">#fdd663</item>
|
||||
<item name="messageViewBackgroundColor">#000000</item>
|
||||
<item name="messageDetailsAddContactIcon">@drawable/ic_person_add</item>
|
||||
<item name="messageDetailsDividerColor">#ff555555</item>
|
||||
<item name="attachmentCardBackground">#313131</item>
|
||||
|
|
Loading…
Reference in a new issue