All Downloads are FREE. Search and download functionalities are using the official Maven repository.

androidMain.tech.skot.core.components.SKStackView.kt Maven / Gradle / Ivy

There is a newer version: 1.2.9
Show newest version
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