V1.0.1(2)接入topon和firebase

This commit is contained in:
lihongwei 2025-02-27 15:30:21 +08:00
parent 8cc6594f09
commit 5afc950ba1
23 changed files with 954 additions and 365 deletions

View File

@ -6,10 +6,10 @@ plugins {
id("org.jetbrains.kotlin.android") id("org.jetbrains.kotlin.android")
id("io.objectbox") id("io.objectbox")
kotlin("kapt") kotlin("kapt")
// id("com.google.gms.google-services") id("com.google.gms.google-services")
// id("com.google.firebase.crashlytics") id("com.google.firebase.crashlytics")
} }
val timestamp = SimpleDateFormat("MM_dd_HH_mm").format(Date()) val timestamp: String = SimpleDateFormat("MM_dd_HH_mm").format(Date())
android { android {
namespace = "com.free.life.wallpaper" namespace = "com.free.life.wallpaper"
compileSdk = 34 compileSdk = 34
@ -19,8 +19,8 @@ android {
applicationId = "com.free.life.wallpaper" applicationId = "com.free.life.wallpaper"
minSdk = 23 minSdk = 23
targetSdk = 34 targetSdk = 34
versionCode = 1 versionCode = 2
versionName = "1.0.0" versionName = "1.0.1"
setProperty("archivesBaseName", "Life Wallpaper_V" + versionName + "(${versionCode})_$timestamp") setProperty("archivesBaseName", "Life Wallpaper_V" + versionName + "(${versionCode})_$timestamp")
testInstrumentationRunner = "androidx.live.runner.AndroidJUnitRunner" testInstrumentationRunner = "androidx.live.runner.AndroidJUnitRunner"
@ -49,9 +49,9 @@ android {
dependencies { dependencies {
implementation("androidx.appcompat:appcompat:1.6.1") implementation("androidx.appcompat:appcompat:1.7.0")
implementation("com.google.android.material:material:1.11.0") implementation("com.google.android.material:material:1.12.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.4") implementation("androidx.constraintlayout:constraintlayout:2.2.0")
testImplementation("junit:junit:4.13.2") testImplementation("junit:junit:4.13.2")
implementation ("com.github.bumptech.glide:glide:4.16.0") implementation ("com.github.bumptech.glide:glide:4.16.0")
implementation ("jp.wasabeef:glide-transformations:4.3.0") // Glide Transformations implementation ("jp.wasabeef:glide-transformations:4.3.0") // Glide Transformations
@ -61,101 +61,101 @@ dependencies {
//------------------firebase // ------------------firebase
// implementation(platform("com.google.firebase:firebase-bom:33.1.1")) implementation(platform("com.google.firebase:firebase-bom:33.9.0"))
// implementation("com.google.firebase:firebase-crashlytics") implementation("com.google.firebase:firebase-crashlytics")
// implementation("com.google.firebase:firebase-analytics") implementation("com.google.firebase:firebase-analytics")
// implementation("com.google.firebase:firebase-config") implementation("com.google.firebase:firebase-config")
//-----------------------------------------------TopOn(Mintegral、Pangle、UnitAds、Digital Turbine(Fyber)、Chartboost&Helium、Ironsource、Liftoff(Vungle)、Inmobi、Start.io、Appnext、Bigo) // -----------------------------------------------TopOn(Mintegral、Pangle、UnitAds、Digital Turbine(Fyber)、Chartboost&Helium、Ironsource、Liftoff(Vungle)、Inmobi、Start.io、Appnext、Bigo)
// //Anythink (Necessary) //Anythink (Necessary)
// implementation("com.anythink.sdk:core-tpn:6.4.07") implementation("com.anythink.sdk:core-tpn:6.4.07")
// implementation("com.anythink.sdk:nativead-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:banner-tpn:6.4.07")
// implementation("com.anythink.sdk:interstitial-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:rewardedvideo-tpn:6.4.07")
// implementation("com.anythink.sdk:splash-tpn:6.4.07") implementation("com.anythink.sdk:splash-tpn:6.4.07")
//
// //Androidx (Necessary) //Androidx (Necessary)
// implementation("androidx.appcompat:appcompat:1.1.0") implementation("androidx.appcompat:appcompat:1.1.0")
// implementation("androidx.browser:browser:1.4.0") implementation("androidx.browser:browser:1.4.0")
//
// //StartApp //StartApp
// implementation("com.anythink.sdk:adapter-tpn-startapp:6.4.07") implementation("com.anythink.sdk:adapter-tpn-startapp:6.4.07")
// implementation("com.startapp:inapp-sdk:5.0.2") implementation("com.startapp:inapp-sdk:5.0.2")
//
// //Appnext //Appnext
// implementation("com.anythink.sdk:adapter-tpn-appnext:6.4.07") implementation("com.anythink.sdk:adapter-tpn-appnext:6.4.07")
// implementation("com.appnext.sdk:ads:2.7.1.473") implementation("com.appnext.sdk:ads:2.7.1.473")
// implementation("com.appnext.sdk:banners: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:native-ads2:2.7.1.473")
// implementation("com.appnext.sdk:actions:2.4.6.472") implementation("com.appnext.sdk:actions:2.4.6.472")
// implementation("androidx.constraintlayout:constraintlayout:2.0.4") implementation("androidx.constraintlayout:constraintlayout:2.0.4")
//
// //Vungle //Vungle
// implementation("com.anythink.sdk:adapter-tpn-vungle:6.4.07") implementation("com.anythink.sdk:adapter-tpn-vungle:6.4.07")
// implementation("com.vungle:vungle-ads:7.4.0") 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-basement:18.1.0")
// implementation("com.google.android.gms:play-services-ads-identifier:18.0.1") implementation("com.google.android.gms:play-services-ads-identifier:18.0.1")
//
// //UnityAds //UnityAds
// implementation("com.anythink.sdk:adapter-tpn-unityads:6.4.07") implementation("com.anythink.sdk:adapter-tpn-unityads:6.4.07")
// implementation("com.unity3d.ads:unity-ads:4.12.2") implementation("com.unity3d.ads:unity-ads:4.12.2")
//
// //Ironsource //Ironsource
// implementation("com.anythink.sdk:adapter-tpn-ironsource:6.4.07") implementation("com.anythink.sdk:adapter-tpn-ironsource:6.4.07")
// implementation("com.ironsource.sdk:mediationsdk:8.2.1") 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-appset:16.0.2")
// implementation("com.google.android.gms:play-services-ads-identifier:18.0.1") implementation("com.google.android.gms:play-services-ads-identifier:18.0.1")
// implementation("com.google.android.gms:play-services-basement:18.1.0") implementation("com.google.android.gms:play-services-basement:18.1.0")
//
// //Bigo //Bigo
// implementation("com.anythink.sdk:adapter-tpn-bigo:6.4.07") implementation("com.anythink.sdk:adapter-tpn-bigo:6.4.07")
// implementation("com.bigossp:bigo-ads:4.9.0") implementation("com.bigossp:bigo-ads:4.9.0")
//
// //Pangle //Pangle
// implementation("com.anythink.sdk:adapter-tpn-pangle-nonchina:6.4.07") implementation("com.anythink.sdk:adapter-tpn-pangle-nonchina:6.4.07")
// implementation("com.pangle.global:ads-sdk:6.1.0.9") implementation("com.pangle.global:ads-sdk:6.1.0.9")
// implementation("com.google.android.gms:play-services-ads-identifier:18.0.1") implementation("com.google.android.gms:play-services-ads-identifier:18.0.1")
//
// //Inmobi //Inmobi
// implementation("com.anythink.sdk:adapter-tpn-inmobi:6.4.07") implementation("com.anythink.sdk:adapter-tpn-inmobi:6.4.07")
// implementation("com.inmobi.monetization:inmobi-ads-kotlin:10.7.5") implementation("com.inmobi.monetization:inmobi-ads-kotlin:10.7.5")
//
// //Mintegral //Mintegral
// implementation("com.anythink.sdk:adapter-tpn-mintegral-nonchina:6.4.07") 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:reward:16.8.11")
// implementation("com.mbridge.msdk.oversea:newinterstitial: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:mbnative:16.8.11")
// implementation("com.mbridge.msdk.oversea:mbnativeadvanced: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:mbsplash:16.8.11")
// implementation("com.mbridge.msdk.oversea:mbbanner:16.8.11") implementation("com.mbridge.msdk.oversea:mbbanner:16.8.11")
// implementation("com.mbridge.msdk.oversea:mbbid:16.8.11") implementation("com.mbridge.msdk.oversea:mbbid:16.8.11")
// implementation("androidx.recyclerview:recyclerview:1.1.0") implementation("androidx.recyclerview:recyclerview:1.1.0")
//
// //Chartboost //Chartboost
// implementation("com.anythink.sdk:adapter-tpn-chartboost:6.4.07") implementation("com.anythink.sdk:adapter-tpn-chartboost:6.4.07")
// implementation("com.chartboost:chartboost-sdk:9.7.0") implementation("com.chartboost:chartboost-sdk:9.7.0")
// implementation("com.chartboost:chartboost-mediation-sdk:4.9.1") implementation("com.chartboost:chartboost-mediation-sdk:4.9.1")
// implementation("com.chartboost:chartboost-mediation-adapter-chartboost:4.9.7.0.0") 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.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:1.0.0")
// implementation("com.squareup.okhttp3:logging-interceptor:4.10.0") implementation("com.squareup.okhttp3:logging-interceptor:4.10.0")
// implementation("com.squareup.okhttp3:okhttp:4.10.0") implementation("com.squareup.okhttp3:okhttp:4.10.0")
// implementation("com.squareup.retrofit2:converter-scalars:2.9.0") implementation("com.squareup.retrofit2:converter-scalars:2.9.0")
// implementation("com.squareup.retrofit2:retrofit: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-coroutines-android:1.7.1")
// implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.1") implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.1")
//
// //Fyber //Fyber
// implementation("com.anythink.sdk:adapter-tpn-fyber:6.4.07") implementation("com.anythink.sdk:adapter-tpn-fyber:6.4.07")
// implementation("com.fyber:marketplace-sdk:8.3.0") implementation("com.fyber:marketplace-sdk:8.3.0")
// implementation("com.google.android.gms:play-services-ads-identifier:18.0.1") implementation("com.google.android.gms:play-services-ads-identifier:18.0.1")
//
// // Debugger UI Tools // Debugger UI Tools
// implementation ("com.anythink.sdk:debugger-ui:1.0.7") implementation ("com.anythink.sdk:debugger-ui:1.0.7")
} }

29
app/google-services.json Normal file
View File

@ -0,0 +1,29 @@
{
"project_info": {
"project_number": "286032835307",
"project_id": "life-wallpaper-c4d04",
"storage_bucket": "life-wallpaper-c4d04.firebasestorage.app"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:286032835307:android:3d99f0b3481b6c4f3784ae",
"android_client_info": {
"package_name": "com.free.life.wallpaper"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyDovGDJpX6HuECSha2b5ispRnGtAh8B5lg"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": []
}
}
}
],
"configuration_version": "1"
}

128
app/proguard-rules.pro vendored
View File

@ -24,5 +24,133 @@
-keepattributes Signature -keepattributes Signature
-keepattributes AnnotationDefault,RuntimeVisibleAnnotations -keepattributes AnnotationDefault,RuntimeVisibleAnnotations
#---------------------------------------------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

View File

@ -5,11 +5,15 @@ import android.content.Context;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.util.Log; import android.util.Log;
import com.anythink.core.api.ATSDK;
import com.anythink.core.api.NetTrafficeCallback;
import com.free.life.wallpaper.bean.Category; import com.free.life.wallpaper.bean.Category;
import com.free.life.wallpaper.topon.AdManager;
import com.free.life.wallpaper.utils.CommonUtils; import com.free.life.wallpaper.utils.CommonUtils;
import com.free.life.wallpaper.utils.DealUtils; import com.free.life.wallpaper.utils.DealUtils;
import com.free.life.wallpaper.ox.DbManager; import com.free.life.wallpaper.ox.DbManager;
import com.free.life.wallpaper.bean.Data; import com.free.life.wallpaper.bean.Data;
import com.google.firebase.FirebaseApp;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
@ -32,8 +36,8 @@ public class MyWallpaper extends Application {
public static String TAG = "-------MyApp---------"; public static String TAG = "-------MyApp---------";
public static Typeface defaultFont; public static Typeface defaultFont;
// private String APPId="h673ddf8ae8467"; private String APPId="h67b85139418a0";
// private String AppKey="a17cd7a62720b00498a8dc5c538c92303"; private String AppKey="a9864901d01b4c7dfbc4c5f066bf20d33";
// private String debug_Key=""; // private String debug_Key="";
private String animasName = "Animals.json"; private String animasName = "Animals.json";
@ -50,6 +54,19 @@ public class MyWallpaper extends Application {
mAppContext = this; mAppContext = this;
defaultFont = Typeface.createFromAsset(getAssets(), "custfont.ttf"); defaultFont = Typeface.createFromAsset(getAssets(), "custfont.ttf");
DbManager.init(this); DbManager.init(this);
initTop();
// // 确保Firebase初始化
// FirebaseApp.initializeApp(this);
//
// // 输出日志以确认Firebase初始化
// if (!FirebaseApp.getApps(this).isEmpty()) {
// Log.d("TAG", "Firebase1 初始化成功1");
// } else {
// Log.e("TAG", "Firebase0 初始化失败0");
// }
String[] names = {animasName,exName,filmName,natureName,pattName,streetName,travelName}; String[] names = {animasName,exName,filmName,natureName,pattName,streetName,travelName};
new Thread(new Runnable() { new Thread(new Runnable() {
@Override @Override
@ -84,28 +101,33 @@ public class MyWallpaper extends Application {
// private void initTop(){ private void initTop(){
// ATSDK.checkIsEuTraffic(this, new NetTrafficeCallback() { ATSDK.checkIsEuTraffic(this, new NetTrafficeCallback() {
//
// @Override @Override
// public void onResultCallback(boolean isEU) { public void onResultCallback(boolean isEU) {
// Log.e(TAG, "onResultCallback:" + isEU); Log.e(TAG, "onResultCallback:" + isEU);
// if (isEU && ATSDK.getGDPRDataLevel( MyApp.mAppContext) == ATSDK.UNKNOWN) { if (isEU && ATSDK.getGDPRDataLevel( MyWallpaper.mAppContext) == ATSDK.UNKNOWN) {
// ATSDK.showGdprAuth(MyApp.mAppContext); ATSDK.showGdprAuth(MyWallpaper.mAppContext);
// } }
//
// } }
//
// @Override @Override
// public void onErrorCallback(String errorMsg) { public void onErrorCallback(String errorMsg) {
// Log.e(TAG, "onErrorCallback:" + errorMsg); Log.e(TAG, "onErrorCallback:" + errorMsg);
// } }
// }); });
//
// ATSDK.init( this, APPId, AppKey); ATSDK.init( this, APPId, AppKey);
// //测试工具 //测试工具
//// ATDebuggerUITest.showDebuggerUI(this,debug_Key); // ATDebuggerUITest.showDebuggerUI(this,debug_Key);
// AdManager.loadAllAd(); AdManager.loadAllAd();
//
// } }
public static Context getContext() {
return mAppContext.getApplicationContext();
}
} }

View File

@ -6,11 +6,11 @@ import android.util.Log;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import com.free.life.wallpaper.MyWallpaper; import com.free.life.wallpaper.MyWallpaper;
import com.free.life.wallpaper.bean.Data_;
import com.free.life.wallpaper.bean.MyObjectBox;
import com.free.life.wallpaper.mylistener.OnUpdateLikeListener; import com.free.life.wallpaper.mylistener.OnUpdateLikeListener;
import com.free.life.wallpaper.mylistener.OnLikeListener; import com.free.life.wallpaper.mylistener.OnLikeListener;
import com.free.life.wallpaper.bean.Data; import com.free.life.wallpaper.bean.Data;
import com.free.life.wallpaper.bean.Data_;
import com.free.life.wallpaper.bean.MyObjectBox;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

View File

@ -0,0 +1,10 @@
package com.free.life.wallpaper.topon;
public interface AdListener {
void loadFail(String placeId);
void showSuccess();
void showFail();
void showClose();
}

View File

@ -0,0 +1,250 @@
package com.free.life.wallpaper.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.free.life.wallpaper.MyWallpaper;
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;
/**
Life_Inter_3
n67b8516f0b4a2
Life_Inter_2
n67b8516e9c6a7
Life_Inter_1
n67b8516e39b5f
*/
private static final String place1Id = "n67b8516e39b5f";
private static final String place2Id = "n67b8516e9c6a7";
private static final String place3Id = "n67b8516f0b4a2";
private static boolean place1LoadFail = false;
private static boolean place2LoadFail = false;
private static boolean place3LoadFail = false;
private static boolean alreadyShow = false;
private static List<ATInterstitial> list = new ArrayList<>();
public static void loadAllAd() {
if (list.isEmpty()) {
ATInterstitial mInterstitialAd1 = new ATInterstitial(MyWallpaper.getContext(), place1Id);
ATInterstitial mInterstitialAd2 = new ATInterstitial(MyWallpaper.getContext(), place2Id);
ATInterstitial mInterstitialAd3 = new ATInterstitial(MyWallpaper.getContext(), 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(MyWallpaper.TAG, "-has Cache------------");
return ad;
}
}
Log.d(MyWallpaper.TAG, "-No Cache------------");
return null;
}
private static void setCallBack(ATInterstitial ad, AdListener listener) {
ad.setAdListener(new ATInterstitialListener() {
@Override
public void onInterstitialAdLoaded() {
Log.d(MyWallpaper.TAG, "LoadLoaded " + ad.mPlacementId);
}
@Override
public void onInterstitialAdLoadFail(AdError adError) {
listener.loadFail(ad.mPlacementId);
Log.d(MyWallpaper.TAG, "LoadFail:--" + ad.mPlacementId + "--" + adError.getCode() + "---" + adError.getDesc());
}
@Override
public void onInterstitialAdClicked(ATAdInfo atAdInfo) {
}
@Override
public void onInterstitialAdShow(ATAdInfo atAdInfo) {
Log.d(MyWallpaper.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 void setAlreadyShow() {
alreadyShow = false;
}
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;
}
private 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();
}
}
});
}
}

View File

@ -0,0 +1,5 @@
package com.free.life.wallpaper.topon;
public interface AdStatusAction {
void onStatus(int adType);
}

View File

@ -0,0 +1,5 @@
package com.free.life.wallpaper.topon;
public interface CountAction {
void onCount(long millisUntilFinished);
}

View File

@ -0,0 +1,5 @@
package com.free.life.wallpaper.topon;
public interface GoMainAction {
void onGo();
}

View File

@ -0,0 +1,6 @@
package com.free.life.wallpaper.topon;
public interface onActionListener {
void onAction();
}

View File

@ -28,6 +28,8 @@ import com.free.life.wallpaper.databinding.ActivitySetBinding;
import com.free.life.wallpaper.ox.DbManager; import com.free.life.wallpaper.ox.DbManager;
import com.free.life.wallpaper.bean.Data; import com.free.life.wallpaper.bean.Data;
import com.free.life.wallpaper.mylistener.DialogTypeListener; import com.free.life.wallpaper.mylistener.DialogTypeListener;
import com.free.life.wallpaper.topon.AdManager;
import com.free.life.wallpaper.topon.onActionListener;
import com.free.life.wallpaper.utils.DealUtils; import com.free.life.wallpaper.utils.DealUtils;
import com.free.life.wallpaper.utils.CommonUtils; import com.free.life.wallpaper.utils.CommonUtils;
@ -71,6 +73,8 @@ public class ActivitySet extends AppCompatActivity implements DialogTypeListener
if (data == null) { if (data == null) {
return; return;
} }
AdManager.loadAllAd();
imId = data.getImId(); imId = data.getImId();
mSavePath = DealUtils.INSTANCE.getSaveFilePath(this, imId); mSavePath = DealUtils.INSTANCE.getSaveFilePath(this, imId);
wallpaperManager = WallpaperManager.getInstance(this); wallpaperManager = WallpaperManager.getInstance(this);
@ -93,7 +97,7 @@ public class ActivitySet extends AppCompatActivity implements DialogTypeListener
int[] screenWidthHeight = CommonUtils.getScreenWidthHeight(this); int[] screenWidthHeight = CommonUtils.getScreenWidthHeight(this);
Log.d(MyWallpaper.TAG,"--------width="+screenWidthHeight[0]+"----height="+screenWidthHeight[1]); Log.d(MyWallpaper.TAG, "--------width=" + screenWidthHeight[0] + "----height=" + screenWidthHeight[1]);
if (file.exists()) { if (file.exists()) {
Glide.with(this) Glide.with(this)
.load(file) .load(file)
@ -137,11 +141,9 @@ public class ActivitySet extends AppCompatActivity implements DialogTypeListener
.into(vb.imageviewPreview); .into(vb.imageviewPreview);
} }
boolean b = DbManager.queryIsLike(imId); boolean b = DbManager.queryIsLike(imId);
vb.imageFavorite.setSelected(b); vb.imageFavorite.setSelected(b);
@ -151,20 +153,28 @@ public class ActivitySet extends AppCompatActivity implements DialogTypeListener
vb.imageviewBack.setOnClickListener(new View.OnClickListener() { vb.imageviewBack.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
finish(); AdManager.showTopOn(ActivitySet.this, new onActionListener() {
@Override
public void onAction() {
finish();
}
});
} }
}); });
vb.buttonSet.setOnClickListener(v -> { vb.buttonSet.setOnClickListener(v -> {
if (dialogSetType == null) { AdManager.showTopOn(ActivitySet.this, new onActionListener() {
dialogSetType = new DialogSetType(); @Override
dialogSetType.setListener(ActivitySet.this); public void onAction() {
} if (dialogSetType == null) {
if (!dialogSetType.isAdded()) { dialogSetType = new DialogSetType();
dialogSetType.show(getSupportFragmentManager(), ""); dialogSetType.setListener(ActivitySet.this);
} }
if (!dialogSetType.isAdded()) {
dialogSetType.show(getSupportFragmentManager(), "");
}
}
});
}); });
vb.imageFavorite.setOnClickListener(new View.OnClickListener() { vb.imageFavorite.setOnClickListener(new View.OnClickListener() {
@Override @Override
@ -182,13 +192,16 @@ public class ActivitySet extends AppCompatActivity implements DialogTypeListener
vb.layoutDownload.setOnClickListener(new View.OnClickListener() { vb.layoutDownload.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
boolean permission = DealUtils.INSTANCE.requestPermission(ActivitySet.this, permissionCode); AdManager.showTopOn(ActivitySet.this, new onActionListener() {
if (!permission) { @Override
return; public void onAction() {
} boolean permission = DealUtils.INSTANCE.requestPermission(ActivitySet.this, permissionCode);
startSaveToAlbum(); if (!permission) {
return;
}
startSaveToAlbum();
}
});
} }
}); });
} }
@ -309,20 +322,20 @@ public class ActivitySet extends AppCompatActivity implements DialogTypeListener
Log.d(MyWallpaper.TAG, "--------onSelectType=" + Thread.currentThread().getName()); Log.d(MyWallpaper.TAG, "--------onSelectType=" + Thread.currentThread().getName());
showSetWallpaperLoading(true); showSetWallpaperLoading(true);
if (downloadFile != null) { if (downloadFile != null) {
new Thread(new Runnable() { new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
setWallpaper(downloadFile, type); setWallpaper(downloadFile, type);
} }
}).start(); }).start();
} else if (fullDrawable != null) { } else if (fullDrawable != null) {
new Thread(new Runnable() { new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
File file = new File(CommonUtils.saveDrawableToFile(fullDrawable, mSavePath)); File file = new File(CommonUtils.saveDrawableToFile(fullDrawable, mSavePath));
setWallpaper(file, type); setWallpaper(file, type);
} }
}).start(); }).start();
} else { } else {
call = DealUtils.INSTANCE.downloadFile(fullUrl, mSavePath, new Function2<Boolean, InputStream, Unit>() { call = DealUtils.INSTANCE.downloadFile(fullUrl, mSavePath, new Function2<Boolean, InputStream, Unit>() {
@Override @Override
@ -392,13 +405,13 @@ public class ActivitySet extends AppCompatActivity implements DialogTypeListener
} }
}); });
} catch (Exception exception) { } catch (Exception exception) {
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
showSetWallpaperLoading(false); showSetWallpaperLoading(false);
Toast.makeText(ActivitySet.this, getString(R.string.set_fail), Toast.LENGTH_SHORT).show(); Toast.makeText(ActivitySet.this, getString(R.string.set_fail), Toast.LENGTH_SHORT).show();
} }
}); });
} }
} }

View File

@ -8,6 +8,9 @@ import android.os.CountDownTimer;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import com.free.life.wallpaper.databinding.ActivityWelcomeBinding; import com.free.life.wallpaper.databinding.ActivityWelcomeBinding;
import com.free.life.wallpaper.topon.AdManager;
import com.free.life.wallpaper.topon.CountAction;
import com.free.life.wallpaper.topon.GoMainAction;
import com.free.life.wallpaper.utils.CommonUtils; import com.free.life.wallpaper.utils.CommonUtils;
public class ActivityWelcome extends AppCompatActivity { public class ActivityWelcome extends AppCompatActivity {
@ -15,7 +18,7 @@ public class ActivityWelcome extends AppCompatActivity {
private CountDownTimer countDownTimer; private CountDownTimer countDownTimer;
private ActivityWelcomeBinding vb; private ActivityWelcomeBinding vb;
private long totalTime = 1500; private final long totalTime = 11000;
@SuppressLint("MissingInflatedId") @SuppressLint("MissingInflatedId")
@Override @Override
@ -26,43 +29,47 @@ public class ActivityWelcome extends AppCompatActivity {
setContentView(vb.getRoot()); setContentView(vb.getRoot());
countDownTimer = new CountDownTimer(totalTime,100) { // countDownTimer = new CountDownTimer(totalTime,100) {
@Override
public void onTick(long millisUntilFinished) {
int progressPercentage = (int) ((100 * millisUntilFinished) / totalTime);
int countdownPercentage = 100 - progressPercentage;
vb.progressbar.setProgress(countdownPercentage);
}
@Override
public void onFinish() {
vb.progressbar.setProgress(100);
Intent intent = new Intent(ActivityWelcome.this, MainActivity.class);
startActivity(intent);
finish();
}
};
// countDownTimer = AdManager.showWelcomeAd(this, totalTime, new CountAction() {
// @Override // @Override
// public void onCount(long millisUntilFinished) { // public void onTick(long millisUntilFinished) {
// int progressPercentage = (int) ((100 * millisUntilFinished) / totalTime); // int progressPercentage = (int) ((100 * millisUntilFinished) / totalTime);
// //
// int countdownPercentage = 100 - progressPercentage; // int countdownPercentage = 100 - progressPercentage;
// //
// vb.progressbar.setProgress(countdownPercentage); // vb.progressbar.setProgress(countdownPercentage);
// } // }
// }, new GoMainAction() { //
// @Override // @Override
// public void onGo() { // public void onFinish() {
// vb.progressbar.setProgress(100); // vb.progressbar.setProgress(100);
// Intent intent = new Intent(WElActivity.this, HomeActivity.class); // Intent intent = new Intent(ActivityWelcome.this, MainActivity.class);
// startActivity(intent); // startActivity(intent);
// finish(); // finish();
// } // }
// }); // };
AdManager.loadAllAd();
AdManager.setAlreadyShow();
countDownTimer = AdManager.showWelcomeAd(this, totalTime, new CountAction() {
@Override
public void onCount(long millisUntilFinished) {
int progressPercentage = (int) ((100 * millisUntilFinished) / totalTime);
int countdownPercentage = 100 - progressPercentage;
vb.progressbar.setProgress(countdownPercentage);
}
}, new GoMainAction() {
@Override
public void onGo() {
vb.progressbar.setProgress(100);
Intent intent = new Intent(ActivityWelcome.this, MainActivity.class);
startActivity(intent);
finish();
}
});
countDownTimer.start(); countDownTimer.start();
} }

View File

@ -14,6 +14,8 @@ import com.free.life.wallpaper.databinding.ActivityClassBinding;
import com.free.life.wallpaper.bean.Category; import com.free.life.wallpaper.bean.Category;
import com.free.life.wallpaper.bean.Data; import com.free.life.wallpaper.bean.Data;
import com.free.life.wallpaper.mylistener.ItemClickListener; import com.free.life.wallpaper.mylistener.ItemClickListener;
import com.free.life.wallpaper.topon.AdManager;
import com.free.life.wallpaper.topon.onActionListener;
import com.free.life.wallpaper.utils.CommonUtils; import com.free.life.wallpaper.utils.CommonUtils;
import com.free.life.wallpaper.utils.RecyclerSpace; import com.free.life.wallpaper.utils.RecyclerSpace;
@ -41,7 +43,12 @@ public class ClassActivity extends AppCompatActivity implements ItemClickListene
vb.imageviewBack.setOnClickListener(new View.OnClickListener() { vb.imageviewBack.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
finish(); AdManager.showTopOn(ClassActivity.this, new onActionListener() {
@Override
public void onAction() {
finish();
}
});
} }
}); });
} }
@ -62,8 +69,13 @@ public class ClassActivity extends AppCompatActivity implements ItemClickListene
@Override @Override
public void onItemClickAction(Data info) { public void onItemClickAction(Data info) {
Intent intent = new Intent(this, ActivitySet.class); AdManager.showTopOn(ClassActivity.this, new onActionListener() {
intent.putExtra(CommonUtils.key_info, info); @Override
startActivity(intent); public void onAction() {
Intent intent = new Intent(ClassActivity.this, ActivitySet.class);
intent.putExtra(CommonUtils.key_info, info);
startActivity(intent);
}
});
} }
} }

View File

@ -5,6 +5,7 @@ import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.Toast;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
@ -15,6 +16,8 @@ import com.free.life.wallpaper.recycler.HomeParentAdapter;
import com.free.life.wallpaper.bean.Category; import com.free.life.wallpaper.bean.Category;
import com.free.life.wallpaper.bean.Data; import com.free.life.wallpaper.bean.Data;
import com.free.life.wallpaper.mylistener.ItemClickListener; import com.free.life.wallpaper.mylistener.ItemClickListener;
import com.free.life.wallpaper.topon.AdManager;
import com.free.life.wallpaper.topon.onActionListener;
import com.free.life.wallpaper.utils.CommonUtils; import com.free.life.wallpaper.utils.CommonUtils;
import com.free.life.wallpaper.utils.RecyclerSpace; import com.free.life.wallpaper.utils.RecyclerSpace;
@ -147,15 +150,25 @@ public class FragmentHome extends Fragment implements ItemClickListener {
@Override @Override
public void onItemClickAction(Data info) { public void onItemClickAction(Data info) {
Intent intent = new Intent(requireContext(), ActivitySet.class); AdManager.showTopOn(getActivity(), new onActionListener() {
intent.putExtra(CommonUtils.key_info, info); @Override
startActivity(intent); public void onAction() {
Intent intent = new Intent(requireContext(), ActivitySet.class);
intent.putExtra(CommonUtils.key_info, info);
startActivity(intent);
}
});
} }
@Override @Override
public void onClickMore(int index) { public void onClickMore(int index) {
Intent intent = new Intent(requireContext(), ClassActivity.class); AdManager.showTopOn(getActivity(), new onActionListener() {
intent.putExtra(ClassActivity.key_index, index); @Override
startActivity(intent); public void onAction() {
Intent intent = new Intent(requireContext(), ClassActivity.class);
intent.putExtra(ClassActivity.key_index, index);
startActivity(intent);
}
});
} }
} }

View File

@ -6,6 +6,7 @@ import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.Toast;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.GridLayoutManager;
@ -18,6 +19,8 @@ import com.free.life.wallpaper.ox.DbManager;
import com.free.life.wallpaper.bean.Data; import com.free.life.wallpaper.bean.Data;
import com.free.life.wallpaper.mylistener.ItemClickListener; import com.free.life.wallpaper.mylistener.ItemClickListener;
import com.free.life.wallpaper.mylistener.OnLikeListener; import com.free.life.wallpaper.mylistener.OnLikeListener;
import com.free.life.wallpaper.topon.AdManager;
import com.free.life.wallpaper.topon.onActionListener;
import com.free.life.wallpaper.utils.CommonUtils; import com.free.life.wallpaper.utils.CommonUtils;
import com.free.life.wallpaper.utils.RecyclerSpace; import com.free.life.wallpaper.utils.RecyclerSpace;
@ -83,9 +86,14 @@ public class FragmentLike extends Fragment implements ItemClickListener {
@Override @Override
public void onItemClickAction(Data info) { public void onItemClickAction(Data info) {
Intent intent = new Intent(requireContext(), ActivitySet.class); AdManager.showTopOn(getActivity(), new onActionListener() {
intent.putExtra(CommonUtils.key_info, info); @Override
startActivity(intent); public void onAction() {
Intent intent = new Intent(requireContext(), ActivitySet.class);
intent.putExtra(CommonUtils.key_info, info);
startActivity(intent);
}
});
} }
@Override @Override

View File

@ -11,6 +11,7 @@ import androidx.viewpager2.adapter.FragmentStateAdapter;
import com.free.life.wallpaper.databinding.ActivityMainBinding; import com.free.life.wallpaper.databinding.ActivityMainBinding;
import com.free.life.wallpaper.databinding.TabCustomViewBinding; import com.free.life.wallpaper.databinding.TabCustomViewBinding;
import com.free.life.wallpaper.topon.AdManager;
import com.google.android.material.tabs.TabLayout; import com.google.android.material.tabs.TabLayout;
import com.free.life.wallpaper.R; import com.free.life.wallpaper.R;
import com.free.life.wallpaper.utils.CommonUtils; import com.free.life.wallpaper.utils.CommonUtils;
@ -31,6 +32,8 @@ public class MainActivity extends AppCompatActivity {
setContentView(vb.getRoot()); setContentView(vb.getRoot());
AdManager.loadAllAd();
List<Fragment> list = new ArrayList<>(); List<Fragment> list = new ArrayList<>();
list.add(FragmentHome.newInstance(0)); list.add(FragmentHome.newInstance(0));
list.add(FragmentLike.newInstance()); list.add(FragmentLike.newInstance());

View File

@ -1,10 +1,10 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules. // Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins { plugins {
id("com.android.application") version "8.1.3" apply false id("com.android.application") version "8.8.1" apply false
id("org.jetbrains.kotlin.android") version "1.9.0" apply false id("org.jetbrains.kotlin.android") version "2.0.0" apply false
kotlin("kapt") version "1.9.0" kotlin("kapt") version "1.9.0"
id("com.google.gms.google-services") version "4.3.15" apply false id("com.google.gms.google-services") version "4.4.2" apply false
id ("com.google.firebase.crashlytics") version "2.9.2" apply false id ("com.google.firebase.crashlytics") version "3.0.3" apply false
} }
buildscript { buildscript {

Binary file not shown.

View File

@ -1,6 +1,7 @@
#Wed Mar 06 17:02:01 CST 2024
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

297
gradlew vendored
View File

@ -1,7 +1,7 @@
#!/usr/bin/env sh #!/bin/sh
# #
# Copyright 2015 the original author or authors. # Copyright © 2015-2021 the original authors.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -15,69 +15,104 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# #
# SPDX-License-Identifier: Apache-2.0
#
############################################################################## ##############################################################################
## #
## Gradle start up script for UN*X # Gradle start up script for POSIX generated by Gradle.
## #
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
############################################################################## ##############################################################################
# Attempt to set APP_HOME # Attempt to set APP_HOME
# Resolve links: $0 may be a link # Resolve links: $0 may be a link
PRG="$0" app_path=$0
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do # Need this for daisy-chained symlinks.
ls=`ls -ld "$PRG"` while
link=`expr "$ls" : '.*-> \(.*\)$'` APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
if expr "$link" : '/.*' > /dev/null; then [ -h "$app_path" ]
PRG="$link" do
else ls=$( ls -ld "$app_path" )
PRG=`dirname "$PRG"`"/$link" link=${ls#*' -> '}
fi case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle" # This is normally unused
APP_BASE_NAME=`basename "$0"` # shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum" MAX_FD=maximum
warn () { warn () {
echo "$*" echo "$*"
} } >&2
die () { die () {
echo echo
echo "$*" echo "$*"
echo echo
exit 1 exit 1
} } >&2
# OS specific support (must be 'true' or 'false'). # OS specific support (must be 'true' or 'false').
cygwin=false cygwin=false
msys=false msys=false
darwin=false darwin=false
nonstop=false nonstop=false
case "`uname`" in case "$( uname )" in #(
CYGWIN* ) CYGWIN* ) cygwin=true ;; #(
cygwin=true Darwin* ) darwin=true ;; #(
;; MSYS* | MINGW* ) msys=true ;; #(
Darwin* ) NONSTOP* ) nonstop=true ;;
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
@ -87,9 +122,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
if [ -n "$JAVA_HOME" ] ; then if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables # IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java" JAVACMD=$JAVA_HOME/jre/sh/java
else else
JAVACMD="$JAVA_HOME/bin/java" JAVACMD=$JAVA_HOME/bin/java
fi fi
if [ ! -x "$JAVACMD" ] ; then if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@ -98,88 +133,120 @@ Please set the JAVA_HOME variable in your environment to match the
location of your Java installation." location of your Java installation."
fi fi
else else
JAVACMD="java" JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the Please set the JAVA_HOME variable in your environment to match the
location of your Java installation." location of your Java installation."
fi
fi fi
# Increase the maximum file descriptors if we can. # Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
MAX_FD_LIMIT=`ulimit -H -n` case $MAX_FD in #(
if [ $? -eq 0 ] ; then max*)
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
MAX_FD="$MAX_FD_LIMIT" # shellcheck disable=SC2039,SC3045
fi MAX_FD=$( ulimit -H -n ) ||
ulimit -n $MAX_FD warn "Could not query maximum file descriptor limit"
if [ $? -ne 0 ] ; then esac
warn "Could not set maximum file descriptor limit: $MAX_FD" case $MAX_FD in #(
fi '' | soft) :;; #(
else *)
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
fi # shellcheck disable=SC2039,SC3045
fi ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac esac
fi fi
# Escape application args # Collect all arguments for the java command, stacking in reverse order:
save () { # * args from the command line
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done # * the main class name
echo " " # * -classpath
} # * -D...appname settings
APP_ARGS=`save "$@"` # * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# Collect all arguments for the java command, following the shell quoting and substitution rules # For Cygwin or MSYS, switch paths to Windows format before running java
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@" exec "$JAVACMD" "$@"

37
gradlew.bat vendored
View File

@ -13,8 +13,10 @@
@rem See the License for the specific language governing permissions and @rem See the License for the specific language governing permissions and
@rem limitations under the License. @rem limitations under the License.
@rem @rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%" == "" @echo off @if "%DEBUG%"=="" @echo off
@rem ########################################################################## @rem ##########################################################################
@rem @rem
@rem Gradle startup script for Windows @rem Gradle startup script for Windows
@ -25,7 +27,8 @@
if "%OS%"=="Windows_NT" setlocal if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0 set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=. if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0 set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME% set APP_HOME=%DIRNAME%
@ -40,13 +43,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute if %ERRORLEVEL% equ 0 goto execute
echo. echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. echo location of your Java installation. 1>&2
goto fail goto fail
@ -56,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute if exist "%JAVA_EXE%" goto execute
echo. echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. echo location of your Java installation. 1>&2
goto fail goto fail
@ -75,13 +78,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
:end :end
@rem End local scope for the variables with windows NT shell @rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd if %ERRORLEVEL% equ 0 goto mainEnd
:fail :fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code! rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 set EXIT_CODE=%ERRORLEVEL%
exit /b 1 if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd :mainEnd
if "%OS%"=="Windows_NT" endlocal if "%OS%"=="Windows_NT" endlocal

View File

@ -11,28 +11,28 @@ dependencyResolutionManagement {
google() google()
mavenCentral() mavenCentral()
//
// //Anythink(Core) //Anythink(Core)
// maven ("https://jfrog.anythinktech.com/artifactory/overseas_sdk") maven ("https://jfrog.anythinktech.com/artifactory/overseas_sdk")
//
// //Appnext //Appnext
// maven ("https://dl.appnext.com") maven ("https://dl.appnext.com")
//
// //Ironsource //Ironsource
// maven ("https://android-sdk.is.com/") maven ("https://android-sdk.is.com/")
//
// //Pangle //Pangle
// maven ("https://artifact.bytedance.com/repository/pangle") maven ("https://artifact.bytedance.com/repository/pangle")
//
// //Mintegral //Mintegral
// maven ("https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea") maven ("https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea")
//
// //Chartboost //Chartboost
// maven ("https://cboost.jfrog.io/artifactory/chartboost-ads") maven ("https://cboost.jfrog.io/artifactory/chartboost-ads")
// maven ("https://cboost.jfrog.io/artifactory/chartboost-mediation") maven ("https://cboost.jfrog.io/artifactory/chartboost-mediation")
//
// //TopOn集成测试工具 //TopOn集成测试工具
// maven ( "https://jfrog.anythinktech.com/artifactory/debugger") maven ( "https://jfrog.anythinktech.com/artifactory/debugger")
} }
} }