Skip to content

Commit

Permalink
Truncate changelog and add the link to the website
Browse files Browse the repository at this point in the history
  • Loading branch information
nevenz committed Nov 2, 2022
1 parent 00c8b21 commit 8352b87
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 1,304 deletions.
10 changes: 6 additions & 4 deletions app/src/main/java/com/orgzly/android/ui/CommonActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,12 @@ abstract class CommonActivity : AppCompatActivity() {
protected fun displayWhatsNewDialog() {
whatsNewDialog?.dismiss()

whatsNewDialog = WhatsNewDialog.create(this)
whatsNewDialog?.let {
it.setOnDismissListener { whatsNewDialog = null }
it.show()
whatsNewDialog = WhatsNewDialog.create(this).apply {
setOnDismissListener {
whatsNewDialog = null
}

show()
}
}

Expand Down

This file was deleted.

35 changes: 35 additions & 0 deletions app/src/main/java/com/orgzly/android/ui/dialogs/WhatsNewDialog.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.orgzly.android.ui.dialogs

import android.content.Context
import android.text.method.LinkMovementMethod
import android.widget.TextView
import androidx.appcompat.app.AlertDialog
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.orgzly.R
import com.orgzly.android.ui.util.getLayoutInflater
import com.orgzly.android.util.MiscUtils

object WhatsNewDialog {
/**
* Display dialog with changes.
*/
fun create(context: Context): AlertDialog {
val layoutView = context.getLayoutInflater().inflate(R.layout.dialog_whats_new, null, false)

layoutView.findViewById<TextView>(R.id.dialog_whats_new_intro).apply {
text = MiscUtils.fromHtml(context.getString(R.string.whats_new_intro))
movementMethod = LinkMovementMethod.getInstance()
}

layoutView.findViewById<TextView>(R.id.dialog_whats_new_outro).apply {
text = MiscUtils.fromHtml(context.getString(R.string.whats_new_outro))
movementMethod = LinkMovementMethod.getInstance()
}

return MaterialAlertDialogBuilder(context)
.setTitle(R.string.whats_new_title)
.setPositiveButton(R.string.ok, null)
.setView(layoutView)
.create()
}
}
12 changes: 6 additions & 6 deletions app/src/main/java/com/orgzly/android/ui/views/WhatsNewChange.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ class WhatsNewChange(context: Context, attrs: AttributeSet) : LinearLayout(conte
typedArray.getString(R.styleable.WhatsNewChange_text)
}

val view = context.getLayoutInflater().inflate(R.layout.text_list_item, this, true)
val layoutView = context.getLayoutInflater().inflate(R.layout.text_list_item, this, true)

val c = view.findViewById<TextView>(R.id.content)
c.text = MiscUtils.fromHtml(content)
c.movementMethod = LinkMovementMethod.getInstance()
layoutView.findViewById<TextView>(R.id.content).apply {
text = MiscUtils.fromHtml(content)
movementMethod = LinkMovementMethod.getInstance()
}
}
}

}
Loading

0 comments on commit 8352b87

Please sign in to comment.