Store changelog locally

#1708
This commit is contained in:
Moez Bhatti
2021-03-14 15:31:23 -04:00
parent 48a0803bc4
commit f766745e12
8 changed files with 314 additions and 102 deletions
@@ -32,21 +32,21 @@ class ChangelogAdapter(private val context: Context) : QkAdapter<ChangelogAdapte
data class ChangelogItem(val type: Int, val label: String)
fun setChangelog(changelog: ChangelogManager.Changelog) {
fun setChangelog(changelog: ChangelogManager.CumulativeChangelog) {
val changes = mutableListOf<ChangelogItem>()
if (changelog.added.isNotEmpty()) {
changes += ChangelogItem(0, context.getString(R.string.changelog_added))
changes += changelog.added.map { change -> ChangelogItem(1, change) }
changes += changelog.added.map { change -> ChangelogItem(1, "• $change") }
changes += ChangelogItem(0, "")
}
if (changelog.improved.isNotEmpty()) {
changes += ChangelogItem(0, context.getString(R.string.changelog_improved))
changes += changelog.improved.map { change -> ChangelogItem(1, change) }
changes += changelog.improved.map { change -> ChangelogItem(1, "• $change") }
changes += ChangelogItem(0, "")
}
if (changelog.fixed.isNotEmpty()) {
changes += ChangelogItem(0, context.getString(R.string.changelog_fixed))
changes += changelog.fixed.map { change -> ChangelogItem(1, change) }
changes += changelog.fixed.map { change -> ChangelogItem(1, "• $change") }
changes += ChangelogItem(0, "")
}
data = changes
@@ -49,7 +49,7 @@ class ChangelogDialog(activity: MainActivity) {
layout.dismiss.setOnClickListener { dialog.dismiss() }
}
fun show(changelog: ChangelogManager.Changelog) {
fun show(changelog: ChangelogManager.CumulativeChangelog) {
adapter.setChangelog(changelog)
dialog.show()
}