Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 52959a4d authored by cketti's avatar cketti Committed by GitHub
Browse files

Merge pull request #7199 from thundernest/message_view_theme

Use theme background color in message view and compose screens
parents 9f12cb4a 567a423e
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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 {
+1 −9
Original line number Diff line number Diff line
@@ -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();

+5 −1
Original line number Diff line number Diff line
@@ -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) {
+5 −1
Original line number Diff line number Diff line
<?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
+5 −0
Original line number Diff line number Diff line
<?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">

Loading