aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/utils/FragmentUtils.kt
blob: f945c90a664d1b9f92455639c3179e5be4eb2b92 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.pitchedapps.frost.utils

import android.os.Bundle
import android.support.v4.app.Fragment

/**
 * Created by Allan Wang on 2017-05-29.
 */

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
}