package com.ccwangluo.accelerator.ui.login

import android.os.Handler
import android.os.Looper
import android.os.Message
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.lifecycle.lifecycleScope
import com.alipay.sdk.app.PayTask
import com.ccwangluo.accelerator.databinding.FragmentSplashBinding
import com.ccwangluo.accelerator.ui.BottomNavigationFragment
import com.tencent.map.geolocation.TencentLocationManager
import com.xuexiang.xpage.annotation.Page
import com.xuexiang.xpage.base.XPageFragment
import com.xuexiang.xpage.utils.TitleBar
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext


@Page(name = "splash")
class SplashFragment : XPageFragment() {

    override fun initTitleBar(): TitleBar? {
        return null
    }

    override fun inflateView(inflater: LayoutInflater?, container: ViewGroup?): View {
        val inflate = FragmentSplashBinding.inflate(inflater!!, container, false)
        return inflate.root
    }


    override fun initViews() {
        TencentLocationManager.getInstance(context)
        lifecycleScope.launch(Dispatchers.IO) {
            delay(1000)
            withContext(Dispatchers.Main) {
                openPage(BottomNavigationFragment::class.java, false)
            }
        }
    }

    override fun initListeners() {

    }
}