package com.base.appzxhy.business.pangle

import android.content.Context
import android.os.Bundle
import android.widget.ImageView
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import com.base.appzxhy.R
import com.base.appzxhy.business.ads.AdsMgr
import com.base.appzxhy.business.ads.AdsShowCallBack
import com.base.appzxhy.business.pangle.PangleInit.initPangle
import com.base.appzxhy.databinding.ActivityPangleBinding
import com.bumptech.glide.Glide
import com.bytedance.sdk.openadsdk.mtestsuite.api.PAGMTestSuite
import com.bytedance.sdk.openadsdk.mtestsuite.api.PAGMTestSuite.ImageCallBack


class PangleActivity : AppCompatActivity() {
    private lateinit var binding: ActivityPangleBinding
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()
        binding = ActivityPangleBinding.inflate(layoutInflater)
        setContentView(binding.root)
        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
            val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
            insets
        }

        binding.initSdk.setOnClickListener {
            initPangle(this)
        }

        binding.showOpen.setOnClickListener {
            AdsMgr.showOpen(this, showCallBack = object : AdsShowCallBack() {
                override fun next() {
//                    this@PangleActivity.startActivity(Intent(this@PangleActivity, MainActivity::class.java))
                }

            })
        }

        binding.showInter.setOnClickListener {
            AdsMgr.showInsert(this, showCallBack = object : AdsShowCallBack() {
                override fun next() {

                }

            })
        }
        binding.showReward.setOnClickListener {
            AdsMgr.showReward(this, showCallBack = object : AdsShowCallBack() {
                override fun next() {

                }

            })
        }

        binding.showBanner.setOnClickListener {
            AdsMgr.showBanner(binding.flBanner)
        }

        binding.testsuite.setOnClickListener {
            //完成集成后，您可以在SDK的zip文件中找到testsuite并将其添加到您的项目中，然后测试中介广告。
            // 请确保在您正式发布应用程序之前移除此文件。
//            test-suite-0.2.10.aar
//            PAGMTestSuite.launchTestSuite(this, object : ImageCallBack {
//                override fun loadImage(imageView: ImageView, url: String?) {
//                    Glide.with(applicationContext).load(url).into(imageView)
//                }
//            })

        }
    }


}