diff --git a/app/src/main/kotlin/jackall/moncalc/fragment/FruitAnalyze.kt b/app/src/main/kotlin/jackall/moncalc/fragment/FruitAnalyze.kt index daa17fd..ef6d35e 100644 --- a/app/src/main/kotlin/jackall/moncalc/fragment/FruitAnalyze.kt +++ b/app/src/main/kotlin/jackall/moncalc/fragment/FruitAnalyze.kt @@ -1,21 +1,29 @@ 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.FragmentAnalyzeFruitBinding +import jackall.moncalc.viewmodel.FruitAnalyzeViewModel /** * Created by matsumoto_k on 2017/11/04. */ class FruitAnalyze : Fragment() { + lateinit var binding: FragmentAnalyzeFruitBinding + val fruitAnalyzeViewModel by lazy { ViewModelProviders.of(this, FruitAnalyzeViewModel.Factory()).get(FruitAnalyzeViewModel::class.java) } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) } override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { - return inflater.inflate(R.layout.fragment_analyze_fruit, container, false) + binding = DataBindingUtil.inflate(inflater, R.layout.fragment_analyze_fruit, container, false) + binding.fruitAnalyzeViewModel = fruitAnalyzeViewModel + return binding.root } } \ No newline at end of file