Commit f3a9d15e authored by wanglei's avatar wanglei

...

parent c3417193
......@@ -131,5 +131,15 @@ object AdmobHelper {
return System.currentTimeMillis() - lastCloseDocumentShowAd > interval * 1000L
}
fun isShowCloseDocument(): Boolean {
val status = AppPreferences.getInstance().getString("close_document_ad_show", "0").toInt()
return status == 1
}
fun isShowRvNativeAd(): Boolean {
val status = AppPreferences.getInstance().getString("rv_native_ad_show", "0").toInt()
return status == 1
}
}
\ No newline at end of file
......@@ -112,6 +112,7 @@ object AdmobInterstitialUtils {
interLoadTime = System.currentTimeMillis()
pullAd(ad.responseInfo, "interAd", reqId = reqId)
ad.onPaidEventListener = AdmobEvent.EventOnPaidEventListener(ad)
AdDisplayUtils.incrementInterRequestCount()
}
})
}
......
......@@ -66,10 +66,12 @@ object AdmobNativeUtils {
super.onAdLoaded()
onAdLoaded?.invoke()
onAdLoaded = null
AdDisplayUtils.incrementNativeRequestCount()
}
override fun onAdClicked() {
clickAd(nativeAd?.responseInfo, "nativeAd")
AdDisplayUtils.incrementNativeClickCount()
}
override fun onAdFailedToLoad(p0: LoadAdError) {
......
......@@ -57,6 +57,7 @@ object AdmobOpenUtils {
onLoad?.invoke(true)
pullAd(ad.responseInfo, "openAd", reqId = reqId)
ad.onPaidEventListener = AdmobEvent.EventOnPaidEventListener(ad)
AdDisplayUtils.incrementOpenRequestCount()
}
override fun onAdFailedToLoad(p0: LoadAdError) {
......@@ -108,6 +109,7 @@ object AdmobOpenUtils {
thisMOpenAd?.fullScreenContentCallback = object : FullScreenContentCallback() {
override fun onAdClicked() {
clickAd(thisMOpenAd?.responseInfo, "openAd")
AdDisplayUtils.incrementClickShow()
}
override fun onAdDismissedFullScreenContent() {
......@@ -129,6 +131,8 @@ object AdmobOpenUtils {
override fun onAdShowedFullScreenContent() {
showBefore?.invoke(true)
showAd(thisMOpenAd?.responseInfo, "openAd", activity)
AdDisplayUtils.incrementOpenShow()
}
}
thisMOpenAd?.show(activity)
......
......@@ -26,6 +26,7 @@ import com.artifex.mupdfdemo.SearchTask
import com.artifex.mupdfdemo.SearchTaskResult
import com.base.pdfviewerscannerwhite.R
import com.base.pdfviewerscannerwhite.ads.AdmobHelper
import com.base.pdfviewerscannerwhite.ads.AdmobHelper.isShowCloseDocument
import com.base.pdfviewerscannerwhite.ads.admob.AdmobInterstitialUtils
import com.base.pdfviewerscannerwhite.ads.admob.AdmobNativeUtils
import com.base.pdfviewerscannerwhite.bean.ConstObject.DO_SAVE_PDF
......@@ -166,7 +167,7 @@ class PdfActivity : BaseActivity<ActivityPdfBinding>(), PdfView {
return@addCallback
}
if (AdmobHelper.isShowCloseDocumentInter()) {
if (AdmobHelper.isShowCloseDocumentInter() && isShowCloseDocument()) {
AdmobInterstitialUtils.showInterstitialAd(this@PdfActivity) {
if (it) {
AdmobHelper.lastCloseDocumentShowAd = System.currentTimeMillis()
......
......@@ -83,8 +83,11 @@ class DocumentPageFragment() : BaseFragment<FragmentDocumentPageBinding>(), Docu
binding.flAd.visibility = View.VISIBLE
AdmobNativeUtils.showNativeAd(requireActivity(), binding.flAd, R.layout.layout_admob_document)
} else {
binding.flAd.visibility = View.GONE
arrayList.add(1, DocumentBean().apply { isAd = true })
if (AdmobHelper.isShowRvNativeAd()) {
arrayList.add(1, DocumentBean().apply { isAd = true })
}
}
adapter.submitList(arrayList)
}
......
......@@ -57,6 +57,7 @@ import com.base.pdfviewerscannerwhite.utils.KotlinExt.toFormatSize
import com.base.pdfviewerscannerwhite.utils.KotlinExt.toFormatTime2
import com.base.pdfviewerscannerwhite.utils.KotlinExt.toFormatTime3
import com.base.pdfviewerscannerwhite.utils.KotlinExt.toFormatTime4
import com.base.pdfviewerscannerwhite.utils.PermissionUtils.checkNotificationPermission
import com.base.pdfviewerscannerwhite.utils.PermissionUtils.requestStoragePermission
import com.base.pdfviewerscannerwhite.utils.SpStringUtils
import com.base.pdfviewerscannerwhite.utils.SpStringUtils.LAST_VIEW_KEY
......@@ -495,7 +496,7 @@ object DialogView {
fun Activity.showNotificationDialog(launcher: ActivityLauncher) {
// if (checkNotificationPermission()) return
if (checkNotificationPermission()) return
val dialog = AlertDialog.Builder(this).create()
val binding = DialogNotificationEnableBinding.inflate(LayoutInflater.from(this))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment