Fix styles on help-style pages
This commit is contained in:
parent
b5b850c605
commit
83ef306b83
2 changed files with 50 additions and 10 deletions
|
@ -1,8 +1,10 @@
|
|||
package com.wbrawner.simplemarkdown.view.activity
|
||||
|
||||
import android.content.res.Configuration
|
||||
import android.os.Bundle
|
||||
import android.view.MenuItem
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.appcompat.app.AppCompatDelegate
|
||||
import com.wbrawner.simplemarkdown.R
|
||||
import kotlinx.android.synthetic.main.activity_markdown_info.*
|
||||
|
||||
|
@ -11,7 +13,7 @@ class MarkdownInfoActivity : AppCompatActivity() {
|
|||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_markdown_info)
|
||||
val supportActionBar = supportActionBar
|
||||
setSupportActionBar(toolbar)
|
||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||
val intent = intent
|
||||
if (intent == null || !intent.hasExtra("title") || !intent.hasExtra("html")) {
|
||||
|
@ -19,10 +21,18 @@ class MarkdownInfoActivity : AppCompatActivity() {
|
|||
return
|
||||
}
|
||||
title = intent.getStringExtra("title")
|
||||
val isNightMode = AppCompatDelegate.getDefaultNightMode() ==
|
||||
AppCompatDelegate.MODE_NIGHT_YES
|
||||
|| resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK == Configuration.UI_MODE_NIGHT_YES
|
||||
val defaultCssId = if (isNightMode) {
|
||||
R.string.pref_custom_css_default_dark
|
||||
} else {
|
||||
R.string.pref_custom_css_default
|
||||
}
|
||||
val css: String? = getString(defaultCssId)
|
||||
|
||||
infoWebview.loadDataWithBaseURL(null,
|
||||
String.format(FORMAT_CSS,
|
||||
getString(R.string.pref_custom_css_default)
|
||||
) + intent.getStringExtra("html"),
|
||||
String.format(FORMAT_CSS, css) + intent.getStringExtra("html"),
|
||||
"text/html",
|
||||
"UTF-8", null
|
||||
)
|
||||
|
|
|
@ -1,12 +1,42 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="com.wbrawner.simplemarkdown.view.activity.MarkdownInfoActivity">
|
||||
tools:context="com.wbrawner.simplemarkdown.view.activity.MarkdownInfoActivity"
|
||||
android:fitsSystemWindows="true"
|
||||
android:clipToPadding="false"
|
||||
android:clipChildren="false">
|
||||
|
||||
<WebView
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/infoWebview"
|
||||
android:layout_width="match_parent"
|
||||
android:id="@+id/infoWebview" />
|
||||
</FrameLayout>
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginBottom="40dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/bottomSheet"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:translationY="16dp"
|
||||
app:cardCornerRadius="16dp"
|
||||
app:cardElevation="4dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:background="@color/colorBackground" />
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
|
Loading…
Reference in a new issue