V1.0.1(2) 集成TopOn
This commit is contained in:
parent
3d73fb32bc
commit
12e254f49b
@ -2,6 +2,9 @@ import java.util.Date
|
||||
import java.text.SimpleDateFormat
|
||||
plugins {
|
||||
alias(libs.plugins.android.application)
|
||||
id("org.jetbrains.kotlin.android")
|
||||
id("com.google.gms.google-services")
|
||||
id("com.google.firebase.crashlytics")
|
||||
}
|
||||
val timestamp = SimpleDateFormat("MM_dd_HH_mm").format(Date())
|
||||
android {
|
||||
@ -12,8 +15,8 @@ android {
|
||||
applicationId = "com.wallpaper.shinywallpaper"
|
||||
minSdk = 23
|
||||
targetSdk = 34
|
||||
versionCode = 1
|
||||
versionName = "1.0.0"
|
||||
versionCode = 2
|
||||
versionName = "1.0.1"
|
||||
setProperty("archivesBaseName", "Shiny Wallpaper_V" + versionName + "(${versionCode})_$timestamp")
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
@ -31,6 +34,9 @@ android {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
kotlinOptions{
|
||||
jvmTarget = "1.8"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@ -50,4 +56,68 @@ dependencies {
|
||||
val roomVersion = "2.5.0"
|
||||
implementation("androidx.room:room-runtime:$roomVersion")
|
||||
annotationProcessor("androidx.room:room-compiler:$roomVersion")
|
||||
|
||||
// Import the BoM for the Firebase platform
|
||||
implementation(platform("com.google.firebase:firebase-bom:33.1.1"))
|
||||
implementation("com.google.firebase:firebase-crashlytics")
|
||||
implementation("com.google.firebase:firebase-analytics")
|
||||
|
||||
|
||||
//-----------------------------------------------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")
|
||||
|
||||
//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")
|
||||
|
||||
//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")
|
||||
|
||||
//Tramini
|
||||
implementation("com.anythink.sdk:tramini-plugin-tpn:6.3.68")
|
||||
|
||||
// Debugger UI Tools
|
||||
implementation ("com.anythink.sdk:debugger-ui:1.0.7")
|
||||
|
||||
//----------------------------------------------TopOn
|
||||
}
|
||||
29
app/google-services.json
Normal file
29
app/google-services.json
Normal file
@ -0,0 +1,29 @@
|
||||
{
|
||||
"project_info": {
|
||||
"project_number": "661802525934",
|
||||
"project_id": "shiny-wallpaper",
|
||||
"storage_bucket": "shiny-wallpaper.appspot.com"
|
||||
},
|
||||
"client": [
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:661802525934:android:65cbaea12dd841da617fff",
|
||||
"android_client_info": {
|
||||
"package_name": "com.wallpaper.shinywallpaper"
|
||||
}
|
||||
},
|
||||
"oauth_client": [],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyAt3V4mYVmQzkQecX9T4ZWXXSw4NFRsX9o"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"appinvite_service": {
|
||||
"other_platform_oauth_client": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"configuration_version": "1"
|
||||
}
|
||||
95
app/proguard-rules.pro
vendored
95
app/proguard-rules.pro
vendored
@ -46,4 +46,97 @@
|
||||
}
|
||||
# for DexGuard only
|
||||
# -keepresourcexmlelements manifest/application/meta-data@value=GlideModule
|
||||
# ------------Glide--------------------------------------
|
||||
# ------------Glide--------------------------------------
|
||||
|
||||
|
||||
#---------------------------------------------Topon
|
||||
# Vungle
|
||||
-dontwarn com.vungle.ads.**
|
||||
-keepclassmembers 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.** { *; }
|
||||
-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.*{ *; }
|
||||
#---------------------------------------------Topon
|
||||
@ -31,6 +31,9 @@
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".Main.MainActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".Main.WelActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
@ -2,6 +2,11 @@ package com.wallpaper.shinywallpaper.Application;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.anythink.core.api.ATSDK;
|
||||
import com.anythink.core.api.NetTrafficeCallback;
|
||||
import com.wallpaper.shinywallpaper.topon.AdManager;
|
||||
|
||||
public class MainApplication extends Application {
|
||||
/**
|
||||
@ -9,10 +14,17 @@ public class MainApplication extends Application {
|
||||
*/
|
||||
private static Context mContext;
|
||||
|
||||
public static String TAG = "-----------Shiny Wallpaper";
|
||||
private String APPId = "h66ac8a671bbd0";
|
||||
private String AppKey = "a116399e0e2703ec58ccea9b23f1687f4";
|
||||
|
||||
private String debug_Key = "3a867af63ec8b55d99c4ef9ddb797f53f9b6bbdc";
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
mContext = getApplicationContext();
|
||||
initTopOnSDk();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -28,4 +40,29 @@ public class MainApplication extends Application {
|
||||
super.onLowMemory();
|
||||
}
|
||||
|
||||
|
||||
private void initTopOnSDk(){
|
||||
ATSDK.checkIsEuTraffic(this, new NetTrafficeCallback() {
|
||||
|
||||
@Override
|
||||
public void onResultCallback(boolean isEU) {
|
||||
Log.e(TAG, "onResultCallback:" + isEU);
|
||||
if (isEU && ATSDK.getGDPRDataLevel(MainApplication.this) == ATSDK.UNKNOWN) {
|
||||
ATSDK.showGdprAuth(MainApplication.this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onErrorCallback(String errorMsg) {
|
||||
Log.e(TAG, "onErrorCallback:" + errorMsg);
|
||||
}
|
||||
});
|
||||
ATSDK.init( this, APPId, AppKey);
|
||||
AdManager.loadAllAd();
|
||||
//测试工具
|
||||
// ATDebuggerUITest.showDebuggerUI(this,debug_Key);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -11,6 +11,7 @@ import androidx.viewpager2.widget.ViewPager2;
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
import com.google.android.material.tabs.TabLayoutMediator;
|
||||
import com.wallpaper.shinywallpaper.R;
|
||||
import com.wallpaper.shinywallpaper.topon.AdManager;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
@ -18,7 +19,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
AdManager.loadAllAd();
|
||||
ViewPager2 viewPager2 = findViewById(R.id.main_viewpager);
|
||||
TabLayout tabLayout = findViewById(R.id.main_tablayout);
|
||||
|
||||
|
||||
@ -0,0 +1,73 @@
|
||||
package com.wallpaper.shinywallpaper.Main;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.CountDownTimer;
|
||||
import android.util.Log;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
|
||||
import com.wallpaper.shinywallpaper.Application.MainApplication;
|
||||
import com.wallpaper.shinywallpaper.R;
|
||||
import com.wallpaper.shinywallpaper.topon.AdManager;
|
||||
|
||||
import kotlin.Unit;
|
||||
import kotlin.jvm.functions.Function0;
|
||||
import kotlin.jvm.functions.Function1;
|
||||
|
||||
public class WelActivity extends AppCompatActivity {
|
||||
|
||||
private CountDownTimer countDownTimer;
|
||||
private ProgressBar progressBar;
|
||||
private long time = 10000;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_splash);
|
||||
|
||||
progressBar = findViewById(R.id.update_progress);
|
||||
|
||||
countDownTimer = AdManager.showWelcomeAd(WelActivity.this, time, new Function1<Long, Unit>() {
|
||||
@Override
|
||||
public Unit invoke(Long aLong) {
|
||||
float percentage = 100 - ((float) aLong / time) * 100;
|
||||
int round = Math.round(percentage);
|
||||
progressBar.setProgress(round);
|
||||
if(AdManager.INSTANCE.getPlace1LoadFail()&&AdManager.INSTANCE.getPlace2LoadFail()&&AdManager.INSTANCE.getPlace3LoadFail()){
|
||||
countDownTimer.cancel();
|
||||
intoMain();
|
||||
Log.d(MainApplication.TAG,"-------------cancel" );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}, new Function0<Unit>() {
|
||||
@Override
|
||||
public Unit invoke() {
|
||||
intoMain();
|
||||
return null;
|
||||
}
|
||||
});
|
||||
countDownTimer.start();
|
||||
|
||||
}
|
||||
|
||||
private void intoMain() {
|
||||
progressBar.setProgress(100);
|
||||
Intent intent = new Intent(WelActivity.this, MainActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (countDownTimer != null) {
|
||||
countDownTimer.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -29,6 +29,8 @@ import com.wallpaper.shinywallpaper.Json.ImageItem;
|
||||
import com.wallpaper.shinywallpaper.R;
|
||||
import com.wallpaper.shinywallpaper.StaticValue;
|
||||
import com.wallpaper.shinywallpaper.Utils.GallerySaver;
|
||||
import com.wallpaper.shinywallpaper.topon.AdManager;
|
||||
import com.wallpaper.shinywallpaper.topon.onActionListener;
|
||||
|
||||
public class FullScreenImageActivity extends AppCompatActivity {
|
||||
|
||||
@ -50,6 +52,7 @@ public class FullScreenImageActivity extends AppCompatActivity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_full_screen_image);
|
||||
AdManager.loadAllAd();
|
||||
|
||||
// Window w = getWindow();
|
||||
// // 设置无边界布局标志,仅扩展到状态栏
|
||||
@ -72,7 +75,7 @@ public class FullScreenImageActivity extends AppCompatActivity {
|
||||
setWallpaperButton = findViewById(R.id.setWallpaperButton);
|
||||
progressBar = findViewById(R.id.progressBar);
|
||||
overlayView = findViewById(R.id.overlayView);
|
||||
gallerySaver=new GallerySaver(this,progressBar,overlayView);
|
||||
gallerySaver = new GallerySaver(this, progressBar, overlayView);
|
||||
|
||||
// 接收传递的 ImageItem 对象
|
||||
Intent intent = getIntent();
|
||||
@ -115,9 +118,15 @@ public class FullScreenImageActivity extends AppCompatActivity {
|
||||
btnDownload.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
showProgress();
|
||||
FullScreenImageActivity activity = (FullScreenImageActivity) v.getContext();
|
||||
gallerySaver.saveToGallery(activity, imageItem.getSourceUrl());
|
||||
AdManager.showTopOn(FullScreenImageActivity.this, new onActionListener() {
|
||||
@Override
|
||||
public void onAction() {
|
||||
showProgress();
|
||||
FullScreenImageActivity activity = (FullScreenImageActivity) v.getContext();
|
||||
gallerySaver.saveToGallery(activity, imageItem.getSourceUrl());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
@ -126,9 +135,14 @@ public class FullScreenImageActivity extends AppCompatActivity {
|
||||
setWallpaperButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
showProgress();
|
||||
AdManager.showTopOn(FullScreenImageActivity.this, new onActionListener() {
|
||||
@Override
|
||||
public void onAction() {
|
||||
showProgress();
|
||||
setWallpaper();
|
||||
}
|
||||
});
|
||||
|
||||
setWallpaper();
|
||||
}
|
||||
});
|
||||
fullScreenImageView.setOnClickListener(v -> toFullScreen());
|
||||
|
||||
@ -15,6 +15,7 @@ import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||
import com.wallpaper.shinywallpaper.R;
|
||||
import com.wallpaper.shinywallpaper.StaticValue;
|
||||
import com.wallpaper.shinywallpaper.topon.AdManager;
|
||||
|
||||
public class SubFullScreenImageActivity extends AppCompatActivity {
|
||||
|
||||
@ -25,25 +26,21 @@ public class SubFullScreenImageActivity extends AppCompatActivity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_sub_full_screen_image);
|
||||
|
||||
AdManager.loadAllAd();
|
||||
subFullScreen = findViewById(R.id.sub_fullscreen);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
Window w = getWindow();
|
||||
// 设置无边界布局标志,仅扩展到状态栏
|
||||
w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||
// 移除半透明状态栏标志
|
||||
w.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||
Window w = getWindow();
|
||||
// 设置无边界布局标志,仅扩展到状态栏
|
||||
w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||
// 移除半透明状态栏标志
|
||||
w.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||
// 设置半透明状态栏
|
||||
// w.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||
// 设置透明状态栏
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
w.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
||||
w.setStatusBarColor(Color.TRANSPARENT);
|
||||
w.setNavigationBarColor(Color.TRANSPARENT);
|
||||
w.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
|
||||
}
|
||||
}
|
||||
// 设置透明状态栏
|
||||
w.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
||||
w.setStatusBarColor(Color.TRANSPARENT);
|
||||
w.setNavigationBarColor(Color.TRANSPARENT);
|
||||
w.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
|
||||
|
||||
|
||||
// 接收传递的参数
|
||||
@ -54,17 +51,15 @@ public class SubFullScreenImageActivity extends AppCompatActivity {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!imageUrl.isEmpty()) {
|
||||
Glide.with(this)
|
||||
.asDrawable()
|
||||
.skipMemoryCache(true)
|
||||
.diskCacheStrategy(DiskCacheStrategy.ALL)
|
||||
.load(imageUrl)
|
||||
.placeholder(R.drawable.rectangular_placeholder_map)
|
||||
.error(R.drawable.rectangular_placeholder_map)
|
||||
.fitCenter()
|
||||
.into(subFullScreen);
|
||||
}
|
||||
Glide.with(this)
|
||||
.asDrawable()
|
||||
.skipMemoryCache(true)
|
||||
.diskCacheStrategy(DiskCacheStrategy.ALL)
|
||||
.load(imageUrl)
|
||||
.placeholder(R.drawable.rectangular_placeholder_map)
|
||||
.error(R.drawable.rectangular_placeholder_map)
|
||||
.fitCenter()
|
||||
.into(subFullScreen);
|
||||
|
||||
subFullScreen.setOnClickListener(v -> finish());
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.wallpaper.shinywallpaper.SecondSub;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.ImageButton;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
@ -11,6 +12,8 @@ import com.wallpaper.shinywallpaper.Json.Category;
|
||||
import com.wallpaper.shinywallpaper.Json.ImageItem;
|
||||
import com.wallpaper.shinywallpaper.R;
|
||||
import com.wallpaper.shinywallpaper.StaticValue;
|
||||
import com.wallpaper.shinywallpaper.topon.AdManager;
|
||||
import com.wallpaper.shinywallpaper.topon.onActionListener;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -23,6 +26,7 @@ public class SubRecyclerViewActivity extends AppCompatActivity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_sub_recycler_view);
|
||||
AdManager.loadAllAd();
|
||||
|
||||
// Window w = getWindow();
|
||||
// // 设置无边界布局标志,仅扩展到状态栏
|
||||
@ -45,6 +49,26 @@ public class SubRecyclerViewActivity extends AppCompatActivity {
|
||||
|
||||
recyclerView.setAdapter(new SubRecyclerViewAdapter(this, imageList));
|
||||
|
||||
btnBack.setOnClickListener(v -> finish());
|
||||
btnBack.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
AdManager.showTopOn(SubRecyclerViewActivity.this, new onActionListener() {
|
||||
@Override
|
||||
public void onAction() {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
super.onBackPressed();
|
||||
AdManager.showTopOn(SubRecyclerViewActivity.this, new onActionListener() {
|
||||
@Override
|
||||
public void onAction() {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,11 @@
|
||||
package com.wallpaper.shinywallpaper.topon
|
||||
|
||||
interface AdListener {
|
||||
|
||||
fun loadFail(placeId: String)
|
||||
fun showSuccess()
|
||||
|
||||
fun showFail()
|
||||
|
||||
fun showClose()
|
||||
}
|
||||
@ -0,0 +1,218 @@
|
||||
package com.wallpaper.shinywallpaper.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.wallpaper.shinywallpaper.Application.MainApplication
|
||||
|
||||
|
||||
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
|
||||
|
||||
/**
|
||||
* Wallpeper_Set
|
||||
* n66ac8acc220e4
|
||||
* Wallpaper_Prev
|
||||
* n66ac8abd92954
|
||||
* Wallpaper_Open
|
||||
* n66ac8aabe6d83
|
||||
*/
|
||||
|
||||
const val place1Id = "n66ac8acc220e4"
|
||||
const val place2Id = "n66ac8abd92954"
|
||||
const val place3Id = "n66ac8aabe6d83"
|
||||
|
||||
|
||||
var place1LoadFail = false
|
||||
var place2LoadFail = false
|
||||
var place3LoadFail = false
|
||||
|
||||
val list = mutableListOf<ATInterstitial>()
|
||||
|
||||
|
||||
@JvmStatic
|
||||
fun loadAllAd() {
|
||||
if (list.size <= 0) {
|
||||
val mInterstitialAd1 = ATInterstitial(MainApplication.getContext(), place1Id)
|
||||
val mInterstitialAd2 = ATInterstitial(MainApplication.getContext(), place2Id)
|
||||
val mInterstitialAd3 = ATInterstitial(MainApplication.getContext(), 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() {
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
ad.load()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@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, 100) {
|
||||
override fun onTick(millisUntilFinished: Long) {
|
||||
countAction.invoke(millisUntilFinished)
|
||||
if (!alreadyShow) {
|
||||
showAD(activity) {
|
||||
if (it == type_has_cache) {
|
||||
alreadyShow = true
|
||||
}
|
||||
if (it == type_show_close || it == type_show_fail) {
|
||||
goMain.invoke()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun 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(MainApplication.TAG, "LoadLoaded ${ad.mPlacementId}")
|
||||
}
|
||||
|
||||
override fun onInterstitialAdLoadFail(p0: AdError?) {
|
||||
Log.d(MainApplication.TAG, "LoadFail:${p0?.code} ${p0?.desc}")
|
||||
}
|
||||
|
||||
override fun onInterstitialAdClicked(p0: ATAdInfo?) {
|
||||
|
||||
}
|
||||
|
||||
override fun onInterstitialAdShow(p0: ATAdInfo?) {
|
||||
Log.d(MainApplication.TAG, "AdShow ${p0?.showId} ")
|
||||
listener.showSuccess()
|
||||
ad.load()
|
||||
}
|
||||
|
||||
override fun onInterstitialAdClose(p0: ATAdInfo?) {
|
||||
listener.showClose()
|
||||
}
|
||||
|
||||
override fun onInterstitialAdVideoStart(p0: ATAdInfo?) {
|
||||
|
||||
}
|
||||
|
||||
override fun onInterstitialAdVideoEnd(p0: ATAdInfo?) {
|
||||
|
||||
}
|
||||
|
||||
override fun onInterstitialAdVideoError(p0: AdError?) {
|
||||
listener.showFail()
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@JvmStatic
|
||||
private fun showAD(activity: Activity, action: (type: Int) -> Unit) {
|
||||
val readyAd = getReadyAd()
|
||||
if (readyAd != null) {
|
||||
Log.d(MainApplication.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)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun showTopOn(activity: Activity, listener: onActionListener) {
|
||||
showAD(activity) { type ->
|
||||
if (type == type_no_cache || type == type_show_close || type == type_show_fail) {
|
||||
listener.onAction()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
package com.wallpaper.shinywallpaper.topon;
|
||||
|
||||
public interface onActionListener {
|
||||
|
||||
void onAction();
|
||||
}
|
||||
27
app/src/main/res/drawable/progressbar.xml
Normal file
27
app/src/main/res/drawable/progressbar.xml
Normal file
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@android:id/background">
|
||||
<shape>
|
||||
<corners android:radius="10dp" />
|
||||
<solid android:color="@color/pb_bg" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item android:id="@android:id/progress">
|
||||
<clip>
|
||||
<shape>
|
||||
<corners android:radius="10dp" />
|
||||
<gradient
|
||||
android:angle="0"
|
||||
android:endColor="@color/pb_end_color"
|
||||
android:startColor="@color/pb_start_color" />
|
||||
</shape>
|
||||
</clip>
|
||||
</item>
|
||||
</layer-list>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
40
app/src/main/res/layout/activity_splash.xml
Normal file
40
app/src/main/res/layout/activity_splash.xml
Normal file
@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/constraint"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="200dp"
|
||||
app:cardCornerRadius="10dp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="147dp"
|
||||
android:layout_height="147dp"
|
||||
android:src="@mipmap/ic_launcher_foreground" />
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/update_progress"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="10dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginStart="33dp"
|
||||
android:layout_marginEnd="33dp"
|
||||
android:layout_marginBottom="40dp"
|
||||
android:progress="30"
|
||||
android:progressDrawable="@drawable/progressbar"
|
||||
app:layout_constraintBottom_toBottomOf="parent" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@ -4,4 +4,7 @@
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
<color name="component1">#252525</color>
|
||||
<color name="component2">#4D000000</color>
|
||||
<color name="pb_bg">#898989</color>
|
||||
<color name="pb_start_color">#F6bfcb</color>
|
||||
<color name="pb_end_color">#c56a83</color>
|
||||
</resources>
|
||||
@ -1,4 +1,7 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
plugins {
|
||||
alias(libs.plugins.android.application) apply false
|
||||
id("org.jetbrains.kotlin.android") version "1.9.0" apply false
|
||||
id("com.google.gms.google-services") version "4.3.15" apply false
|
||||
id ("com.google.firebase.crashlytics") version "2.9.2" apply false
|
||||
}
|
||||
@ -16,6 +16,17 @@ dependencyResolutionManagement {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
//Anythink(Core)
|
||||
maven("https://jfrog.anythinktech.com/artifactory/overseas_sdk")
|
||||
//Ironsource
|
||||
maven("https://android-sdk.is.com/")
|
||||
//Mintegral
|
||||
maven("https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea")
|
||||
//Pangle
|
||||
maven ( "https://artifact.bytedance.com/repository/pangle")
|
||||
|
||||
//TopOn集成测试工具
|
||||
maven ( "https://jfrog.anythinktech.com/artifactory/debugger")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user