Newer
Older
MonCalc / app / src / main / kotlin / jackall / moncalc / viewmodel / RegistItemViewModel.kt
package jackall.moncalc.viewmodel

import android.databinding.BaseObservable
import android.databinding.BindingAdapter
import android.databinding.ObservableInt
import android.widget.Spinner
import jackall.moncalc.adapter.CustomSpinnerAdapter

/**
 * Created by matsumoto_k on 2017/11/04.
 */
class RegistItemViewModel(
        val fruitSpinnerAdapter: CustomSpinnerAdapter,
        val gradeSpinnerAdapter: CustomSpinnerAdapter
) : BaseObservable() {
    val fruitRank = ObservableInt()
    val gradeRank = ObservableInt()

    object Adapter {
        @JvmStatic
        @BindingAdapter("android:setSpinnerAdapter")
        fun setAdapter(spinner: Spinner, adapter: CustomSpinnerAdapter) {
            spinner.adapter = adapter
        }
    }
}