aboutsummaryrefslogtreecommitdiff
path: root/library/src
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-07-02 14:36:33 -0700
committerAllan Wang <me@allanwang.ca>2017-07-02 14:36:33 -0700
commit404aebc5c8dc1dd4288e65e9dd07ca1273ab6146 (patch)
treef045ea18ec8329e7ed213a941518cc870f99a8d8 /library/src
parentf4090285eb82a46cd7f99df4d2c606e3eb723154 (diff)
downloadkau-404aebc5c8dc1dd4288e65e9dd07ca1273ab6146.tar.gz
kau-404aebc5c8dc1dd4288e65e9dd07ca1273ab6146.tar.bz2
kau-404aebc5c8dc1dd4288e65e9dd07ca1273ab6146.zip
Create withArguments
Diffstat (limited to 'library/src')
-rw-r--r--library/src/main/kotlin/ca/allanwang/kau/utils/ActivityUtils.kt2
-rw-r--r--library/src/main/kotlin/ca/allanwang/kau/utils/FragmentUtils.kt12
-rw-r--r--library/src/main/kotlin/ca/allanwang/kau/utils/ViewUtils.kt2
3 files changed, 15 insertions, 1 deletions
diff --git a/library/src/main/kotlin/ca/allanwang/kau/utils/ActivityUtils.kt b/library/src/main/kotlin/ca/allanwang/kau/utils/ActivityUtils.kt
index 4f95b2c..ec51bfd 100644
--- a/library/src/main/kotlin/ca/allanwang/kau/utils/ActivityUtils.kt
+++ b/library/src/main/kotlin/ca/allanwang/kau/utils/ActivityUtils.kt
@@ -6,10 +6,12 @@ import android.graphics.Color
import android.support.annotation.ColorInt
import android.support.annotation.StringRes
import android.support.design.widget.Snackbar
+import android.support.v4.app.Fragment
import android.view.Menu
import ca.allanwang.kau.R
import com.mikepenz.iconics.typeface.IIcon
import org.jetbrains.anko.contentView
+import org.jetbrains.anko.withArguments
/**
* Created by Allan Wang on 2017-06-21.
diff --git a/library/src/main/kotlin/ca/allanwang/kau/utils/FragmentUtils.kt b/library/src/main/kotlin/ca/allanwang/kau/utils/FragmentUtils.kt
new file mode 100644
index 0000000..e0bdd8b
--- /dev/null
+++ b/library/src/main/kotlin/ca/allanwang/kau/utils/FragmentUtils.kt
@@ -0,0 +1,12 @@
+package ca.allanwang.kau.utils
+
+import android.support.v4.app.Fragment
+import org.jetbrains.anko.bundleOf
+
+/**
+ * Created by Allan Wang on 2017-07-02.
+ */
+fun Fragment.withArguments(vararg params:Pair<String, Any>):Fragment {
+ arguments = bundleOf(*params)
+ return this
+} \ 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 d17a11f..bd17b92 100644
--- a/library/src/main/kotlin/ca/allanwang/kau/utils/ViewUtils.kt
+++ b/library/src/main/kotlin/ca/allanwang/kau/utils/ViewUtils.kt
@@ -48,7 +48,7 @@ import com.mikepenz.iconics.typeface.IIcon
@KauUtils fun View.isInvisible(): Boolean = visibility == View.INVISIBLE
@KauUtils fun View.isGone(): Boolean = visibility == View.GONE
-fun View.snackbar(text: String, duration: Int = Snackbar.LENGTH_LONG, builder: Snackbar.() -> Unit = {}): Snackbar {
+fun View.snackbar(text: String, duration: Int = Snackbar.LENGTH_LONG, builder: Snackbar.() -> Unit = {}):Snackbar {
val snackbar = Snackbar.make(this, text, duration)
snackbar.builder()
snackbar.show()