V1.0.1(2) 集成topon

This commit is contained in:
litingting 2025-03-04 10:07:04 +08:00
parent 8005ec82e9
commit 2709e7de98
15 changed files with 641 additions and 86 deletions

View File

@ -4,8 +4,8 @@ plugins {
id("com.android.application") id("com.android.application")
id("org.jetbrains.kotlin.android") id("org.jetbrains.kotlin.android")
id("io.objectbox") id("io.objectbox")
// 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 = SimpleDateFormat("MM_dd_HH_mm").format(Date())
android { android {
@ -17,8 +17,8 @@ android {
applicationId = "com.cartoon.live.wallpaper.free" applicationId = "com.cartoon.live.wallpaper.free"
minSdk = 23 minSdk = 23
targetSdk = 34 targetSdk = 34
versionCode = 1 versionCode = 2
versionName = "1.0.0" versionName = "1.0.1"
setProperty( setProperty(
"archivesBaseName", "archivesBaseName",
"Cartoon Live Wallpaper_V" + versionName + "(${versionCode})_$timestamp" "Cartoon Live Wallpaper_V" + versionName + "(${versionCode})_$timestamp"
@ -75,5 +75,103 @@ dependencies {
implementation ("androidx.media3:media3-ui:1.4.1") implementation ("androidx.media3:media3-ui:1.4.1")
implementation ("androidx.media3:media3-exoplayer-dash:1.4.1") implementation ("androidx.media3:media3-exoplayer-dash:1.4.1")
implementation(platform("com.google.firebase:firebase-bom:33.7.0"))
implementation("com.google.firebase:firebase-analytics")
implementation("com.google.firebase:firebase-crashlytics")
implementation("com.google.firebase:firebase-config")
//-----------------------------------------------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
} }

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

@ -0,0 +1,29 @@
{
"project_info": {
"project_number": "573250689758",
"project_id": "cartoon-live-wallpaper-be63d",
"storage_bucket": "cartoon-live-wallpaper-be63d.firebasestorage.app"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:573250689758:android:cc32af4c21cdddf498c04f",
"android_client_info": {
"package_name": "com.cartoon.live.wallpaper.free"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyB89Tn6O6K0bMTkGv5eMTr4XdBNB33-UQY"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": []
}
}
}
],
"configuration_version": "1"
}

127
app/proguard-rules.pro vendored
View File

@ -125,5 +125,132 @@
#---------------------------------------------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

@ -3,6 +3,9 @@ package com.cartoon.live.wallpaper;
import android.app.Application; import android.app.Application;
import android.graphics.Typeface; import android.graphics.Typeface;
import com.anythink.core.api.ATSDK;
import com.anythink.core.api.NetTrafficeCallback;
import com.cartoon.live.wallpaper.ad.AdManager;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
import com.cartoon.live.wallpaper.mydata.ResultData; import com.cartoon.live.wallpaper.mydata.ResultData;
@ -35,7 +38,7 @@ public class MyApp extends Application {
super.onCreate(); super.onCreate();
mApplication = this; mApplication = this;
defaultFont = Typeface.createFromAsset(getAssets(), "font.ttf"); defaultFont = Typeface.createFromAsset(getAssets(), "font.ttf");
// initSDk(); initSDk();
Db.init(this); Db.init(this);
String dbinit = StoreShared.INSTANCE.getDbinit(); String dbinit = StoreShared.INSTANCE.getDbinit();
if(dbinit.equals("0")){ if(dbinit.equals("0")){
@ -83,27 +86,27 @@ public class MyApp extends Application {
private void initSDk(){ private void initSDk(){
// String APPId ="h6776591bc967e"; String APPId ="h67c565cdc0e17";
//
// String AppKey ="a359707dba4dcae7ac8bc66d0d163295c"; String AppKey ="a4c045537b7a69a812d5e5909dd187c60";
// String debugKey = "d2f08ee302fdd0741819983376817c0bf71bfe67"; String debugKey = "";
// ATSDK.checkIsEuTraffic(this, new NetTrafficeCallback() { ATSDK.checkIsEuTraffic(this, new NetTrafficeCallback() {
//
// @Override @Override
// public void onResultCallback(boolean isEU) { public void onResultCallback(boolean isEU) {
// if (isEU && ATSDK.getGDPRDataLevel(App.this) == ATSDK.UNKNOWN) { if (isEU && ATSDK.getGDPRDataLevel(MyApp.this) == ATSDK.UNKNOWN) {
// ATSDK.showGdprAuth(App.this); ATSDK.showGdprAuth(MyApp.this);
// } }
//
// } }
//
// @Override @Override
// public void onErrorCallback(String errorMsg) { public void onErrorCallback(String errorMsg) {
//
// } }
// }); });
// ATSDK.init( this, APPId, AppKey); ATSDK.init( this, APPId, AppKey);
//// ATDebuggerUITest.showDebuggerUI(this,debugKey); // ATDebuggerUITest.showDebuggerUI(this,debugKey);
// AdManager.loadAllAd(); AdManager.loadAllAd();
} }
} }

View File

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

View File

@ -0,0 +1,246 @@
package com.cartoon.live.wallpaper.ad;
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.cartoon.live.wallpaper.MyApp;
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;
private static final String place1Id = "n67c565f4864fc";
private static final String place2Id = "n67c565f3badab";
private static final String place3Id = "n67c565f37b061";
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.size() == 0) {
ATInterstitial mInterstitialAd1 = new ATInterstitial(MyApp.getApplication(), place1Id);
ATInterstitial mInterstitialAd2 = new ATInterstitial(MyApp.getApplication(), place2Id);
ATInterstitial mInterstitialAd3 = new ATInterstitial(MyApp.getApplication(), 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(MyApp.TAG, "-has Cache------------");
return ad;
}
}
Log.d(MyApp.TAG, "-No Cache------------");
return null;
}
private static void setCallBack(ATInterstitial ad, AdListener listener) {
ad.setAdListener(new ATInterstitialListener() {
@Override
public void onInterstitialAdLoaded() {
Log.d(MyApp.TAG, "LoadLoaded " + ad.mPlacementId);
}
@Override
public void onInterstitialAdLoadFail(AdError adError) {
listener.loadFail(ad.mPlacementId);
Log.d(MyApp.TAG, "LoadFail:--" + ad.mPlacementId + "--" + adError.getCode() + "---" + adError.getDesc());
}
@Override
public void onInterstitialAdClicked(ATAdInfo atAdInfo) {
}
@Override
public void onInterstitialAdShow(ATAdInfo atAdInfo) {
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
) {
Log.d(MyApp.TAG,"----------alreadyShow="+alreadyShow);
alreadyShow = false;
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.cartoon.live.wallpaper.ad;
public interface AdStatusAction {
void onStatus(int adType);
}

View File

@ -0,0 +1,5 @@
package com.cartoon.live.wallpaper.ad;
public interface CountAction {
void onCount(long millisUntilFinished);
}

View File

@ -0,0 +1,5 @@
package com.cartoon.live.wallpaper.ad;
public interface GoMainAction {
void onGo();
}

View File

@ -0,0 +1,6 @@
package com.cartoon.live.wallpaper.ad;
public interface onActionListener {
void onAction();
}

View File

@ -6,6 +6,7 @@ import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import com.cartoon.live.wallpaper.ad.AdManager;
import com.google.android.material.tabs.TabLayout; import com.google.android.material.tabs.TabLayout;
import com.google.android.material.tabs.TabLayoutMediator; import com.google.android.material.tabs.TabLayoutMediator;
import com.cartoon.live.wallpaper.R; import com.cartoon.live.wallpaper.R;
@ -27,6 +28,7 @@ public class HomeActivity extends BaseActivity<ActivityMainBinding> {
@Override @Override
protected void onCreateInit() { protected void onCreateInit() {
AdManager.loadAllAd();
List<Fragment> fragmentList = new ArrayList<>(); List<Fragment> fragmentList = new ArrayList<>();
fragmentList.add(HomeFragment.newInstance(0)); fragmentList.add(HomeFragment.newInstance(0));
fragmentList.add(HomeFragment.newInstance(3)); fragmentList.add(HomeFragment.newInstance(3));

View File

@ -17,6 +17,8 @@ import androidx.media3.exoplayer.ExoPlayer;
import androidx.media3.exoplayer.source.ProgressiveMediaSource; import androidx.media3.exoplayer.source.ProgressiveMediaSource;
import com.cartoon.live.wallpaper.R; import com.cartoon.live.wallpaper.R;
import com.cartoon.live.wallpaper.ad.AdManager;
import com.cartoon.live.wallpaper.ad.onActionListener;
import com.cartoon.live.wallpaper.databinding.ActivityPreviewBinding; import com.cartoon.live.wallpaper.databinding.ActivityPreviewBinding;
import com.cartoon.live.wallpaper.listener.OnVideoApi; import com.cartoon.live.wallpaper.listener.OnVideoApi;
import com.cartoon.live.wallpaper.mydata.FavoriteData; import com.cartoon.live.wallpaper.mydata.FavoriteData;
@ -71,6 +73,7 @@ public class PreviewActivity extends BaseActivity<ActivityPreviewBinding> implem
@Override @Override
protected void onCreateInit() { protected void onCreateInit() {
showLoading(true, false); showLoading(true, false);
AdManager.loadAllAd();
Intent intent = getIntent(); Intent intent = getIntent();
id = intent.getIntExtra(KEY_ID, -1); id = intent.getIntExtra(KEY_ID, -1);
wallpaperType = intent.getIntExtra(KEY_wallpaperType, -1); wallpaperType = intent.getIntExtra(KEY_wallpaperType, -1);
@ -80,6 +83,13 @@ public class PreviewActivity extends BaseActivity<ActivityPreviewBinding> implem
vb.tvDescribe.setText(describe); vb.tvDescribe.setText(describe);
filePath = Com.getCachePath(id); filePath = Com.getCachePath(id);
mFile = new File(filePath); mFile = new File(filePath);
AdManager.showTopOn(PreviewActivity.this, new onActionListener() {
@Override
public void onAction() {
}
});
initExoPlay(); initExoPlay();
initFavorite(); initFavorite();
if (mFile.exists()) { if (mFile.exists()) {
@ -100,7 +110,7 @@ public class PreviewActivity extends BaseActivity<ActivityPreviewBinding> implem
disposable = RetrofitManager.getInstance().getShiftMp4(id, image, filePath,this, new OnVideoApi() { disposable = RetrofitManager.getInstance().getShiftMp4(id, image, filePath,this, new OnVideoApi() {
@Override @Override
public void onVideoResult(boolean success, String path) { public void onVideoResult(boolean success, String path) {
Com.logMsg("-------------success =" + success + "--path=" + path);
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -108,7 +118,6 @@ public class PreviewActivity extends BaseActivity<ActivityPreviewBinding> implem
checkPlay(); checkPlay();
} else { } else {
showRetry(); showRetry();
Com.logMsg("-------------loading fail");
} }
} }
}); });
@ -119,7 +128,7 @@ public class PreviewActivity extends BaseActivity<ActivityPreviewBinding> implem
disposable = RetrofitManager.getInstance().getMp4(id, image, filePath,this, new OnVideoApi() { disposable = RetrofitManager.getInstance().getMp4(id, image, filePath,this, new OnVideoApi() {
@Override @Override
public void onVideoResult(boolean success, String path) { public void onVideoResult(boolean success, String path) {
Com.logMsg("-------------success =" + success + "--path=" + path);
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -127,7 +136,7 @@ public class PreviewActivity extends BaseActivity<ActivityPreviewBinding> implem
checkPlay(); checkPlay();
} else { } else {
showRetry(); showRetry();
Com.logMsg("-------------loading fail");
} }
} }
}); });
@ -153,7 +162,6 @@ public class PreviewActivity extends BaseActivity<ActivityPreviewBinding> implem
public void onPlaybackStateChanged(int playbackState) { public void onPlaybackStateChanged(int playbackState) {
if (playbackState == Player.STATE_READY) { if (playbackState == Player.STATE_READY) {
showLoading(false, true); showLoading(false, true);
Com.logMsg("-------onPlaybackStateChanged-----" + exoPlayer.getPlayWhenReady());
} }
} }
}); });
@ -212,6 +220,9 @@ public class PreviewActivity extends BaseActivity<ActivityPreviewBinding> implem
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (v.equals(vb.layoutFavorite)) { if (v.equals(vb.layoutFavorite)) {
AdManager.showTopOn(PreviewActivity.this, new onActionListener() {
@Override
public void onAction() {
vb.imFavorite.setSelected(!vb.imFavorite.isSelected()); vb.imFavorite.setSelected(!vb.imFavorite.isSelected());
boolean selected = vb.imFavorite.isSelected(); boolean selected = vb.imFavorite.isSelected();
if (selected) { if (selected) {
@ -220,10 +231,25 @@ public class PreviewActivity extends BaseActivity<ActivityPreviewBinding> implem
} else { } else {
Db.deleteLike(id); Db.deleteLike(id);
} }
}
});
} else if (v.equals(vb.layoutSet)) { } else if (v.equals(vb.layoutSet)) {
AdManager.showTopOn(PreviewActivity.this, new onActionListener() {
@Override
public void onAction() {
setLiveWallpaper(); setLiveWallpaper();
}
});
} else if (v.equals(vb.layoutBack)) { } else if (v.equals(vb.layoutBack)) {
AdManager.showTopOn(PreviewActivity.this, new onActionListener() {
@Override
public void onAction() {
finish(); finish();
}
});
} else if (v.equals(vb.tvRetry)) { } else if (v.equals(vb.tvRetry)) {
requestVideo(); requestVideo();
} }
@ -285,9 +311,9 @@ public class PreviewActivity extends BaseActivity<ActivityPreviewBinding> implem
WallpaperManager wallpaperManager = WallpaperManager.getInstance(this); WallpaperManager wallpaperManager = WallpaperManager.getInstance(this);
try { try {
wallpaperManager.clear(); wallpaperManager.clear();
Com.logMsg("----------clear=");
} catch (Exception e) { } catch (Exception e) {
Com.logMsg("---------e=" + e.getMessage());
} }
try { try {
@ -316,9 +342,9 @@ public class PreviewActivity extends BaseActivity<ActivityPreviewBinding> implem
public void run() { public void run() {
if(vb.horizontalLayout.getVisibility() != View.VISIBLE){ if(vb.horizontalLayout.getVisibility() != View.VISIBLE){
showLoading(true, true); showLoading(true, true);
Com.logMsg("------------showLoading------11-----");
}else { }else {
Com.logMsg("------------showLoading------22-----");
} }
vb.horizontalProgress.setProgress(progress); vb.horizontalProgress.setProgress(progress);
} }
@ -331,22 +357,7 @@ public class PreviewActivity extends BaseActivity<ActivityPreviewBinding> implem
} }
// runOnUiThread(new Runnable() {
// @Override
// public void run() {
// if (contentLength <= 0) {
// Common.logMsg("contentLength" +contentLength);
// } else {
// showLoading(true, true);
// int progress = (int) ((100 * bytesRead) / contentLength);
// Common.logMsg("Download progress: " + progress + "%"+"---loadingui="+loadingui);
// vb.horizontalProgress.setProgress(progress);
// }
// if (done) {
// Common.logMsg("Download complete!");
// }
// }
// });
} }
} }

View File

@ -4,12 +4,15 @@ import android.content.Intent;
import android.os.CountDownTimer; import android.os.CountDownTimer;
import android.view.View; import android.view.View;
import com.cartoon.live.wallpaper.ad.AdManager;
import com.cartoon.live.wallpaper.ad.CountAction;
import com.cartoon.live.wallpaper.ad.GoMainAction;
import com.cartoon.live.wallpaper.databinding.ActivityWelBinding; import com.cartoon.live.wallpaper.databinding.ActivityWelBinding;
import com.cartoon.live.wallpaper.parent.BaseActivity; import com.cartoon.live.wallpaper.parent.BaseActivity;
public class WelActivity extends BaseActivity<ActivityWelBinding> { public class WelActivity extends BaseActivity<ActivityWelBinding> {
private static final long SPLASH_TIME_OUT = 1000L; private static final long SPLASH_TIME_OUT = 11000L;
private CountDownTimer countDownTimer; private CountDownTimer countDownTimer;
@Override @Override
@ -19,38 +22,23 @@ public class WelActivity extends BaseActivity<ActivityWelBinding> {
@Override @Override
protected void onCreateInit() { protected void onCreateInit() {
countDownTimer = new CountDownTimer(SPLASH_TIME_OUT,100) { AdManager.loadAllAd();
countDownTimer = AdManager.showWelcomeAd(WelActivity.this, SPLASH_TIME_OUT, new CountAction() {
@Override @Override
public void onTick(long millisUntilFinished) { public void onCount(long millisUntilFinished) {
float v = 100 - (float) millisUntilFinished / SPLASH_TIME_OUT * 100; float v = 100 - (float) millisUntilFinished / SPLASH_TIME_OUT * 100;
int v1 = (int) v; int v1 = (int) v;
vb.progressBar.setProgress(v1); vb.progressBar.setProgress(v1);
} }
}, new GoMainAction() {
@Override @Override
public void onFinish() { public void onGo() {
vb.progressBar.setProgress(100); vb.progressBar.setProgress(100);
Intent intent = new Intent(WelActivity.this, HomeActivity.class); Intent intent = new Intent(WelActivity.this, HomeActivity.class);
startActivity(intent); startActivity(intent);
finish(); finish();
} }
}; });
// countDownTimer = AdManager.showWelcomeAd(WelcomeActivity.this, SPLASH_TIME_OUT, new CountAction() {
// @Override
// public void onCount(long millisUntilFinished) {
// float v = 100 - (float) millisUntilFinished / SPLASH_TIME_OUT * 100;
// int v1 = (int) v;
// vb.progressBar.setProgress(v1);
// }
// }, new GoMainAction() {
// @Override
// public void onGo() {
// vb.progressBar.setProgress(100);
// Intent intent = new Intent(WelcomeActivity.this, MainActivity.class);
// startActivity(intent);
// finish();
// }
// });
countDownTimer.start(); countDownTimer.start();
} }

View File

@ -3,8 +3,8 @@ plugins {
id("com.android.application") version "8.1.3" apply false id("com.android.application") version "8.1.3" apply false
id("org.jetbrains.kotlin.android") version "1.8.10" apply false id("org.jetbrains.kotlin.android") version "1.8.10" apply false
// id("com.google.gms.google-services") version "4.4.2" apply false id("com.google.gms.google-services") version "4.4.2" apply false
// id ("com.google.firebase.crashlytics") version "3.0.2" apply false id ("com.google.firebase.crashlytics") version "3.0.2" apply false
} }
buildscript { buildscript {

View File

@ -10,7 +10,27 @@ dependencyResolutionManagement {
repositories { repositories {
google() google()
mavenCentral() mavenCentral()
//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")
} }
} }