V1.0.1(2),接入topon和firebase

This commit is contained in:
lihongwei 2025-03-10 15:21:33 +08:00
parent 2089b3c5fe
commit 2601b06106
19 changed files with 681 additions and 30 deletions

View File

@ -3,6 +3,8 @@ import java.util.Date
plugins { plugins {
alias(libs.plugins.android.application) alias(libs.plugins.android.application)
id("com.google.gms.google-services")
id("com.google.firebase.crashlytics")
} }
val timestamp: String = SimpleDateFormat("MM_dd_HH_mm").format(Date()) val timestamp: String = SimpleDateFormat("MM_dd_HH_mm").format(Date())
android { android {
@ -13,8 +15,8 @@ android {
applicationId = "com.keyboard.wallpaperkeyboard" applicationId = "com.keyboard.wallpaperkeyboard"
minSdk = 23 minSdk = 23
targetSdk = 35 targetSdk = 35
versionCode = 1 versionCode = 2
versionName = "1.0.0" versionName = "1.0.1"
setProperty( setProperty(
"archivesBaseName", "archivesBaseName",
"Colorful Keyboard_V" + versionName + "(${versionCode})_$timestamp" "Colorful Keyboard_V" + versionName + "(${versionCode})_$timestamp"
@ -57,4 +59,103 @@ dependencies {
implementation("com.github.bumptech.glide:glide:4.16.0") implementation("com.github.bumptech.glide:glide:4.16.0")
implementation("com.github.omicronapps:7-Zip-JBinding-4Android:Release-16.02-2.02") implementation("com.github.omicronapps:7-Zip-JBinding-4Android:Release-16.02-2.02")
// Import the BoM for the Firebase platform
implementation(platform("com.google.firebase:firebase-bom:33.1.1"))
// Add the dependencies for the Crashlytics and Analytics libraries
// When using the BoM, you don't specify versions in Firebase library dependencies
implementation("com.google.firebase:firebase-crashlytics")
implementation("com.google.firebase:firebase-analytics")
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.1.0")
//----------------------------------------------TopOn
} }

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

@ -0,0 +1,29 @@
{
"project_info": {
"project_number": "729963581698",
"project_id": "colorful-keyboard-4fb83",
"storage_bucket": "colorful-keyboard-4fb83.firebasestorage.app"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:729963581698:android:7ec0f1fa66da817d24321b",
"android_client_info": {
"package_name": "com.keyboard.wallpaperkeyboard"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyCVeUrcNdCpBdt2UyF-X-S6bIbECXUVwOQ"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": []
}
}
}
],
"configuration_version": "1"
}

128
app/proguard-rules.pro vendored
View File

@ -34,3 +34,131 @@
-keep class com.omicronapplications.** { *; } -keep class com.omicronapplications.** { *; }
-keep class net.sf.sevenzipjbinding.** { *; } -keep class net.sf.sevenzipjbinding.** { *; }
#---------------------------------------------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,11 +3,15 @@ package com.keyboard.wallpaperkeyboard;
import android.app.Application; import android.app.Application;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.util.Log;
import com.anythink.core.api.ATSDK;
import com.anythink.core.api.NetTrafficeCallback;
import com.keyboard.wallpaperkeyboard.data.dao.WallpaperEntityDao; import com.keyboard.wallpaperkeyboard.data.dao.WallpaperEntityDao;
import com.keyboard.wallpaperkeyboard.data.database.AppDatabase; import com.keyboard.wallpaperkeyboard.data.database.AppDatabase;
import com.keyboard.wallpaperkeyboard.data.entity.WallpaperEntity; import com.keyboard.wallpaperkeyboard.data.entity.WallpaperEntity;
import com.keyboard.wallpaperkeyboard.data.repository.WallpaperRepository; import com.keyboard.wallpaperkeyboard.data.repository.WallpaperRepository;
import com.keyboard.wallpaperkeyboard.topon.AdManager;
import com.keyboard.wallpaperkeyboard.util.JsonUtils; import com.keyboard.wallpaperkeyboard.util.JsonUtils;
import java.util.List; import java.util.List;
@ -20,6 +24,13 @@ public class MyApplication extends Application {
public static final String KEY_FILE_PATH = "file_path"; public static final String KEY_FILE_PATH = "file_path";
private static final String KEY_INITIALIZED = "is_database_initialized"; private static final String KEY_INITIALIZED = "is_database_initialized";
public static final String TAG = "--------------";
private static final String AppKey = "aa8ba44868df81895ad400c6d161d7ac1";
private static final String APPId = "h67ce631665766";
private static final String debug_KEy = "5c12401a5c59afe9a3ac946dd22ae5f1fecd8c1c";
@Override @Override
public void onCreate() { public void onCreate() {
super.onCreate(); super.onCreate();
@ -33,6 +44,45 @@ public class MyApplication extends Application {
initializeDatabase(); initializeDatabase();
preferences.edit().putBoolean(KEY_INITIALIZED, true).apply(); preferences.edit().putBoolean(KEY_INITIALIZED, true).apply();
} }
// // 确保Firebase初始化
// FirebaseApp.initializeApp(this);
//
// // 输出日志以确认Firebase初始化
// if (!FirebaseApp.getApps(this).isEmpty()) {
// Log.d("TAG", "Firebase1 初始化成功1");
// } else {
// Log.e("TAG", "Firebase0 初始化失败0");
// }
initSdk();
}
private void initSdk() {
ATSDK.checkIsEuTraffic(this, new NetTrafficeCallback() {
@Override
public void onResultCallback(boolean isEU) {
Log.e(TAG, "onResultCallback:" + isEU);
if (isEU && ATSDK.getGDPRDataLevel(MyApplication.this) == ATSDK.UNKNOWN) {
ATSDK.showGdprAuth(MyApplication.this);
}
}
@Override
public void onErrorCallback(String errorMsg) {
Log.e(TAG, "onErrorCallback:" + errorMsg);
}
});
ATSDK.init(this, APPId, AppKey);
AdManager.loadAllAd();
//测试工具
// ATDebuggerUITest.showDebuggerUI(this, debug_KEy);
// ATSDK.setNetworkLogDebug(true);
} }
public static Context getContext() { public static Context getContext() {

View File

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

View File

@ -0,0 +1,249 @@
package com.keyboard.wallpaperkeyboard.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.keyboard.wallpaperkeyboard.MyApplication;
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;
/**
INST3
n67ce856722442
INST2
n67ce85668b66d
INST1
n67ce8565e4c39
*/
private static final String place1Id = "n67ce8565e4c39";
private static final String place2Id = "n67ce85668b66d";
private static final String place3Id = "n67ce856722442";
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(MyApplication.getContext(), place1Id);
ATInterstitial mInterstitialAd2 = new ATInterstitial(MyApplication.getContext(), place2Id);
ATInterstitial mInterstitialAd3 = new ATInterstitial(MyApplication.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(MyApplication.TAG, "-has Cache------------");
return ad;
}
}
Log.d(MyApplication.TAG, "-No Cache------------");
return null;
}
private static void setCallBack(ATInterstitial ad, AdListener listener) {
ad.setAdListener(new ATInterstitialListener() {
@Override
public void onInterstitialAdLoaded() {
Log.d(MyApplication.TAG, "LoadLoaded " + ad.mPlacementId);
}
@Override
public void onInterstitialAdLoadFail(AdError adError) {
listener.loadFail(ad.mPlacementId);
Log.d(MyApplication.TAG, "LoadFail:--" + ad.mPlacementId + "--" + adError.getCode() + "---" + adError.getDesc());
}
@Override
public void onInterstitialAdClicked(ATAdInfo atAdInfo) {
}
@Override
public void onInterstitialAdShow(ATAdInfo atAdInfo) {
Log.d(MyApplication.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.keyboard.wallpaperkeyboard.topon;
public interface AdStatusAction {
void onStatus(int adType);
}

View File

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

View File

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

View File

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

View File

@ -14,6 +14,8 @@ import androidx.recyclerview.widget.GridLayoutManager;
import com.keyboard.wallpaperkeyboard.R; import com.keyboard.wallpaperkeyboard.R;
import com.keyboard.wallpaperkeyboard.data.entity.WallpaperEntity; import com.keyboard.wallpaperkeyboard.data.entity.WallpaperEntity;
import com.keyboard.wallpaperkeyboard.databinding.ActivityListBinding; import com.keyboard.wallpaperkeyboard.databinding.ActivityListBinding;
import com.keyboard.wallpaperkeyboard.topon.AdManager;
import com.keyboard.wallpaperkeyboard.topon.onActionListener;
import com.keyboard.wallpaperkeyboard.ui.adapter.InputMethodAdapter; import com.keyboard.wallpaperkeyboard.ui.adapter.InputMethodAdapter;
import com.keyboard.wallpaperkeyboard.ui.viewmodel.WallpaperViewModel; import com.keyboard.wallpaperkeyboard.ui.viewmodel.WallpaperViewModel;
import com.keyboard.wallpaperkeyboard.util.ItemDecoration; import com.keyboard.wallpaperkeyboard.util.ItemDecoration;
@ -50,6 +52,8 @@ public class ListActivity extends AppCompatActivity {
return; return;
} }
AdManager.loadAllAd();
wallpaperViewModel = new ViewModelProvider(this).get(WallpaperViewModel.class); wallpaperViewModel = new ViewModelProvider(this).get(WallpaperViewModel.class);
binding.recyclerView.setLayoutManager(new GridLayoutManager(this, 1)); binding.recyclerView.setLayoutManager(new GridLayoutManager(this, 1));
@ -62,7 +66,14 @@ public class ListActivity extends AppCompatActivity {
} }
private void initEvent() { private void initEvent() {
binding.back.setOnClickListener(view -> finish()); binding.back.setOnClickListener(v -> {
AdManager.showTopOn(this, new onActionListener() {
@Override
public void onAction() {
finish();
}
});
});
binding.title.setText(name); binding.title.setText(name);
getCategoryByClassName(); getCategoryByClassName();

View File

@ -15,6 +15,7 @@ import com.google.android.material.tabs.TabLayoutMediator;
import com.keyboard.wallpaperkeyboard.R; import com.keyboard.wallpaperkeyboard.R;
import com.keyboard.wallpaperkeyboard.databinding.ActivityMainBinding; import com.keyboard.wallpaperkeyboard.databinding.ActivityMainBinding;
import com.keyboard.wallpaperkeyboard.databinding.MainItemCustomBinding; import com.keyboard.wallpaperkeyboard.databinding.MainItemCustomBinding;
import com.keyboard.wallpaperkeyboard.topon.AdManager;
import com.keyboard.wallpaperkeyboard.ui.adapter.MainViewPager2Adapter; import com.keyboard.wallpaperkeyboard.ui.adapter.MainViewPager2Adapter;
public class MainActivity extends AppCompatActivity { public class MainActivity extends AppCompatActivity {
@ -38,6 +39,8 @@ public class MainActivity extends AppCompatActivity {
} }
private void initData() { private void initData() {
AdManager.loadAllAd();
MainViewPager2Adapter adapter = new MainViewPager2Adapter(this); MainViewPager2Adapter adapter = new MainViewPager2Adapter(this);
binding.mainViewpager2.setAdapter(adapter); binding.mainViewpager2.setAdapter(adapter);
} }

View File

@ -14,11 +14,12 @@ import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners; import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.keyboard.wallpaperkeyboard.R; import com.keyboard.wallpaperkeyboard.R;
import com.keyboard.wallpaperkeyboard.databinding.ActivitySplashBinding; import com.keyboard.wallpaperkeyboard.databinding.ActivitySplashBinding;
import com.keyboard.wallpaperkeyboard.topon.AdManager;
public class SplashActivity extends AppCompatActivity { public class SplashActivity extends AppCompatActivity {
private ActivitySplashBinding binding; private ActivitySplashBinding binding;
private static final long TOTAL_TIME = 3000; private static final long TOTAL_TIME = 11000;
private CountDownTimer countDownTimer; private CountDownTimer countDownTimer;
@Override @Override
@ -39,23 +40,21 @@ public class SplashActivity extends AppCompatActivity {
} }
private void initEvent() { private void initEvent() {
AdManager.loadAllAd();
AdManager.setAlreadyShow();
loadImage(); loadImage();
startProgressTimer(); startProgressTimer();
} }
private void startProgressTimer() { private void startProgressTimer() {
countDownTimer = new CountDownTimer(TOTAL_TIME, 100) { countDownTimer = AdManager.showWelcomeAd(this, TOTAL_TIME, millisUntilFinished -> {
@Override int percentage = (int) (100 - (float) millisUntilFinished / TOTAL_TIME * 100);
public void onTick(long millisUntilFinished) { binding.progressBar.setProgress(percentage);
int percentage = (int) (100 - (float) millisUntilFinished / TOTAL_TIME * 100); },
binding.progressBar.setProgress(percentage); this::startMain
} );
@Override
public void onFinish() {
startMain();
}
};
countDownTimer.start(); countDownTimer.start();
} }

View File

@ -24,6 +24,8 @@ import com.keyboard.wallpaperkeyboard.R;
import com.keyboard.wallpaperkeyboard.callback.DownloadAndUnzipCallback; import com.keyboard.wallpaperkeyboard.callback.DownloadAndUnzipCallback;
import com.keyboard.wallpaperkeyboard.data.entity.WallpaperEntity; import com.keyboard.wallpaperkeyboard.data.entity.WallpaperEntity;
import com.keyboard.wallpaperkeyboard.databinding.ActivityWallpaperBinding; import com.keyboard.wallpaperkeyboard.databinding.ActivityWallpaperBinding;
import com.keyboard.wallpaperkeyboard.topon.AdManager;
import com.keyboard.wallpaperkeyboard.topon.onActionListener;
import com.keyboard.wallpaperkeyboard.ui.adapter.InputMethodAdapter; import com.keyboard.wallpaperkeyboard.ui.adapter.InputMethodAdapter;
import com.keyboard.wallpaperkeyboard.ui.dialog.SelectInputMethodDialog; import com.keyboard.wallpaperkeyboard.ui.dialog.SelectInputMethodDialog;
import com.keyboard.wallpaperkeyboard.ui.viewmodel.WallpaperViewModel; import com.keyboard.wallpaperkeyboard.ui.viewmodel.WallpaperViewModel;
@ -72,6 +74,8 @@ public class WallpaperActivity extends AppCompatActivity {
return; return;
} }
AdManager.loadAllAd();
wallpaperViewModel = new ViewModelProvider(this).get(WallpaperViewModel.class); wallpaperViewModel = new ViewModelProvider(this).get(WallpaperViewModel.class);
Random random = new Random(); Random random = new Random();
@ -95,8 +99,22 @@ public class WallpaperActivity extends AppCompatActivity {
} }
private void initEvent() { private void initEvent() {
binding.back.setOnClickListener(v -> finish()); binding.back.setOnClickListener(v -> {
binding.downloadApply.setOnClickListener(v -> downloadAndUnzip()); AdManager.showTopOn(this, new onActionListener() {
@Override
public void onAction() {
finish();
}
});
});
binding.downloadApply.setOnClickListener(v -> {
AdManager.showTopOn(this, new onActionListener() {
@Override
public void onAction() {
downloadAndUnzip();
}
});
});
binding.like.setOnClickListener(v -> toggleLike()); binding.like.setOnClickListener(v -> toggleLike());
binding.home.setOnClickListener(v -> jumpToMainActivity()); binding.home.setOnClickListener(v -> jumpToMainActivity());

View File

@ -16,6 +16,8 @@ import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners; import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.keyboard.wallpaperkeyboard.R; import com.keyboard.wallpaperkeyboard.R;
import com.keyboard.wallpaperkeyboard.data.entity.WallpaperEntity; import com.keyboard.wallpaperkeyboard.data.entity.WallpaperEntity;
import com.keyboard.wallpaperkeyboard.topon.AdManager;
import com.keyboard.wallpaperkeyboard.topon.onActionListener;
import com.keyboard.wallpaperkeyboard.ui.activity.ListActivity; import com.keyboard.wallpaperkeyboard.ui.activity.ListActivity;
import com.keyboard.wallpaperkeyboard.ui.activity.WallpaperActivity; import com.keyboard.wallpaperkeyboard.ui.activity.WallpaperActivity;
import com.keyboard.wallpaperkeyboard.ui.viewmodel.WallpaperViewModel; import com.keyboard.wallpaperkeyboard.ui.viewmodel.WallpaperViewModel;
@ -102,15 +104,20 @@ public class InputMethodAdapter extends RecyclerView.Adapter<InputMethodAdapter.
private void setClickListeners(WallpaperEntity wallpaperEntity) { private void setClickListeners(WallpaperEntity wallpaperEntity) {
imageView.setOnClickListener(view -> { imageView.setOnClickListener(view -> {
Intent intent; AdManager.showTopOn(activity, new onActionListener() {
if (type == 0) { @Override
intent = new Intent(activity, ListActivity.class); public void onAction() {
intent.putExtra("name", wallpaperEntity.getClassName()); Intent intent;
} else { if (type == 0) {
intent = new Intent(activity, WallpaperActivity.class); intent = new Intent(activity, ListActivity.class);
intent.putExtra("wallpaper", wallpaperEntity); intent.putExtra("name", wallpaperEntity.getClassName());
} } else {
activity.startActivity(intent); intent = new Intent(activity, WallpaperActivity.class);
intent.putExtra("wallpaper", wallpaperEntity);
}
activity.startActivity(intent);
}
});
}); });
favorite.setOnClickListener(view -> toggleLike(wallpaperEntity)); favorite.setOnClickListener(view -> toggleLike(wallpaperEntity));

View File

@ -1,4 +1,7 @@
// 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 {
alias(libs.plugins.android.application) apply false alias(libs.plugins.android.application) 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
} }

View File

@ -1,5 +1,5 @@
[versions] [versions]
agp = "8.8.2" agp = "8.9.0"
junit = "4.13.2" junit = "4.13.2"
junitVersion = "1.2.1" junitVersion = "1.2.1"
espressoCore = "3.6.1" espressoCore = "3.6.1"

View File

@ -1,6 +1,6 @@
#Wed Feb 19 17:02:15 CST 2025 #Wed Feb 19 17:02:15 CST 2025
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

View File

@ -17,6 +17,28 @@ dependencyResolutionManagement {
google() google()
mavenCentral() mavenCentral()
maven("https://jitpack.io") maven("https://jitpack.io")
//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")
} }
} }