package cn.muchinfo.rma.view.base.future

import android.app.Activity
import android.content.Context
import android.graphics.drawable.ColorDrawable
import androidx.annotation.NonNull
import androidx.annotation.Nullable
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter
import androidx.viewpager.widget.ViewPager
import cn.muchinfo.rma.view.base.BaseViewModel
import com.qmuiteam.qmui.util.QMUIDisplayHelper
import com.qmuiteam.qmui.widget.tab.QMUITabBuilder
import com.qmuiteam.qmui.widget.tab.QMUITabIndicator
import com.qmuiteam.qmui.widget.tab.QMUITabSegment

/**
 * 解耦一些多个fragment公用的一些东西
 */
class BaseFutureModel: BaseViewModel() {

    /**
     * 解耦+统一布局样式
     */
    fun qmuiTabSegmentConfig(idTab: QMUITabSegment?,
                             textSize: Int,
                             context: Context?): QMUITabBuilder? {

        idTab?.setIndicator(QMUITabIndicator(QMUIDisplayHelper.dp2px(context, 2), false, true))
        val space: Int = QMUIDisplayHelper.dp2px(context, 10)

        idTab?.setItemSpaceInScrollMode(space)
        idTab?.setPadding(space, 0, space, 0)
        idTab?.mode = QMUITabSegment.MODE_FIXED//这里可以根据tab的数量设置不同的mode
        idTab?.right = space

        val size: Int = QMUIDisplayHelper.sp2px(context, textSize)
        val builder = idTab?.tabBuilder()
        builder?.skinChangeWithTintColor(false)?.
        setSelectedDrawable(ColorDrawable())?.
        setSelectedDrawable(ColorDrawable())?.
        setTextSize(size, size)?.
        setDynamicChangeIconColor(false)

        return builder
    }
}