Skip to content

Commit e73723c

Browse files
committed
fix: 修复主题模式
Resolves: #288
1 parent 2846648 commit e73723c

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

app/src/main/java/com/github/zly2006/zhihu/markdown/RenderMarkdown.kt

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ import com.github.zly2006.zhihu.data.AccountData
6565
import com.github.zly2006.zhihu.navigation.LocalNavigator
6666
import com.github.zly2006.zhihu.navigation.Video
6767
import com.github.zly2006.zhihu.navigation.resolveContent
68+
import com.github.zly2006.zhihu.theme.ThemeManager
6869
import com.github.zly2006.zhihu.ui.PREFERENCE_NAME
6970
import com.github.zly2006.zhihu.ui.components.OpenImageDislog
7071
import com.github.zly2006.zhihu.ui.subscreens.PREF_FONT_SIZE
@@ -220,8 +221,9 @@ fun RenderMarkdown(
220221
val preferences = remember { context.getSharedPreferences(PREFERENCE_NAME, Context.MODE_PRIVATE) }
221222
val fontSize = preferences.getInt(PREF_FONT_SIZE, 100)
222223
val lineHeight = preferences.getInt(PREF_LINE_HEIGHT, 160)
223-
val theme = MarkdownTheme.auto().copy(
224-
bodyStyle = MarkdownTheme.auto().bodyStyle.copy(
224+
val defaultTheme = MarkdownTheme.auto(ThemeManager.isDarkTheme())
225+
val theme = defaultTheme.copy(
226+
bodyStyle = defaultTheme.bodyStyle.copy(
225227
fontSize = 16.sp * fontSize / 100,
226228
lineHeight = 16.sp * fontSize / 100 * lineHeight / 100,
227229
),
@@ -237,25 +239,21 @@ fun RenderMarkdown(
237239
resolveContent(url)?.let { navigator.onNavigate(it) }
238240
?: luoTianYiUrlLauncher(context, url.toUri())
239241
},
242+
header = header,
243+
footer = footer,
240244
theme = theme,
241245
)
242246
}
243247

244248
if (selectable) {
245249
SelectionContainer(modifier = modifier) {
246-
Column {
247-
header?.invoke()
248-
markdownBody()
249-
footer?.invoke()
250-
}
250+
markdownBody()
251251
}
252252
} else {
253253
Column(
254254
modifier = modifier,
255255
) {
256-
header?.invoke()
257256
markdownBody()
258-
footer?.invoke()
259257
}
260258
}
261259
}

0 commit comments

Comments
 (0)