aboutsummaryrefslogtreecommitdiff
path: root/sample
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-09-24 16:56:11 -0400
committerGitHub <noreply@github.com>2017-09-24 16:56:11 -0400
commit1edb6e1ac1297f6feb229d8f89e07a88de1ae2e9 (patch)
tree5009d1486f2e1ccc0ddff88bbf0ad51b9d20e1e7 /sample
parentc465bd64a7da087447659b83ed515d87ee8d342f (diff)
downloadkau-1edb6e1ac1297f6feb229d8f89e07a88de1ae2e9.tar.gz
kau-1edb6e1ac1297f6feb229d8f89e07a88de1ae2e9.tar.bz2
kau-1edb6e1ac1297f6feb229d8f89e07a88de1ae2e9.zip
v3.4.3 (#65)3.4.3
* fix/mediapicker (#50) * Bring all glide request managers to one instance * Switch to test implementation * Check if parent is null for searchview * Ensure open close runs on ui thread * Make glide contract internal * Update changelog * Update version Update changelog for previous prs * v3.4.1 (#63) * Check browser intent before launching (#54) * Update changelog * fix/misc (#55) * Add kapt plugin * Fix kau vector * Debug lintRelease * Revert debug * Update dependencies * Check context finishing state before showing dialog (#61) * Keep copy of shared pref rather than application context (#60) * Keep copy of shared pref rather than application context * Add back preference name * Add resolver checks (#62) Squashed commit of the following: commit 7fe57d4ab1dbfe8bfb4d4a15bd0fbf636da491fa Author: Allan Wang <me@allanwang.ca> Date: Sat Sep 23 15:25:18 2017 -0400 Add missing quote commit ffc3ac99248c2250a7f14ef709f37d787cbe0d83 Author: Allan Wang <me@allanwang.ca> Date: Sat Sep 23 15:20:54 2017 -0400 Update changelog Update gradle Update version name * Fix bundle NPE for activity creation Update changelog * Feature/kpref time picker (#64) * Init kpref time builder and open up other builders * Enable self refresh * Add readme * Update changelog * Update readme
Diffstat (limited to 'sample')
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/KPrefSample.kt3
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt31
-rw-r--r--sample/src/main/res/values/strings.xml3
-rw-r--r--sample/src/main/res/xml/kau_changelog.xml8
4 files changed, 28 insertions, 17 deletions
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 9adabed..0c243e4 100644
--- a/sample/src/main/kotlin/ca/allanwang/kau/sample/KPrefSample.kt
+++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/KPrefSample.kt
@@ -17,4 +17,7 @@ object KPrefSample : KPref() {
var check3: Boolean by kpref("check3", false)
var text: String by kpref("text", "empty")
var seekbar: Int by kpref("seekbar", 20)
+ var time12: Int by kpref("time_12", 315)
+ var time24: Int by kpref("time_24", 2220)
+
} \ No newline at end of file
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 1528970..ca75ebb 100644
--- a/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt
+++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt
@@ -107,8 +107,7 @@ class MainActivity : KPrefActivity() {
checkbox(R.string.checkbox_3, { KPrefSample.check3 }, { KPrefSample.check3 = it }) {
descRes = R.string.desc_dependent
enabler = { KPrefSample.check2 }
- onDisabledClick = {
- itemView, _, _ ->
+ onDisabledClick = { itemView, _, _ ->
itemView.context.toast("I am still disabled")
true
}
@@ -140,8 +139,7 @@ class MainActivity : KPrefActivity() {
text(R.string.text, { KPrefSample.text }, { KPrefSample.text = it }) {
descRes = R.string.text_desc
- onClick = {
- itemView, _, item ->
+ onClick = { itemView, _, item ->
itemView.context.materialDialog {
title("Type Text")
input("Type here", item.pref, { _, input -> item.pref = input.toString() })
@@ -193,17 +191,25 @@ class MainActivity : KPrefActivity() {
textGetter = { string(R.string.kau_lorem_ipsum) }
}
+ timePicker(R.string.time, { KPrefSample.time12 }, { KPrefSample.time12 = it }) {
+ descRes = R.string.time_desc_12
+ use24HourFormat = false
+ }
+
+ timePicker(R.string.time, { KPrefSample.time24 }, { KPrefSample.time24 = it }) {
+ descRes = R.string.time_desc_24
+ use24HourFormat = true
+ }
+
}
fun subPrefs(): KPrefAdapterBuilder.() -> Unit = {
text(R.string.text, { KPrefSample.text }, { KPrefSample.text = it }) {
descRes = R.string.text_desc
- onClick = {
- itemView, _, item ->
+ onClick = { itemView, _, item ->
itemView.context.materialDialog {
title("Type Text")
- input("Type here", item.pref, {
- _, input ->
+ input("Type here", item.pref, { _, input ->
item.pref = input.toString()
reloadSelf()
})
@@ -237,21 +243,18 @@ class MainActivity : KPrefActivity() {
menuInflater.inflate(R.menu.menu_main, menu)
if (searchView == null) searchView = bindSearchView(menu, R.id.action_search) {
- textCallback = {
- query, searchView ->
+ textCallback = { query, searchView ->
val items = wordBank.filter { it.contains(query) }.sorted().map { SearchItem(it) }
searchView.results = items
}
- searchCallback = {
- query, _ ->
+ searchCallback = { query, _ ->
toast("Enter pressed for $query")
true
}
textDebounceInterval = 0
noResultsFound = R.string.kau_no_results_found
shouldClearOnClose = false
- onItemClick = {
- _, _, content, searchView ->
+ onItemClick = { _, _, content, searchView ->
toast(content)
searchView.revealClose()
}
diff --git a/sample/src/main/res/values/strings.xml b/sample/src/main/res/values/strings.xml
index a887ad3..1e3361e 100644
--- a/sample/src/main/res/values/strings.xml
+++ b/sample/src/main/res/values/strings.xml
@@ -15,6 +15,9 @@
<string name="text">Text Pref</string>
<string name="text_desc">Saves the text</string>
<string name="seekbar">Seekbar</string>
+ <string name="time">Time Pref</string>
+ <string name="time_desc_12">AM PM version</string>
+ <string name="time_desc_24">24h version</string>
<string name="sub_item">Sub Item Pref</string>
<string name="sub_item_desc">Press this to view the next subset of preferences</string>
<string name="your_email">your.email@here.com</string>
diff --git a/sample/src/main/res/xml/kau_changelog.xml b/sample/src/main/res/xml/kau_changelog.xml
index 8476660..7f421f8 100644
--- a/sample/src/main/res/xml/kau_changelog.xml
+++ b/sample/src/main/res/xml/kau_changelog.xml
@@ -6,9 +6,11 @@
<item text="" />
-->
- <version title="v3.4.1"/>
- <item text="Validate context before showing dialogs" />
- <item text="Add intent resolver checks prior to all executions." />
+ <version title="v3.4.3"/>
+ <item text=":core: Validate context before showing dialogs" />
+ <item text=":core: Add intent resolver checks prior to all executions." />
+ <item text=":core: Fix bundle NPE when starting activity" />
+ <item text=":kpref-activity: Create timePicker" />
<item text="" />
<item text="" />
<item text="" />