Use Markwon for pretty changelogs

This commit is contained in:
Zakhar Timoshenko
2023-01-19 07:35:56 +03:00
parent f57d23026b
commit d290ba24b7
4 changed files with 5 additions and 5 deletions

View File

@@ -128,6 +128,7 @@ dependencies {
implementation 'io.coil-kt:coil-svg:2.2.2'
implementation 'com.github.KotatsuApp:subsampling-scale-image-view:1b19231b2f'
implementation 'com.github.solkin:disk-lru-cache:1.4'
implementation 'io.noties.markwon:core:4.6.2'
implementation 'ch.acra:acra-http:5.9.7'
implementation 'ch.acra:acra-dialog:5.9.7'

View File

@@ -5,6 +5,7 @@ import android.content.Intent
import androidx.core.net.toUri
import com.google.android.material.R as materialR
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import io.noties.markwon.Markwon
import org.koitharu.kotatsu.R
import org.koitharu.kotatsu.core.github.AppVersion
import org.koitharu.kotatsu.utils.FileSize
@@ -25,7 +26,7 @@ class AppUpdateDialog(private val context: Context) {
materialR.style.ThemeOverlay_Material3_MaterialAlertDialog_Centered,
)
.setTitle(R.string.app_update_available)
.setMessage(message)
.setMessage(Markwon.create(context).toMarkdown(message))
.setIcon(R.drawable.ic_app_update)
.setPositiveButton(R.string.download) { _, _ ->
val intent = Intent(Intent.ACTION_VIEW, version.apkUrl.toUri())

View File

@@ -18,6 +18,7 @@ import androidx.core.widget.TextViewCompat
import androidx.fragment.app.viewModels
import com.google.android.material.color.MaterialColors
import dagger.hilt.android.AndroidEntryPoint
import io.noties.markwon.Markwon
import org.koitharu.kotatsu.R
import org.koitharu.kotatsu.base.ui.BaseFragment
import org.koitharu.kotatsu.base.ui.widgets.SegmentedBarView
@@ -96,7 +97,7 @@ class ToolsFragment :
return
}
binding.cardUpdate.textSecondary.text = getString(R.string.new_version_s, version.name)
binding.cardUpdate.textChangelog.text = version.description
binding.cardUpdate.textChangelog.text = Markwon.create(requireActivity()).toMarkdown(version.description)
binding.cardUpdate.root.isVisible = true
}

View File

@@ -17,7 +17,6 @@
android:id="@+id/textPrimary"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/margin_normal"
android:text="@string/app_update_available"
android:textAppearance="?attr/textAppearanceTitleLarge"
app:layout_constraintEnd_toEndOf="parent"
@@ -28,7 +27,6 @@
android:id="@+id/textSecondary"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/margin_normal"
android:layout_marginTop="@dimen/margin_small"
android:text="@string/new_version_s"
android:textAppearance="?attr/textAppearanceBodyMedium"
@@ -42,7 +40,6 @@
android:id="@+id/textChangelog"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/margin_normal"
android:layout_marginTop="@dimen/margin_small"
android:fontFamily="monospace"
android:textAppearance="?attr/textAppearanceBodyMedium"