package com.composition.android.ad.csj.impl

import android.content.Context
import com.bytedance.sdk.openadsdk.TTAppDownloadListener
import com.composition.android.ad.csj.R
import com.composition.android.lib.ad.basic.NativeAdViewHolder

/**
 * @classname:
 * @author: LiuXiaoLong
 * @date: 2022/10/25
 * description:穿山甲广告下载监听
 */
class CSJAppDownloadListener(var context: Context, var nativeAdViewHolder: NativeAdViewHolder?) : TTAppDownloadListener {
    override fun onIdle() {
        nativeAdViewHolder?.callActionButtonView?.text = context.getString(R.string.start_download)
    }

    override fun onDownloadActive(p0: Long, p1: Long, p2: String?, p3: String?) {
        nativeAdViewHolder?.callActionButtonView?.text = context.getString(R.string.downloading)
    }

    override fun onDownloadPaused(p0: Long, p1: Long, p2: String?, p3: String?) {
        nativeAdViewHolder?.callActionButtonView?.text = context.getString(R.string.download_pause)
    }

    override fun onDownloadFailed(p0: Long, p1: Long, p2: String?, p3: String?) {
        nativeAdViewHolder?.callActionButtonView?.text = context.getString(R.string.download_again)

    }

    override fun onDownloadFinished(p0: Long, p1: String?, p2: String?) {
        nativeAdViewHolder?.callActionButtonView?.text = context.getString(R.string.click_to_open)

    }

    override fun onInstalled(p0: String?, p1: String?) {
        nativeAdViewHolder?.callActionButtonView?.text = context.getString(R.string.click_to_install)

    }
}