aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/utils/FragmentUtils.kt
blob: e7a38227eb3c473744d6b0f87b8e2d86ce68b0c7 (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
25
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.
 */

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
}