V1.0.1(1) 集成max广告
This commit is contained in:
parent
b7107c5cc5
commit
df103383eb
@ -8,10 +8,12 @@ plugins {
|
|||||||
id("com.google.firebase.crashlytics")
|
id("com.google.firebase.crashlytics")
|
||||||
kotlin("kapt")
|
kotlin("kapt")
|
||||||
id ("kotlin-android")
|
id ("kotlin-android")
|
||||||
|
id("applovin-quality-service")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
applovin {
|
||||||
|
apiKey = "Ap3tAuLQUbET7lPATOvLHQkgWaKanmaE36A5H6NyBekZRdG0QZU2J0rCbRhpZqz8XffKhS6GRDom9XnQqSlhTA"
|
||||||
|
}
|
||||||
val timestamp = SimpleDateFormat("MM_dd_HH_mm").format(Date())
|
val timestamp = SimpleDateFormat("MM_dd_HH_mm").format(Date())
|
||||||
android {
|
android {
|
||||||
namespace = "com.themes.fancy.keyboard.keyboard"
|
namespace = "com.themes.fancy.keyboard.keyboard"
|
||||||
@ -21,8 +23,8 @@ android {
|
|||||||
applicationId = "com.themes.fancy.keyboard"
|
applicationId = "com.themes.fancy.keyboard"
|
||||||
minSdk = 23
|
minSdk = 23
|
||||||
targetSdk = 34
|
targetSdk = 34
|
||||||
versionCode = 1
|
versionCode = 2
|
||||||
versionName = "1.0.0"
|
versionName = "1.0.1"
|
||||||
setProperty(
|
setProperty(
|
||||||
"archivesBaseName",
|
"archivesBaseName",
|
||||||
"Fancy Keyboard_V" + versionName + "(${versionCode})_$timestamp"
|
"Fancy Keyboard_V" + versionName + "(${versionCode})_$timestamp"
|
||||||
@ -86,63 +88,27 @@ dependencies {
|
|||||||
implementation("com.google.firebase:firebase-config")
|
implementation("com.google.firebase:firebase-config")
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------TopOn(pangle、IronSource、mintegral、unityads、liftoff(vungle)、Bigo)
|
//--------------------MAx
|
||||||
//Anythink (Necessary)
|
implementation("com.applovin:applovin-sdk:+")
|
||||||
// implementation("com.anythink.sdk:core-tpn:6.3.68")
|
implementation("com.applovin.mediation:bigoads-adapter:+")
|
||||||
// implementation("com.anythink.sdk:nativead-tpn:6.3.68")
|
implementation("com.applovin.mediation:chartboost-adapter:+")
|
||||||
// implementation("com.anythink.sdk:banner-tpn:6.3.68")
|
implementation("com.google.android.gms:play-services-base:16.1.0")
|
||||||
// implementation("com.anythink.sdk:interstitial-tpn:6.3.68")
|
implementation("com.applovin.mediation:fyber-adapter:+")
|
||||||
// implementation("com.anythink.sdk:rewardedvideo-tpn:6.3.68")
|
//Google Ad Manager
|
||||||
// implementation("com.anythink.sdk:splash-tpn:6.3.68")
|
// implementation("com.applovin.mediation:google-ad-manager-adapter:+")
|
||||||
//
|
|
||||||
// //Androidx (Necessary)
|
//Google Bidding and Google AdMob
|
||||||
// implementation("androidx.appcompat:appcompat:1.1.0")
|
// implementation("com.applovin.mediation:google-adapter:+")
|
||||||
// implementation("androidx.browser:browser:1.4.0")
|
implementation("com.applovin.mediation:inmobi-adapter:+")
|
||||||
//
|
implementation("com.squareup.picasso:picasso:2.71828")
|
||||||
// //Vungle
|
implementation("androidx.recyclerview:recyclerview:1.1.0")
|
||||||
// implementation("com.anythink.sdk:adapter-tpn-vungle:6.3.68")
|
implementation("com.applovin.mediation:ironsource-adapter:+")
|
||||||
// implementation("com.vungle:vungle-ads:7.3.2")
|
implementation("com.applovin.mediation:vungle-adapter:+")
|
||||||
// implementation("com.google.android.gms:play-services-basement:18.1.0")
|
implementation("com.applovin.mediation:facebook-adapter:+")
|
||||||
// implementation("com.google.android.gms:play-services-ads-identifier:18.0.1")
|
implementation("com.applovin.mediation:moloco-adapter:+")
|
||||||
//
|
implementation("com.applovin.mediation:bytedance-adapter:+")
|
||||||
// //UnityAds
|
implementation("com.applovin.mediation:unityads-adapter:+")
|
||||||
// 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
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
3
app/proguard-rules.pro
vendored
3
app/proguard-rules.pro
vendored
@ -43,3 +43,6 @@
|
|||||||
-keep class com.omicronapplications.** { *; }
|
-keep class com.omicronapplications.** { *; }
|
||||||
-keep class net.sf.sevenzipjbinding.** { *; }
|
-keep class net.sf.sevenzipjbinding.** { *; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,15 @@
|
|||||||
package com.themes.fancy.keyboard.keyboard
|
package com.themes.fancy.keyboard.keyboard
|
||||||
|
|
||||||
|
//import com.pretty.keyboard.theme.keyboard.helper.ObjectBox
|
||||||
import android.app.Application
|
import android.app.Application
|
||||||
|
import android.content.Intent
|
||||||
import android.graphics.Typeface
|
import android.graphics.Typeface
|
||||||
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager
|
||||||
|
import com.applovin.sdk.AppLovinMediationProvider
|
||||||
|
import com.applovin.sdk.AppLovinSdk
|
||||||
|
import com.applovin.sdk.AppLovinSdkInitializationConfiguration
|
||||||
import com.themes.fancy.keyboard.keyboard.data.Class
|
import com.themes.fancy.keyboard.keyboard.data.Class
|
||||||
import com.themes.fancy.keyboard.keyboard.data.KbSource
|
import com.themes.fancy.keyboard.keyboard.data.KbSource
|
||||||
//import com.pretty.keyboard.theme.keyboard.helper.ObjectBox
|
|
||||||
import org.json.JSONArray
|
import org.json.JSONArray
|
||||||
import java.io.BufferedReader
|
import java.io.BufferedReader
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
@ -22,12 +27,20 @@ class MyApplication : Application() {
|
|||||||
var defaultFont: Typeface? = null
|
var defaultFont: Typeface? = null
|
||||||
const val DB_VERSION = 1
|
const val DB_VERSION = 1
|
||||||
const val DB_NAME = "KEy"
|
const val DB_NAME = "KEy"
|
||||||
|
|
||||||
|
|
||||||
|
private const val MAx_SDK_key =
|
||||||
|
"3R_Opo3qdAFOciRXUG1wMgn3tWbv7SCl3649Glt_Q35HBLNBkRadTh3KBaDUZ0cvJXwcBg78Xa60W6UT1QN3l2"
|
||||||
|
|
||||||
|
var initSDkOK = false
|
||||||
|
var initAction = "SDK_INIT"
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
super.onCreate()
|
super.onCreate()
|
||||||
appInstance = this
|
appInstance = this
|
||||||
// ObjectBox.init(this)
|
// ObjectBox.init(this)
|
||||||
|
InitializeMax()
|
||||||
defaultFont = Typeface.createFromAsset(assets, "Bold.ttf")
|
defaultFont = Typeface.createFromAsset(assets, "Bold.ttf")
|
||||||
dealFile()
|
dealFile()
|
||||||
|
|
||||||
@ -71,13 +84,13 @@ class MyApplication : Application() {
|
|||||||
}
|
}
|
||||||
kbSourceList.add(
|
kbSourceList.add(
|
||||||
KbSource().apply {
|
KbSource().apply {
|
||||||
setImgPath(imgPath)
|
setImgPath(imgPath)
|
||||||
setZipPath(zipPath)
|
setZipPath(zipPath)
|
||||||
setTitleName(title)
|
setTitleName(title)
|
||||||
setImgGif(imgGif)
|
setImgGif(imgGif)
|
||||||
thumbUrl = thUrl
|
thumbUrl = thUrl
|
||||||
thumbGif = thGif
|
thumbGif = thGif
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,9 +98,9 @@ class MyApplication : Application() {
|
|||||||
|
|
||||||
val dataClass = Class()
|
val dataClass = Class()
|
||||||
.apply {
|
.apply {
|
||||||
parentName = pName
|
parentName = pName
|
||||||
keyboardList = kbSourceList
|
keyboardList = kbSourceList
|
||||||
}
|
}
|
||||||
dataList.add(dataClass)
|
dataList.add(dataClass)
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -101,6 +114,7 @@ class MyApplication : Application() {
|
|||||||
list = mainList
|
list = mainList
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getJsonString(fileInputStream: InputStream): String? {
|
private fun getJsonString(fileInputStream: InputStream): String? {
|
||||||
return try {
|
return try {
|
||||||
// FileInputStream fileInputStream = new FileInputStream(path);
|
// FileInputStream fileInputStream = new FileInputStream(path);
|
||||||
@ -119,5 +133,18 @@ class MyApplication : Application() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun InitializeMax() {
|
||||||
|
val initConfig = AppLovinSdkInitializationConfiguration.builder(MAx_SDK_key, this)
|
||||||
|
.setMediationProvider(AppLovinMediationProvider.MAX)
|
||||||
|
.build()
|
||||||
|
|
||||||
|
// Initialize the SDK with the configuration
|
||||||
|
AppLovinSdk.getInstance(this).initialize(initConfig) {
|
||||||
|
initSDkOK = true
|
||||||
|
LocalBroadcastManager.getInstance(this@MyApplication)
|
||||||
|
.sendBroadcast(Intent(initAction))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
package com.themes.fancy.keyboard.keyboard.max;
|
||||||
|
|
||||||
|
import com.applovin.mediation.MaxAd;
|
||||||
|
|
||||||
|
public interface MaxListener {
|
||||||
|
void onFail(MaxAd ad);
|
||||||
|
|
||||||
|
void onShowSuccess(MaxAd ad);
|
||||||
|
|
||||||
|
void onHidden();
|
||||||
|
}
|
||||||
@ -0,0 +1,181 @@
|
|||||||
|
package com.themes.fancy.keyboard.keyboard.max;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
|
||||||
|
import com.applovin.mediation.MaxAd;
|
||||||
|
import com.applovin.mediation.MaxAdListener;
|
||||||
|
import com.applovin.mediation.MaxError;
|
||||||
|
import com.applovin.mediation.ads.MaxInterstitialAd;
|
||||||
|
import com.themes.fancy.keyboard.keyboard.MyApplication;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class MaxManager {
|
||||||
|
/**
|
||||||
|
Fance_INST_Open
|
||||||
|
1a0f03313d368072
|
||||||
|
Fance_INST_Play
|
||||||
|
7bafe9fefecee023
|
||||||
|
Fance_INST_Seting
|
||||||
|
b7e78c541f19d6c1
|
||||||
|
*/
|
||||||
|
private static final String one_AD = "1a0f03313d368072";
|
||||||
|
private static final String two_Ad = "7bafe9fefecee023";
|
||||||
|
private static final String three_ad = "b7e78c541f19d6c1";
|
||||||
|
|
||||||
|
|
||||||
|
public static final int type_no_cache = 0;
|
||||||
|
public static final int type_has_cache = 1;
|
||||||
|
public static final int type_show_success = 2;
|
||||||
|
public static final int type_show_close = 3;
|
||||||
|
public static final int type_show_fail = 4;
|
||||||
|
|
||||||
|
private static List<MaxInterstitialAd> adList = new ArrayList<>();
|
||||||
|
|
||||||
|
public static MaxInterstitialAd getAd(List<MaxInterstitialAd> list) {
|
||||||
|
Collections.shuffle(list);
|
||||||
|
for (MaxInterstitialAd ad : list) {
|
||||||
|
if (ad.isReady()) {
|
||||||
|
return ad;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<MaxInterstitialAd> onLoadAd() {
|
||||||
|
if (adList.isEmpty()) {
|
||||||
|
MaxInterstitialAd AdT = new MaxInterstitialAd(two_Ad, MyApplication.appInstance);
|
||||||
|
MaxInterstitialAd AdOne = new MaxInterstitialAd(one_AD, MyApplication.appInstance);
|
||||||
|
MaxInterstitialAd AdThree = new MaxInterstitialAd(three_ad, MyApplication.appInstance);
|
||||||
|
adList.add(AdOne);
|
||||||
|
adList.add(AdT);
|
||||||
|
adList.add(AdThree);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (MaxInterstitialAd ad : adList) {
|
||||||
|
if (!ad.isReady()) {
|
||||||
|
setMyListener(ad, new MaxListener() {
|
||||||
|
@Override
|
||||||
|
public void onFail(MaxAd ad) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onShowSuccess(MaxAd ad) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onHidden() {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ad.loadAd();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return adList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setMyListener(MaxInterstitialAd ad, MaxListener maxListener) {
|
||||||
|
ad.setListener(new MaxAdListener() {
|
||||||
|
@Override
|
||||||
|
public void onAdLoaded(@NonNull MaxAd maxAd) {
|
||||||
|
Log.d(MyApplication.TAG, "-------onAdLoaded-----maxAd=" + maxAd.getAdUnitId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAdDisplayed(@NonNull MaxAd maxAd) {
|
||||||
|
Log.d(MyApplication.TAG, "-------onAdDisplayed-----maxAd=" + maxAd.getAdUnitId());
|
||||||
|
maxListener.onShowSuccess(maxAd);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAdHidden(@NonNull MaxAd maxAd) {
|
||||||
|
Log.d(MyApplication.TAG, "-------onAdHidden-----maxAd=" + maxAd.getAdUnitId());
|
||||||
|
maxListener.onHidden();
|
||||||
|
setMyListener(ad, new MaxListener() {
|
||||||
|
@Override
|
||||||
|
public void onFail(MaxAd ad) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onShowSuccess(MaxAd ad) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onHidden() {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ad.loadAd();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAdClicked(@NonNull MaxAd maxAd) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAdLoadFailed(@NonNull String s, @NonNull MaxError maxError) {
|
||||||
|
Log.d(MyApplication.TAG, "-------onAdLoadFailed-----s=" + s+"----maxError="+maxError.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAdDisplayFailed(@NonNull MaxAd maxAd, @NonNull MaxError maxError) {
|
||||||
|
maxListener.onFail(maxAd);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static void ShowAd(Activity activity, onAdStatusListener listener) {
|
||||||
|
MaxInterstitialAd ad = MaxManager.getAd(adList);
|
||||||
|
if (ad == null) {
|
||||||
|
listener.onAdStatus(type_no_cache);
|
||||||
|
} else {
|
||||||
|
listener.onAdStatus(type_has_cache);
|
||||||
|
MaxManager.setMyListener(ad, new MaxListener() {
|
||||||
|
@Override
|
||||||
|
public void onFail(MaxAd ad) {
|
||||||
|
listener.onAdStatus(type_show_fail);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onShowSuccess(MaxAd ad) {
|
||||||
|
listener.onAdStatus(type_show_success);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onHidden() {
|
||||||
|
listener.onAdStatus(type_show_close);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ad.showAd(activity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void startShowMaxAd(Activity activity, onAdAfterAction listener) {
|
||||||
|
MaxManager.ShowAd(activity, new onAdStatusListener() {
|
||||||
|
@Override
|
||||||
|
public void onAdStatus(int type) {
|
||||||
|
if (type == MaxManager.type_show_close || type == MaxManager.type_show_fail || type == MaxManager.type_no_cache) {
|
||||||
|
if (listener != null)
|
||||||
|
listener.onAction();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,76 @@
|
|||||||
|
package com.themes.fancy.keyboard.keyboard.max
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.content.BroadcastReceiver
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
|
import android.content.IntentFilter
|
||||||
|
import android.os.CountDownTimer
|
||||||
|
import android.util.Log
|
||||||
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager
|
||||||
|
import com.applovin.mediation.ads.MaxInterstitialAd
|
||||||
|
import com.themes.fancy.keyboard.keyboard.MyApplication
|
||||||
|
|
||||||
|
|
||||||
|
object WelComManager {
|
||||||
|
|
||||||
|
private lateinit var timer: CountDownTimer
|
||||||
|
|
||||||
|
private var need_Show = true
|
||||||
|
|
||||||
|
private lateinit var lists: List<MaxInterstitialAd>
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun initTimer(activity: Activity, countTime: Long,countAction: (Long) -> Unit, goMainAction: () -> Unit): CountDownTimer {
|
||||||
|
need_Show = true
|
||||||
|
timer = object : CountDownTimer(countTime, 100) {
|
||||||
|
override fun onTick(millisUntilFinished: Long) {
|
||||||
|
countAction.invoke(millisUntilFinished)
|
||||||
|
if (need_Show) {
|
||||||
|
MaxManager.ShowAd(activity) {
|
||||||
|
Log.d(MyApplication.TAG, "--onTick----------it=$it")
|
||||||
|
if (it == MaxManager.type_has_cache) {
|
||||||
|
need_Show = false
|
||||||
|
}
|
||||||
|
if (it == MaxManager.type_show_close || it == MaxManager.type_show_fail) {
|
||||||
|
Log.d(MyApplication.TAG, "--onTick---------enter")
|
||||||
|
goMainAction.invoke()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onFinish() {
|
||||||
|
if (need_Show) {
|
||||||
|
MaxManager.ShowAd(activity) {
|
||||||
|
if (it == MaxManager.type_show_close || it == MaxManager.type_show_fail || it == MaxManager.type_no_cache) {
|
||||||
|
Log.d(MyApplication.TAG, "--onFinish---------enter")
|
||||||
|
goMainAction.invoke()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
startAd(activity)
|
||||||
|
return timer
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun startAd(activity: Activity) {
|
||||||
|
if (!MyApplication.initSDkOK) {
|
||||||
|
LocalBroadcastManager.getInstance(activity)
|
||||||
|
.registerReceiver(object : BroadcastReceiver() {
|
||||||
|
override fun onReceive(context: Context?, intent: Intent?) {
|
||||||
|
lists = MaxManager.onLoadAd()
|
||||||
|
timer.start()
|
||||||
|
Log.d(MyApplication.TAG, "------------1sucess")
|
||||||
|
}
|
||||||
|
}, IntentFilter(MyApplication.initAction))
|
||||||
|
} else {
|
||||||
|
lists = MaxManager.onLoadAd()
|
||||||
|
timer.start()
|
||||||
|
Log.d(MyApplication.TAG, "------------2sucess")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
package com.themes.fancy.keyboard.keyboard.max;
|
||||||
|
|
||||||
|
public interface onAdAfterAction {
|
||||||
|
|
||||||
|
void onAction();
|
||||||
|
}
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
package com.themes.fancy.keyboard.keyboard.max;
|
||||||
|
|
||||||
|
public interface onAdStatusListener {
|
||||||
|
|
||||||
|
void onAdStatus(int type);
|
||||||
|
}
|
||||||
@ -12,12 +12,12 @@ import androidx.annotation.NonNull;
|
|||||||
import androidx.cardview.widget.CardView;
|
import androidx.cardview.widget.CardView;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
import com.themes.fancy.keyboard.keyboard.R;
|
import com.themes.fancy.keyboard.keyboard.R;
|
||||||
import com.themes.fancy.keyboard.keyboard.data.KbSource;
|
import com.themes.fancy.keyboard.keyboard.data.KbSource;
|
||||||
|
import com.themes.fancy.keyboard.keyboard.helper.Common;
|
||||||
import com.themes.fancy.keyboard.keyboard.listener.OnClickCallback;
|
import com.themes.fancy.keyboard.keyboard.listener.OnClickCallback;
|
||||||
import com.themes.fancy.keyboard.keyboard.viewui.ApplyActivity;
|
import com.themes.fancy.keyboard.keyboard.viewui.ApplyActivity;
|
||||||
import com.bumptech.glide.Glide;
|
|
||||||
import com.themes.fancy.keyboard.keyboard.helper.Common;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|||||||
@ -24,12 +24,13 @@ import com.bumptech.glide.request.target.Target
|
|||||||
import com.themes.fancy.keyboard.keyboard.MyApplication
|
import com.themes.fancy.keyboard.keyboard.MyApplication
|
||||||
import com.themes.fancy.keyboard.keyboard.R
|
import com.themes.fancy.keyboard.keyboard.R
|
||||||
import com.themes.fancy.keyboard.keyboard.data.KbSource
|
import com.themes.fancy.keyboard.keyboard.data.KbSource
|
||||||
import com.themes.fancy.keyboard.keyboard.listener.ApplyCallback
|
|
||||||
import com.themes.fancy.keyboard.keyboard.listener.OnClickCallback
|
|
||||||
import com.themes.fancy.keyboard.keyboard.myada.MainAdapter
|
|
||||||
import com.themes.fancy.keyboard.keyboard.helper.Common
|
import com.themes.fancy.keyboard.keyboard.helper.Common
|
||||||
import com.themes.fancy.keyboard.keyboard.helper.DownloadMan
|
import com.themes.fancy.keyboard.keyboard.helper.DownloadMan
|
||||||
import com.themes.fancy.keyboard.keyboard.helper.SpSave
|
import com.themes.fancy.keyboard.keyboard.helper.SpSave
|
||||||
|
import com.themes.fancy.keyboard.keyboard.listener.ApplyCallback
|
||||||
|
import com.themes.fancy.keyboard.keyboard.listener.OnClickCallback
|
||||||
|
import com.themes.fancy.keyboard.keyboard.max.MaxManager
|
||||||
|
import com.themes.fancy.keyboard.keyboard.myada.MainAdapter
|
||||||
import com.themes.fancy.keyboard.keyboard.myroom.DbManager
|
import com.themes.fancy.keyboard.keyboard.myroom.DbManager
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import java.io.File
|
import java.io.File
|
||||||
@ -86,7 +87,10 @@ class ApplyActivity : AppCompatActivity() {
|
|||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.layout_apply)
|
setContentView(R.layout.layout_apply)
|
||||||
Common.initFullScreen(this)
|
Common.initFullScreen(this)
|
||||||
|
MaxManager.startShowMaxAd(this@ApplyActivity) {
|
||||||
|
|
||||||
|
}
|
||||||
|
MaxManager.onLoadAd()
|
||||||
findViewId()
|
findViewId()
|
||||||
getExtraData()
|
getExtraData()
|
||||||
displayData()
|
displayData()
|
||||||
@ -153,19 +157,25 @@ class ApplyActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
private fun onClick() {
|
private fun onClick() {
|
||||||
imgBack.setOnClickListener {
|
imgBack.setOnClickListener {
|
||||||
finish()
|
MaxManager.startShowMaxAd(this@ApplyActivity){
|
||||||
|
finish()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
imgLike.setOnClickListener {
|
imgLike.setOnClickListener {
|
||||||
imgLike.isSelected = !imgLike.isSelected
|
MaxManager.startShowMaxAd(this@ApplyActivity){
|
||||||
|
imgLike.isSelected = !imgLike.isSelected
|
||||||
|
|
||||||
lifecycleScope.launch {
|
lifecycleScope.launch {
|
||||||
if (imgLike.isSelected) {
|
if (imgLike.isSelected) {
|
||||||
DbManager.addLike(data)
|
DbManager.addLike(data)
|
||||||
} else {
|
} else {
|
||||||
DbManager.removeLike(data)
|
DbManager.removeLike(data)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
val forYouList = MyApplication.list.filter {
|
val forYouList = MyApplication.list.filter {
|
||||||
it.parentName == "for you"
|
it.parentName == "for you"
|
||||||
@ -228,14 +238,16 @@ class ApplyActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
private fun setApply() {
|
private fun setApply() {
|
||||||
applyBtn.setOnClickListener {
|
applyBtn.setOnClickListener {
|
||||||
val checkEnable = Common.checkEnable(this)
|
MaxManager.startShowMaxAd(this@ApplyActivity) {
|
||||||
val checkSetDefault = Common.checkSetDefault(this)
|
val checkEnable = Common.checkEnable(this)
|
||||||
if (!checkEnable || !checkSetDefault) {
|
val checkSetDefault = Common.checkSetDefault(this)
|
||||||
showDialog()
|
if (!checkEnable || !checkSetDefault) {
|
||||||
return@setOnClickListener
|
showDialog()
|
||||||
}
|
} else {
|
||||||
startDown()
|
startDown()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,12 +7,14 @@ import android.widget.ProgressBar
|
|||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import com.themes.fancy.keyboard.keyboard.R
|
import com.themes.fancy.keyboard.keyboard.R
|
||||||
import com.themes.fancy.keyboard.keyboard.helper.Common
|
import com.themes.fancy.keyboard.keyboard.helper.Common
|
||||||
|
import com.themes.fancy.keyboard.keyboard.max.WelComManager
|
||||||
|
|
||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
|
|
||||||
class LaunchActivity : AppCompatActivity() {
|
class LaunchActivity : AppCompatActivity() {
|
||||||
|
|
||||||
private lateinit var progressBar: ProgressBar
|
private lateinit var progressBar: ProgressBar
|
||||||
private var countTime = 1000L
|
private var countTime = 11000L
|
||||||
private lateinit var timer: CountDownTimer
|
private lateinit var timer: CountDownTimer
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
@ -25,21 +27,14 @@ class LaunchActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
private fun init() {
|
private fun init() {
|
||||||
|
|
||||||
timer = object : CountDownTimer(countTime, 100) {
|
timer = WelComManager.initTimer(this@LaunchActivity, 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
|
}, {
|
||||||
}
|
progressBar.progress = 100
|
||||||
|
toHome()
|
||||||
override fun onFinish() {
|
})
|
||||||
progressBar.progress = 100
|
|
||||||
toHome()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
timer.start()
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -15,24 +15,26 @@ import com.themes.fancy.keyboard.keyboard.R
|
|||||||
import com.themes.fancy.keyboard.keyboard.data.KbSource
|
import com.themes.fancy.keyboard.keyboard.data.KbSource
|
||||||
import com.themes.fancy.keyboard.keyboard.helper.Common
|
import com.themes.fancy.keyboard.keyboard.helper.Common
|
||||||
import com.themes.fancy.keyboard.keyboard.helper.Common.loadWepJif
|
import com.themes.fancy.keyboard.keyboard.helper.Common.loadWepJif
|
||||||
|
import com.themes.fancy.keyboard.keyboard.max.MaxManager
|
||||||
import com.themes.fancy.keyboard.keyboard.myada.MainAdapter
|
import com.themes.fancy.keyboard.keyboard.myada.MainAdapter
|
||||||
|
|
||||||
class MainActivity : AppCompatActivity() {
|
class MainActivity : AppCompatActivity() {
|
||||||
|
|
||||||
private lateinit var forYouRecycler: RecyclerView
|
private lateinit var forYouRecycler: RecyclerView
|
||||||
private lateinit var viewAllLayout: LinearLayout
|
private lateinit var viewAllLayout: LinearLayout
|
||||||
private lateinit var cardView:CardView
|
private lateinit var cardView: CardView
|
||||||
private lateinit var banner:ImageView
|
private lateinit var banner: ImageView
|
||||||
|
|
||||||
private var dialog: DialogActive?= null
|
private var dialog: DialogActive? = null
|
||||||
|
|
||||||
private var bannerKbSource: KbSource? = null
|
private var bannerKbSource: KbSource? = null
|
||||||
|
|
||||||
@SuppressLint("MissingInflatedId")
|
@SuppressLint("MissingInflatedId")
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.layout_main_activity)
|
setContentView(R.layout.layout_main_activity)
|
||||||
Common.initFullScreen(this)
|
Common.initFullScreen(this)
|
||||||
|
MaxManager.onLoadAd()
|
||||||
findViewId()
|
findViewId()
|
||||||
initDialog()
|
initDialog()
|
||||||
loadBanner()
|
loadBanner()
|
||||||
@ -52,21 +54,21 @@ class MainActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun initDialog(){
|
private fun initDialog() {
|
||||||
val checkEnable = Common.checkEnable(MyApplication.appInstance)
|
val checkEnable = Common.checkEnable(MyApplication.appInstance)
|
||||||
val checkSetDefault = Common.checkSetDefault(MyApplication.appInstance)
|
val checkSetDefault = Common.checkSetDefault(MyApplication.appInstance)
|
||||||
if(!checkEnable||!checkSetDefault){
|
if (!checkEnable || !checkSetDefault) {
|
||||||
dialog = dialog?: DialogActive {
|
dialog = dialog ?: DialogActive {
|
||||||
|
|
||||||
}
|
}
|
||||||
dialog?.show(supportFragmentManager,"")
|
dialog?.show(supportFragmentManager, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onClick() {
|
private fun onClick() {
|
||||||
cardView.setOnClickListener {
|
cardView.setOnClickListener {
|
||||||
if(bannerKbSource == null){
|
if (bannerKbSource == null) {
|
||||||
|
|
||||||
return@setOnClickListener
|
return@setOnClickListener
|
||||||
}
|
}
|
||||||
@ -76,15 +78,19 @@ class MainActivity : AppCompatActivity() {
|
|||||||
intentApply.putExtra(ApplyActivity.ZIP_URL_KEY, bannerKbSource!!.zipPath)
|
intentApply.putExtra(ApplyActivity.ZIP_URL_KEY, bannerKbSource!!.zipPath)
|
||||||
intentApply.putExtra(ApplyActivity.NAME_KEY, bannerKbSource!!.titleName)
|
intentApply.putExtra(ApplyActivity.NAME_KEY, bannerKbSource!!.titleName)
|
||||||
intentApply.putExtra(ApplyActivity.GIF_KEY, bannerKbSource!!.imgGif)
|
intentApply.putExtra(ApplyActivity.GIF_KEY, bannerKbSource!!.imgGif)
|
||||||
if(!bannerKbSource!!.thumbGif.isNullOrEmpty()){
|
if (!bannerKbSource!!.thumbGif.isNullOrEmpty()) {
|
||||||
intentApply.putExtra(ApplyActivity.THUMB_KEY,bannerKbSource!!.thumbGif)
|
intentApply.putExtra(ApplyActivity.THUMB_KEY, bannerKbSource!!.thumbGif)
|
||||||
}else{
|
} else {
|
||||||
intentApply.putExtra(ApplyActivity.THUMB_KEY,bannerKbSource!!.thumbUrl)
|
intentApply.putExtra(ApplyActivity.THUMB_KEY, bannerKbSource!!.thumbUrl)
|
||||||
}
|
}
|
||||||
startActivity(intentApply)
|
startActivity(intentApply)
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
viewAllLayout.setOnClickListener {
|
viewAllLayout.setOnClickListener {
|
||||||
startActivity(Intent(this, ViewActivity::class.java))
|
MaxManager.startShowMaxAd(this@MainActivity) {
|
||||||
|
startActivity(Intent(this, ViewActivity::class.java))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -108,7 +114,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun loadBanner(){
|
private fun loadBanner() {
|
||||||
val dataClass = MyApplication.list.shuffled()[0]
|
val dataClass = MyApplication.list.shuffled()[0]
|
||||||
bannerKbSource = dataClass.keyboardList.shuffled()[0]
|
bannerKbSource = dataClass.keyboardList.shuffled()[0]
|
||||||
|
|
||||||
@ -117,11 +123,10 @@ class MainActivity : AppCompatActivity() {
|
|||||||
if (thumbGif != null) {
|
if (thumbGif != null) {
|
||||||
if (thumbGif.isNotEmpty()) {
|
if (thumbGif.isNotEmpty()) {
|
||||||
loadWepJif(this, thumbGif, banner)
|
loadWepJif(this, thumbGif, banner)
|
||||||
} else if(!thumb.isNullOrEmpty()){
|
} else if (!thumb.isNullOrEmpty()) {
|
||||||
Glide.with(this).load(thumb).into(banner)
|
Glide.with(this).load(thumb).into(banner)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -23,6 +23,7 @@ import com.themes.fancy.keyboard.keyboard.databinding.LayoutSuccessBinding;
|
|||||||
import com.themes.fancy.keyboard.keyboard.helper.Common;
|
import com.themes.fancy.keyboard.keyboard.helper.Common;
|
||||||
import com.themes.fancy.keyboard.keyboard.helper.ResName;
|
import com.themes.fancy.keyboard.keyboard.helper.ResName;
|
||||||
import com.themes.fancy.keyboard.keyboard.helper.SpSave;
|
import com.themes.fancy.keyboard.keyboard.helper.SpSave;
|
||||||
|
import com.themes.fancy.keyboard.keyboard.max.MaxManager;
|
||||||
|
|
||||||
import jp.wasabeef.glide.transformations.BlurTransformation;
|
import jp.wasabeef.glide.transformations.BlurTransformation;
|
||||||
|
|
||||||
@ -39,7 +40,7 @@ public class SuccessPage extends AppCompatActivity {
|
|||||||
Common.INSTANCE.initFullScreen(this,true);
|
Common.INSTANCE.initFullScreen(this,true);
|
||||||
vb = LayoutSuccessBinding.inflate(getLayoutInflater());
|
vb = LayoutSuccessBinding.inflate(getLayoutInflater());
|
||||||
setContentView(vb.getRoot());
|
setContentView(vb.getRoot());
|
||||||
|
MaxManager.onLoadAd();
|
||||||
onInit();
|
onInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -14,6 +14,7 @@ import com.themes.fancy.keyboard.keyboard.R
|
|||||||
import com.themes.fancy.keyboard.keyboard.data.Class
|
import com.themes.fancy.keyboard.keyboard.data.Class
|
||||||
import com.themes.fancy.keyboard.keyboard.myada.TabAdapter
|
import com.themes.fancy.keyboard.keyboard.myada.TabAdapter
|
||||||
import com.themes.fancy.keyboard.keyboard.helper.Common
|
import com.themes.fancy.keyboard.keyboard.helper.Common
|
||||||
|
import com.themes.fancy.keyboard.keyboard.max.MaxManager
|
||||||
|
|
||||||
class ViewActivity : AppCompatActivity() {
|
class ViewActivity : AppCompatActivity() {
|
||||||
private lateinit var tabRecycler: RecyclerView
|
private lateinit var tabRecycler: RecyclerView
|
||||||
@ -27,6 +28,7 @@ class ViewActivity : AppCompatActivity() {
|
|||||||
setContentView(R.layout.layout_view_all)
|
setContentView(R.layout.layout_view_all)
|
||||||
Common.initFullScreen(this)
|
Common.initFullScreen(this)
|
||||||
findViewId()
|
findViewId()
|
||||||
|
MaxManager.onLoadAd()
|
||||||
setTabRecycler()
|
setTabRecycler()
|
||||||
setContent()
|
setContent()
|
||||||
}
|
}
|
||||||
|
|||||||
9
app/src/main/res/drawable/back.xml
Normal file
9
app/src/main/res/drawable/back.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="64dp"
|
||||||
|
android:height="64dp"
|
||||||
|
android:viewportWidth="1024"
|
||||||
|
android:viewportHeight="1024">
|
||||||
|
<path
|
||||||
|
android:pathData="M395.2,513.6l323.1,-312.4c19.1,-18.4 19.1,-48.3 0,-66.7 -19.1,-18.4 -49.9,-18.4 -69,0L291.8,480.3c-19.1,18.4 -19.1,48.3 0,66.7l357.6,345.7c9.5,9.2 22,13.8 34.5,13.8 12.5,0 25,-4.6 34.5,-13.8 19.1,-18.4 19.1,-48.2 0,-66.7L395.2,513.6z"
|
||||||
|
android:fillColor="@color/black"/>
|
||||||
|
</vector>
|
||||||
@ -15,7 +15,7 @@
|
|||||||
android:paddingStart="5dp"
|
android:paddingStart="5dp"
|
||||||
android:paddingTop="10dp"
|
android:paddingTop="10dp"
|
||||||
android:paddingBottom="10dp"
|
android:paddingBottom="10dp"
|
||||||
android:src="@drawable/im_back"
|
android:src="@drawable/back"
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
|||||||
@ -6,3 +6,8 @@ plugins {
|
|||||||
id ("com.google.firebase.crashlytics") version "3.0.2" apply false
|
id ("com.google.firebase.crashlytics") version "3.0.2" apply false
|
||||||
kotlin("kapt") version "2.0.0"
|
kotlin("kapt") version "2.0.0"
|
||||||
}
|
}
|
||||||
|
buildscript {
|
||||||
|
dependencies {
|
||||||
|
classpath ("com.applovin.quality:AppLovinQualityServiceGradlePlugin:+")
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -3,7 +3,7 @@ pluginManagement {
|
|||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
|
maven { url = uri("https://artifacts.applovin.com/android") }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dependencyResolutionManagement {
|
dependencyResolutionManagement {
|
||||||
@ -13,6 +13,9 @@ dependencyResolutionManagement {
|
|||||||
mavenCentral()
|
mavenCentral()
|
||||||
maven("https://jitpack.io")
|
maven("https://jitpack.io")
|
||||||
|
|
||||||
|
maven { url = uri("https://cboost.jfrog.io/artifactory/chartboost-ads/") }
|
||||||
|
maven { url = uri("https://android-sdk.is.com") }
|
||||||
|
maven { url = uri("https://artifact.bytedance.com/repository/pangle") }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user