Skip to content

Commit

Permalink
๐Ÿ”€ #83 from boostcampwm-2022/feat/running_tab
Browse files Browse the repository at this point in the history
RunningActivity ์ƒ๋ช…์ฃผ๊ธฐ ๊ด€์ฐฐ ์˜ต์ €๋ฒ„ ์ƒ์„ฑ
  • Loading branch information
yonghanJu authored Dec 8, 2022
2 parents 5dce97e + e6d1dea commit e791eb0
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,36 +92,11 @@ internal class RunningActivity :
}
}

override fun onStart() {
super.onStart()
mapView.onStart()
}

override fun onResume() {
super.onResume()
mapView.onResume()
}

override fun onPause() {
mapView.onPause()
super.onPause()
}

override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState)
mapView.onSaveInstanceState(outState)
}

override fun onStop() {
mapView.onStop()
super.onStop()
}

override fun onDestroy() {
mapView.onDestroy()
super.onDestroy()
}

override fun onLowMemory() {
super.onLowMemory()
mapView.onLowMemory()
Expand All @@ -138,11 +113,12 @@ internal class RunningActivity :
private fun initViews(savedInstanceState: Bundle?) {
mapView = binding.mapView

mapView.onCreate(savedInstanceState)
mapView.getMapAsync(this)

binding.vm = viewModel

this.onBackPressedDispatcher.addCallback(this, backPressedCallback)
lifecycle.addObserver(RunningActivityObserver(mapView, savedInstanceState))
}

private fun observeState() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.whyranoid.presentation.running

import android.os.Bundle
import androidx.lifecycle.DefaultLifecycleObserver
import androidx.lifecycle.LifecycleOwner
import com.naver.maps.map.MapView

class RunningActivityObserver(
private val mapView: MapView,
private val savedInstanceState: Bundle?
) : DefaultLifecycleObserver {

override fun onCreate(owner: LifecycleOwner) {
super.onCreate(owner)
mapView.onCreate(savedInstanceState)
}

override fun onStart(owner: LifecycleOwner) {
super.onStart(owner)
mapView.onStart()
}

override fun onResume(owner: LifecycleOwner) {
super.onResume(owner)
mapView.onResume()
}

override fun onPause(owner: LifecycleOwner) {
mapView.onPause()
super.onPause(owner)
}

override fun onStop(owner: LifecycleOwner) {
mapView.onStop()
super.onStop(owner)
}

override fun onDestroy(owner: LifecycleOwner) {
mapView.onDestroy()
super.onDestroy(owner)
}
}

0 comments on commit e791eb0

Please sign in to comment.