V1.0.1(2) topon 广告

This commit is contained in:
litingting 2024-11-28 18:11:41 +08:00
parent 8388b2928e
commit c620f43587
22 changed files with 645 additions and 270 deletions

View File

@ -18,8 +18,8 @@ android {
applicationId = "com.pretty.keyboard.theme" applicationId = "com.pretty.keyboard.theme"
minSdk = 23 minSdk = 23
targetSdk = 34 targetSdk = 34
versionCode = 1 versionCode = 2
versionName = "1.0.0" versionName = "1.0.1"
setProperty( setProperty(
"archivesBaseName", "archivesBaseName",
"Pretty Keyboard_V" + versionName + "(${versionCode})_$timestamp" "Pretty Keyboard_V" + versionName + "(${versionCode})_$timestamp"
@ -78,63 +78,95 @@ dependencies {
implementation("com.google.firebase:firebase-config") implementation("com.google.firebase:firebase-config")
//-----------------------------------------------TopOn(pangle、IronSource、mintegral、unityads、liftoff(vungle)、Bigo) //-----------------------------------------------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.3.68") //Anythink (Necessary)
// implementation("com.anythink.sdk:nativead-tpn:6.3.68") implementation("com.anythink.sdk:core-tpn:6.4.07")
// implementation("com.anythink.sdk:banner-tpn:6.3.68") implementation("com.anythink.sdk:nativead-tpn:6.4.07")
// implementation("com.anythink.sdk:interstitial-tpn:6.3.68") implementation("com.anythink.sdk:banner-tpn:6.4.07")
// implementation("com.anythink.sdk:rewardedvideo-tpn:6.3.68") implementation("com.anythink.sdk:interstitial-tpn:6.4.07")
// implementation("com.anythink.sdk:splash-tpn:6.3.68") 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") //Androidx (Necessary)
// implementation("androidx.browser:browser:1.4.0") 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") //StartApp
// implementation("com.vungle:vungle-ads:7.3.2") implementation("com.anythink.sdk:adapter-tpn-startapp:6.4.07")
// implementation("com.google.android.gms:play-services-basement:18.1.0") implementation("com.startapp:inapp-sdk:5.0.2")
// implementation("com.google.android.gms:play-services-ads-identifier:18.0.1")
// //Appnext
// //UnityAds implementation("com.anythink.sdk:adapter-tpn-appnext:6.4.07")
// implementation("com.anythink.sdk:adapter-tpn-unityads:6.3.68") implementation("com.appnext.sdk:ads:2.7.1.473")
// implementation("com.unity3d.ads:unity-ads:4.9.3") implementation("com.appnext.sdk:banners:2.7.1.473")
// implementation("com.appnext.sdk:native-ads2:2.7.1.473")
// //Ironsource implementation("com.appnext.sdk:actions:2.4.6.472")
// implementation("com.anythink.sdk:adapter-tpn-ironsource:6.3.68") implementation("androidx.constraintlayout:constraintlayout:2.0.4")
// implementation("com.ironsource.sdk:mediationsdk:8.1.0")
// implementation("com.google.android.gms:play-services-appset:16.0.2") //Vungle
// implementation("com.google.android.gms:play-services-ads-identifier:18.0.1") implementation("com.anythink.sdk:adapter-tpn-vungle:6.4.07")
// implementation("com.google.android.gms:play-services-basement:18.1.0") implementation("com.vungle:vungle-ads:7.4.0")
// implementation("com.google.android.gms:play-services-basement:18.1.0")
// //Bigo implementation("com.google.android.gms:play-services-ads-identifier:18.0.1")
// implementation("com.anythink.sdk:adapter-tpn-bigo:6.3.68")
// implementation("com.bigossp:bigo-ads:4.7.4") //UnityAds
// implementation("com.anythink.sdk:adapter-tpn-unityads:6.4.07")
// //Pangle implementation("com.unity3d.ads:unity-ads:4.12.2")
// implementation("com.anythink.sdk:adapter-tpn-pangle-nonchina:6.3.68.1")
// implementation( "com.pangle.global:ads-sdk:6.0.0.3") //Ironsource
// implementation( "com.google.android.gms:play-services-ads-identifier:18.0.1") implementation("com.anythink.sdk:adapter-tpn-ironsource:6.4.07")
// implementation("com.ironsource.sdk:mediationsdk:8.2.1")
// //Mintegral implementation("com.google.android.gms:play-services-appset:16.0.2")
// implementation("com.anythink.sdk:adapter-tpn-mintegral-nonchina:6.3.68") implementation("com.google.android.gms:play-services-ads-identifier:18.0.1")
// implementation("com.mbridge.msdk.oversea:reward:16.7.51") implementation("com.google.android.gms:play-services-basement:18.1.0")
// implementation("com.mbridge.msdk.oversea:newinterstitial:16.7.51")
// implementation("com.mbridge.msdk.oversea:mbnative:16.7.51") //Bigo
// implementation("com.mbridge.msdk.oversea:mbnativeadvanced:16.7.51") implementation("com.anythink.sdk:adapter-tpn-bigo:6.4.07")
// implementation("com.mbridge.msdk.oversea:mbsplash:16.7.51") implementation("com.bigossp:bigo-ads:4.9.0")
// implementation("com.mbridge.msdk.oversea:mbbanner:16.7.51")
// implementation("com.mbridge.msdk.oversea:mbbid:16.7.51") //Pangle
// implementation("androidx.recyclerview:recyclerview:1.1.0") implementation("com.anythink.sdk:adapter-tpn-pangle-nonchina:6.4.07")
// implementation("com.pangle.global:ads-sdk:6.1.0.9")
// //Tramini implementation("com.google.android.gms:play-services-ads-identifier:18.0.1")
// implementation("com.anythink.sdk:tramini-plugin-tpn:6.3.68")
// //Inmobi
// // Debugger UI Tools implementation("com.anythink.sdk:adapter-tpn-inmobi:6.4.07")
// implementation ("com.anythink.sdk:debugger-ui:1.0.7") 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
} }

130
app/proguard-rules.pro vendored
View File

@ -57,3 +57,133 @@
-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

@ -23,10 +23,7 @@
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity
android:name=".ui.SettingActivity"
android:screenOrientation="portrait"
android:exported="false" />
<activity <activity
android:name=".ui.ApplySkinActivity" android:name=".ui.ApplySkinActivity"
android:screenOrientation="portrait" android:screenOrientation="portrait"

View File

@ -2,7 +2,10 @@ package com.pretty.keyboard.theme.keyboard
import android.app.Application import android.app.Application
import android.util.Log import android.util.Log
import com.anythink.core.api.ATSDK
import com.anythink.core.api.NetTrafficeCallback
import com.google.firebase.FirebaseApp import com.google.firebase.FirebaseApp
import com.pretty.keyboard.theme.keyboard.ad.AdManager
import com.pretty.keyboard.theme.keyboard.bean.DataClass import com.pretty.keyboard.theme.keyboard.bean.DataClass
import com.pretty.keyboard.theme.keyboard.bean.Info import com.pretty.keyboard.theme.keyboard.bean.Info
import org.json.JSONArray import org.json.JSONArray
@ -22,9 +25,12 @@ class MyApp : Application() {
} }
private val appId = "h6747e01b51741"
private val appKey= "a932869092832f1ee359fc3655b7d8afe"
override fun onCreate() { override fun onCreate() {
super.onCreate() super.onCreate()
appInstance = this appInstance = this
initAd()
dealFile() dealFile()
} }
@ -115,5 +121,25 @@ class MyApp : Application() {
} }
private fun initAd(){
ATSDK.checkIsEuTraffic(this, object : NetTrafficeCallback {
override fun onResultCallback(isEU: Boolean) {
Log.e(TAG, "onResultCallback:$isEU")
if (isEU && ATSDK.getGDPRDataLevel(this@MyApp) == ATSDK.UNKNOWN) {
ATSDK.showGdprAuth(this@MyApp)
}
}
override fun onErrorCallback(errorMsg: String) {
Log.e(TAG, "onErrorCallback:$errorMsg")
}
})
ATSDK.init( this, appId, appKey)
AdManager.loadAllAd()
//测试工具
// ATDebuggerUITest.showDebuggerUI(this,debug_KEy);
}
} }

View File

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

View File

@ -0,0 +1,253 @@
package com.pretty.keyboard.theme.keyboard.ad;
import android.app.Activity;
import android.os.CountDownTimer;
import android.util.Log;
import androidx.annotation.NonNull;
import com.anythink.core.api.ATAdInfo;
import com.anythink.core.api.AdError;
import com.anythink.interstitial.api.ATInterstitial;
import com.anythink.interstitial.api.ATInterstitialListener;
import com.pretty.keyboard.theme.keyboard.MyApp;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class AdManager {
private static final int type_no_cache = 0;
private static final int type_has_cache = 1;
private static final int type_show_success = 2;
private static final int type_show_close = 3;
private static final int type_show_fail = 4;
/**
Pretty_inter_3
n6747e0402540d
Pretty_inter_2
n6747e03fc8133
Pretty_inter_1
n6747e03f75505
*/
private static final String place1Id = "n6747e0402540d";
private static final String place2Id = "n6747e03fc8133";
private static final String place3Id = "n6747e03f75505";
private static boolean place1LoadFail = false;
private static boolean place2LoadFail = false;
private static boolean place3LoadFail = false;
private static boolean alreadyShow = false;
private static List<ATInterstitial> list = new ArrayList<>();
public static void loadAllAd() {
if (list.size() == 0) {
ATInterstitial mInterstitialAd1 = new ATInterstitial(MyApp.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();
}
}
});
}
}

View File

@ -0,0 +1,5 @@
package com.pretty.keyboard.theme.keyboard.ad;
public interface AdStatusAction {
void onStatus(int adType);
}

View File

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

View File

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

View File

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

View File

@ -17,7 +17,7 @@ import com.pretty.keyboard.theme.keyboard.bean.DataClass;
import java.util.List; import java.util.List;
public class AllAdapter extends RecyclerView.Adapter<AllAdapter.ViewAllTabViewHolder> { public class AllTabAdapter extends RecyclerView.Adapter<AllTabAdapter.ViewAllTabViewHolder> {
private Context mContext; private Context mContext;
private List<DataClass> viewAllList; private List<DataClass> viewAllList;
@ -28,7 +28,7 @@ public class AllAdapter extends RecyclerView.Adapter<AllAdapter.ViewAllTabViewHo
private int oldSelectedPos = -1; private int oldSelectedPos = -1;
public AllAdapter(Context context) { public AllTabAdapter(Context context) {
mContext = context; mContext = context;
} }
@ -47,13 +47,13 @@ public class AllAdapter extends RecyclerView.Adapter<AllAdapter.ViewAllTabViewHo
@NonNull @NonNull
@Override @Override
public AllAdapter.ViewAllTabViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { public AllTabAdapter.ViewAllTabViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(mContext).inflate(R.layout.item_all_layout, parent, false); View view = LayoutInflater.from(mContext).inflate(R.layout.item_all_layout, parent, false);
return new AllAdapter.ViewAllTabViewHolder(view); return new AllTabAdapter.ViewAllTabViewHolder(view);
} }
@Override @Override
public void onBindViewHolder(@NonNull AllAdapter.ViewAllTabViewHolder holder, int pos) { public void onBindViewHolder(@NonNull AllTabAdapter.ViewAllTabViewHolder holder, int pos) {
DataClass dataClass = viewAllList.get(pos); DataClass dataClass = viewAllList.get(pos);
holder.tabTitle.setText(dataClass.getParentName().toUpperCase()); holder.tabTitle.setText(dataClass.getParentName().toUpperCase());

View File

@ -13,6 +13,7 @@ import androidx.cardview.widget.CardView;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.pretty.keyboard.theme.keyboard.R; import com.pretty.keyboard.theme.keyboard.R;
import com.pretty.keyboard.theme.keyboard.ad.AdManager;
import com.pretty.keyboard.theme.keyboard.callback.ItemClickListener; import com.pretty.keyboard.theme.keyboard.callback.ItemClickListener;
import com.pretty.keyboard.theme.keyboard.bean.Info; import com.pretty.keyboard.theme.keyboard.bean.Info;
import com.pretty.keyboard.theme.keyboard.ui.ApplySkinActivity; import com.pretty.keyboard.theme.keyboard.ui.ApplySkinActivity;

View File

@ -11,20 +11,22 @@ import androidx.viewpager.widget.ViewPager
import androidx.viewpager.widget.ViewPager.OnPageChangeListener import androidx.viewpager.widget.ViewPager.OnPageChangeListener
import com.pretty.keyboard.theme.keyboard.MyApp import com.pretty.keyboard.theme.keyboard.MyApp
import com.pretty.keyboard.theme.keyboard.R import com.pretty.keyboard.theme.keyboard.R
import com.pretty.keyboard.theme.keyboard.ad.AdManager
import com.pretty.keyboard.theme.keyboard.bean.DataClass import com.pretty.keyboard.theme.keyboard.bean.DataClass
import com.pretty.keyboard.theme.keyboard.listadapter.AllAdapter import com.pretty.keyboard.theme.keyboard.listadapter.AllTabAdapter
import com.pretty.keyboard.theme.keyboard.utils.Common import com.pretty.keyboard.theme.keyboard.utils.Common
class AllActivity : AppCompatActivity() { class AllActivity : AppCompatActivity() {
private lateinit var tabRecycler: RecyclerView private lateinit var tabRecycler: RecyclerView
private lateinit var viewContent: ViewPager private lateinit var viewContent: ViewPager
lateinit var viewAllList:MutableList<DataClass> lateinit var viewAllList:MutableList<DataClass>
private lateinit var tabAdapter: AllAdapter private lateinit var tabAdapter: AllTabAdapter
private lateinit var imgBack: ImageView private lateinit var imgBack: ImageView
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_layout_view_all) setContentView(R.layout.activity_layout_view_all)
AdManager.loadAllAd()
Common.initFullScreen(this) Common.initFullScreen(this)
findViewId() findViewId()
setTabRecycler() setTabRecycler()
@ -36,8 +38,11 @@ class AllActivity : AppCompatActivity() {
viewContent = findViewById(R.id.view_pager_content) viewContent = findViewById(R.id.view_pager_content)
imgBack = findViewById(R.id.back) imgBack = findViewById(R.id.back)
imgBack.setOnClickListener { imgBack.setOnClickListener {
AdManager.showTopOn(this@AllActivity){
finish() finish()
} }
}
} }
private fun setTabRecycler(){ private fun setTabRecycler(){
@ -53,11 +58,11 @@ class AllActivity : AppCompatActivity() {
add(first[0]) add(first[0])
addAll(shuffled) addAll(shuffled)
} }
tabAdapter = AllAdapter( tabAdapter = AllTabAdapter(
this@AllActivity this@AllActivity
).apply { ).apply {
tabTitleName(viewAllList) tabTitleName(viewAllList)
setChangeListener (object : AllAdapter.OnChangListener{ setChangeListener (object : AllTabAdapter.OnChangListener{
override fun onChange(posit: Int) { override fun onChange(posit: Int) {
viewContent.setCurrentItem(posit,false) viewContent.setCurrentItem(posit,false)
} }

View File

@ -22,6 +22,7 @@ import com.bumptech.glide.request.RequestListener
import com.bumptech.glide.request.target.Target import com.bumptech.glide.request.target.Target
import com.pretty.keyboard.theme.keyboard.MyApp import com.pretty.keyboard.theme.keyboard.MyApp
import com.pretty.keyboard.theme.keyboard.R 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.ApplySkinListener
import com.pretty.keyboard.theme.keyboard.callback.ItemClickListener import com.pretty.keyboard.theme.keyboard.callback.ItemClickListener
import com.pretty.keyboard.theme.keyboard.dialogfragment.ActiveDialog import com.pretty.keyboard.theme.keyboard.dialogfragment.ActiveDialog
@ -49,6 +50,10 @@ class ApplySkinActivity : AppCompatActivity() {
@JvmField @JvmField
val THUMB_KEY = "thumb_key" val THUMB_KEY = "thumb_key"
@JvmField
val IS_MAIN = "is_main"
} }
private var dialog: ActiveDialog? = null private var dialog: ActiveDialog? = null
@ -72,12 +77,16 @@ class ApplySkinActivity : AppCompatActivity() {
private lateinit var imDownload: ImageView private lateinit var imDownload: ImageView
private lateinit var thumb: String private lateinit var thumb: String
private var isMain:Boolean = false
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_layout_apply) setContentView(R.layout.activity_layout_apply)
Common.initFullScreen(this) Common.initFullScreen(this)
AdManager.showTopOn(this){
}
AdManager.loadAllAd()
findViewId() findViewId()
getExtraData() getExtraData()
displayData() displayData()
@ -92,12 +101,15 @@ class ApplySkinActivity : AppCompatActivity() {
name = intent.getStringExtra(NAME_KEY).toString() name = intent.getStringExtra(NAME_KEY).toString()
gifUrl = intent.getStringExtra(GIF_KEY).toString() gifUrl = intent.getStringExtra(GIF_KEY).toString()
thumb = intent.getStringExtra(THUMB_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) val serviceZipName = DownloadUtils.getServiceZipName(zipUrl)
unzipPath = DownloadUtils.getUnzipPath(serviceZipName) unzipPath = DownloadUtils.getUnzipPath(serviceZipName)
if (File(unzipPath).exists()) { if (File(unzipPath).exists()) {
imDownload.isVisible = false imDownload.isVisible = false
tvDownload.text = getString(R.string.apply) tvDownload.text = getString(R.string.apply)
@ -136,12 +148,22 @@ class ApplySkinActivity : AppCompatActivity() {
private fun onClick() { private fun onClick() {
imgBack.setOnClickListener { imgBack.setOnClickListener {
if(isMain){
AdManager.showTopOn(this@ApplySkinActivity){
finish() finish()
} }
}else{
finish()
}
}
viewAllLayout.setOnClickListener { viewAllLayout.setOnClickListener {
AdManager.showTopOn(this) {
startActivity(Intent(this, AllActivity::class.java)) startActivity(Intent(this, AllActivity::class.java))
finish() finish()
} }
}
val forYouList = MyApp.list.filter { val forYouList = MyApp.list.filter {
it.parentName == "for you" it.parentName == "for you"
@ -204,13 +226,16 @@ class ApplySkinActivity : AppCompatActivity() {
private fun setApply() { private fun setApply() {
applyBtn.setOnClickListener { applyBtn.setOnClickListener {
AdManager.showTopOn(this@ApplySkinActivity){
val checkEnable = InputUtils.checkEnable(this) val checkEnable = InputUtils.checkEnable(this)
val checkSetDefault = InputUtils.checkSetDefault(this) val checkSetDefault = InputUtils.checkSetDefault(this)
if (!checkEnable || !checkSetDefault) { if (!checkEnable || !checkSetDefault) {
showDialog() showDialog()
return@setOnClickListener return@showTopOn
} }
startDown() startDown()
}
} }
} }
@ -229,11 +254,6 @@ class ApplySkinActivity : AppCompatActivity() {
val file = File(unzipPath) val file = File(unzipPath)
if (file.exists()) { if (file.exists()) {
val findFirstDirectory = DownloadUtils.findFirstDirectory(file) val findFirstDirectory = DownloadUtils.findFirstDirectory(file)
Log.d(
MyApp.TAG,
"-----findFirstDirectory=$findFirstDirectory"
)
apply("${findFirstDirectory}/") apply("${findFirstDirectory}/")
applyBtn.isEnabled = true applyBtn.isEnabled = true
loadingLayout.isVisible = false loadingLayout.isVisible = false

View File

@ -15,6 +15,7 @@ import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
import com.pretty.keyboard.theme.keyboard.MyApp import com.pretty.keyboard.theme.keyboard.MyApp
import com.pretty.keyboard.theme.keyboard.R 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.bean.Info
import com.pretty.keyboard.theme.keyboard.dialogfragment.ActiveDialog import com.pretty.keyboard.theme.keyboard.dialogfragment.ActiveDialog
import com.pretty.keyboard.theme.keyboard.listadapter.MainAdapter import com.pretty.keyboard.theme.keyboard.listadapter.MainAdapter
@ -27,7 +28,7 @@ class HomeActivity : AppCompatActivity() {
private lateinit var forYouRecycler: RecyclerView private lateinit var forYouRecycler: RecyclerView
private lateinit var viewAllLayout: LinearLayout private lateinit var viewAllLayout: LinearLayout
private lateinit var menuView: ImageView
private lateinit var drawView: DrawerLayout private lateinit var drawView: DrawerLayout
private lateinit var keySetting: LinearLayout private lateinit var keySetting: LinearLayout
@ -56,7 +57,7 @@ class HomeActivity : AppCompatActivity() {
private fun findViewId() { private fun findViewId() {
forYouRecycler = findViewById(R.id.for_you_recycler) forYouRecycler = findViewById(R.id.for_you_recycler)
viewAllLayout = findViewById(R.id.layout_view_all) viewAllLayout = findViewById(R.id.layout_view_all)
menuView = findViewById(R.id.imageMenu)
drawView = findViewById(R.id.drawLayout) drawView = findViewById(R.id.drawLayout)
keySetting = findViewById(R.id.layout_keyboard_setting) keySetting = findViewById(R.id.layout_keyboard_setting)
layoutRate = findViewById(R.id.layout_rate) layoutRate = findViewById(R.id.layout_rate)
@ -90,30 +91,24 @@ class HomeActivity : AppCompatActivity() {
intentApply.putExtra(ApplySkinActivity.ZIP_URL_KEY, bannerInfo!!.zipPath) intentApply.putExtra(ApplySkinActivity.ZIP_URL_KEY, bannerInfo!!.zipPath)
intentApply.putExtra(ApplySkinActivity.NAME_KEY, bannerInfo!!.titleName) intentApply.putExtra(ApplySkinActivity.NAME_KEY, bannerInfo!!.titleName)
intentApply.putExtra(ApplySkinActivity.GIF_KEY, bannerInfo!!.imgGif) intentApply.putExtra(ApplySkinActivity.GIF_KEY, bannerInfo!!.imgGif)
intentApply.putExtra(ApplySkinActivity.IS_MAIN,true)
if(!bannerInfo!!.thumbGif.isNullOrEmpty()){ if(!bannerInfo!!.thumbGif.isNullOrEmpty()){
intentApply.putExtra(ApplySkinActivity.THUMB_KEY,bannerInfo!!.thumbGif) intentApply.putExtra(ApplySkinActivity.THUMB_KEY,bannerInfo!!.thumbGif)
}else{ }else{
intentApply.putExtra(ApplySkinActivity.THUMB_KEY,bannerInfo!!.thumbUrl) intentApply.putExtra(ApplySkinActivity.THUMB_KEY,bannerInfo!!.thumbUrl)
} }
startActivity(intentApply) startActivity(intentApply)
} }
viewAllLayout.setOnClickListener { viewAllLayout.setOnClickListener {
AdManager.showTopOn(this){
startActivity(Intent(this, AllActivity::class.java)) startActivity(Intent(this, AllActivity::class.java))
} }
menuView.setOnClickListener {
drawView.openDrawer(GravityCompat.END)
} }
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)
}
} }

View File

@ -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<LinearLayout>(R.id.linear_step_one)
layoutStepTwo = findViewById<LinearLayout>(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)
}
}
}

View File

@ -19,6 +19,7 @@ import com.bumptech.glide.load.DataSource;
import com.bumptech.glide.load.engine.GlideException; import com.bumptech.glide.load.engine.GlideException;
import com.bumptech.glide.request.RequestListener; import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.target.Target; 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.databinding.ActivitySuccessBinding;
import com.pretty.keyboard.theme.keyboard.utils.Common; import com.pretty.keyboard.theme.keyboard.utils.Common;
import com.pretty.keyboard.theme.keyboard.utils.Save; import com.pretty.keyboard.theme.keyboard.utils.Save;
@ -37,6 +38,7 @@ public class SuccessActivity extends AppCompatActivity {
protected void onCreate(@Nullable Bundle savedInstanceState) { protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
Common.INSTANCE.initFullScreen(this); Common.INSTANCE.initFullScreen(this);
AdManager.loadAllAd();
vb = ActivitySuccessBinding.inflate(getLayoutInflater()); vb = ActivitySuccessBinding.inflate(getLayoutInflater());
setContentView(vb.getRoot()); setContentView(vb.getRoot());
Common.INSTANCE.initFullScreen(this); Common.INSTANCE.initFullScreen(this);

View File

@ -3,43 +3,41 @@ package com.pretty.keyboard.theme.keyboard.ui
import android.content.Intent import android.content.Intent
import android.os.Bundle import android.os.Bundle
import android.os.CountDownTimer import android.os.CountDownTimer
import android.widget.ImageView
import android.widget.ProgressBar import android.widget.ProgressBar
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import com.pretty.keyboard.theme.keyboard.R import com.pretty.keyboard.theme.keyboard.R
import com.pretty.keyboard.theme.keyboard.ad.AdManager
import com.pretty.keyboard.theme.keyboard.utils.Common import com.pretty.keyboard.theme.keyboard.utils.Common
import kotlin.math.roundToInt import kotlin.math.roundToInt
class WelActivity : AppCompatActivity() { class WelActivity : AppCompatActivity() {
private lateinit var progressBar: ProgressBar private lateinit var progressBar: ProgressBar
private var countTime = 1000L private var countTime = 12000L
private lateinit var timer: CountDownTimer private var timer: CountDownTimer? =null
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_layout_wel) setContentView(R.layout.activity_layout_wel)
Common.initFullScreen(this) Common.initFullScreen(this)
AdManager.loadAllAd()
init() init()
findView() findView()
} }
private fun init() { private fun init() {
timer = object : CountDownTimer(countTime, 100) { timer = AdManager.showWelcomeAd(this, countTime, {
override fun onTick(millisUntilFinished: Long) { val percentage: Float = 100 - it.toFloat() / countTime * 100
val percentage: Float = 100 - millisUntilFinished.toFloat() / countTime * 100
val round = percentage.roundToInt() val round = percentage.roundToInt()
progressBar.progress = round progressBar.progress = round
} }, {
override fun onFinish() {
progressBar.progress = 100 progressBar.progress = 100
toHome() toHome()
} })
}
timer.start() timer?.start()
} }
@ -56,7 +54,8 @@ class WelActivity : AppCompatActivity() {
override fun onDestroy() { override fun onDestroy() {
super.onDestroy() super.onDestroy()
timer.cancel() timer?.cancel()
timer = null
} }

View File

@ -25,15 +25,7 @@
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:layout_width="34dp"
android:layout_height="34dp"
android:padding="5dp"
android:id="@+id/imageMenu"
android:visibility="gone"
app:layout_constraintTop_toTopOf="@id/text_view_appName"
app:layout_constraintEnd_toEndOf="@id/card_banner"
android:src="@mipmap/im_menu" />
<androidx.cardview.widget.CardView <androidx.cardview.widget.CardView

View File

@ -9,7 +9,7 @@
<string name="app_privacy_path">https://marielathama.bitbucket.io/privacy.html</string> <string name="app_privacy_path">https://marielathama.bitbucket.io/privacy.html</string>
<string name="recommended">Recommended</string> <string name="recommended">Recommended</string>
<string name="Keyboard_set">Keyboard settings</string> <string name="Keyboard_set">Keyboard settings</string>
<string name="open_str">Activate Nova keyboard to enable MORE functions!</string> <string name="open_str">Activate Pretty Keyboard to enable MORE functions!</string>
<string name="step_1">Step 1:Select</string> <string name="step_1">Step 1:Select</string>
<string name="step_2">Step 2:Enable</string> <string name="step_2">Step 2:Enable</string>
<string name="theme_application_successful">Theme application successful</string> <string name="theme_application_successful">Theme application successful</string>

View File

@ -6,7 +6,7 @@
# http://www.gradle.org/docs/current/userguide/build_environment.html # http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process. # Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings. # 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. # When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit # 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 # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects

View File

@ -13,16 +13,26 @@ dependencyResolutionManagement {
mavenCentral() mavenCentral()
maven("https://jitpack.io") maven("https://jitpack.io")
// //Anythink(Core) //Anythink(Core)
// maven("https://jfrog.anythinktech.com/artifactory/overseas_sdk") maven ("https://jfrog.anythinktech.com/artifactory/overseas_sdk")
// //Ironsource
// maven("https://android-sdk.is.com/") //Appnext
// //Mintegral maven ("https://dl.appnext.com")
// maven("https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea")
// //Pangle //Ironsource
// maven ( "https://artifact.bytedance.com/repository/pangle") maven ("https://android-sdk.is.com/")
//
// //TopOn集成测试工具 //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") // maven ( "https://jfrog.anythinktech.com/artifactory/debugger")
} }
} }