aboutsummaryrefslogtreecommitdiff
path: root/library
diff options
context:
space:
mode:
Diffstat (limited to 'library')
-rw-r--r--library/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt2
-rw-r--r--library/src/main/kotlin/ca/allanwang/kau/utils/Kotterknife.kt64
-rw-r--r--library/src/main/kotlin/ca/allanwang/kau/utils/Utils.kt4
-rw-r--r--library/src/main/kotlin/ca/allanwang/kau/utils/ViewUtils.kt9
4 files changed, 35 insertions, 44 deletions
diff --git a/library/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt b/library/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt
index d27a609..1bb8b52 100644
--- a/library/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt
+++ b/library/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt
@@ -86,7 +86,7 @@ fun Context.showChangelog(@XmlRes xmlRes: Int) {
}).start()
}
-val isNetworkAvailable = fun Context.(): Boolean {
+fun Context.isNetworkAvailable(): Boolean {
val connectivityManager = getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
val activeNetworkInfo = connectivityManager.activeNetworkInfo
return activeNetworkInfo != null && activeNetworkInfo.isConnectedOrConnecting
diff --git a/library/src/main/kotlin/ca/allanwang/kau/utils/Kotterknife.kt b/library/src/main/kotlin/ca/allanwang/kau/utils/Kotterknife.kt
index bd68b03..a8ddd2a 100644
--- a/library/src/main/kotlin/ca/allanwang/kau/utils/Kotterknife.kt
+++ b/library/src/main/kotlin/ca/allanwang/kau/utils/Kotterknife.kt
@@ -18,72 +18,72 @@ import kotlin.reflect.KProperty
import android.support.v4.app.DialogFragment as SupportDialogFragment
import android.support.v4.app.Fragment as SupportFragment
-public fun <V : View> View.bindView(id: Int)
+fun <V : View> View.bindView(id: Int)
: ReadOnlyProperty<View, V> = required(id, viewFinder)
-public fun <V : View> Activity.bindView(id: Int)
+fun <V : View> Activity.bindView(id: Int)
: ReadOnlyProperty<Activity, V> = required(id, viewFinder)
-public fun <V : View> Dialog.bindView(id: Int)
+fun <V : View> Dialog.bindView(id: Int)
: ReadOnlyProperty<Dialog, V> = required(id, viewFinder)
-public fun <V : View> DialogFragment.bindView(id: Int)
+fun <V : View> DialogFragment.bindView(id: Int)
: ReadOnlyProperty<DialogFragment, V> = required(id, viewFinder)
-public fun <V : View> android.support.v4.app.DialogFragment.bindView(id: Int)
+fun <V : View> android.support.v4.app.DialogFragment.bindView(id: Int)
: ReadOnlyProperty<android.support.v4.app.DialogFragment, V> = required(id, viewFinder)
-public fun <V : View> Fragment.bindView(id: Int)
+fun <V : View> Fragment.bindView(id: Int)
: ReadOnlyProperty<Fragment, V> = required(id, viewFinder)
-public fun <V : View> android.support.v4.app.Fragment.bindView(id: Int)
+fun <V : View> android.support.v4.app.Fragment.bindView(id: Int)
: ReadOnlyProperty<android.support.v4.app.Fragment, V> = required(id, viewFinder)
-public fun <V : View> ViewHolder.bindView(id: Int)
+fun <V : View> ViewHolder.bindView(id: Int)
: ReadOnlyProperty<ViewHolder, V> = required(id, viewFinder)
-public fun <V : View> View.bindOptionalView(id: Int)
+fun <V : View> View.bindOptionalView(id: Int)
: ReadOnlyProperty<View, V?> = optional(id, viewFinder)
-public fun <V : View> Activity.bindOptionalView(id: Int)
+fun <V : View> Activity.bindOptionalView(id: Int)
: ReadOnlyProperty<Activity, V?> = optional(id, viewFinder)
-public fun <V : View> Dialog.bindOptionalView(id: Int)
+fun <V : View> Dialog.bindOptionalView(id: Int)
: ReadOnlyProperty<Dialog, V?> = optional(id, viewFinder)
-public fun <V : View> DialogFragment.bindOptionalView(id: Int)
+fun <V : View> DialogFragment.bindOptionalView(id: Int)
: ReadOnlyProperty<DialogFragment, V?> = optional(id, viewFinder)
-public fun <V : View> android.support.v4.app.DialogFragment.bindOptionalView(id: Int)
+fun <V : View> android.support.v4.app.DialogFragment.bindOptionalView(id: Int)
: ReadOnlyProperty<android.support.v4.app.DialogFragment, V?> = optional(id, viewFinder)
-public fun <V : View> Fragment.bindOptionalView(id: Int)
+fun <V : View> Fragment.bindOptionalView(id: Int)
: ReadOnlyProperty<Fragment, V?> = optional(id, viewFinder)
-public fun <V : View> android.support.v4.app.Fragment.bindOptionalView(id: Int)
+fun <V : View> android.support.v4.app.Fragment.bindOptionalView(id: Int)
: ReadOnlyProperty<android.support.v4.app.Fragment, V?> = optional(id, viewFinder)
-public fun <V : View> ViewHolder.bindOptionalView(id: Int)
+fun <V : View> ViewHolder.bindOptionalView(id: Int)
: ReadOnlyProperty<ViewHolder, V?> = optional(id, viewFinder)
-public fun <V : View> View.bindViews(vararg ids: Int)
+fun <V : View> View.bindViews(vararg ids: Int)
: ReadOnlyProperty<View, List<V>> = required(ids, viewFinder)
-public fun <V : View> Activity.bindViews(vararg ids: Int)
+fun <V : View> Activity.bindViews(vararg ids: Int)
: ReadOnlyProperty<Activity, List<V>> = required(ids, viewFinder)
-public fun <V : View> Dialog.bindViews(vararg ids: Int)
+fun <V : View> Dialog.bindViews(vararg ids: Int)
: ReadOnlyProperty<Dialog, List<V>> = required(ids, viewFinder)
-public fun <V : View> DialogFragment.bindViews(vararg ids: Int)
+fun <V : View> DialogFragment.bindViews(vararg ids: Int)
: ReadOnlyProperty<DialogFragment, List<V>> = required(ids, viewFinder)
-public fun <V : View> android.support.v4.app.DialogFragment.bindViews(vararg ids: Int)
+fun <V : View> android.support.v4.app.DialogFragment.bindViews(vararg ids: Int)
: ReadOnlyProperty<android.support.v4.app.DialogFragment, List<V>> = required(ids, viewFinder)
-public fun <V : View> Fragment.bindViews(vararg ids: Int)
+fun <V : View> Fragment.bindViews(vararg ids: Int)
: ReadOnlyProperty<Fragment, List<V>> = required(ids, viewFinder)
-public fun <V : View> android.support.v4.app.Fragment.bindViews(vararg ids: Int)
+fun <V : View> android.support.v4.app.Fragment.bindViews(vararg ids: Int)
: ReadOnlyProperty<android.support.v4.app.Fragment, List<V>> = required(ids, viewFinder)
-public fun <V : View> ViewHolder.bindViews(vararg ids: Int)
+fun <V : View> ViewHolder.bindViews(vararg ids: Int)
: ReadOnlyProperty<ViewHolder, List<V>> = required(ids, viewFinder)
-public fun <V : View> View.bindOptionalViews(vararg ids: Int)
+fun <V : View> View.bindOptionalViews(vararg ids: Int)
: ReadOnlyProperty<View, List<V>> = optional(ids, viewFinder)
-public fun <V : View> Activity.bindOptionalViews(vararg ids: Int)
+fun <V : View> Activity.bindOptionalViews(vararg ids: Int)
: ReadOnlyProperty<Activity, List<V>> = optional(ids, viewFinder)
-public fun <V : View> Dialog.bindOptionalViews(vararg ids: Int)
+fun <V : View> Dialog.bindOptionalViews(vararg ids: Int)
: ReadOnlyProperty<Dialog, List<V>> = optional(ids, viewFinder)
-public fun <V : View> DialogFragment.bindOptionalViews(vararg ids: Int)
+fun <V : View> DialogFragment.bindOptionalViews(vararg ids: Int)
: ReadOnlyProperty<DialogFragment, List<V>> = optional(ids, viewFinder)
-public fun <V : View> android.support.v4.app.DialogFragment.bindOptionalViews(vararg ids: Int)
+fun <V : View> android.support.v4.app.DialogFragment.bindOptionalViews(vararg ids: Int)
: ReadOnlyProperty<android.support.v4.app.DialogFragment, List<V>> = optional(ids, viewFinder)
-public fun <V : View> Fragment.bindOptionalViews(vararg ids: Int)
+fun <V : View> Fragment.bindOptionalViews(vararg ids: Int)
: ReadOnlyProperty<Fragment, List<V>> = optional(ids, viewFinder)
-public fun <V : View> android.support.v4.app.Fragment.bindOptionalViews(vararg ids: Int)
+fun <V : View> android.support.v4.app.Fragment.bindOptionalViews(vararg ids: Int)
: ReadOnlyProperty<android.support.v4.app.Fragment, List<V>> = optional(ids, viewFinder)
-public fun <V : View> ViewHolder.bindOptionalViews(vararg ids: Int)
+fun <V : View> ViewHolder.bindOptionalViews(vararg ids: Int)
: ReadOnlyProperty<ViewHolder, List<V>> = optional(ids, viewFinder)
private val View.viewFinder: View.(Int) -> View?
diff --git a/library/src/main/kotlin/ca/allanwang/kau/utils/Utils.kt b/library/src/main/kotlin/ca/allanwang/kau/utils/Utils.kt
index c7ff9f2..79f80f3 100644
--- a/library/src/main/kotlin/ca/allanwang/kau/utils/Utils.kt
+++ b/library/src/main/kotlin/ca/allanwang/kau/utils/Utils.kt
@@ -6,6 +6,6 @@ import android.content.res.Resources
* Created by Allan Wang on 2017-05-28.
*/
-val dpToPx = fun Int.(): Int = (this * Resources.getSystem().displayMetrics.density).toInt()
+fun Int.dpToPx(): Int = (this * Resources.getSystem().displayMetrics.density).toInt()
-val pxToDp = fun Int.(): Int = (this / Resources.getSystem().displayMetrics.density).toInt()
+fun Int.pxToDp(px: Int) = (px / android.content.res.Resources.getSystem().displayMetrics.density).toInt() \ No newline at end of file
diff --git a/library/src/main/kotlin/ca/allanwang/kau/utils/ViewUtils.kt b/library/src/main/kotlin/ca/allanwang/kau/utils/ViewUtils.kt
index a5204aa..bd8478d 100644
--- a/library/src/main/kotlin/ca/allanwang/kau/utils/ViewUtils.kt
+++ b/library/src/main/kotlin/ca/allanwang/kau/utils/ViewUtils.kt
@@ -44,15 +44,6 @@ fun View.matchParent() {
}
}
-fun ProgressBar.tintRes(@ColorRes id: Int) = tint(ContextCompat.getColor(context, id))
-
-fun ProgressBar.tint(@ColorInt color: Int) {
- val sl = ColorStateList.valueOf(color)
- progressTintList = sl
- secondaryProgressTintList = sl
- indeterminateTintList = sl
-}
-
fun View.snackbar(text: String, duration: Int = Snackbar.LENGTH_LONG, builder: (Snackbar) -> Unit = {}) {
val snackbar = Snackbar.make(this, text, duration)
builder.invoke(snackbar)