From cd6951dcbb31d89e2b48af89af4819dd79a8b876 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Szczodrzy=C5=84ski?= Date: Mon, 5 Apr 2021 21:02:49 +0200 Subject: [PATCH] [UI] Add highlighting user mentions in changelog. --- .../edziennik/ui/dialogs/changelog/ChangelogDialog.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/changelog/ChangelogDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/changelog/ChangelogDialog.kt index e492ae66..40ea90b2 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/changelog/ChangelogDialog.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/changelog/ChangelogDialog.kt @@ -44,9 +44,14 @@ class ChangelogDialog( val textView = TextView(activity) textView.setPadding(24.dp, 24.dp, 24.dp, 0) - val text = app.assets.open("pl-changelog.html").bufferedReader().use { + var text = app.assets.open("pl-changelog.html").bufferedReader().use { it.readText() } + + val commitsUrlPrefix = "https://github.com/szkolny-eu/szkolny-android/commits?author=" + text = text.replace("""\[(.+?)]\(@([A-z0-9-]+)\)""".toRegex(), "$1") + text = text.replace("""\s@([A-z0-9-]+)""".toRegex(), " @$1") + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { textView.text = Html.fromHtml(text) }