Skip to content

Commit

Permalink
Changed the deprecated ViewModelProviders.of() ViewModelProvider().
Browse files Browse the repository at this point in the history
  • Loading branch information
SudKul committed Aug 24, 2020
1 parent 43531f7 commit 840bdee
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import androidx.fragment.app.Fragment
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProviders
import androidx.lifecycle.ViewModelProvider
import androidx.navigation.fragment.findNavController
import com.example.android.trackmysleepquality.R
import com.example.android.trackmysleepquality.database.SleepDatabase
Expand Down Expand Up @@ -57,7 +57,7 @@ class SleepDetailFragment : Fragment() {

// Get a reference to the ViewModel associated with this fragment.
val sleepDetailViewModel =
ViewModelProviders.of(
ViewModelProvider(
this, viewModelFactory).get(SleepDetailViewModel::class.java)

// To use the View Model with data binding, you have to explicitly
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import androidx.fragment.app.Fragment
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProviders
import androidx.lifecycle.ViewModelProvider
import androidx.navigation.fragment.findNavController
import com.example.android.trackmysleepquality.R
import com.example.android.trackmysleepquality.database.SleepDatabase
Expand Down Expand Up @@ -59,7 +59,7 @@ class SleepQualityFragment : Fragment() {

// Get a reference to the ViewModel associated with this fragment.
val sleepQualityViewModel =
ViewModelProviders.of(
ViewModelProvider(
this, viewModelFactory).get(SleepQualityViewModel::class.java)

// To use the View Model with data binding, you have to explicitly
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import androidx.fragment.app.Fragment
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProviders
import androidx.lifecycle.ViewModelProvider
import androidx.navigation.fragment.findNavController
import androidx.recyclerview.widget.GridLayoutManager
import com.example.android.trackmysleepquality.R
Expand Down Expand Up @@ -57,7 +57,7 @@ class SleepTrackerFragment : Fragment() {
val viewModelFactory = SleepTrackerViewModelFactory(dataSource, application)

val sleepTrackerViewModel =
ViewModelProviders.of(
ViewModelProvider(
this, viewModelFactory).get(SleepTrackerViewModel::class.java)

binding.sleepTrackerViewModel = sleepTrackerViewModel
Expand Down

0 comments on commit 840bdee

Please sign in to comment.