From c620f43587e646f958fc391e6528f2b89ded32cb Mon Sep 17 00:00:00 2001 From: litingting Date: Thu, 28 Nov 2024 18:11:41 +0800 Subject: [PATCH] =?UTF-8?q?V1.0.1(2)=20=20topon=20=E5=B9=BF=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle.kts | 148 ++++++---- app/proguard-rules.pro | 130 +++++++++ app/src/main/AndroidManifest.xml | 5 +- .../pretty/keyboard/theme/keyboard/MyApp.kt | 26 ++ .../theme/keyboard/ad/AdListener.java | 10 + .../keyboard/theme/keyboard/ad/AdManager.java | 253 ++++++++++++++++++ .../theme/keyboard/ad/AdStatusAction.java | 5 + .../theme/keyboard/ad/CountAction.java | 5 + .../theme/keyboard/ad/GoMainAction.java | 5 + .../theme/keyboard/ad/onActionListener.java | 6 + .../{AllAdapter.java => AllTabAdapter.java} | 10 +- .../keyboard/listadapter/MainAdapter.java | 1 + .../keyboard/theme/keyboard/ui/AllActivity.kt | 15 +- .../theme/keyboard/ui/ApplySkinActivity.kt | 52 ++-- .../theme/keyboard/ui/HomeActivity.kt | 49 ++-- .../theme/keyboard/ui/SettingActivity.kt | 118 -------- .../theme/keyboard/ui/SuccessActivity.java | 2 + .../keyboard/theme/keyboard/ui/WelActivity.kt | 31 ++- .../main/res/layout/activity_layout_home.xml | 10 +- app/src/main/res/values/strings.xml | 2 +- gradle.properties | 2 +- settings.gradle.kts | 30 ++- 22 files changed, 645 insertions(+), 270 deletions(-) create mode 100644 app/src/main/java/com/pretty/keyboard/theme/keyboard/ad/AdListener.java create mode 100644 app/src/main/java/com/pretty/keyboard/theme/keyboard/ad/AdManager.java create mode 100644 app/src/main/java/com/pretty/keyboard/theme/keyboard/ad/AdStatusAction.java create mode 100644 app/src/main/java/com/pretty/keyboard/theme/keyboard/ad/CountAction.java create mode 100644 app/src/main/java/com/pretty/keyboard/theme/keyboard/ad/GoMainAction.java create mode 100644 app/src/main/java/com/pretty/keyboard/theme/keyboard/ad/onActionListener.java rename app/src/main/java/com/pretty/keyboard/theme/keyboard/listadapter/{AllAdapter.java => AllTabAdapter.java} (88%) delete mode 100644 app/src/main/java/com/pretty/keyboard/theme/keyboard/ui/SettingActivity.kt diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 564dcba..b1305ae 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -18,8 +18,8 @@ android { applicationId = "com.pretty.keyboard.theme" minSdk = 23 targetSdk = 34 - versionCode = 1 - versionName = "1.0.0" + versionCode = 2 + versionName = "1.0.1" setProperty( "archivesBaseName", "Pretty Keyboard_V" + versionName + "(${versionCode})_$timestamp" @@ -78,63 +78,95 @@ dependencies { implementation("com.google.firebase:firebase-config") - //-----------------------------------------------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(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 } \ No newline at end of file diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 1ca8b9e..10791ea 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -57,3 +57,133 @@ -keep class com.omicronapplications.** { *; } -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 ; + } + -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 + diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 8fb6e9a..f281acd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -23,10 +23,7 @@ - + list = new ArrayList<>(); + + + public static void loadAllAd() { + if (list.size() == 0) { + ATInterstitial mInterstitialAd1 = new ATInterstitial(MyApp.appInstance, place1Id); + ATInterstitial mInterstitialAd2 = new ATInterstitial(MyApp.appInstance, place2Id); + ATInterstitial mInterstitialAd3 = new ATInterstitial(MyApp.appInstance, 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) { + Log.d(MyApp.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 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(); + } + } + }); + + } +} diff --git a/app/src/main/java/com/pretty/keyboard/theme/keyboard/ad/AdStatusAction.java b/app/src/main/java/com/pretty/keyboard/theme/keyboard/ad/AdStatusAction.java new file mode 100644 index 0000000..ecda24c --- /dev/null +++ b/app/src/main/java/com/pretty/keyboard/theme/keyboard/ad/AdStatusAction.java @@ -0,0 +1,5 @@ +package com.pretty.keyboard.theme.keyboard.ad; + +public interface AdStatusAction { + void onStatus(int adType); +} diff --git a/app/src/main/java/com/pretty/keyboard/theme/keyboard/ad/CountAction.java b/app/src/main/java/com/pretty/keyboard/theme/keyboard/ad/CountAction.java new file mode 100644 index 0000000..7475225 --- /dev/null +++ b/app/src/main/java/com/pretty/keyboard/theme/keyboard/ad/CountAction.java @@ -0,0 +1,5 @@ +package com.pretty.keyboard.theme.keyboard.ad; + +public interface CountAction { + void onCount(long millisUntilFinished); +} diff --git a/app/src/main/java/com/pretty/keyboard/theme/keyboard/ad/GoMainAction.java b/app/src/main/java/com/pretty/keyboard/theme/keyboard/ad/GoMainAction.java new file mode 100644 index 0000000..b9d82e2 --- /dev/null +++ b/app/src/main/java/com/pretty/keyboard/theme/keyboard/ad/GoMainAction.java @@ -0,0 +1,5 @@ +package com.pretty.keyboard.theme.keyboard.ad; + +public interface GoMainAction { + void onGo(); +} diff --git a/app/src/main/java/com/pretty/keyboard/theme/keyboard/ad/onActionListener.java b/app/src/main/java/com/pretty/keyboard/theme/keyboard/ad/onActionListener.java new file mode 100644 index 0000000..609df77 --- /dev/null +++ b/app/src/main/java/com/pretty/keyboard/theme/keyboard/ad/onActionListener.java @@ -0,0 +1,6 @@ +package com.pretty.keyboard.theme.keyboard.ad; + +public interface onActionListener { + + void onAction(); +} diff --git a/app/src/main/java/com/pretty/keyboard/theme/keyboard/listadapter/AllAdapter.java b/app/src/main/java/com/pretty/keyboard/theme/keyboard/listadapter/AllTabAdapter.java similarity index 88% rename from app/src/main/java/com/pretty/keyboard/theme/keyboard/listadapter/AllAdapter.java rename to app/src/main/java/com/pretty/keyboard/theme/keyboard/listadapter/AllTabAdapter.java index 87ac7e5..aa581bf 100644 --- a/app/src/main/java/com/pretty/keyboard/theme/keyboard/listadapter/AllAdapter.java +++ b/app/src/main/java/com/pretty/keyboard/theme/keyboard/listadapter/AllTabAdapter.java @@ -17,7 +17,7 @@ import com.pretty.keyboard.theme.keyboard.bean.DataClass; import java.util.List; -public class AllAdapter extends RecyclerView.Adapter { +public class AllTabAdapter extends RecyclerView.Adapter { private Context mContext; private List viewAllList; @@ -28,7 +28,7 @@ public class AllAdapter extends RecyclerView.Adapter - private lateinit var tabAdapter: AllAdapter + private lateinit var tabAdapter: AllTabAdapter private lateinit var imgBack: ImageView override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_layout_view_all) + AdManager.loadAllAd() Common.initFullScreen(this) findViewId() setTabRecycler() @@ -36,7 +38,10 @@ class AllActivity : AppCompatActivity() { viewContent = findViewById(R.id.view_pager_content) imgBack = findViewById(R.id.back) imgBack.setOnClickListener { - finish() + AdManager.showTopOn(this@AllActivity){ + finish() + } + } } @@ -53,11 +58,11 @@ class AllActivity : AppCompatActivity() { add(first[0]) addAll(shuffled) } - tabAdapter = AllAdapter( + tabAdapter = AllTabAdapter( this@AllActivity ).apply { tabTitleName(viewAllList) - setChangeListener (object : AllAdapter.OnChangListener{ + setChangeListener (object : AllTabAdapter.OnChangListener{ override fun onChange(posit: Int) { viewContent.setCurrentItem(posit,false) } diff --git a/app/src/main/java/com/pretty/keyboard/theme/keyboard/ui/ApplySkinActivity.kt b/app/src/main/java/com/pretty/keyboard/theme/keyboard/ui/ApplySkinActivity.kt index 0733773..d3ac305 100644 --- a/app/src/main/java/com/pretty/keyboard/theme/keyboard/ui/ApplySkinActivity.kt +++ b/app/src/main/java/com/pretty/keyboard/theme/keyboard/ui/ApplySkinActivity.kt @@ -22,6 +22,7 @@ import com.bumptech.glide.request.RequestListener import com.bumptech.glide.request.target.Target import com.pretty.keyboard.theme.keyboard.MyApp import com.pretty.keyboard.theme.keyboard.R +import com.pretty.keyboard.theme.keyboard.ad.AdManager import com.pretty.keyboard.theme.keyboard.callback.ApplySkinListener import com.pretty.keyboard.theme.keyboard.callback.ItemClickListener import com.pretty.keyboard.theme.keyboard.dialogfragment.ActiveDialog @@ -49,6 +50,10 @@ class ApplySkinActivity : AppCompatActivity() { @JvmField val THUMB_KEY = "thumb_key" + + + @JvmField + val IS_MAIN = "is_main" } private var dialog: ActiveDialog? = null @@ -72,12 +77,16 @@ class ApplySkinActivity : AppCompatActivity() { private lateinit var imDownload: ImageView private lateinit var thumb: String + private var isMain:Boolean = false override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_layout_apply) Common.initFullScreen(this) + AdManager.showTopOn(this){ + } + AdManager.loadAllAd() findViewId() getExtraData() displayData() @@ -92,12 +101,15 @@ class ApplySkinActivity : AppCompatActivity() { name = intent.getStringExtra(NAME_KEY).toString() gifUrl = intent.getStringExtra(GIF_KEY).toString() thumb = intent.getStringExtra(THUMB_KEY).toString() + isMain = intent.getBooleanExtra(IS_MAIN,false) + + + + Log.d(MyApp.TAG, "zipUrl==== $zipUrl") val serviceZipName = DownloadUtils.getServiceZipName(zipUrl) unzipPath = DownloadUtils.getUnzipPath(serviceZipName) - - if (File(unzipPath).exists()) { imDownload.isVisible = false tvDownload.text = getString(R.string.apply) @@ -136,11 +148,21 @@ class ApplySkinActivity : AppCompatActivity() { private fun onClick() { imgBack.setOnClickListener { - finish() + if(isMain){ + AdManager.showTopOn(this@ApplySkinActivity){ + finish() + } + }else{ + finish() + } + + } viewAllLayout.setOnClickListener { - startActivity(Intent(this, AllActivity::class.java)) - finish() + AdManager.showTopOn(this) { + startActivity(Intent(this, AllActivity::class.java)) + finish() + } } val forYouList = MyApp.list.filter { @@ -204,13 +226,16 @@ class ApplySkinActivity : AppCompatActivity() { private fun setApply() { applyBtn.setOnClickListener { - val checkEnable = InputUtils.checkEnable(this) - val checkSetDefault = InputUtils.checkSetDefault(this) - if (!checkEnable || !checkSetDefault) { - showDialog() - return@setOnClickListener + AdManager.showTopOn(this@ApplySkinActivity){ + val checkEnable = InputUtils.checkEnable(this) + val checkSetDefault = InputUtils.checkSetDefault(this) + if (!checkEnable || !checkSetDefault) { + showDialog() + return@showTopOn + } + startDown() } - startDown() + } } @@ -229,11 +254,6 @@ class ApplySkinActivity : AppCompatActivity() { val file = File(unzipPath) if (file.exists()) { val findFirstDirectory = DownloadUtils.findFirstDirectory(file) - - Log.d( - MyApp.TAG, - "-----findFirstDirectory=$findFirstDirectory" - ) apply("${findFirstDirectory}/") applyBtn.isEnabled = true loadingLayout.isVisible = false diff --git a/app/src/main/java/com/pretty/keyboard/theme/keyboard/ui/HomeActivity.kt b/app/src/main/java/com/pretty/keyboard/theme/keyboard/ui/HomeActivity.kt index eaf833e..4f79af1 100644 --- a/app/src/main/java/com/pretty/keyboard/theme/keyboard/ui/HomeActivity.kt +++ b/app/src/main/java/com/pretty/keyboard/theme/keyboard/ui/HomeActivity.kt @@ -15,6 +15,7 @@ import androidx.recyclerview.widget.RecyclerView import com.bumptech.glide.Glide import com.pretty.keyboard.theme.keyboard.MyApp import com.pretty.keyboard.theme.keyboard.R +import com.pretty.keyboard.theme.keyboard.ad.AdManager import com.pretty.keyboard.theme.keyboard.bean.Info import com.pretty.keyboard.theme.keyboard.dialogfragment.ActiveDialog import com.pretty.keyboard.theme.keyboard.listadapter.MainAdapter @@ -27,7 +28,7 @@ class HomeActivity : AppCompatActivity() { private lateinit var forYouRecycler: RecyclerView private lateinit var viewAllLayout: LinearLayout - private lateinit var menuView: ImageView + private lateinit var drawView: DrawerLayout private lateinit var keySetting: LinearLayout @@ -56,7 +57,7 @@ class HomeActivity : AppCompatActivity() { private fun findViewId() { forYouRecycler = findViewById(R.id.for_you_recycler) viewAllLayout = findViewById(R.id.layout_view_all) - menuView = findViewById(R.id.imageMenu) + drawView = findViewById(R.id.drawLayout) keySetting = findViewById(R.id.layout_keyboard_setting) layoutRate = findViewById(R.id.layout_rate) @@ -85,35 +86,29 @@ class HomeActivity : AppCompatActivity() { return@setOnClickListener } - val intentApply = Intent(this, ApplySkinActivity::class.java) - intentApply.putExtra(ApplySkinActivity.DISPLAY_URL_KEY, bannerInfo!!.imgPath) - intentApply.putExtra(ApplySkinActivity.ZIP_URL_KEY, bannerInfo!!.zipPath) - intentApply.putExtra(ApplySkinActivity.NAME_KEY, bannerInfo!!.titleName) - intentApply.putExtra(ApplySkinActivity.GIF_KEY, bannerInfo!!.imgGif) - if(!bannerInfo!!.thumbGif.isNullOrEmpty()){ - intentApply.putExtra(ApplySkinActivity.THUMB_KEY,bannerInfo!!.thumbGif) - }else{ - intentApply.putExtra(ApplySkinActivity.THUMB_KEY,bannerInfo!!.thumbUrl) - } - startActivity(intentApply) + val intentApply = Intent(this, ApplySkinActivity::class.java) + intentApply.putExtra(ApplySkinActivity.DISPLAY_URL_KEY, bannerInfo!!.imgPath) + intentApply.putExtra(ApplySkinActivity.ZIP_URL_KEY, bannerInfo!!.zipPath) + intentApply.putExtra(ApplySkinActivity.NAME_KEY, bannerInfo!!.titleName) + intentApply.putExtra(ApplySkinActivity.GIF_KEY, bannerInfo!!.imgGif) + intentApply.putExtra(ApplySkinActivity.IS_MAIN,true) + if(!bannerInfo!!.thumbGif.isNullOrEmpty()){ + intentApply.putExtra(ApplySkinActivity.THUMB_KEY,bannerInfo!!.thumbGif) + }else{ + intentApply.putExtra(ApplySkinActivity.THUMB_KEY,bannerInfo!!.thumbUrl) + } + startActivity(intentApply) + } viewAllLayout.setOnClickListener { - startActivity(Intent(this, AllActivity::class.java)) - } - menuView.setOnClickListener { - drawView.openDrawer(GravityCompat.END) + AdManager.showTopOn(this){ + startActivity(Intent(this, AllActivity::class.java)) + } + } - layoutRate.setOnClickListener { - val intent = Intent(Intent.ACTION_VIEW) - intent.data = Uri.parse(getString(R.string.app_google_play)+packageName) - startActivity(intent) - } - layoutPrivacy.setOnClickListener { - val intent = Intent(Intent.ACTION_VIEW) - intent.data = Uri.parse(getString(R.string.app_privacy_path)) - startActivity(intent) - } + + } diff --git a/app/src/main/java/com/pretty/keyboard/theme/keyboard/ui/SettingActivity.kt b/app/src/main/java/com/pretty/keyboard/theme/keyboard/ui/SettingActivity.kt deleted file mode 100644 index 3cc598d..0000000 --- a/app/src/main/java/com/pretty/keyboard/theme/keyboard/ui/SettingActivity.kt +++ /dev/null @@ -1,118 +0,0 @@ -package com.pretty.keyboard.theme.keyboard.ui - -import android.annotation.SuppressLint -import android.content.BroadcastReceiver -import android.content.Context -import android.content.Intent -import android.content.IntentFilter -import androidx.appcompat.app.AppCompatActivity -import android.os.Bundle -import android.provider.Settings -import android.view.inputmethod.InputMethodManager -import android.widget.ImageView -import android.widget.LinearLayout -import android.widget.TextView -import androidx.core.view.isVisible -import com.pretty.keyboard.theme.keyboard.R -import com.pretty.keyboard.theme.keyboard.utils.Common -import com.pretty.keyboard.theme.keyboard.utils.InputUtils - -class SettingActivity : AppCompatActivity() { - - private lateinit var layoutStepOne: LinearLayout - private lateinit var imgBack: ImageView - private lateinit var layoutStepTwo: LinearLayout - private lateinit var imgStepOkOne: ImageView - private lateinit var imgStepOkTwo: ImageView - private lateinit var intentFilter:IntentFilter - private var myreceiver:BroadcastReceiver?= null - - private lateinit var stepOne:TextView - private lateinit var stepTwo:TextView - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - setContentView(R.layout.dialog_layout_active) - Common.initFullScreen(this) - findViewId() - onViewStep() - getReceiver() - } - - @SuppressLint("SuspiciousIndentation") - private fun findViewId() { - layoutStepOne = findViewById(R.id.linear_step_one) - layoutStepTwo = findViewById(R.id.linear_step_two) - imgBack = findViewById(R.id.back) - imgStepOkOne = findViewById(R.id.ok_one) - imgStepOkTwo = findViewById(R.id.ok_two) - stepOne= findViewById(R.id.text_step_one) - stepTwo= findViewById(R.id.text_step_two) - } - - private fun onViewStep(){ - imgBack.setOnClickListener { - finish() - } - layoutStepOne.setOnClickListener { - startActivity(Intent(Settings.ACTION_INPUT_METHOD_SETTINGS)) - } - layoutStepTwo.setOnClickListener { - val inputMethodManager = this.getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager - inputMethodManager.showInputMethodPicker() - } - } - - override fun onResume() { - super.onResume() - updateUI() - } - - private fun getReceiver(){ - myreceiver = object :BroadcastReceiver(){ - override fun onReceive(context: Context?, intent: Intent?) { - updateUI() - } - } - intentFilter = IntentFilter(Intent.ACTION_INPUT_METHOD_CHANGED) - - registerReceiver(myreceiver,intentFilter) - } - - private fun updateUI(){ - - val checkEnable = InputUtils.checkEnable(this) - val checkSetDefault = InputUtils.checkSetDefault(this) - if(checkEnable){ - layoutStepOne.isEnabled =false - layoutStepOne.isSelected = true - imgStepOkOne.isVisible = true - stepOne.setTextColor(getColor(R.color.step_true)) - }else{ - layoutStepOne.isEnabled =true - layoutStepOne.isSelected = false - imgStepOkOne.isVisible = false - stepOne.setTextColor(getColor(R.color.white)) - } - - if(checkSetDefault){ - layoutStepTwo.isEnabled =false - layoutStepTwo.isSelected = true - imgStepOkTwo.isVisible = true - stepTwo.setTextColor(getColor(R.color.step_true)) - }else{ - layoutStepTwo.isEnabled =true - layoutStepTwo.isSelected = false - imgStepOkTwo.isVisible = false - stepTwo.setTextColor(getColor(R.color.white)) - } - - - } - - override fun onDestroy() { - super.onDestroy() - if(myreceiver != null){ - unregisterReceiver(myreceiver) - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/pretty/keyboard/theme/keyboard/ui/SuccessActivity.java b/app/src/main/java/com/pretty/keyboard/theme/keyboard/ui/SuccessActivity.java index 2c71d6b..f61c13b 100644 --- a/app/src/main/java/com/pretty/keyboard/theme/keyboard/ui/SuccessActivity.java +++ b/app/src/main/java/com/pretty/keyboard/theme/keyboard/ui/SuccessActivity.java @@ -19,6 +19,7 @@ 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.Target; +import com.pretty.keyboard.theme.keyboard.ad.AdManager; import com.pretty.keyboard.theme.keyboard.databinding.ActivitySuccessBinding; import com.pretty.keyboard.theme.keyboard.utils.Common; import com.pretty.keyboard.theme.keyboard.utils.Save; @@ -37,6 +38,7 @@ public class SuccessActivity extends AppCompatActivity { protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); Common.INSTANCE.initFullScreen(this); + AdManager.loadAllAd(); vb = ActivitySuccessBinding.inflate(getLayoutInflater()); setContentView(vb.getRoot()); Common.INSTANCE.initFullScreen(this); diff --git a/app/src/main/java/com/pretty/keyboard/theme/keyboard/ui/WelActivity.kt b/app/src/main/java/com/pretty/keyboard/theme/keyboard/ui/WelActivity.kt index dbd5053..69f9519 100644 --- a/app/src/main/java/com/pretty/keyboard/theme/keyboard/ui/WelActivity.kt +++ b/app/src/main/java/com/pretty/keyboard/theme/keyboard/ui/WelActivity.kt @@ -3,43 +3,41 @@ package com.pretty.keyboard.theme.keyboard.ui import android.content.Intent import android.os.Bundle import android.os.CountDownTimer -import android.widget.ImageView import android.widget.ProgressBar import androidx.appcompat.app.AppCompatActivity import com.pretty.keyboard.theme.keyboard.R +import com.pretty.keyboard.theme.keyboard.ad.AdManager import com.pretty.keyboard.theme.keyboard.utils.Common import kotlin.math.roundToInt class WelActivity : AppCompatActivity() { private lateinit var progressBar: ProgressBar - private var countTime = 1000L - private lateinit var timer: CountDownTimer + private var countTime = 12000L + private var timer: CountDownTimer? =null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_layout_wel) Common.initFullScreen(this) + AdManager.loadAllAd() init() findView() } private fun init() { - timer = object : CountDownTimer(countTime, 100) { - override fun onTick(millisUntilFinished: Long) { - val percentage: Float = 100 - millisUntilFinished.toFloat() / countTime * 100 - val round = percentage.roundToInt() - progressBar.progress = round - } + timer = AdManager.showWelcomeAd(this, countTime, { + val percentage: Float = 100 - it.toFloat() / countTime * 100 + val round = percentage.roundToInt() + progressBar.progress = round + }, { + progressBar.progress = 100 + toHome() + }) - override fun onFinish() { - progressBar.progress = 100 - toHome() - } - } - timer.start() + timer?.start() } @@ -56,7 +54,8 @@ class WelActivity : AppCompatActivity() { override fun onDestroy() { super.onDestroy() - timer.cancel() + timer?.cancel() + timer = null } diff --git a/app/src/main/res/layout/activity_layout_home.xml b/app/src/main/res/layout/activity_layout_home.xml index a8205ef..812c120 100644 --- a/app/src/main/res/layout/activity_layout_home.xml +++ b/app/src/main/res/layout/activity_layout_home.xml @@ -25,15 +25,7 @@ app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintTop_toTopOf="parent" /> - + https://marielathama.bitbucket.io/privacy.html Recommended Keyboard settings - Activate Nova keyboard to enable MORE functions! + Activate Pretty Keyboard to enable MORE functions! Step 1:Select Step 2:Enable Theme application successful diff --git a/gradle.properties b/gradle.properties index 3c5031e..debf753 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ # http://www.gradle.org/docs/current/userguide/build_environment.html # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. -org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 +org.gradle.jvmargs=-Xmx4096m -Dfile.encoding=UTF-8 # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects diff --git a/settings.gradle.kts b/settings.gradle.kts index 96e83ee..c3028b9 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -13,16 +13,26 @@ dependencyResolutionManagement { mavenCentral() maven("https://jitpack.io") -// //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集成测试工具 + //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") } }