Newer
Older
MonCalc / app / src / main / kotlin / jackall / moncalc / fragment / HistoryFragment.kt
package jackall.moncalc.fragment

import android.arch.lifecycle.ViewModelProviders
import android.databinding.DataBindingUtil
import android.os.Bundle
import android.support.v4.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import jackall.moncalc.R
import jackall.moncalc.databinding.FragmentHistoryBinding

/**
 * Created by matsumoto_k on 2017/11/03.
 */
class HistoryFragment : Fragment() {
    lateinit var binding: FragmentHistoryBinding
    val historyViewModel by lazy { ViewModelProviders.of(this, HistoryViewModel.Factory()).get(HistoryViewModel::class.java) }
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
    }

    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
        binding = DataBindingUtil.inflate<FragmentHistoryBinding>(layoutInflater, R.layout.fragment_history, container, false)
        binding.historyViewModel = historyViewModel
        lifecycle.addObserver(historyViewModel)
        return binding.root
    }
}