V1.0.5(6)广告平台从MAX换成TopOn
This commit is contained in:
parent
c5b98b1a3e
commit
72bcf4bcba
@ -6,13 +6,8 @@ plugins {
|
||||
id ("kotlin-kapt")
|
||||
id("com.google.gms.google-services")
|
||||
id("com.google.firebase.crashlytics")
|
||||
id("applovin-quality-service")
|
||||
}
|
||||
|
||||
applovin {
|
||||
apiKey =
|
||||
"Dl27vTcbmSn21PBrDMXpSqmsfG9shMGyquWAiaWdAbSq3wFKDu3lz_TXSAt_JsOVCRChddpPl2dZrymN3OooUM"
|
||||
}
|
||||
|
||||
val timestamp = SimpleDateFormat("MM_dd_HH_mm").format(Date())
|
||||
android {
|
||||
@ -24,8 +19,8 @@ android {
|
||||
applicationId = "com.tool.minimalistwallpaper"
|
||||
minSdk = 23
|
||||
targetSdk = 34
|
||||
versionCode = 5
|
||||
versionName = "1.0.4"
|
||||
versionCode = 6
|
||||
versionName = "1.0.5"
|
||||
setProperty("archivesBaseName", "minimalistwallpaper_v" + versionName + "(${versionCode})_$timestamp")
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
@ -77,9 +72,95 @@ dependencies {
|
||||
implementation("com.google.firebase:firebase-crashlytics")
|
||||
implementation("com.google.firebase:firebase-analytics")
|
||||
|
||||
implementation("com.applovin:applovin-sdk:+")
|
||||
implementation("com.applovin.mediation:vungle-adapter:+")
|
||||
implementation("com.applovin.mediation:mintegral-adapter:+")
|
||||
implementation("com.applovin.mediation:bytedance-adapter:+")
|
||||
implementation("com.applovin.mediation:unityads-adapter:+")
|
||||
//-----------------------------------------------TopOn(Mintegral、Pangle、UnitAds、Digital Turbine(Fyber)、Chartboost&Helium、Ironsource、Liftoff(Vungle)、Inmobi、Start.io、Appnext、Bigo)
|
||||
|
||||
//Anythink (Necessary)
|
||||
implementation("com.anythink.sdk:core-tpn:6.4.07")
|
||||
implementation("com.anythink.sdk:nativead-tpn:6.4.07")
|
||||
implementation("com.anythink.sdk:banner-tpn:6.4.07")
|
||||
implementation("com.anythink.sdk:interstitial-tpn:6.4.07")
|
||||
implementation("com.anythink.sdk:rewardedvideo-tpn:6.4.07")
|
||||
implementation("com.anythink.sdk:splash-tpn:6.4.07")
|
||||
|
||||
//Androidx (Necessary)
|
||||
implementation("androidx.appcompat:appcompat:1.1.0")
|
||||
implementation("androidx.browser:browser:1.4.0")
|
||||
|
||||
//StartApp
|
||||
implementation("com.anythink.sdk:adapter-tpn-startapp:6.4.07")
|
||||
implementation("com.startapp:inapp-sdk:5.0.2")
|
||||
|
||||
//Appnext
|
||||
implementation("com.anythink.sdk:adapter-tpn-appnext:6.4.07")
|
||||
implementation("com.appnext.sdk:ads:2.7.1.473")
|
||||
implementation("com.appnext.sdk:banners:2.7.1.473")
|
||||
implementation("com.appnext.sdk:native-ads2:2.7.1.473")
|
||||
implementation("com.appnext.sdk:actions:2.4.6.472")
|
||||
implementation("androidx.constraintlayout:constraintlayout:2.0.4")
|
||||
|
||||
//Vungle
|
||||
implementation("com.anythink.sdk:adapter-tpn-vungle:6.4.07")
|
||||
implementation("com.vungle:vungle-ads:7.4.0")
|
||||
implementation("com.google.android.gms:play-services-basement:18.1.0")
|
||||
implementation("com.google.android.gms:play-services-ads-identifier:18.0.1")
|
||||
|
||||
//UnityAds
|
||||
implementation("com.anythink.sdk:adapter-tpn-unityads:6.4.07")
|
||||
implementation("com.unity3d.ads:unity-ads:4.12.2")
|
||||
|
||||
//Ironsource
|
||||
implementation("com.anythink.sdk:adapter-tpn-ironsource:6.4.07")
|
||||
implementation("com.ironsource.sdk:mediationsdk:8.2.1")
|
||||
implementation("com.google.android.gms:play-services-appset:16.0.2")
|
||||
implementation("com.google.android.gms:play-services-ads-identifier:18.0.1")
|
||||
implementation("com.google.android.gms:play-services-basement:18.1.0")
|
||||
|
||||
//Bigo
|
||||
implementation("com.anythink.sdk:adapter-tpn-bigo:6.4.07")
|
||||
implementation("com.bigossp:bigo-ads:4.9.0")
|
||||
|
||||
//Pangle
|
||||
implementation("com.anythink.sdk:adapter-tpn-pangle-nonchina:6.4.07")
|
||||
implementation("com.pangle.global:ads-sdk:6.1.0.9")
|
||||
implementation("com.google.android.gms:play-services-ads-identifier:18.0.1")
|
||||
|
||||
//Inmobi
|
||||
implementation("com.anythink.sdk:adapter-tpn-inmobi:6.4.07")
|
||||
implementation("com.inmobi.monetization:inmobi-ads-kotlin:10.7.5")
|
||||
|
||||
//Mintegral
|
||||
implementation("com.anythink.sdk:adapter-tpn-mintegral-nonchina:6.4.07")
|
||||
implementation("com.mbridge.msdk.oversea:reward:16.8.11")
|
||||
implementation("com.mbridge.msdk.oversea:newinterstitial:16.8.11")
|
||||
implementation("com.mbridge.msdk.oversea:mbnative:16.8.11")
|
||||
implementation("com.mbridge.msdk.oversea:mbnativeadvanced:16.8.11")
|
||||
implementation("com.mbridge.msdk.oversea:mbsplash:16.8.11")
|
||||
implementation("com.mbridge.msdk.oversea:mbbanner:16.8.11")
|
||||
implementation("com.mbridge.msdk.oversea:mbbid:16.8.11")
|
||||
implementation("androidx.recyclerview:recyclerview:1.1.0")
|
||||
|
||||
//Chartboost
|
||||
implementation("com.anythink.sdk:adapter-tpn-chartboost:6.4.07")
|
||||
implementation("com.chartboost:chartboost-sdk:9.7.0")
|
||||
implementation("com.chartboost:chartboost-mediation-sdk:4.9.1")
|
||||
implementation("com.chartboost:chartboost-mediation-adapter-chartboost:4.9.7.0.0")
|
||||
implementation("com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:1.0.0")
|
||||
implementation("com.squareup.okhttp3:logging-interceptor:4.10.0")
|
||||
implementation("com.squareup.okhttp3:okhttp:4.10.0")
|
||||
implementation("com.squareup.retrofit2:converter-scalars:2.9.0")
|
||||
implementation("com.squareup.retrofit2:retrofit:2.9.0")
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1")
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.1")
|
||||
|
||||
//Fyber
|
||||
implementation("com.anythink.sdk:adapter-tpn-fyber:6.4.07")
|
||||
implementation("com.fyber:marketplace-sdk:8.3.0")
|
||||
implementation("com.google.android.gms:play-services-ads-identifier:18.0.1")
|
||||
|
||||
// Debugger UI Tools
|
||||
//implementation ("com.anythink.sdk:debugger-ui:1.0.7")
|
||||
|
||||
//----------------------------------------------TopOn
|
||||
|
||||
|
||||
}
|
||||
132
app/proguard-rules.pro
vendored
132
app/proguard-rules.pro
vendored
@ -30,4 +30,134 @@
|
||||
-keep class com.tool.minimalistwallpaper.data.MydataBase { *; }
|
||||
-keep class com.tool.minimalistwallpaper.data.MyDAO { *; }
|
||||
-keep class com.tool.minimalistwallpaper.data.Mydata { *; }
|
||||
-keep class com.tool.minimalistwallpaper.data.Otherdata { *; }
|
||||
-keep class com.tool.minimalistwallpaper.data.Otherdata { *; }
|
||||
|
||||
|
||||
#---------------------------------------------Topon
|
||||
-keep class com.startapp.** {
|
||||
*;
|
||||
}
|
||||
|
||||
-keep class com.truenet.** {
|
||||
*;
|
||||
}
|
||||
|
||||
-keepattributes Exceptions, InnerClasses, Signature, Deprecated, SourceFile,
|
||||
LineNumberTable, *Annotation*, EnclosingMethod
|
||||
-dontwarn android.webkit.JavascriptInterface
|
||||
-dontwarn com.startapp.**
|
||||
|
||||
-dontwarn org.jetbrains.annotations.**
|
||||
-keep class com.appnext.** { *; }
|
||||
-dontwarn com.appnext.**
|
||||
# Vungle
|
||||
-dontwarn com.vungle.ads.**
|
||||
-keepclassmembers class com.vungle.ads.** {
|
||||
*;
|
||||
}
|
||||
-keep class com.vungle.ads.**
|
||||
|
||||
|
||||
|
||||
# Google
|
||||
-keep class com.google.android.gms.** { *; }
|
||||
-dontwarn com.google.android.gms.**
|
||||
|
||||
|
||||
|
||||
|
||||
# START OkHttp + Okio
|
||||
# JSR 305 annotations are for embedding nullability information.
|
||||
-dontwarn javax.annotation.**
|
||||
|
||||
|
||||
# A resource is loaded with a relative path so the package of this class must be preserved.
|
||||
-adaptresourcefilenames okhttp3/internal/publicsuffix/PublicSuffixDatabase.gz
|
||||
|
||||
|
||||
# Animal Sniffer compileOnly dependency to ensure APIs are compatible with older versions of Java.
|
||||
-dontwarn org.codehaus.mojo.animal_sniffer.*
|
||||
|
||||
|
||||
# OkHttp platform used only on JVM and when Conscrypt and other security providers are available.
|
||||
-dontwarn okhttp3.internal.platform.**
|
||||
-dontwarn org.conscrypt.**
|
||||
-dontwarn org.bouncycastle.**
|
||||
-dontwarn org.openjsse.**
|
||||
|
||||
|
||||
# Animal Sniffer compileOnly dependency to ensure APIs are compatible with older versions of Java.
|
||||
-dontwarn org.codehaus.mojo.animal_sniffer.*
|
||||
|
||||
|
||||
# END OkHttp + Okio
|
||||
|
||||
|
||||
# START Protobuf
|
||||
-dontwarn com.google.protobuf.**
|
||||
-keepclassmembers class com.google.protobuf.** {
|
||||
*;
|
||||
}
|
||||
-keep class * extends com.google.protobuf.GeneratedMessageLite { *; }
|
||||
|
||||
|
||||
# END Protobuf
|
||||
-keepclassmembers class com.ironsource.sdk.controller.IronSourceWebView$JSInterface {
|
||||
public *;
|
||||
}
|
||||
-keepclassmembers class * implements android.os.Parcelable {
|
||||
public static final android.os.Parcelable$Creator *;
|
||||
}
|
||||
-keep public class com.google.android.gms.ads.** {
|
||||
public *;
|
||||
}
|
||||
-keep class com.ironsource.adapters.** { *;
|
||||
}
|
||||
-dontwarn com.ironsource.mediationsdk.**
|
||||
-dontwarn com.ironsource.adapters.**
|
||||
-keepattributes JavascriptInterface
|
||||
-keepclassmembers class * {
|
||||
@android.webkit.JavascriptInterface <methods>;
|
||||
}
|
||||
-keep class com.bytedance.sdk.** { *; }
|
||||
-keep class com.inmobi.** { *; }
|
||||
-keep public class com.google.android.gms.**
|
||||
-dontwarn com.google.android.gms.**
|
||||
-dontwarn com.squareup.picasso.**
|
||||
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient{
|
||||
public *;
|
||||
}
|
||||
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info{
|
||||
public *;
|
||||
}
|
||||
# skip the Picasso library classes
|
||||
-keep class com.squareup.picasso.** {*;}
|
||||
-dontwarn com.squareup.okhttp.**
|
||||
# skip Moat classes
|
||||
-keep class com.moat.** {*;}
|
||||
-dontwarn com.moat.**
|
||||
# skip IAB classes
|
||||
-keep class com.iab.** {*;}
|
||||
-dontwarn com.iab.**
|
||||
-keepattributes Signature
|
||||
-keepattributes *Annotation*
|
||||
-keep class com.mbridge.** {*; }
|
||||
-keep interface com.mbridge.** {*; }
|
||||
-keep class android.support.v4.** { *; }
|
||||
-dontwarn com.mbridge.**
|
||||
-keep class **.R$* { public static final int mbridge*; }
|
||||
-keep public class com.mbridge.* extends androidx.** { *; }
|
||||
-keep public class androidx.viewpager.widget.PagerAdapter{ *; }
|
||||
-keep public class androidx.viewpager.widget.ViewPager.OnPageChangeListener{ *; }
|
||||
-keep interface androidx.annotation.IntDef{ *; }
|
||||
-keep interface androidx.annotation.Nullable{ *; }
|
||||
-keep interface androidx.annotation.CheckResult{ *; }
|
||||
-keep interface androidx.annotation.NonNull{ *; }
|
||||
-keep public class androidx.fragment.app.Fragment{ *; }
|
||||
-keep public class androidx.core.content.FileProvider{ *; }
|
||||
-keep public class androidx.core.app.NotificationCompat{ *; }
|
||||
-keep public class androidx.appcompat.widget.AppCompatImageView { *; }
|
||||
-keep public class androidx.recyclerview.*{ *; }
|
||||
-keep class com.chartboost.** { *; }
|
||||
|
||||
#---------------------------------------------Topon
|
||||
@ -11,9 +11,9 @@
|
||||
"type": "SINGLE",
|
||||
"filters": [],
|
||||
"attributes": [],
|
||||
"versionCode": 5,
|
||||
"versionName": "1.0.4",
|
||||
"outputFile": "minimalistwallpaper_v1.0.4(5)_08_27_16_28-release.apk"
|
||||
"versionCode": 6,
|
||||
"versionName": "1.0.5",
|
||||
"outputFile": "minimalistwallpaper_v1.0.5(6)_10_09_15_13-release.apk"
|
||||
}
|
||||
],
|
||||
"elementType": "File"
|
||||
|
||||
@ -2,21 +2,16 @@ package com.tool.minimalistwallpaper;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.util.Log;
|
||||
|
||||
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
|
||||
import com.applovin.sdk.AppLovinMediationProvider;
|
||||
import com.applovin.sdk.AppLovinSdk;
|
||||
import com.applovin.sdk.AppLovinSdkConfiguration;
|
||||
import com.applovin.sdk.AppLovinSdkInitializationConfiguration;
|
||||
import com.anythink.core.api.ATSDK;
|
||||
import com.anythink.core.api.NetTrafficeCallback;
|
||||
import com.tool.minimalistwallpaper.data.Mydata;
|
||||
import com.tool.minimalistwallpaper.data.MydataBase;
|
||||
import com.tool.minimalistwallpaper.data.Otherdata;
|
||||
import com.tool.minimalistwallpaper.tools.Mytools;
|
||||
import com.tool.minimalistwallpaper.topon.AdManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -33,7 +28,8 @@ public class MinimalistWPSkin extends Application {
|
||||
private static final String PREFS_NAME = "MyPrefs";
|
||||
private static final String KEY_IS_INSERTED = "isinserted";
|
||||
public static final String AD_BROADCAST = "on_success_action";
|
||||
private static final String MAX_SDK = "NprBImK6BeQcxVNp44x4_ikQeJmyfGD8OEHbpNDUu7_WudCrCm_TIKr807Zzd8rfb6TG5NITCTxbZHZT9PbAGa";
|
||||
private static final String AppKey = "a4dc9b217365fa7d649417a6ff14ab50b";
|
||||
private static final String APPId = "h6705e95e200d1";
|
||||
public static Boolean initSDK = false;
|
||||
|
||||
public static String TAG = "-------Wallpaper----------";
|
||||
@ -68,18 +64,28 @@ public class MinimalistWPSkin extends Application {
|
||||
|
||||
private void initSDk() {
|
||||
|
||||
AppLovinSdkInitializationConfiguration initConfig = AppLovinSdkInitializationConfiguration.builder(MAX_SDK, this)
|
||||
.setMediationProvider(AppLovinMediationProvider.MAX)
|
||||
.build();
|
||||
AppLovinSdk.getInstance(this).initialize(initConfig, new AppLovinSdk.SdkInitializationListener() {
|
||||
ATSDK.checkIsEuTraffic(this, new NetTrafficeCallback() {
|
||||
|
||||
@Override
|
||||
public void onSdkInitialized(final AppLovinSdkConfiguration sdkConfig) {
|
||||
initSDK = true;
|
||||
Log.e("zzj", "------------initSDk--------success");
|
||||
LocalBroadcastManager.getInstance(MinimalistWPSkin.app).sendBroadcast(new Intent(AD_BROADCAST));
|
||||
public void onResultCallback(boolean isEU) {
|
||||
Log.e(TAG, "onResultCallback:" + isEU);
|
||||
if (isEU && ATSDK.getGDPRDataLevel(MinimalistWPSkin.this) == ATSDK.UNKNOWN) {
|
||||
ATSDK.showGdprAuth(MinimalistWPSkin.this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onErrorCallback(String errorMsg) {
|
||||
Log.e(TAG, "onErrorCallback:" + errorMsg);
|
||||
}
|
||||
});
|
||||
|
||||
ATSDK.init( this, APPId, AppKey);
|
||||
AdManager.loadAllAd();
|
||||
//测试工具
|
||||
// ATDebuggerUITest.showDebuggerUI(this,debug_KEy);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,5 +1,10 @@
|
||||
package com.tool.minimalistwallpaper.activity;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.graphics.Insets;
|
||||
@ -7,25 +12,17 @@ import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import com.applovin.mediation.MaxAd;
|
||||
import com.applovin.mediation.ads.MaxInterstitialAd;
|
||||
import com.anythink.interstitial.api.ATInterstitial;
|
||||
import com.tool.minimalistwallpaper.R;
|
||||
import com.tool.minimalistwallpaper.adapter.MainRvAdapter;
|
||||
import com.tool.minimalistwallpaper.data.MydataBase;
|
||||
import com.tool.minimalistwallpaper.data.Otherdata;
|
||||
import com.tool.minimalistwallpaper.databinding.ActivityAllBinding;
|
||||
import com.tool.minimalistwallpaper.max.MaxManager;
|
||||
import com.tool.minimalistwallpaper.max.onAdAfterAction;
|
||||
import com.tool.minimalistwallpaper.tools.Adcallback;
|
||||
import com.tool.minimalistwallpaper.tools.Mytools;
|
||||
import com.tool.minimalistwallpaper.tools.SpaceItem;
|
||||
import com.tool.minimalistwallpaper.tools.StaticValue;
|
||||
import com.tool.minimalistwallpaper.topon.AdManager;
|
||||
import com.tool.minimalistwallpaper.topon.onActionListener;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -36,7 +33,7 @@ public class AllActivity extends AppCompatActivity {
|
||||
private MainRvAdapter mainRvListAdapter;
|
||||
private String name;
|
||||
private SpaceItem spaceItem = new SpaceItem(12, 12, 12);
|
||||
private static List<MaxInterstitialAd> adsList;
|
||||
private static List<ATInterstitial> adsList;
|
||||
|
||||
@SuppressLint("MissingInflatedId")
|
||||
@Override
|
||||
@ -44,7 +41,11 @@ public class AllActivity extends AppCompatActivity {
|
||||
super.onCreate(savedInstanceState);
|
||||
binding = ActivityAllBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
MaxManager.startShowMaxAd(AllActivity.this, new onAdAfterAction() {
|
||||
|
||||
AdManager.loadAllAd();
|
||||
|
||||
AdManager.showTopOn(AllActivity.this, new onActionListener() {
|
||||
// TODO: 2024/10/9
|
||||
@Override
|
||||
public void onAction() {
|
||||
|
||||
|
||||
@ -1,49 +1,35 @@
|
||||
package com.tool.minimalistwallpaper.activity;
|
||||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.GestureDetectorCompat;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Dialog;
|
||||
import android.app.WallpaperManager;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
import android.provider.MediaStore;
|
||||
import android.util.Log;
|
||||
import android.view.GestureDetector;
|
||||
import android.view.Gravity;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.applovin.mediation.MaxAd;
|
||||
import com.applovin.mediation.ads.MaxInterstitialAd;
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
import com.anythink.interstitial.api.ATInterstitial;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.target.CustomTarget;
|
||||
import com.bumptech.glide.request.transition.Transition;
|
||||
@ -52,25 +38,21 @@ import com.tool.minimalistwallpaper.R;
|
||||
import com.tool.minimalistwallpaper.data.MydataBase;
|
||||
import com.tool.minimalistwallpaper.data.Otherdata;
|
||||
import com.tool.minimalistwallpaper.databinding.ActivityPreViewBinding;
|
||||
import com.tool.minimalistwallpaper.max.MaxManager;
|
||||
import com.tool.minimalistwallpaper.max.onAdAfterAction;
|
||||
import com.tool.minimalistwallpaper.tools.Adcallback;
|
||||
|
||||
import com.tool.minimalistwallpaper.tools.Mytools;
|
||||
import com.tool.minimalistwallpaper.tools.SetCallback;
|
||||
import com.tool.minimalistwallpaper.tools.SetDialogFragment;
|
||||
import com.tool.minimalistwallpaper.tools.StaticValue;
|
||||
import com.tool.minimalistwallpaper.tools.Utils;
|
||||
import com.tool.minimalistwallpaper.topon.AdManager;
|
||||
import com.tool.minimalistwallpaper.topon.onActionListener;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.zip.Inflater;
|
||||
|
||||
import javax.security.auth.login.LoginException;
|
||||
|
||||
public class PreViewActivity extends AppCompatActivity {
|
||||
ActivityPreViewBinding binding;
|
||||
@ -82,10 +64,11 @@ public class PreViewActivity extends AppCompatActivity {
|
||||
private File downrs;
|
||||
private WallpaperManager wallpaperManager;
|
||||
private BroadcastReceiver wallpaperChangedReceiver;
|
||||
private boolean isWallpaperSet = false; // 用来防止Toast重复显示
|
||||
private GestureDetector gestureDetector;
|
||||
public static boolean KEY_Change = false;
|
||||
private Otherdata checkdata = new Otherdata();
|
||||
private static List<MaxInterstitialAd> adsList;
|
||||
private static List<ATInterstitial> adsList;
|
||||
private SetDialogFragment dialog;
|
||||
|
||||
@SuppressLint("MissingInflatedId")
|
||||
@ -102,22 +85,28 @@ public class PreViewActivity extends AppCompatActivity {
|
||||
return insets;
|
||||
});
|
||||
|
||||
AdManager.loadAllAd();
|
||||
|
||||
|
||||
initData();
|
||||
initEvent();
|
||||
|
||||
// 初始化广播接收器
|
||||
wallpaperChangedReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (Intent.ACTION_WALLPAPER_CHANGED.equals(intent.getAction())) {
|
||||
unregisterReceiver(wallpaperChangedReceiver);
|
||||
finish();
|
||||
Toast.makeText(PreViewActivity.this, getString(R.string.set_successful), Toast.LENGTH_SHORT).show();
|
||||
|
||||
if (!isWallpaperSet) { // 确保只执行一次
|
||||
isWallpaperSet = true; // 设置标志位,防止重复
|
||||
Toast.makeText(PreViewActivity.this, getString(R.string.set_successful), Toast.LENGTH_SHORT).show();
|
||||
finish(); // 关闭活动
|
||||
}
|
||||
unregisterReceiver(wallpaperChangedReceiver); // 确保广播接收器被注销
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// 注册广播接收器
|
||||
IntentFilter filter = new IntentFilter(Intent.ACTION_WALLPAPER_CHANGED);
|
||||
registerReceiver(wallpaperChangedReceiver, filter);
|
||||
|
||||
@ -153,7 +142,8 @@ public class PreViewActivity extends AppCompatActivity {
|
||||
binding.preDownwp.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
MaxManager.startShowMaxAd(PreViewActivity.this, new onAdAfterAction() {
|
||||
AdManager.showTopOn(PreViewActivity.this, new onActionListener() {
|
||||
// TODO: 2024/10/9
|
||||
@Override
|
||||
public void onAction() {
|
||||
binding.imgDownload.setVisibility(View.GONE);
|
||||
@ -237,7 +227,8 @@ public class PreViewActivity extends AppCompatActivity {
|
||||
dialog = SetDialogFragment.newInstance(new SetCallback() {
|
||||
@Override
|
||||
public void onAction(int flag) {
|
||||
MaxManager.startShowMaxAd(PreViewActivity.this, new onAdAfterAction() {
|
||||
AdManager.showTopOn(PreViewActivity.this, new onActionListener() {
|
||||
// TODO: 2024/10/9
|
||||
@Override
|
||||
public void onAction() {
|
||||
setWp(setmap, flag);
|
||||
@ -249,7 +240,6 @@ public class PreViewActivity extends AppCompatActivity {
|
||||
|
||||
dialog.show(getSupportFragmentManager(),"");
|
||||
|
||||
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
|
||||
@ -43,7 +43,7 @@ public class SettingActivity extends AppCompatActivity {
|
||||
}
|
||||
});
|
||||
binding.settingBack.setOnClickListener(v -> finish());
|
||||
binding.versionText.setText("1.0.2");
|
||||
binding.versionText.setText("1.0.5");
|
||||
binding.rate.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
@ -1,44 +1,25 @@
|
||||
package com.tool.minimalistwallpaper.activity;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.CountDownTimer;
|
||||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.os.Bundle;
|
||||
import android.os.CountDownTimer;
|
||||
import android.util.Log;
|
||||
|
||||
import com.applovin.mediation.MaxAd;
|
||||
import com.applovin.mediation.ads.MaxInterstitialAd;
|
||||
import com.tool.minimalistwallpaper.MinimalistWPSkin;
|
||||
import com.tool.minimalistwallpaper.R;
|
||||
import com.tool.minimalistwallpaper.max.WelComManager;
|
||||
import com.tool.minimalistwallpaper.tools.Adcallback;
|
||||
import com.tool.minimalistwallpaper.tools.CustomProgressBar;
|
||||
import com.tool.minimalistwallpaper.tools.Mytools;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import kotlin.Unit;
|
||||
import kotlin.jvm.functions.Function0;
|
||||
import kotlin.jvm.functions.Function1;
|
||||
import com.tool.minimalistwallpaper.topon.AdManager;
|
||||
|
||||
public class SplashActivity extends AppCompatActivity {
|
||||
private CountDownTimer countDownTimer;
|
||||
private static List<MaxInterstitialAd> adsList;
|
||||
public static boolean isAlreadyShow = false;
|
||||
|
||||
|
||||
private long totalTime = 11000;
|
||||
private static final long totalTime = 11000; // 倒计时总时间
|
||||
private CustomProgressBar customProgressBar;
|
||||
private final boolean isAlreadyShow = false; // 用于追踪广告是否已经展示
|
||||
|
||||
@SuppressLint("MissingInflatedId")
|
||||
@Override
|
||||
@ -46,34 +27,40 @@ public class SplashActivity extends AppCompatActivity {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_splash);
|
||||
|
||||
// 处理 Edge-to-Edge 样式
|
||||
EdgeToEdge.enable(this);
|
||||
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.activity_splash), (v, insets) -> {
|
||||
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||
return insets;
|
||||
});
|
||||
customProgressBar = findViewById(R.id.splash_pg);
|
||||
customProgressBar.setProgress(5);
|
||||
countDownTimer = WelComManager.initTimer(SplashActivity.this, totalTime, new Function1<Long, Unit>() {
|
||||
@Override
|
||||
public Unit invoke(Long aLong) {
|
||||
Float percentage = 100 - (float) aLong / totalTime * 100;
|
||||
customProgressBar.setProgress(percentage);
|
||||
return null;
|
||||
}
|
||||
}, new Function0<Unit>() {
|
||||
@Override
|
||||
public Unit invoke() {
|
||||
startMain();
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
// 初始化进度条
|
||||
customProgressBar = findViewById(R.id.splash_pg);
|
||||
customProgressBar.setProgress(5); // 初始进度
|
||||
|
||||
// 启动倒计时和广告逻辑
|
||||
countDownTimer = AdManager.showWelcomeAd(
|
||||
SplashActivity.this,
|
||||
totalTime,
|
||||
millisUntilFinished -> {
|
||||
// 计算并更新进度条的百分比
|
||||
float percentage = 100 - (float) millisUntilFinished / totalTime * 100;
|
||||
customProgressBar.setProgress(percentage);
|
||||
},
|
||||
this::startMain // 倒计时结束或广告展示结束时,跳转主界面
|
||||
);
|
||||
|
||||
// 启动倒计时
|
||||
countDownTimer.start();
|
||||
}
|
||||
|
||||
|
||||
// 跳转到主界面的方法
|
||||
private void startMain() {
|
||||
// 确保进度条更新至满值
|
||||
customProgressBar.setProgress(100);
|
||||
|
||||
// 跳转到主界面
|
||||
Intent intent = new Intent(SplashActivity.this, MainActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
@ -82,10 +69,10 @@ public class SplashActivity extends AppCompatActivity {
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
// 在页面销毁时,清理倒计时资源
|
||||
if (countDownTimer != null) {
|
||||
countDownTimer.cancel();
|
||||
countDownTimer = null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,11 +0,0 @@
|
||||
package com.tool.minimalistwallpaper.max;
|
||||
|
||||
import com.applovin.mediation.MaxAd;
|
||||
|
||||
public interface MaxListener {
|
||||
void onFail(MaxAd ad);
|
||||
|
||||
void onShowSuccess(MaxAd ad);
|
||||
|
||||
void onHidden();
|
||||
}
|
||||
@ -1,181 +0,0 @@
|
||||
package com.tool.minimalistwallpaper.max;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
|
||||
import com.applovin.mediation.MaxAd;
|
||||
import com.applovin.mediation.MaxAdListener;
|
||||
import com.applovin.mediation.MaxError;
|
||||
import com.applovin.mediation.ads.MaxInterstitialAd;
|
||||
import com.tool.minimalistwallpaper.MinimalistWPSkin;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class MaxManager {
|
||||
/**
|
||||
* private static final String one_AD = "2377d38d18e72a02";
|
||||
* private static final String two_Ad = "cebc382a642385a6";
|
||||
* private static final String three_ad = "f4f1f8de8666c541";
|
||||
*/
|
||||
private static final String one_AD = "2377d38d18e72a02";
|
||||
private static final String two_Ad = "cebc382a642385a6";
|
||||
private static final String three_ad = "f4f1f8de8666c541";
|
||||
|
||||
|
||||
public static final int type_no_cache = 0;
|
||||
public static final int type_has_cache = 1;
|
||||
public static final int type_show_success = 2;
|
||||
public static final int type_show_close = 3;
|
||||
public static final int type_show_fail = 4;
|
||||
|
||||
private static List<MaxInterstitialAd> adList = new ArrayList<>();
|
||||
|
||||
public static MaxInterstitialAd getAd(List<MaxInterstitialAd> list) {
|
||||
Collections.shuffle(list);
|
||||
for (MaxInterstitialAd ad : list) {
|
||||
if (ad.isReady()) {
|
||||
return ad;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static List<MaxInterstitialAd> onLoadAd() {
|
||||
if (adList.isEmpty()) {
|
||||
MaxInterstitialAd AdT = new MaxInterstitialAd(two_Ad, MinimalistWPSkin.app);
|
||||
MaxInterstitialAd AdOne = new MaxInterstitialAd(one_AD, MinimalistWPSkin.app);
|
||||
MaxInterstitialAd AdThree = new MaxInterstitialAd(three_ad, MinimalistWPSkin.app);
|
||||
adList.add(AdOne);
|
||||
adList.add(AdT);
|
||||
adList.add(AdThree);
|
||||
}
|
||||
|
||||
for (MaxInterstitialAd ad : adList) {
|
||||
if (!ad.isReady()) {
|
||||
setMyListener(ad, new MaxListener() {
|
||||
@Override
|
||||
public void onFail(MaxAd ad) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onShowSuccess(MaxAd ad) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHidden() {
|
||||
|
||||
}
|
||||
});
|
||||
ad.loadAd();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return adList;
|
||||
}
|
||||
|
||||
public static void setMyListener(MaxInterstitialAd ad, MaxListener maxListener) {
|
||||
ad.setListener(new MaxAdListener() {
|
||||
@Override
|
||||
public void onAdLoaded(@NonNull MaxAd maxAd) {
|
||||
Log.d(MinimalistWPSkin.TAG, "-------onAdLoaded-----maxAd=" + maxAd.getAdUnitId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdDisplayed(@NonNull MaxAd maxAd) {
|
||||
Log.d(MinimalistWPSkin.TAG, "-------onAdDisplayed-----maxAd=" + maxAd.getAdUnitId());
|
||||
maxListener.onShowSuccess(maxAd);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdHidden(@NonNull MaxAd maxAd) {
|
||||
Log.d(MinimalistWPSkin.TAG, "-------onAdHidden-----maxAd=" + maxAd.getAdUnitId());
|
||||
maxListener.onHidden();
|
||||
setMyListener(ad, new MaxListener() {
|
||||
@Override
|
||||
public void onFail(MaxAd ad) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onShowSuccess(MaxAd ad) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHidden() {
|
||||
|
||||
}
|
||||
});
|
||||
ad.loadAd();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdClicked(@NonNull MaxAd maxAd) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdLoadFailed(@NonNull String s, @NonNull MaxError maxError) {
|
||||
Log.d(MinimalistWPSkin.TAG, "-------onAdLoadFailed-----s=" + s + "----maxError=" + maxError.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdDisplayFailed(@NonNull MaxAd maxAd, @NonNull MaxError maxError) {
|
||||
maxListener.onFail(maxAd);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
protected static void ShowAd(Activity activity, onAdStatusListener listener) {
|
||||
MaxInterstitialAd ad = MaxManager.getAd(adList);
|
||||
if (ad == null) {
|
||||
listener.onAdStatus(type_no_cache);
|
||||
} else {
|
||||
listener.onAdStatus(type_has_cache);
|
||||
MaxManager.setMyListener(ad, new MaxListener() {
|
||||
@Override
|
||||
public void onFail(MaxAd ad) {
|
||||
listener.onAdStatus(type_show_fail);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onShowSuccess(MaxAd ad) {
|
||||
listener.onAdStatus(type_show_success);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHidden() {
|
||||
listener.onAdStatus(type_show_close);
|
||||
}
|
||||
});
|
||||
ad.showAd(activity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void startShowMaxAd(Activity activity, onAdAfterAction listener) {
|
||||
MaxManager.ShowAd(activity, new onAdStatusListener() {
|
||||
@Override
|
||||
public void onAdStatus(int type) {
|
||||
if (type == MaxManager.type_show_close || type == MaxManager.type_show_fail || type == MaxManager.type_no_cache) {
|
||||
if (listener != null) {
|
||||
listener.onAction();
|
||||
Log.d(MinimalistWPSkin.TAG, "-------------showAd");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,77 +0,0 @@
|
||||
package com.tool.minimalistwallpaper.max
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.os.CountDownTimer
|
||||
import android.util.Log
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager
|
||||
|
||||
import com.applovin.mediation.ads.MaxInterstitialAd
|
||||
import com.tool.minimalistwallpaper.MinimalistWPSkin
|
||||
|
||||
|
||||
object WelComManager {
|
||||
|
||||
private lateinit var timer: CountDownTimer
|
||||
|
||||
private var need_Show = true
|
||||
|
||||
private lateinit var lists: List<MaxInterstitialAd>
|
||||
|
||||
@JvmStatic
|
||||
fun initTimer(activity: Activity, countTime: Long,countAction: (Long) -> Unit, goMainAction: () -> Unit): CountDownTimer {
|
||||
need_Show = true
|
||||
timer = object : CountDownTimer(countTime, 100) {
|
||||
override fun onTick(millisUntilFinished: Long) {
|
||||
countAction.invoke(millisUntilFinished)
|
||||
if (need_Show) {
|
||||
MaxManager.ShowAd(activity) {
|
||||
Log.d(MinimalistWPSkin.TAG, "--onTick----------it=$it")
|
||||
if (it == MaxManager.type_has_cache) {
|
||||
need_Show = false
|
||||
}
|
||||
if (it == MaxManager.type_show_close || it == MaxManager.type_show_fail) {
|
||||
Log.d(MinimalistWPSkin.TAG, "--onTick---------enter")
|
||||
goMainAction.invoke()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFinish() {
|
||||
if (need_Show) {
|
||||
MaxManager.ShowAd(activity) {
|
||||
if (it == MaxManager.type_show_close || it == MaxManager.type_show_fail || it == MaxManager.type_no_cache) {
|
||||
Log.d(MinimalistWPSkin.TAG, "--onFinish---------enter")
|
||||
goMainAction.invoke()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
startAd(activity)
|
||||
return timer
|
||||
}
|
||||
|
||||
private fun startAd(activity: Activity) {
|
||||
if (!MinimalistWPSkin.initSDK) {
|
||||
LocalBroadcastManager.getInstance(activity)
|
||||
.registerReceiver(object : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context?, intent: Intent?) {
|
||||
lists = MaxManager.onLoadAd()
|
||||
timer.start()
|
||||
Log.d(MinimalistWPSkin.TAG, "------------1sucess")
|
||||
}
|
||||
}, IntentFilter(MinimalistWPSkin.AD_BROADCAST))
|
||||
} else {
|
||||
lists = MaxManager.onLoadAd()
|
||||
timer.start()
|
||||
Log.d(MinimalistWPSkin.TAG, "------------2sucess")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,6 +0,0 @@
|
||||
package com.tool.minimalistwallpaper.max;
|
||||
|
||||
public interface onAdAfterAction {
|
||||
|
||||
void onAction();
|
||||
}
|
||||
@ -1,6 +0,0 @@
|
||||
package com.tool.minimalistwallpaper.max;
|
||||
|
||||
public interface onAdStatusListener {
|
||||
|
||||
void onAdStatus(int type);
|
||||
}
|
||||
@ -1,8 +0,0 @@
|
||||
package com.tool.minimalistwallpaper.tools;
|
||||
|
||||
import com.applovin.mediation.MaxAd;
|
||||
|
||||
public interface Adcallback {
|
||||
void onShowFail(MaxAd ad);
|
||||
void onAdHidden( );
|
||||
}
|
||||
@ -1,7 +1,5 @@
|
||||
package com.tool.minimalistwallpaper.tools;
|
||||
|
||||
import com.applovin.mediation.MaxAd;
|
||||
|
||||
public interface SetCallback {
|
||||
|
||||
void onAction(int flag);
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
package com.tool.minimalistwallpaper.topon;
|
||||
|
||||
public interface AdListener {
|
||||
void loadFail(String placeId);
|
||||
void showSuccess();
|
||||
|
||||
void showFail();
|
||||
|
||||
void showClose();
|
||||
}
|
||||
@ -0,0 +1,248 @@
|
||||
package com.tool.minimalistwallpaper.topon;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.CountDownTimer;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.anythink.core.api.ATAdInfo;
|
||||
import com.anythink.core.api.AdError;
|
||||
import com.anythink.interstitial.api.ATInterstitial;
|
||||
import com.anythink.interstitial.api.ATInterstitialListener;
|
||||
import com.tool.minimalistwallpaper.MinimalistWPSkin;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class AdManager {
|
||||
|
||||
private static final int type_no_cache = 0;
|
||||
private static final int type_has_cache = 1;
|
||||
private static final int type_show_success = 2;
|
||||
private static final int type_show_close = 3;
|
||||
private static final int type_show_fail = 4;
|
||||
|
||||
/**
|
||||
Mini_int_3
|
||||
n6705e99ec522b
|
||||
Mini_int_2
|
||||
n6705e99e7373d
|
||||
Mini_int_1
|
||||
n6705e99e150a9
|
||||
*/
|
||||
|
||||
private static final String place1Id = "n6705e99ec522b";
|
||||
private static final String place2Id = "n6705e99e7373d";
|
||||
private static final String place3Id = "n6705e99e150a9";
|
||||
|
||||
|
||||
private static boolean place1LoadFail = false;
|
||||
private static boolean place2LoadFail = false;
|
||||
private static boolean place3LoadFail = false;
|
||||
|
||||
private static boolean alreadyShow = false;
|
||||
|
||||
private static final List<ATInterstitial> list = new ArrayList<>();
|
||||
|
||||
|
||||
public static void loadAllAd() {
|
||||
if (list.isEmpty()) {
|
||||
ATInterstitial mInterstitialAd1 = new ATInterstitial(MinimalistWPSkin.app, place1Id);
|
||||
ATInterstitial mInterstitialAd2 = new ATInterstitial(MinimalistWPSkin.app, place2Id);
|
||||
ATInterstitial mInterstitialAd3 = new ATInterstitial(MinimalistWPSkin.app, place3Id);
|
||||
list.add(mInterstitialAd1);
|
||||
list.add(mInterstitialAd2);
|
||||
list.add(mInterstitialAd3);
|
||||
}
|
||||
for (ATInterstitial ad : list) {
|
||||
if (!ad.isAdReady()) {
|
||||
setCallBack(ad, new AdListener() {
|
||||
@Override
|
||||
public void loadFail(@NonNull String placeId) {
|
||||
if (placeId.equals(place1Id)) {
|
||||
place1LoadFail = true;
|
||||
}
|
||||
if (placeId.equals(place2Id)) {
|
||||
place2LoadFail = true;
|
||||
}
|
||||
if (placeId.equals(place3Id)) {
|
||||
place3LoadFail = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showSuccess() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showFail() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showClose() {
|
||||
|
||||
}
|
||||
});
|
||||
ad.load();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private static ATInterstitial getReadyAd() {
|
||||
Collections.shuffle(list);
|
||||
for (ATInterstitial ad : list) {
|
||||
if (ad.isAdReady()) {
|
||||
Log.d(MinimalistWPSkin.TAG, "-has Cache------------");
|
||||
return ad;
|
||||
}
|
||||
}
|
||||
Log.d(MinimalistWPSkin.TAG, "-No Cache------------");
|
||||
return null;
|
||||
}
|
||||
|
||||
private static void setCallBack(ATInterstitial ad, AdListener listener) {
|
||||
ad.setAdListener(new ATInterstitialListener() {
|
||||
|
||||
|
||||
@Override
|
||||
public void onInterstitialAdLoaded() {
|
||||
Log.d(MinimalistWPSkin.TAG, "LoadLoaded " + ad.mPlacementId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInterstitialAdLoadFail(AdError adError) {
|
||||
listener.loadFail(ad.mPlacementId);
|
||||
Log.d(MinimalistWPSkin.TAG, "LoadFail:--" + ad.mPlacementId + "--" + adError.getCode() + "---" + adError.getDesc());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInterstitialAdClicked(ATAdInfo atAdInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInterstitialAdShow(ATAdInfo atAdInfo) {
|
||||
Log.d(MinimalistWPSkin.TAG, "AdShow " + atAdInfo.getShowId());
|
||||
listener.showSuccess();
|
||||
// ad.load()
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInterstitialAdClose(ATAdInfo atAdInfo) {
|
||||
listener.showClose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInterstitialAdVideoStart(ATAdInfo atAdInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInterstitialAdVideoEnd(ATAdInfo atAdInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInterstitialAdVideoError(AdError adError) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static CountDownTimer showWelcomeAd(
|
||||
Activity activity,
|
||||
Long totalTim,
|
||||
CountAction countAction,
|
||||
GoMainAction goMain
|
||||
) {
|
||||
|
||||
CountDownTimer timer = new CountDownTimer(totalTim, 100) {
|
||||
@Override
|
||||
public void onTick(long millisUntilFinished) {
|
||||
countAction.onCount(millisUntilFinished);
|
||||
if (!alreadyShow) {
|
||||
showAD(activity, new AdStatusAction() {
|
||||
@Override
|
||||
public void onStatus(int adType) {
|
||||
if (adType == type_has_cache) {
|
||||
alreadyShow = true;
|
||||
}
|
||||
if (adType == type_show_close || adType == type_show_fail) {
|
||||
goMain.onGo();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
if (!alreadyShow) {
|
||||
showTopOn(activity, new onActionListener() {
|
||||
@Override
|
||||
public void onAction() {
|
||||
goMain.onGo();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
return timer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void showAD(Activity activity, AdStatusAction action) {
|
||||
ATInterstitial readyAd = getReadyAd();
|
||||
if (readyAd != null) {
|
||||
action.onStatus(type_has_cache);
|
||||
setCallBack(readyAd, new AdListener() {
|
||||
@Override
|
||||
public void loadFail(@NonNull String placeId) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showSuccess() {
|
||||
action.onStatus(type_show_success);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showFail() {
|
||||
action.onStatus(type_show_fail);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showClose() {
|
||||
action.onStatus(type_show_close);
|
||||
}
|
||||
});
|
||||
readyAd.show(activity);
|
||||
} else {
|
||||
action.onStatus(type_no_cache);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void showTopOn(Activity activity, onActionListener listener) {
|
||||
showAD(activity, new AdStatusAction() {
|
||||
@Override
|
||||
public void onStatus(int adType) {
|
||||
if (adType == type_no_cache || adType == type_show_close || adType == type_show_fail) {
|
||||
listener.onAction();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
package com.tool.minimalistwallpaper.topon;
|
||||
|
||||
public interface AdStatusAction {
|
||||
void onStatus(int adType);
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
package com.tool.minimalistwallpaper.topon;
|
||||
|
||||
public interface CountAction {
|
||||
void onCount(long millisUntilFinished);
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
package com.tool.minimalistwallpaper.topon;
|
||||
|
||||
public interface GoMainAction {
|
||||
void onGo();
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
package com.tool.minimalistwallpaper.topon;
|
||||
|
||||
public interface onActionListener {
|
||||
|
||||
void onAction();
|
||||
}
|
||||
@ -4,9 +4,4 @@ plugins {
|
||||
id("org.jetbrains.kotlin.android") version "1.9.0" apply false
|
||||
id("com.google.gms.google-services") version "4.3.15" apply false
|
||||
id ("com.google.firebase.crashlytics") version "2.9.2" apply false
|
||||
}
|
||||
buildscript{
|
||||
dependencies{
|
||||
classpath("com.applovin.quality:AppLovinQualityServiceGradlePlugin:+")
|
||||
}
|
||||
}
|
||||
@ -6,7 +6,7 @@
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
||||
org.gradle.jvmargs=-Xmx4096m -Dfile.encoding=UTF-8
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
|
||||
@ -3,7 +3,7 @@ pluginManagement {
|
||||
google()
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
maven { url = uri("https://artifacts.applovin.com/android") }
|
||||
|
||||
}
|
||||
}
|
||||
dependencyResolutionManagement {
|
||||
@ -11,8 +11,29 @@ dependencyResolutionManagement {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
maven { url = uri("https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea") }
|
||||
maven { url = uri("https://artifact.bytedance.com/repository/pangle") }
|
||||
|
||||
//Anythink(Core)
|
||||
maven ("https://jfrog.anythinktech.com/artifactory/overseas_sdk")
|
||||
|
||||
//Appnext
|
||||
maven ("https://dl.appnext.com")
|
||||
|
||||
//Ironsource
|
||||
maven ("https://android-sdk.is.com/")
|
||||
|
||||
//Pangle
|
||||
maven ("https://artifact.bytedance.com/repository/pangle")
|
||||
|
||||
//Mintegral
|
||||
maven ("https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea")
|
||||
|
||||
//Chartboost
|
||||
maven ("https://cboost.jfrog.io/artifactory/chartboost-ads")
|
||||
maven ("https://cboost.jfrog.io/artifactory/chartboost-mediation")
|
||||
|
||||
//TopOn集成测试工具
|
||||
// maven ( "https://jfrog.anythinktech.com/artifactory/debugger")
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user