Skip to content

Commit 259553e

Browse files
ADFA-3418: Drop FlashbarContainerView.hostActivity
The container is constructed with the same activity show() receives (Flashbar.kt:57, :78), so onAttachedToWindow can register against context directly.
1 parent 6d42b80 commit 259553e

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

‎subprojects/flashbar/src/main/java/com/itsaky/androidide/flashbar/FlashbarContainerView.kt‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ internal class FlashbarContainerView(context: Context)
8686

8787
private var configCallbacks: ComponentCallbacks? = null
8888
private var registeredActivity: Activity? = null
89-
private var hostActivity: Activity? = null
9089

9190
override fun onInterceptTouchEvent(event: MotionEvent): Boolean {
9291
when (event.action) {
@@ -111,7 +110,7 @@ internal class FlashbarContainerView(context: Context)
111110
// relied on the dismiss paths, whose post{} never runs once the view is detached.
112111
override fun onAttachedToWindow() {
113112
super.onAttachedToWindow()
114-
hostActivity?.let { registerConfigurationCallback(it) }
113+
(context as? Activity)?.let { registerConfigurationCallback(it) }
115114
}
116115

117116
override fun onDetachedFromWindow() {
@@ -190,7 +189,6 @@ internal class FlashbarContainerView(context: Context)
190189

191190
// Only add the withView to the parent once
192191
if (this.parent == null) {
193-
hostActivity = activity
194192
activityRootView.addView(this)
195193
post {
196194
adjustOrientation(activity)

0 commit comments

Comments
 (0)