Skip to content

Commit

Permalink
Fixed deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
Daeda88 committed Nov 8, 2023
1 parent ec41eb1 commit 18abba8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Copyright 2022 Splendo Consulting B.V. The Netherlands
package com.splendo.kaluga.example.architecture.xml

import android.os.Bundle
import androidx.activity.OnBackPressedCallback
import androidx.activity.addCallback
import com.splendo.kaluga.architecture.navigation.ActivityNavigator
import com.splendo.kaluga.architecture.navigation.NavigationSpec
import com.splendo.kaluga.architecture.navigation.parseTypeOfOrNull
Expand Down Expand Up @@ -59,9 +61,14 @@ class ArchitectureDetailsActivity : KalugaViewModelActivity<ArchitectureDetailsV
setContentView(binding.root)
binding.viewModel = viewModel
binding.lifecycleOwner = this
}

override fun onBackPressed() {
viewModel.onBackPressed()
onBackPressedDispatcher.addCallback(
this,
object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
viewModel.onBackPressed()
}
},
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package com.splendo.kaluga.example.scientific

import android.os.Bundle
import androidx.activity.OnBackPressedCallback
import com.splendo.kaluga.architecture.navigation.ActivityNavigator
import com.splendo.kaluga.architecture.navigation.NavigationBundleSpecType
import com.splendo.kaluga.architecture.navigation.NavigationSpec
Expand Down Expand Up @@ -75,9 +76,14 @@ class ScientificConverterActivity : KalugaViewModelActivity<ScientificConverterV
setContentView(binding.root)
binding.viewModel = viewModel
binding.lifecycleOwner = this
}

override fun onBackPressed() {
viewModel.onClosePressed()
onBackPressedDispatcher.addCallback(
this,
object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
viewModel.onClosePressed()
}
},
)
}
}

0 comments on commit 18abba8

Please sign in to comment.