Commit 15c83002 authored by wanglei's avatar wanglei

...

parent 669ea17a
......@@ -2,6 +2,7 @@ package com.base.datarecovery.activity
import android.graphics.Color
import android.graphics.Typeface
import android.view.View
import androidx.activity.addCallback
import androidx.core.view.updatePadding
import androidx.fragment.app.Fragment
......@@ -48,10 +49,12 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
if (!checkStorePermission()) {
if (dialog == null) {
dialog = showPermissionBottomSheet(launcher) {
binding.flBanner.visibility = View.VISIBLE
AdmobBannerUtils.showCollapsibleBannerAd(this, binding.flBanner)
}
}
} else {
binding.flBanner.visibility = View.VISIBLE
AdmobBannerUtils.showCollapsibleBannerAd(this, binding.flBanner)
}
binding.viewpager2.run {
......
......@@ -3,11 +3,14 @@ package com.base.datarecovery.ads.admob
import android.content.Context
import android.os.Bundle
import android.util.Log
import android.view.View
import android.view.ViewGroup
import android.view.ViewTreeObserver
import androidx.core.view.children
import com.base.datarecovery.BuildConfig
import com.base.datarecovery.help.ConfigHelper
import com.base.datarecovery.utils.AppPreferences
import com.base.datarecovery.utils.LogEx
import com.google.ads.mediation.admob.AdMobAdapter
import com.google.android.gms.ads.AdListener
import com.google.android.gms.ads.AdRequest
......@@ -17,6 +20,7 @@ import java.util.UUID
object AdmobBannerUtils {
private val TAG = "AdmobBannerUtils"
private var adView: AdView? = null
private var listener: ViewTreeObserver.OnGlobalLayoutListener? = null
......@@ -29,7 +33,15 @@ object AdmobBannerUtils {
adView?.destroy()
}
adView = AdView(context)
parent.removeAllViews()
// parent.removeAllViews()
adView?.tag = "CollapsibleBannerAd"
// parent.removeAllViews()
val list = parent.children
list.forEach {
if (it.tag != "zhanweitu") {
parent.removeView(it)
}
}
parent.addView(adView)
listener = ViewTreeObserver.OnGlobalLayoutListener {
val screenPixelDensity = context.resources.displayMetrics.density
......@@ -37,13 +49,13 @@ object AdmobBannerUtils {
val adSize = AdSize.getCurrentOrientationAnchoredAdaptiveBannerAdSize(context, adWidth)
adView?.adUnitId = if (BuildConfig.DEBUG) ConfigHelper.bannerAdmobIdTest else ConfigHelper.bannerAdmobId
adView?.setAdSize(adSize)
loadCollapsibleBanner()
loadCollapsibleBanner(parent)
parent.viewTreeObserver.removeOnGlobalLayoutListener(listener)
}
parent.viewTreeObserver.addOnGlobalLayoutListener(listener)
}
private fun loadCollapsibleBanner() {
private fun loadCollapsibleBanner(parent: ViewGroup) {
val extras = Bundle()
extras.putString("collapsible", "bottom")
extras.putString("collapsible_request_id", UUID.randomUUID().toString())
......@@ -52,6 +64,19 @@ object AdmobBannerUtils {
adView?.adListener =
object : AdListener() {
override fun onAdLoaded() {}
override fun onAdClosed() {
super.onAdClosed()
LogEx.logDebug(TAG, "onAdClosed")
val removeList = arrayListOf<View>()
parent.children.forEach {
if (it.tag != "CollapsibleBannerAd") {
removeList.add(it)
}
}
removeList.forEach {
parent.removeView(it)
}
}
}
adView?.loadAd(adRequest)
}
......
......@@ -137,6 +137,7 @@ object AdmobInterstitialUtils {
onHidden: (() -> Unit)?
) {
if (!isShowDialog) {
onHidden?.invoke()
return
}
var mDialog: Dialog? = null
......
......@@ -185,7 +185,7 @@ object AdMaxInterstitialUtils {
if (interstitialAd?.isReady == true) {
return false
}
if (isAdInit.get()) {
// if (isAdInit.get()) {
LogEx.logDebug(TAG, "loadInterstitialAd")
val reqId = UUID.randomUUID().toString()
val obj = JSONObject()
......@@ -195,11 +195,11 @@ object AdMaxInterstitialUtils {
interstitialAd?.loadAd()
AdDisplayUtils.getInstance().incrementAdRequestCount()
return true
} else {
LogEx.logDebug(TAG, "isAdInit=$isAdInit")
EventUtils.event("isAdInit", value = "loadInterstitialAd isAdInit=${isAdInit.get()}")
}
return false
// } else {
// LogEx.logDebug(TAG, "isAdInit=$isAdInit")
// EventUtils.event("isAdInit", value = "loadInterstitialAd isAdInit=${isAdInit.get()}")
// }
// return false
}
......
......@@ -117,11 +117,11 @@ object AdMaxOpenUtils {
appOpenAd?.loadAd()
}
if (!isAdInit.get()) {
EventUtils.event("isAdInit", value = "showAppOpenAd isAdInit=${isAdInit.get()}")
onHidden?.invoke()
return
}
// if (!isAdInit.get()) {
// EventUtils.event("isAdInit", value = "showAppOpenAd isAdInit=${isAdInit.get()}")
// onHidden?.invoke()
// return
// }
LogEx.logDebug(TAG, "showAppOpenAd")
......@@ -171,8 +171,8 @@ object AdMaxOpenUtils {
return false
}
if (isAdInit.get()) {
EventUtils.event("isAdInit", value = "loadAppOpenAd isAdInit=${isAdInit.get()}")
// if (isAdInit.get()) {
// EventUtils.event("isAdInit", value = "loadAppOpenAd isAdInit=${isAdInit.get()}")
LogEx.logDebug(TAG, "appOpenAd loadAd")
val reqId = UUID.randomUUID().toString()
val obj = JSONObject()
......@@ -182,8 +182,8 @@ object AdMaxOpenUtils {
appOpenAd?.loadAd()
AdDisplayUtils.getInstance().incrementAdRequestCount()
return true
}
return false
// }
// return false
}
fun isOpenAdLoaded(): Boolean {
......
......@@ -12,10 +12,10 @@ public class AppManagerStringManager {
static {
// 初始化并添加文案到列表
appManagerCopies.add("Keep your device clutter-free with our App Management tool.");
appManagerCopies.add("Stay in control. Manage your apps with our intuitive App Management feature.");
appManagerCopies.add("Take charge of your apps. Try our App Management feature for organized bliss.");
// appManagerCopies.add("Stay in control. Manage your apps with our intuitive App Management feature.");
// appManagerCopies.add("Take charge of your apps. Try our App Management feature for organized bliss.");
appManagerCopies.add("Say goodbye to app chaos. Our App Management feature makes it easy.");
appManagerCopies.add("Simplify your digital life. Experience the ease of our App Management tool.");
// appManagerCopies.add("Simplify your digital life. Experience the ease of our App Management tool.");
}
public static String getNextDesc() {
......
......@@ -11,10 +11,10 @@ public class AppProcessStringManager {
static {
// 初始化并添加文案到列表
appManagerCopies.add("Manage Your Apps: Keep your device running smoothly with our App Process Manager.");
appManagerCopies.add("App Process Alert: Time to clean up your device's background processes.");
appManagerCopies.add("Optimize Performance: Discover which apps are running in the background and manage them with ease.");
appManagerCopies.add("App Process Check: Ensure your device is running efficiently by managing your app processes.");
appManagerCopies.add("Keep your device running smoothly with our App Process Manager.");
appManagerCopies.add("Time to clean up your device's background processes.");
appManagerCopies.add("Discover which apps are running in the background and manage them with ease.");
appManagerCopies.add("Ensure your device is running efficiently by managing your app processes.");
}
public static String getNextPrivacySpaceCopy() {
......
......@@ -9,11 +9,11 @@ public class DocumentRecoveryStringManager {
static {
// 初始化并添加文案到列表
documentRecoveryCopies.add("Lost a vital document? Our recovery service might be able to help.");
documentRecoveryCopies.add("Can't find an important document? Try our recovery tool today.");
documentRecoveryCopies.add("Accidentally deleted a document? Recover it with ease using our service.");
documentRecoveryCopies.add("Don't panic over lost documents – our recovery feature is here to assist.");
documentRecoveryCopies.add("Regain access to deleted documents with our simple recovery process.");
documentRecoveryCopies.add("Our recovery service might be able to help.");
documentRecoveryCopies.add("Try our recovery tool today.");
documentRecoveryCopies.add("Recover it with ease using our service.");
documentRecoveryCopies.add("our recovery feature is here to assist.");
// documentRecoveryCopies.add("Regain access to deleted documents with our simple recovery process.");
}
public static String getNextRecoveryCopy() {
......
......@@ -11,9 +11,9 @@ public class DuplicatePhotoStringResourceManager {
static {
// 添加推送文案到列表
duplicatePhotoCopyList.add("Discover duplicate photos and free up space on your device.");
duplicatePhotoCopyList.add("Neat trick: Find and remove duplicate photos to instantly gain more storage.");
duplicatePhotoCopyList.add("Twin photos taking up space? Identify and delete them easily with our app.");
duplicatePhotoCopyList.add("Clear the clutter: Spot and remove look-alike photos to free up your phone.");
duplicatePhotoCopyList.add("Find and remove duplicate photos to instantly gain more storage.");
duplicatePhotoCopyList.add("Identify and delete them easily with our app.");
duplicatePhotoCopyList.add("Spot and remove look-alike photos to free up your phone.");
duplicatePhotoCopyList.add("Don't let duplicates drain your storage. Clean up similar photos now.");
duplicatePhotoCopyList.add("Double trouble? Find and delete duplicate photos to reclaim your space.");
}
......
......@@ -9,11 +9,11 @@ public class PhotoRecoveryStringManager {
static {
// 添加照片恢复功能的推送文案到列表
photoRecoveryCopies.add("Lost a precious photo? Our recovery tool can help you find it!");
photoRecoveryCopies.add("Accidentally deleted a photo? Recover it easily with our app.");
photoRecoveryCopies.add("Bring back lost memories: Use our photo recovery feature now.");
photoRecoveryCopies.add("Don't let deleted photos stay lost. Restore them with a few taps.");
photoRecoveryCopies.add("Regret deleting a photo? Try our recovery service to get it back today.");
photoRecoveryCopies.add("Our recovery tool can help you find precious photo!");
photoRecoveryCopies.add("Recover a deleted photo easily with our app.");
photoRecoveryCopies.add("Use our photo recovery feature now.");
photoRecoveryCopies.add("Restore deleted photos with a few taps.");
photoRecoveryCopies.add("Try our recovery service to get it back today.");
}
public static String getNextRecoveryCopy() {
......
......@@ -11,11 +11,11 @@ public class PrivacySpaceStringManager {
static {
// 初始化并添加文案到列表
privacySpaceCopies.add("Secure your private content. Tuck away photos and videos in your hidden space.");
privacySpaceCopies.add("Keep your memories safe. Store them in your private hideaway.");
privacySpaceCopies.add("Don't let others see your private moments. Use our secure hideaway.");
privacySpaceCopies.add("Your privacy is important. Lock away your photos and videos securely.");
privacySpaceCopies.add("Add an extra layer of security to your personal media with our hidden space.");
privacySpaceCopies.add("Tuck away photos and videos in your hidden space.");
privacySpaceCopies.add("Store them in your private hideaway.");
privacySpaceCopies.add("Don't let others see your private moments.");
privacySpaceCopies.add("Lock away your photos and videos securely.");
// privacySpaceCopies.add("Add an extra layer of security to your personal media with our hidden space.");
}
public static String getNextPrivacySpaceCopy() {
......
......@@ -10,11 +10,11 @@ public class ScreenshotCleanupStringManager {
static {
// 添加截图清理功能的推送文案到列表
screenshotCleanupCopies.add("Declutter your gallery: It's time to remove those old screenshots!");
screenshotCleanupCopies.add("Clean up your phone's memory: Delete unwanted screenshots now!");
screenshotCleanupCopies.add("Free up space with ease: Get rid of unnecessary screenshots.");
screenshotCleanupCopies.add("Regain control over your storage: Clear out old screenshots today.");
screenshotCleanupCopies.add("A tidy phone is a happy phone: Remove excess screenshots and save space.");
screenshotCleanupCopies.add("It's time to remove those old screenshots!");
screenshotCleanupCopies.add("Delete unwanted screenshots now!");
screenshotCleanupCopies.add("Get rid of unnecessary screenshots.");
screenshotCleanupCopies.add("Clear out old screenshots today.");
screenshotCleanupCopies.add("Remove excess screenshots and save space.");
}
public static String getNextCleanupCopy() {
......
......@@ -9,11 +9,11 @@ public class VideoRecoveryStringManager {
static {
// 添加视频恢复功能的推送文案到列表
videoRecoveryCopies.add("Regain lost video moments. Start your video recovery now!");
videoRecoveryCopies.add("Don't let lost videos be gone forever. Recover them today with our app.");
videoRecoveryCopies.add("Accidentally deleted a video? Our recovery feature can bring it back.");
videoRecoveryCopies.add("Revive those deleted video clips – it's easy with our recovery tool.");
videoRecoveryCopies.add("Missing a special video? Try our recovery service to retrieve it.");
videoRecoveryCopies.add("Start your video recovery now!");
videoRecoveryCopies.add("Recover lost videos today with our app.");
videoRecoveryCopies.add("Our recovery feature can bring it back.");
videoRecoveryCopies.add("it's easy with our recovery tool.");
videoRecoveryCopies.add("Try our recovery service to retrieve it.");
}
public static String getNextRecoveryCopy() {
......
......@@ -93,8 +93,18 @@
<FrameLayout
android:id="@+id/fl_banner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="60dp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/ll" />
app:layout_constraintTop_toBottomOf="@id/ll">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@mipmap/zhanweitu2"
android:tag="zhanweitu"
tools:ignore="ContentDescription" />
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
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