Skip to content

Commit 8352b87

Browse files
committed
Truncate changelog and add the link to the website
1 parent 00c8b21 commit 8352b87

File tree

7 files changed

+61
-1304
lines changed

7 files changed

+61
-1304
lines changed

Diff for: app/src/main/java/com/orgzly/android/ui/CommonActivity.kt

+6-4
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,12 @@ abstract class CommonActivity : AppCompatActivity() {
191191
protected fun displayWhatsNewDialog() {
192192
whatsNewDialog?.dismiss()
193193

194-
whatsNewDialog = WhatsNewDialog.create(this)
195-
whatsNewDialog?.let {
196-
it.setOnDismissListener { whatsNewDialog = null }
197-
it.show()
194+
whatsNewDialog = WhatsNewDialog.create(this).apply {
195+
setOnDismissListener {
196+
whatsNewDialog = null
197+
}
198+
199+
show()
198200
}
199201
}
200202

Diff for: app/src/main/java/com/orgzly/android/ui/dialogs/WhatsNewDialog.java

-34
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package com.orgzly.android.ui.dialogs
2+
3+
import android.content.Context
4+
import android.text.method.LinkMovementMethod
5+
import android.widget.TextView
6+
import androidx.appcompat.app.AlertDialog
7+
import com.google.android.material.dialog.MaterialAlertDialogBuilder
8+
import com.orgzly.R
9+
import com.orgzly.android.ui.util.getLayoutInflater
10+
import com.orgzly.android.util.MiscUtils
11+
12+
object WhatsNewDialog {
13+
/**
14+
* Display dialog with changes.
15+
*/
16+
fun create(context: Context): AlertDialog {
17+
val layoutView = context.getLayoutInflater().inflate(R.layout.dialog_whats_new, null, false)
18+
19+
layoutView.findViewById<TextView>(R.id.dialog_whats_new_intro).apply {
20+
text = MiscUtils.fromHtml(context.getString(R.string.whats_new_intro))
21+
movementMethod = LinkMovementMethod.getInstance()
22+
}
23+
24+
layoutView.findViewById<TextView>(R.id.dialog_whats_new_outro).apply {
25+
text = MiscUtils.fromHtml(context.getString(R.string.whats_new_outro))
26+
movementMethod = LinkMovementMethod.getInstance()
27+
}
28+
29+
return MaterialAlertDialogBuilder(context)
30+
.setTitle(R.string.whats_new_title)
31+
.setPositiveButton(R.string.ok, null)
32+
.setView(layoutView)
33+
.create()
34+
}
35+
}

Diff for: app/src/main/java/com/orgzly/android/ui/views/WhatsNewChange.kt

+6-6
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ class WhatsNewChange(context: Context, attrs: AttributeSet) : LinearLayout(conte
1616
typedArray.getString(R.styleable.WhatsNewChange_text)
1717
}
1818

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

21-
val c = view.findViewById<TextView>(R.id.content)
22-
c.text = MiscUtils.fromHtml(content)
23-
c.movementMethod = LinkMovementMethod.getInstance()
21+
layoutView.findViewById<TextView>(R.id.content).apply {
22+
text = MiscUtils.fromHtml(content)
23+
movementMethod = LinkMovementMethod.getInstance()
24+
}
2425
}
25-
}
26-
26+
}

0 commit comments

Comments
 (0)