aboutsummaryrefslogtreecommitdiff
path: root/sample/src/main/kotlin
diff options
context:
space:
mode:
Diffstat (limited to 'sample/src/main/kotlin')
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/AboutActivity.kt2
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/KPrefSample.kt1
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt24
3 files changed, 23 insertions, 4 deletions
diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/AboutActivity.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/AboutActivity.kt
index 983544d..78f31ae 100644
--- a/sample/src/main/kotlin/ca/allanwang/kau/sample/AboutActivity.kt
+++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/AboutActivity.kt
@@ -14,6 +14,8 @@ class AboutActivity : AboutActivityBase(R.string::class.java, {
backgroundColor = 0xfffafafa.toInt()
accentColor = 0xff00838F.toInt()
cutoutForeground = 0xff18FFFF.toInt()
+ faqXmlRes = R.xml.kau_faq
+ faqParseNewLine = false
}) {
override fun postInflateMainPage(adapter: FastItemThemedAdapter<IItem<*, *>>) {
diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/KPrefSample.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/KPrefSample.kt
index fc4277f..9adabed 100644
--- a/sample/src/main/kotlin/ca/allanwang/kau/sample/KPrefSample.kt
+++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/KPrefSample.kt
@@ -8,6 +8,7 @@ import ca.allanwang.kau.kpref.kpref
* Created by Allan Wang on 2017-06-07.
*/
object KPrefSample : KPref() {
+ var version: Int by kpref("version", -1)
var textColor: Int by kpref("TEXT_COLOR", Color.WHITE)
var accentColor: Int by kpref("ACCENT_COLOR", 0xffff8900.toInt())
var bgColor: Int by kpref("BG_COLOR", 0xff303030.toInt())
diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt
index 4c9107c..62ca8a3 100644
--- a/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt
+++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt
@@ -6,12 +6,11 @@ import android.view.Menu
import android.view.MenuItem
import ca.allanwang.kau.about.kauLaunchAbout
import ca.allanwang.kau.email.sendEmail
-
-import ca.allanwang.kau.mediapicker.kauLaunchMediaPicker
-import ca.allanwang.kau.mediapicker.kauOnMediaPickerResult
import ca.allanwang.kau.kpref.activity.CoreAttributeContract
import ca.allanwang.kau.kpref.activity.KPrefActivity
import ca.allanwang.kau.kpref.activity.KPrefAdapterBuilder
+import ca.allanwang.kau.mediapicker.kauLaunchMediaPicker
+import ca.allanwang.kau.mediapicker.kauOnMediaPickerResult
import ca.allanwang.kau.searchview.SearchItem
import ca.allanwang.kau.searchview.SearchView
import ca.allanwang.kau.searchview.bindSearchView
@@ -20,6 +19,7 @@ import ca.allanwang.kau.utils.materialDialog
import ca.allanwang.kau.utils.navigationBarColor
import ca.allanwang.kau.utils.startActivity
import ca.allanwang.kau.utils.toast
+import ca.allanwang.kau.xml.showChangelog
import com.mikepenz.google_material_typeface_library.GoogleMaterial
@@ -206,7 +206,18 @@ class MainActivity : KPrefActivity() {
bgCanvas.set(KPrefSample.bgColor)
toolbarCanvas.set(KPrefSample.accentColor)
this.navigationBarColor = KPrefSample.accentColor
-
+ if (KPrefSample.version < BuildConfig.VERSION_CODE) {
+ KPrefSample.version = BuildConfig.VERSION_CODE
+ showChangelog(R.xml.kau_changelog, KPrefSample.textColor) {
+ titleColor(KPrefSample.textColor)
+ backgroundColor(KPrefSample.bgColor)
+ positiveColor(KPrefSample.accentColor)
+ }
+ }
+ supportActionBar?.apply {
+ setDisplayHomeAsUpEnabled(false)
+ setDisplayShowHomeEnabled(false)
+ }
}
override fun onCreateOptionsMenu(menu: Menu): Boolean {
@@ -237,6 +248,11 @@ class MainActivity : KPrefActivity() {
override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
+ R.id.action_changelog -> showChangelog(R.xml.kau_changelog, KPrefSample.textColor) {
+ titleColor(KPrefSample.textColor)
+ backgroundColor(KPrefSample.bgColor)
+ positiveColor(KPrefSample.accentColor)
+ }
R.id.action_settings -> startActivity(AnimActivity::class.java)
R.id.action_email -> sendEmail(R.string.your_email, R.string.your_subject)
else -> return super.onOptionsItemSelected(item)