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

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

There is a newer version: 1.2.9
Show newest version
package tech.skot.core.components

import android.view.View
import androidx.fragment.app.Fragment
import androidx.viewpager2.widget.ViewPager2
import com.google.android.material.tabs.TabLayout
import tech.skot.view.live.MutableSKLiveData

class SKPagerWithTabsViewProxy(
    override val pager: SKPagerViewProxy,
    initialLabels: List,
) : SKComponentViewProxy(), SKPagerWithTabsVC {

    private val labelsLD = MutableSKLiveData(initialLabels)
    override var labels : List
        get() = labelsLD.value
        set(value) {
            labelsLD.postValue(value)
        }

    override fun bindTo(
        activity: SKActivity,
        fragment: Fragment?,
        binding: View
    ) :SKPagerWithTabsView {
        val pagerView = binding.findViewWithTag("sk_view_pager2")
        val tabLayoutView = binding.findViewWithTag("sk_tab_layout")
        return SKPagerWithTabsView(this, activity, fragment, binding, pagerView, tabLayoutView).apply {
            pager.bindTo(activity, fragment, pagerView)
            labelsLD.observe {
                onLabels(labels)
            }

        }
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy