androidMain.tech.skot.core.components.SKStackView.kt Maven / Gradle / Ivy
package tech.skot.core.components
import android.widget.FrameLayout
import androidx.fragment.app.Fragment
import tech.skot.view.SKTransitionAndroidLegacy
class SKStackView(
proxy: SKStackViewProxy,
activity: SKActivity,
fragment: Fragment?,
private val frameLayout: FrameLayout
) : SKComponentView(proxy, activity, fragment, frameLayout) {
fun onLastScreen(lastScreen: Pair, SKTransitionAndroidLegacy?>?) {
fragmentManager.apply {
beginTransaction().apply {
lastScreen?.second?.let {
setCustomAnimations(it.enterAnim, it.exitAnim)
}
if (lastScreen != null) {
replace(frameLayout.id, lastScreen.first.createFragment())
} else {
findFragmentById(frameLayout.id)?.let { fragmentToRemove ->
remove(fragmentToRemove)
}
}
commit()
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy