aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-06-25 15:50:00 -0700
committerAllan Wang <me@allanwang.ca>2017-06-25 15:50:00 -0700
commit3839f9a406b4da9ba888afdaa6ba9c9a157badf6 (patch)
treea9a4ee5627548f7ea32594d5eadf9e84c6c744b9
parentf1aba3f7cfe482e20fe09945d088350eadfe02d6 (diff)
downloadkau-3839f9a406b4da9ba888afdaa6ba9c9a157badf6.tar.gz
kau-3839f9a406b4da9ba888afdaa6ba9c9a157badf6.tar.bz2
kau-3839f9a406b4da9ba888afdaa6ba9c9a157badf6.zip
Update readme and revert anko
-rw-r--r--README.md6
-rw-r--r--library/build.gradle4
-rw-r--r--library/src/main/kotlin/ca/allanwang/kau/kpref/KPrefBinder.kt16
-rw-r--r--library/src/main/kotlin/ca/allanwang/kau/searchview/SearchView.kt19
4 files changed, 23 insertions, 22 deletions
diff --git a/README.md b/README.md
index ea04af0..6592a96 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,6 @@
Kotlin Android Utils
-<!--Current Release v1.1-->
-
This library contains small helper functions used throughout almost all of my other projects. The goal is to make common interactions executable in a single line.
[Changelog](https://github.com/AllanWang/KAU/tree/master/docs/Changelog.md)
@@ -12,7 +10,7 @@ This library contains small helper functions used throughout almost all of my ot
KAU is available on JitPack
-[![](https://jitpack.io/v/ca.allanwang/kau.svg)](https://jitpack.io/#ca.allanwang/kau)
+[![](https://jitpack.io/v/ca.allanwang/kau.svg)](https://jitpack.io/#ca.allanwang/kau) [![GitHub license](https://img.shields.io/badge/license-Apache%202-blue.svg)](https://raw.githubusercontent.com/AllanWang/KAU/master/LICENSE)
To apply, add the following to your root build.gradle:
@@ -29,7 +27,7 @@ And add the following dependencies (You can use a specific version, commit, or -
```gradle
dependencies {
- compile 'ca.allanwang:kau:v1.1'
+ compile "ca.allanwang:kau:$KAU"
}
```
diff --git a/library/build.gradle b/library/build.gradle
index 2c8bb58..6984490 100644
--- a/library/build.gradle
+++ b/library/build.gradle
@@ -2,6 +2,8 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'com.github.dcendents.android-maven'
+group = project.APP_GROUP
+
android {
compileSdkVersion Integer.parseInt(project.TARGET_SDK)
buildToolsVersion project.BUILD_TOOLS
@@ -61,7 +63,7 @@ dependencies {
compile "com.jakewharton.timber:timber:${TIMBER}"
-// compile "org.jetbrains.anko:anko-commons:${ANKO}"
+ compile "org.jetbrains.anko:anko-commons:${ANKO}"
compile "io.reactivex.rxjava2:rxkotlin:${RX_JAVA}"
compile "io.reactivex.rxjava2:rxandroid:${RX_ANDROID}"
diff --git a/library/src/main/kotlin/ca/allanwang/kau/kpref/KPrefBinder.kt b/library/src/main/kotlin/ca/allanwang/kau/kpref/KPrefBinder.kt
index 9503c3a..5fdb6bc 100644
--- a/library/src/main/kotlin/ca/allanwang/kau/kpref/KPrefBinder.kt
+++ b/library/src/main/kotlin/ca/allanwang/kau/kpref/KPrefBinder.kt
@@ -6,6 +6,8 @@ import android.support.v7.widget.RecyclerView
import ca.allanwang.kau.R
import ca.allanwang.kau.kpref.items.*
import com.mikepenz.fastadapter.commons.adapters.FastItemAdapter
+import org.jetbrains.anko.doAsync
+import org.jetbrains.anko.uiThread
/**
* Created by Allan Wang on 2017-06-08.
@@ -22,13 +24,13 @@ fun RecyclerView.setKPrefAdapter(globalOptions: GlobalOptions, builder: KPrefAda
val adapter = FastItemAdapter<KPrefItemCore>()
adapter.withOnClickListener { v, _, item, _ -> item.onClick(v, v.findViewById(R.id.kau_pref_inner_content)) }
this.adapter = adapter
-// doAsync {
-// val items = KPrefAdapterBuilder(globalOptions)
-// builder.invoke(items)
-// uiThread {
-// adapter.add(items.list)
-// }
-// }
+ doAsync {
+ val items = KPrefAdapterBuilder(globalOptions)
+ builder.invoke(items)
+ uiThread {
+ adapter.add(items.list)
+ }
+ }
return adapter
}
diff --git a/library/src/main/kotlin/ca/allanwang/kau/searchview/SearchView.kt b/library/src/main/kotlin/ca/allanwang/kau/searchview/SearchView.kt
index 08097de..e3931b9 100644
--- a/library/src/main/kotlin/ca/allanwang/kau/searchview/SearchView.kt
+++ b/library/src/main/kotlin/ca/allanwang/kau/searchview/SearchView.kt
@@ -21,6 +21,7 @@ import com.mikepenz.google_material_typeface_library.GoogleMaterial
import com.mikepenz.iconics.typeface.IIcon
import io.reactivex.Observable
import io.reactivex.schedulers.Schedulers
+import org.jetbrains.anko.runOnUiThread
/**
@@ -121,22 +122,20 @@ class SearchView @JvmOverloads constructor(
*/
var results: List<SearchItem>
get() = adapter.adapterItems
- set(value) {}
-// set(value) = context.runOnUiThread {
-// cardTransition()
-// adapter.setNewList(
-// if (configs.noResultsFound > 0 && value.isEmpty())
-// listOf(SearchItem("", context.string(configs.noResultsFound), null))
-// else value)
-// }
+ set(value) = context.runOnUiThread {
+ cardTransition()
+ adapter.setNewList(
+ if (configs.noResultsFound > 0 && value.isEmpty())
+ listOf(SearchItem("", context.string(configs.noResultsFound), null))
+ else value)
+ }
/**
* Empties the list on the UI thread
* Note that this does not include any animations
* Use results = listOf() for the animated version
*/
- internal fun clearResults() {}
-// = context.runOnUiThread { adapter.clear() }
+ internal fun clearResults() = context.runOnUiThread { adapter.clear() }
val configs = Configs()
//views