Skip to content

Commit

Permalink
Update dependencies (2024-02)
Browse files Browse the repository at this point in the history
Which requires initializing the database a bit earlier, so that by the
time the view model is created, the database is already there.
  • Loading branch information
vmiklos committed Feb 4, 2024
1 parent 2c43e57 commit 93db380
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
3 changes: 1 addition & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,9 @@ dependencies {
implementation 'javax.annotation:jsr250-api:1.0'
implementation 'com.google.android.material:material:1.11.0'
implementation 'androidx.core:core-ktx:1.12.0'
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.2"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "com.mikepenz:aboutlibraries:7.1.0"
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.preference:preference-ktx:1.2.1'
implementation "androidx.activity:activity-ktx:1.8.2"
implementation "androidx.fragment:fragment-ktx:1.6.2"
Expand Down
8 changes: 4 additions & 4 deletions app/src/main/java/hu/vmiklos/plees_tracker/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -118,17 +118,17 @@ class MainActivity : AppCompatActivity(), View.OnClickListener {

sharedPreferenceListener.applyTheme(PreferenceManager.getDefaultSharedPreferences(this))

val preferences = PreferenceManager.getDefaultSharedPreferences(applicationContext)
preferences.registerOnSharedPreferenceChangeListener(sharedPreferenceListener)
DataModel.init(applicationContext, preferences)

viewModel = ViewModelProvider.AndroidViewModelFactory(application)
.create(MainViewModel::class.java)

setContentView(R.layout.activity_main)
val startStop = findViewById<LinearLayout>(R.id.start_stop_layout)
startStop.setOnClickListener(this)

val preferences = PreferenceManager.getDefaultSharedPreferences(applicationContext)
preferences.registerOnSharedPreferenceChangeListener(sharedPreferenceListener)
DataModel.init(applicationContext, preferences)

preferences.liveData("dashboard_duration", "-7").observe(
this
) { setDashboardText(it ?: "0") }
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.2.0'
classpath 'com.android.tools.build:gradle:8.2.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

// NOTE: Do not place your application dependencies here; they belong
Expand Down

0 comments on commit 93db380

Please sign in to comment.