diff options
author | Allan Wang <me@allanwang.ca> | 2017-05-29 19:47:52 -0700 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2017-05-29 19:47:52 -0700 |
commit | 461425eb6054f18cea1990a4117fe8c78e888ddf (patch) | |
tree | 98c8d84cfb231479cf88c3cc413b7c4a8366e42b /app/src/main/kotlin/com/pitchedapps/frost/utils/FragmentUtils.kt | |
parent | e33120d454aeb72acc2c1315bddea31dd2f15bb2 (diff) | |
download | frost-461425eb6054f18cea1990a4117fe8c78e888ddf.tar.gz frost-461425eb6054f18cea1990a4117fe8c78e888ddf.tar.bz2 frost-461425eb6054f18cea1990a4117fe8c78e888ddf.zip |
Add icon tabs and webview observables
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/utils/FragmentUtils.kt')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/utils/FragmentUtils.kt | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/FragmentUtils.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/FragmentUtils.kt index cd638068..e7a38227 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/utils/FragmentUtils.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/FragmentUtils.kt @@ -2,14 +2,24 @@ package com.pitchedapps.frost.utils import android.os.Bundle import android.support.v4.app.Fragment +import com.pitchedapps.frost.fragments.BaseFragment /** * Created by Allan Wang on 2017-05-29. */ -fun Fragment.withBundle(creator: (Bundle) -> Unit): Fragment { - val bundle = Bundle() - creator.invoke(bundle) - this.arguments = bundle +private fun Fragment.bundle(): Bundle { + if (this.arguments == null) + this.arguments = Bundle() + return this.arguments +} + +fun <T : Fragment> T.putString(key: String, value: String): T { + this.bundle().putString(key, value) + return this +} + +fun <T : Fragment> T.putInt(key: String, value: Int): T { + this.bundle().putInt(key, value) return this }
\ No newline at end of file |