package com.gamedog.vididin.login

import android.app.Activity
import android.content.Intent
import android.os.Bundle
import android.view.LayoutInflater
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import com.ama.core.architecture.appBase.AppViewsEmptyViewModelActivity
import com.gamedog.vididin.databinding.VididinappFeatureLoginActivityLoginBinding as ViewBinding
import dagger.hilt.android.AndroidEntryPoint
import kotlin.jvm.java



@AndroidEntryPoint
@Suppress("DEPRECATION")
class LoginActivity : AppViewsEmptyViewModelActivity<ViewBinding>() {


    override fun onCreate(savedInstanceState: Bundle?) {
        /*Activity.overridePendingTransition(
            designSystemR.anim.slide_in_bottom,
            0
        )*/
        super.onCreate(savedInstanceState)
    }

    override fun inflateViewBinding(inflater: LayoutInflater) = ViewBinding.inflate(inflater)

    override fun ViewBinding.initWindowInsets() {
        // 由于登录页面的子Fragment没有背景，所以在此统一设置内间距即可实现，子Fragment不需要实现。
        ViewCompat.setOnApplyWindowInsetsListener(root) { v, insets ->
            val systemBars = insets.getInsets(
                WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.displayCutout() or WindowInsetsCompat.Type.ime()
            )
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
            insets
        }
    }

    override fun ViewBinding.initViews() {
    }

    override fun ViewBinding.initListeners() {
    }

    override fun ViewBinding.initObservers() {
    }

    override fun finish() {
        super.finish()
    }

    companion object {
        internal fun startActivity(activity: Activity) {
            activity.startActivity(Intent(activity.applicationContext, LoginActivity::class.java))
        }
    }
}