去掉TopOn 集成
This commit is contained in:
parent
b8ad1add14
commit
c21730af24
@ -57,62 +57,7 @@ dependencies {
|
||||
implementation("com.github.bumptech.glide:glide:4.16.0")
|
||||
annotationProcessor("com.github.bumptech.glide:compiler:4.16.0")
|
||||
|
||||
//-----------------------------------------------TopOn(Pangle、IronSource、mintegral、unityads、liftoff(vungle)、Bigo)
|
||||
//Anythink (Necessary)
|
||||
implementation("com.anythink.sdk:core-tpn:6.3.68")
|
||||
implementation("com.anythink.sdk:nativead-tpn:6.3.68")
|
||||
implementation("com.anythink.sdk:banner-tpn:6.3.68")
|
||||
implementation("com.anythink.sdk:interstitial-tpn:6.3.68")
|
||||
implementation("com.anythink.sdk:rewardedvideo-tpn:6.3.68")
|
||||
implementation("com.anythink.sdk:splash-tpn:6.3.68")
|
||||
|
||||
//Androidx (Necessary)
|
||||
implementation("androidx.appcompat:appcompat:1.1.0")
|
||||
implementation("androidx.browser:browser:1.4.0")
|
||||
|
||||
//Vungle
|
||||
implementation("com.anythink.sdk:adapter-tpn-vungle:6.3.68")
|
||||
implementation("com.vungle:vungle-ads:7.3.2")
|
||||
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.3.68")
|
||||
implementation("com.unity3d.ads:unity-ads:4.9.3")
|
||||
|
||||
//Ironsource
|
||||
implementation("com.anythink.sdk:adapter-tpn-ironsource:6.3.68")
|
||||
implementation("com.ironsource.sdk:mediationsdk:8.1.0")
|
||||
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.3.68")
|
||||
implementation("com.bigossp:bigo-ads:4.7.4")
|
||||
|
||||
//Mintegral
|
||||
implementation("com.anythink.sdk:adapter-tpn-mintegral-nonchina:6.3.68")
|
||||
implementation("com.mbridge.msdk.oversea:reward:16.7.51")
|
||||
implementation("com.mbridge.msdk.oversea:newinterstitial:16.7.51")
|
||||
implementation("com.mbridge.msdk.oversea:mbnative:16.7.51")
|
||||
implementation("com.mbridge.msdk.oversea:mbnativeadvanced:16.7.51")
|
||||
implementation("com.mbridge.msdk.oversea:mbsplash:16.7.51")
|
||||
implementation("com.mbridge.msdk.oversea:mbbanner:16.7.51")
|
||||
implementation("com.mbridge.msdk.oversea:mbbid:16.7.51")
|
||||
implementation("androidx.recyclerview:recyclerview:1.1.0")
|
||||
|
||||
//Pangle
|
||||
implementation("com.anythink.sdk:adapter-tpn-pangle-nonchina:6.3.68.1")
|
||||
implementation( "com.pangle.global:ads-sdk:6.0.0.3")
|
||||
implementation( "com.google.android.gms:play-services-ads-identifier:18.0.1")
|
||||
|
||||
//Tramini
|
||||
implementation("com.anythink.sdk:tramini-plugin-tpn:6.3.68")
|
||||
|
||||
// Debugger UI Tools
|
||||
implementation ("com.anythink.sdk:debugger-ui:1.0.7")
|
||||
//----------------------------------------------TopOn()
|
||||
|
||||
//----------------firebase
|
||||
implementation(platform("com.google.firebase:firebase-bom:33.1.1"))
|
||||
|
||||
@ -8,20 +8,12 @@ import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import com.nature.free.test.base.BaseActivity;
|
||||
import com.nature.free.test.data.ClassData;
|
||||
import com.nature.free.test.data.ClassData_;
|
||||
import com.nature.free.test.data.Wallpaper;
|
||||
import com.nature.free.test.databinding.ActivityInfoBinding;
|
||||
import com.nature.free.test.objectbox.ObjectBox;
|
||||
import com.nature.free.test.other.MyAdapter;
|
||||
import com.nature.free.test.other.MyItemSpace;
|
||||
import com.nature.free.test.topon.AdManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import io.objectbox.query.Query;
|
||||
import kotlin.Unit;
|
||||
import kotlin.jvm.functions.Function1;
|
||||
|
||||
public class InfoActivity extends BaseActivity<ActivityInfoBinding> {
|
||||
|
||||
@ -33,7 +25,7 @@ public class InfoActivity extends BaseActivity<ActivityInfoBinding> {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
AdManager.loadAllAd();
|
||||
|
||||
init();
|
||||
mainBinding.back.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
@ -51,18 +43,12 @@ public class InfoActivity extends BaseActivity<ActivityInfoBinding> {
|
||||
}
|
||||
|
||||
private void showTopOnAd(Boolean isfinish) {
|
||||
AdManager.showAD(InfoActivity.this, new Function1<Integer, Unit>() {
|
||||
@Override
|
||||
public Unit invoke(Integer integer) {
|
||||
if (integer == AdManager.type_no_cache || integer == AdManager.type_show_close || integer == AdManager.type_show_fail) {
|
||||
if(isfinish){
|
||||
finish();
|
||||
}
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
// TODO: 2024/7/30 showAd
|
||||
if(isfinish){
|
||||
finish();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -1,14 +1,11 @@
|
||||
package com.nature.free.test;
|
||||
|
||||
import android.Manifest;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter;
|
||||
@ -17,8 +14,6 @@ import androidx.viewpager2.widget.ViewPager2;
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
import com.nature.free.test.base.BaseActivity;
|
||||
import com.nature.free.test.databinding.ActivityMainBinding;
|
||||
import com.nature.free.test.objectbox.ObjectBox;
|
||||
import com.nature.free.test.topon.AdManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -1,12 +1,8 @@
|
||||
package com.nature.free.test
|
||||
|
||||
import android.app.Application
|
||||
import android.util.Log
|
||||
import com.anythink.core.api.ATSDK
|
||||
import com.anythink.core.api.NetTrafficeCallback
|
||||
import com.nature.free.test.data.ClassData
|
||||
import com.nature.free.test.objectbox.ObjectBox
|
||||
import com.nature.free.test.topon.AdManager.loadAllAd
|
||||
|
||||
|
||||
class MyWallpaper : Application() {
|
||||
@ -52,20 +48,8 @@ class MyWallpaper : Application() {
|
||||
}
|
||||
|
||||
private fun initTopOnSDk(){
|
||||
ATSDK.checkIsEuTraffic(this, object : NetTrafficeCallback {
|
||||
override fun onResultCallback(isEU: Boolean) {
|
||||
Log.e(TAG, "onResultCallback:$isEU")
|
||||
if (isEU && ATSDK.getGDPRDataLevel(this@MyWallpaper) == ATSDK.UNKNOWN) {
|
||||
ATSDK.showGdprAuth(this@MyWallpaper)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onErrorCallback(errorMsg: String) {
|
||||
Log.e(TAG, "onErrorCallback:$errorMsg")
|
||||
}
|
||||
})
|
||||
ATSDK.init( this, APPId, AppKey)
|
||||
loadAllAd()
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -3,15 +3,9 @@ package com.nature.free.test;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.CountDownTimer;
|
||||
import android.util.Log;
|
||||
|
||||
import com.nature.free.test.base.BaseActivity;
|
||||
import com.nature.free.test.databinding.ActivityWelBinding;
|
||||
import com.nature.free.test.topon.AdManager;
|
||||
|
||||
import kotlin.Unit;
|
||||
import kotlin.jvm.functions.Function0;
|
||||
import kotlin.jvm.functions.Function1;
|
||||
|
||||
public class SplashActivity extends BaseActivity<ActivityWelBinding> {
|
||||
|
||||
@ -22,31 +16,8 @@ public class SplashActivity extends BaseActivity<ActivityWelBinding> {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
countDownTimer = AdManager.showWelcomeAd(SplashActivity.this, time, new Function1<Long, Unit>() {
|
||||
@Override
|
||||
public Unit invoke(Long aLong) {
|
||||
long number = time - aLong;
|
||||
Double s = calculatePercentage(number, time);
|
||||
|
||||
mainBinding.customProgress.setProgress(s.floatValue());
|
||||
if(AdManager.INSTANCE.getPlace1LoadFail()&&AdManager.INSTANCE.getPlace2LoadFail()&&AdManager.INSTANCE.getPlace3LoadFail()){
|
||||
countDownTimer.cancel();
|
||||
goMain();
|
||||
Log.d(MyWallpaper.TAG,"-------------cancel" );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}, new Function0<Unit>() {
|
||||
@Override
|
||||
public Unit invoke() {
|
||||
Log.d(MyWallpaper.TAG,"-------------gomain" );
|
||||
goMain();
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
countDownTimer.start();
|
||||
|
||||
goMain();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -5,7 +5,6 @@ import android.app.Dialog;
|
||||
import android.app.WallpaperManager;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
@ -24,21 +23,15 @@ import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.DataSource;
|
||||
import com.bumptech.glide.load.engine.GlideException;
|
||||
import com.bumptech.glide.request.RequestListener;
|
||||
import com.bumptech.glide.request.target.CustomTarget;
|
||||
import com.bumptech.glide.request.target.Target;
|
||||
import com.bumptech.glide.request.transition.Transition;
|
||||
import com.nature.free.test.base.BaseActivity;
|
||||
import com.nature.free.test.data.Wallpaper;
|
||||
import com.nature.free.test.data.Wallpaper_;
|
||||
import com.nature.free.test.databinding.ActivityWallpaperBinding;
|
||||
import com.nature.free.test.objectbox.ObjectBox;
|
||||
import com.nature.free.test.other.DialogSet;
|
||||
import com.nature.free.test.other.MyAdapter;
|
||||
import com.nature.free.test.topon.AdManager;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
|
||||
import io.objectbox.query.Query;
|
||||
@ -75,7 +68,7 @@ public class WallPaperActivity extends BaseActivity<ActivityWallpaperBinding> im
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
statusbar();
|
||||
AdManager.loadAllAd();
|
||||
|
||||
tempId = getIntent().getLongExtra(MyWallpaper.KEY_WALLPAPER, 1);
|
||||
isMainEnter = getIntent().getBooleanExtra(MyWallpaper.isMainEnterSetKey, false);
|
||||
Log.d(MyWallpaper.TAG, "--------isMainEnter" + isMainEnter);
|
||||
@ -139,20 +132,14 @@ public class WallPaperActivity extends BaseActivity<ActivityWallpaperBinding> im
|
||||
}
|
||||
|
||||
private void apply(int which) {
|
||||
AdManager.showAD(WallPaperActivity.this, new Function1<Integer, Unit>() {
|
||||
@Override
|
||||
public Unit invoke(Integer integer) {
|
||||
if (integer == AdManager.type_no_cache || integer == AdManager.type_show_close || integer == AdManager.type_show_fail) {
|
||||
mainBinding.load.setVisibility(View.VISIBLE);
|
||||
if (mainBinding.check1.isSelected()) {
|
||||
setmWallpaper(which, mBitmapPro1);
|
||||
} else if (mainBinding.check2.isSelected()) {
|
||||
setmWallpaper(which, mBitmapSource);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
// TODO: 2024/7/30 showAd
|
||||
mainBinding.load.setVisibility(View.VISIBLE);
|
||||
if (mainBinding.check1.isSelected()) {
|
||||
setmWallpaper(which, mBitmapPro1);
|
||||
} else if (mainBinding.check2.isSelected()) {
|
||||
setmWallpaper(which, mBitmapSource);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -376,15 +363,10 @@ public class WallPaperActivity extends BaseActivity<ActivityWallpaperBinding> im
|
||||
}
|
||||
|
||||
private void showTopOnAd() {
|
||||
AdManager.showAD(WallPaperActivity.this, new Function1<Integer, Unit>() {
|
||||
@Override
|
||||
public Unit invoke(Integer integer) {
|
||||
if (integer == AdManager.type_no_cache || integer == AdManager.type_show_close || integer == AdManager.type_show_fail) {
|
||||
finish();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
// TODO: 2024/7/30 showAd
|
||||
finish();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,13 +0,0 @@
|
||||
package com.nature.free.test.topon
|
||||
|
||||
import com.anythink.core.api.AdError
|
||||
|
||||
interface AdListener {
|
||||
|
||||
fun loadFail(placeId: String)
|
||||
fun showSuccess()
|
||||
|
||||
fun showFail()
|
||||
|
||||
fun showClose()
|
||||
}
|
||||
@ -1,207 +0,0 @@
|
||||
package com.nature.free.test.topon
|
||||
|
||||
import android.app.Activity
|
||||
import android.os.CountDownTimer
|
||||
import android.util.Log
|
||||
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.nature.free.test.MyWallpaper
|
||||
|
||||
|
||||
object AdManager {
|
||||
|
||||
|
||||
const val type_no_cache = 0
|
||||
const val type_has_cache = 1
|
||||
const val type_show_success = 2
|
||||
const val type_show_close = 3
|
||||
const val type_show_fail = 4
|
||||
|
||||
|
||||
/**
|
||||
* 广告位ID:n66a0ccb3f4084
|
||||
* n66a0ccb3bcb32
|
||||
* n66a0ccb38879b
|
||||
*/
|
||||
|
||||
const val place1Id = "n66a0ccb3f4084"
|
||||
const val place2Id = "n66a0ccb3bcb32"
|
||||
const val place3Id = "n66a0ccb38879b"
|
||||
|
||||
val list = mutableListOf<ATInterstitial>()
|
||||
|
||||
var place1LoadFail = false
|
||||
var place2LoadFail = false
|
||||
var place3LoadFail = false
|
||||
|
||||
@JvmStatic
|
||||
fun loadAllAd() {
|
||||
if (list.size <= 0) {
|
||||
val mInterstitialAd1 = ATInterstitial(MyWallpaper.globalContext, place1Id)
|
||||
val mInterstitialAd2 = ATInterstitial(MyWallpaper.globalContext, place2Id)
|
||||
val mInterstitialAd3 = ATInterstitial(MyWallpaper.globalContext, place3Id)
|
||||
list.add(mInterstitialAd1)
|
||||
list.add(mInterstitialAd2)
|
||||
list.add(mInterstitialAd3)
|
||||
}
|
||||
for (ad in list) {
|
||||
if (!ad.isAdReady) {
|
||||
setCallBack(ad,object : AdListener {
|
||||
override fun loadFail(placeId: String) {
|
||||
if(placeId == place1Id){
|
||||
place1LoadFail = true
|
||||
}
|
||||
if(placeId == place2Id){
|
||||
place2LoadFail = true
|
||||
}
|
||||
if(placeId == place3Id){
|
||||
place3LoadFail = true
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun showSuccess() {
|
||||
|
||||
}
|
||||
|
||||
override fun showFail() {
|
||||
|
||||
}
|
||||
|
||||
override fun showClose() {
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
Log.d(MyWallpaper.TAG, " start load ad=${ad.mPlacementId}")
|
||||
ad.load(MyWallpaper.globalContext)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@JvmStatic
|
||||
fun getReadyAd(): ATInterstitial? {
|
||||
list.shuffle()
|
||||
for (ad in list) {
|
||||
if (ad.isAdReady) {
|
||||
return ad
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
|
||||
@JvmStatic
|
||||
fun showWelcomeAd(activity: Activity,totalTim: Long,countAction:(millisUntilFinished: Long)->Unit, goMain: () -> Unit): CountDownTimer {
|
||||
var alreadyShow = false
|
||||
var timer = object : CountDownTimer(totalTim, 50) {
|
||||
override fun onTick(millisUntilFinished: Long) {
|
||||
countAction.invoke(millisUntilFinished)
|
||||
if (!alreadyShow) {
|
||||
showAD(activity) {
|
||||
if(it== type_no_cache){
|
||||
Log.d(MyWallpaper.TAG, " ${millisUntilFinished} type_no_cache")
|
||||
}
|
||||
if (it == type_has_cache) {
|
||||
alreadyShow = true
|
||||
}
|
||||
if (it == type_show_close || it == type_show_fail) {
|
||||
goMain.invoke()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
override fun onFinish() {
|
||||
Log.d(MyWallpaper.TAG, " ---onFinish")
|
||||
if (!alreadyShow) {
|
||||
showAD(activity) {
|
||||
if (it == type_show_close || it == type_show_fail || it == type_no_cache) {
|
||||
goMain.invoke()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return timer
|
||||
}
|
||||
|
||||
private fun setCallBack(ad: ATInterstitial, listener: AdListener) {
|
||||
ad.setAdListener(object : ATInterstitialListener {
|
||||
override fun onInterstitialAdLoaded() {
|
||||
Log.d(MyWallpaper.TAG, "LoadLoaded ${ad.mPlacementId}")
|
||||
}
|
||||
|
||||
override fun onInterstitialAdLoadFail(p0: AdError?) {
|
||||
listener.loadFail(ad.mPlacementId)
|
||||
Log.d(MyWallpaper.TAG, "LoadFail:${ad.mPlacementId} ${p0?.code} ${p0?.fullErrorInfo}")
|
||||
}
|
||||
|
||||
override fun onInterstitialAdClicked(p0: ATAdInfo?) {
|
||||
|
||||
}
|
||||
|
||||
override fun onInterstitialAdShow(p0: ATAdInfo?) {
|
||||
Log.d(MyWallpaper.TAG, "AdShow ${p0?.placementId} ${p0?.segmentId}")
|
||||
listener.showSuccess()
|
||||
ad.load()
|
||||
}
|
||||
|
||||
override fun onInterstitialAdClose(p0: ATAdInfo?) {
|
||||
Log.d(MyWallpaper.TAG, "AdClose ${p0?.placementId} ${p0?.segmentId}")
|
||||
listener.showClose()
|
||||
}
|
||||
|
||||
override fun onInterstitialAdVideoStart(p0: ATAdInfo?) {
|
||||
|
||||
}
|
||||
|
||||
override fun onInterstitialAdVideoEnd(p0: ATAdInfo?) {
|
||||
|
||||
}
|
||||
|
||||
override fun onInterstitialAdVideoError(p0: AdError?) {
|
||||
listener.showFail()
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@JvmStatic
|
||||
fun showAD(activity: Activity, action: (type: Int) -> Unit) {
|
||||
val readyAd = getReadyAd()
|
||||
if (readyAd!= null) {
|
||||
Log.d(MyWallpaper.TAG, "readyAd ${readyAd.mPlacementId} ")
|
||||
action.invoke(type_has_cache)
|
||||
setCallBack(readyAd,object : AdListener {
|
||||
override fun loadFail(placeId: String) {
|
||||
|
||||
}
|
||||
|
||||
override fun showSuccess() {
|
||||
action.invoke(type_show_success)
|
||||
}
|
||||
|
||||
override fun showFail() {
|
||||
action.invoke(type_show_fail)
|
||||
}
|
||||
|
||||
override fun showClose() {
|
||||
action.invoke(type_show_close)
|
||||
}
|
||||
|
||||
})
|
||||
readyAd.show(activity)
|
||||
} else {
|
||||
action.invoke(type_no_cache)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -10,16 +10,7 @@ dependencyResolutionManagement {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
//Anythink(Core)
|
||||
maven("https://jfrog.anythinktech.com/artifactory/overseas_sdk")
|
||||
//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")
|
||||
//TopOn集成测试工具
|
||||
maven ( "https://jfrog.anythinktech.com/artifactory/debugger")
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user