Skip to content

Commit

Permalink
fix some buttons didn't work after when the activity was re-created
Browse files Browse the repository at this point in the history
  • Loading branch information
westnordost committed Oct 30, 2024
1 parent 4cd495b commit 6fd8738
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ class MainActivity :
private var wasFollowingPosition: Boolean? = null
private var wasNavigationMode: Boolean? = null

private var mapFragment: MainMapFragment? = null
private val mapFragment: MainMapFragment? get() =
supportFragmentManager.findFragmentById(R.id.mapFragment) as MainMapFragment?

private val bottomSheetFragment: Fragment? get() =
supportFragmentManager.findFragmentByTag(BOTTOM_SHEET)
Expand Down Expand Up @@ -215,12 +216,6 @@ class MainActivity :

locationManager = FineLocationManager(this, this::onLocationChanged)

supportFragmentManager.addFragmentOnAttachListener { _, fragment ->
when (fragment) {
is MainMapFragment -> mapFragment = fragment
}
}

binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)

Expand Down

0 comments on commit 6fd8738

Please sign in to comment.