V1.0.1(2)接入max和firebase
This commit is contained in:
parent
b454325f02
commit
ab09aa1702
@ -3,7 +3,16 @@ import java.util.Date
|
|||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
alias(libs.plugins.android.application)
|
alias(libs.plugins.android.application)
|
||||||
|
id("applovin-quality-service")
|
||||||
|
id("com.google.gms.google-services")
|
||||||
|
id("com.google.firebase.crashlytics")
|
||||||
|
alias(libs.plugins.kotlin.android)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
applovin{
|
||||||
|
apiKey = "OH8NTzNzTxVDH_rsmyr0tCy19fJIZ_wrIoO2DbzbM7MsF1I_DVTrVlnS_uhTyGQkSlcQBvbeekUkaie0caLBX1"
|
||||||
|
}
|
||||||
|
|
||||||
val timestamp: String = SimpleDateFormat("MM_dd_HH_mm").format(Date())
|
val timestamp: String = SimpleDateFormat("MM_dd_HH_mm").format(Date())
|
||||||
android {
|
android {
|
||||||
namespace = "com.keyboard.glowkeyboard"
|
namespace = "com.keyboard.glowkeyboard"
|
||||||
@ -13,8 +22,8 @@ android {
|
|||||||
applicationId = "com.keyboard.glowkeyboard"
|
applicationId = "com.keyboard.glowkeyboard"
|
||||||
minSdk = 23
|
minSdk = 23
|
||||||
targetSdk = 35
|
targetSdk = 35
|
||||||
versionCode = 1
|
versionCode = 2
|
||||||
versionName = "1.0.0"
|
versionName = "1.0.1"
|
||||||
setProperty(
|
setProperty(
|
||||||
"archivesBaseName",
|
"archivesBaseName",
|
||||||
"Glow Keyboard_V" + versionName + "(${versionCode})_$timestamp"
|
"Glow Keyboard_V" + versionName + "(${versionCode})_$timestamp"
|
||||||
@ -39,6 +48,9 @@ android {
|
|||||||
sourceCompatibility = JavaVersion.VERSION_11
|
sourceCompatibility = JavaVersion.VERSION_11
|
||||||
targetCompatibility = JavaVersion.VERSION_11
|
targetCompatibility = JavaVersion.VERSION_11
|
||||||
}
|
}
|
||||||
|
kotlinOptions {
|
||||||
|
jvmTarget = "11"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@ -47,6 +59,7 @@ dependencies {
|
|||||||
implementation(libs.material)
|
implementation(libs.material)
|
||||||
implementation(libs.activity)
|
implementation(libs.activity)
|
||||||
implementation(libs.constraintlayout)
|
implementation(libs.constraintlayout)
|
||||||
|
implementation(libs.core.ktx)
|
||||||
testImplementation(libs.junit)
|
testImplementation(libs.junit)
|
||||||
androidTestImplementation(libs.ext.junit)
|
androidTestImplementation(libs.ext.junit)
|
||||||
androidTestImplementation(libs.espresso.core)
|
androidTestImplementation(libs.espresso.core)
|
||||||
@ -57,4 +70,34 @@ dependencies {
|
|||||||
implementation("com.github.bumptech.glide:glide:4.16.0")
|
implementation("com.github.bumptech.glide:glide:4.16.0")
|
||||||
|
|
||||||
implementation("com.github.omicronapps:7-Zip-JBinding-4Android:Release-16.02-2.02")
|
implementation("com.github.omicronapps:7-Zip-JBinding-4Android:Release-16.02-2.02")
|
||||||
|
|
||||||
|
// Import the BoM for the Firebase platform
|
||||||
|
implementation(platform("com.google.firebase:firebase-bom:33.7.0"))
|
||||||
|
|
||||||
|
// Add the dependencies for the Crashlytics and Analytics libraries
|
||||||
|
// When using the BoM, you don't specify versions in Firebase library dependencies
|
||||||
|
implementation("com.google.firebase:firebase-crashlytics")
|
||||||
|
implementation("com.google.firebase:firebase-analytics")
|
||||||
|
implementation("com.google.firebase:firebase-config")
|
||||||
|
|
||||||
|
//--------------------------MAX(Liftoff Monetize(vungle)、Mintegral、Pangle、Unity Ads)
|
||||||
|
implementation("com.applovin:applovin-sdk:+")
|
||||||
|
implementation("com.applovin.mediation:bigoads-adapter:+")
|
||||||
|
implementation("com.applovin.mediation:chartboost-adapter:+")
|
||||||
|
implementation("com.google.android.gms:play-services-base:16.1.0")
|
||||||
|
implementation("com.applovin.mediation:fyber-adapter:+")
|
||||||
|
//Google Ad Manager
|
||||||
|
// implementation("com.applovin.mediation:google-ad-manager-adapter:+")
|
||||||
|
|
||||||
|
//Google Bidding and Google AdMob
|
||||||
|
//implementation("com.applovin.mediation:google-adapter:+")
|
||||||
|
implementation("com.applovin.mediation:inmobi-adapter:+")
|
||||||
|
implementation("com.squareup.picasso:picasso:2.71828")
|
||||||
|
implementation("androidx.recyclerview:recyclerview:1.1.0")
|
||||||
|
implementation("com.applovin.mediation:ironsource-adapter:+")
|
||||||
|
implementation("com.applovin.mediation:vungle-adapter:+")
|
||||||
|
implementation("com.applovin.mediation:facebook-adapter:+")
|
||||||
|
implementation("com.applovin.mediation:moloco-adapter:+")
|
||||||
|
implementation("com.applovin.mediation:bytedance-adapter:+")
|
||||||
|
implementation("com.applovin.mediation:unityads-adapter:+")
|
||||||
}
|
}
|
||||||
29
app/google-services.json
Normal file
29
app/google-services.json
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"project_info": {
|
||||||
|
"project_number": "186697378932",
|
||||||
|
"project_id": "glow-keyboard-b53e5",
|
||||||
|
"storage_bucket": "glow-keyboard-b53e5.firebasestorage.app"
|
||||||
|
},
|
||||||
|
"client": [
|
||||||
|
{
|
||||||
|
"client_info": {
|
||||||
|
"mobilesdk_app_id": "1:186697378932:android:a2595d5e54b45e3068f521",
|
||||||
|
"android_client_info": {
|
||||||
|
"package_name": "com.keyboard.glowkeyboard"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"oauth_client": [],
|
||||||
|
"api_key": [
|
||||||
|
{
|
||||||
|
"current_key": "AIzaSyCgDiGZa0wbP2HBRgMv9s-lYYkxd63XQo8"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"services": {
|
||||||
|
"appinvite_service": {
|
||||||
|
"other_platform_oauth_client": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"configuration_version": "1"
|
||||||
|
}
|
||||||
@ -3,12 +3,18 @@ package com.keyboard.glowkeyboard;
|
|||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.pm.ActivityInfo;
|
import android.content.pm.ActivityInfo;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||||
|
|
||||||
|
import com.applovin.sdk.AppLovinMediationProvider;
|
||||||
|
import com.applovin.sdk.AppLovinSdk;
|
||||||
|
import com.applovin.sdk.AppLovinSdkConfiguration;
|
||||||
|
import com.applovin.sdk.AppLovinSdkInitializationConfiguration;
|
||||||
import com.keyboard.glowkeyboard.room.AppDatabase;
|
import com.keyboard.glowkeyboard.room.AppDatabase;
|
||||||
import com.keyboard.glowkeyboard.room.GlowData;
|
import com.keyboard.glowkeyboard.room.GlowData;
|
||||||
import com.keyboard.glowkeyboard.room.GlowDataDao;
|
import com.keyboard.glowkeyboard.room.GlowDataDao;
|
||||||
@ -25,6 +31,12 @@ public class MyApplication extends Application {
|
|||||||
public static final String KEY_FILE_PATH = "file_path";
|
public static final String KEY_FILE_PATH = "file_path";
|
||||||
private static final String INIT_FLAG = "init_database";
|
private static final String INIT_FLAG = "init_database";
|
||||||
|
|
||||||
|
public static final String TAG = "--------------";
|
||||||
|
|
||||||
|
public static final String AD_BROADCAST = "on_success_action";
|
||||||
|
private static final String MAX_SDK = "QO7vrmMcUGTR8MlzqDIT1QZLXnT_fdE0Sff5ReOETa3aRhPdI81JaOqw5a5C0DrV4ApHvTQ84Fq8ScnDgZ7s0l";
|
||||||
|
public static Boolean initSDK = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
@ -39,6 +51,26 @@ public class MyApplication extends Application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
lockScreenOrientation();
|
lockScreenOrientation();
|
||||||
|
|
||||||
|
initSdk();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initSdk() {
|
||||||
|
|
||||||
|
AppLovinSdkInitializationConfiguration initConfig = AppLovinSdkInitializationConfiguration.builder(MAX_SDK, this)
|
||||||
|
.setMediationProvider(AppLovinMediationProvider.MAX)
|
||||||
|
.build();
|
||||||
|
AppLovinSdk.getInstance(this).initialize(initConfig, new AppLovinSdk.SdkInitializationListener() {
|
||||||
|
@Override
|
||||||
|
public void onSdkInitialized(final AppLovinSdkConfiguration sdkConfig) {
|
||||||
|
initSDK = true;
|
||||||
|
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(new Intent(AD_BROADCAST));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
AppLovinSdk.getInstance(this).getSettings().setVerboseLogging(true);
|
||||||
|
//MAX广告测试
|
||||||
|
// AppLovinSdk.getInstance( this ).showMediationDebugger();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void lockScreenOrientation() {
|
private void lockScreenOrientation() {
|
||||||
|
|||||||
@ -0,0 +1,11 @@
|
|||||||
|
package com.keyboard.glowkeyboard.max;
|
||||||
|
|
||||||
|
import com.applovin.mediation.MaxAd;
|
||||||
|
|
||||||
|
public interface MaxListener {
|
||||||
|
void onFail(MaxAd ad);
|
||||||
|
|
||||||
|
void onShowSuccess(MaxAd ad);
|
||||||
|
|
||||||
|
void onHidden();
|
||||||
|
}
|
||||||
179
app/src/main/java/com/keyboard/glowkeyboard/max/MaxManager.java
Normal file
179
app/src/main/java/com/keyboard/glowkeyboard/max/MaxManager.java
Normal file
@ -0,0 +1,179 @@
|
|||||||
|
package com.keyboard.glowkeyboard.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.keyboard.glowkeyboard.MyApplication;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class MaxManager {
|
||||||
|
/**
|
||||||
|
Glow_inter_1
|
||||||
|
515ea66dace11a45
|
||||||
|
Glow_inter_2
|
||||||
|
6b2edd192cc8b79a
|
||||||
|
Glow_inter_3
|
||||||
|
8f7377eb9043de4b
|
||||||
|
*/
|
||||||
|
private static final String one_AD = "515ea66dace11a45";
|
||||||
|
private static final String two_Ad = "6b2edd192cc8b79a";
|
||||||
|
private static final String three_ad = "8f7377eb9043de4b";
|
||||||
|
|
||||||
|
|
||||||
|
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.getContext());
|
||||||
|
MaxInterstitialAd AdOne = new MaxInterstitialAd(one_AD, MyApplication.getContext());
|
||||||
|
MaxInterstitialAd AdThree = new MaxInterstitialAd(three_ad, MyApplication.getContext());
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public 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,44 @@
|
|||||||
|
package com.keyboard.glowkeyboard.max
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.os.CountDownTimer
|
||||||
|
import android.util.Log
|
||||||
|
import com.keyboard.glowkeyboard.MyApplication
|
||||||
|
|
||||||
|
object WelComManager {
|
||||||
|
|
||||||
|
private lateinit var timer: CountDownTimer
|
||||||
|
private var need_Show = true
|
||||||
|
|
||||||
|
@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) {
|
||||||
|
goMainAction.invoke()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return timer
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
package com.keyboard.glowkeyboard.max;
|
||||||
|
|
||||||
|
public interface onAdAfterAction {
|
||||||
|
|
||||||
|
void onAction();
|
||||||
|
}
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
package com.keyboard.glowkeyboard.max;
|
||||||
|
|
||||||
|
public interface onAdStatusListener {
|
||||||
|
|
||||||
|
void onAdStatus(int type);
|
||||||
|
}
|
||||||
@ -14,6 +14,8 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||||||
|
|
||||||
import com.keyboard.glowkeyboard.R;
|
import com.keyboard.glowkeyboard.R;
|
||||||
import com.keyboard.glowkeyboard.databinding.ActivityCategoryListBinding;
|
import com.keyboard.glowkeyboard.databinding.ActivityCategoryListBinding;
|
||||||
|
import com.keyboard.glowkeyboard.max.MaxManager;
|
||||||
|
import com.keyboard.glowkeyboard.max.onAdAfterAction;
|
||||||
import com.keyboard.glowkeyboard.ui.adapter.GlowAdapter;
|
import com.keyboard.glowkeyboard.ui.adapter.GlowAdapter;
|
||||||
import com.keyboard.glowkeyboard.util.ItemDecoration;
|
import com.keyboard.glowkeyboard.util.ItemDecoration;
|
||||||
import com.keyboard.glowkeyboard.viewmodel.GlowViewModel;
|
import com.keyboard.glowkeyboard.viewmodel.GlowViewModel;
|
||||||
@ -33,6 +35,14 @@ public class CategoryListActivity extends AppCompatActivity {
|
|||||||
initializeBinding();
|
initializeBinding();
|
||||||
setupWindowInsets();
|
setupWindowInsets();
|
||||||
|
|
||||||
|
MaxManager.onLoadAd();
|
||||||
|
MaxManager.startShowMaxAd(this, new onAdAfterAction() {
|
||||||
|
@Override
|
||||||
|
public void onAction() {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
loadInitialData();
|
loadInitialData();
|
||||||
configureEvents();
|
configureEvents();
|
||||||
}
|
}
|
||||||
@ -71,8 +81,13 @@ public class CategoryListActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void terminateActivity() {
|
private void terminateActivity() {
|
||||||
|
MaxManager.startShowMaxAd(this, new onAdAfterAction() {
|
||||||
|
@Override
|
||||||
|
public void onAction() {
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private void configureRecyclerView() {
|
private void configureRecyclerView() {
|
||||||
RecyclerView recycler = viewBinding.recyclerView;
|
RecyclerView recycler = viewBinding.recyclerView;
|
||||||
|
|||||||
@ -22,6 +22,8 @@ import com.bumptech.glide.request.RequestOptions;
|
|||||||
import com.keyboard.glowkeyboard.MyApplication;
|
import com.keyboard.glowkeyboard.MyApplication;
|
||||||
import com.keyboard.glowkeyboard.R;
|
import com.keyboard.glowkeyboard.R;
|
||||||
import com.keyboard.glowkeyboard.databinding.ActivityGlowBinding;
|
import com.keyboard.glowkeyboard.databinding.ActivityGlowBinding;
|
||||||
|
import com.keyboard.glowkeyboard.max.MaxManager;
|
||||||
|
import com.keyboard.glowkeyboard.max.onAdAfterAction;
|
||||||
import com.keyboard.glowkeyboard.room.GlowData;
|
import com.keyboard.glowkeyboard.room.GlowData;
|
||||||
import com.keyboard.glowkeyboard.ui.adapter.GlowAdapter;
|
import com.keyboard.glowkeyboard.ui.adapter.GlowAdapter;
|
||||||
import com.keyboard.glowkeyboard.ui.dialog.RequestDialog;
|
import com.keyboard.glowkeyboard.ui.dialog.RequestDialog;
|
||||||
@ -79,6 +81,14 @@ public class GlowActivity extends AppCompatActivity {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MaxManager.onLoadAd();
|
||||||
|
MaxManager.startShowMaxAd(this, new onAdAfterAction() {
|
||||||
|
@Override
|
||||||
|
public void onAction() {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
glowViewModel = new ViewModelProvider(this).get(GlowViewModel.class);
|
glowViewModel = new ViewModelProvider(this).get(GlowViewModel.class);
|
||||||
title = glowData.getTitle();
|
title = glowData.getTitle();
|
||||||
zipUrl = glowData.getZipUrl();
|
zipUrl = glowData.getZipUrl();
|
||||||
@ -111,8 +121,22 @@ public class GlowActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void attachEvents() {
|
private void attachEvents() {
|
||||||
binding.back.setOnClickListener(v -> finish());
|
binding.back.setOnClickListener(v -> {
|
||||||
binding.downloadApply.setOnClickListener(v -> processDownload());
|
MaxManager.startShowMaxAd(this, new onAdAfterAction() {
|
||||||
|
@Override
|
||||||
|
public void onAction() {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
binding.downloadApply.setOnClickListener(v -> {
|
||||||
|
MaxManager.startShowMaxAd(this, new onAdAfterAction() {
|
||||||
|
@Override
|
||||||
|
public void onAction() {
|
||||||
|
processDownload();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
binding.like.setOnClickListener(v -> updateFavorite());
|
binding.like.setOnClickListener(v -> updateFavorite());
|
||||||
binding.home.setOnClickListener(v -> navigateHome());
|
binding.home.setOnClickListener(v -> navigateHome());
|
||||||
binding.title.setText(title);
|
binding.title.setText(title);
|
||||||
|
|||||||
@ -17,6 +17,7 @@ import com.keyboard.glowkeyboard.R;
|
|||||||
import com.keyboard.glowkeyboard.databinding.ActivityCategoryListBinding;
|
import com.keyboard.glowkeyboard.databinding.ActivityCategoryListBinding;
|
||||||
import com.keyboard.glowkeyboard.databinding.ActivityMainBinding;
|
import com.keyboard.glowkeyboard.databinding.ActivityMainBinding;
|
||||||
import com.keyboard.glowkeyboard.databinding.MainTabCustomBinding;
|
import com.keyboard.glowkeyboard.databinding.MainTabCustomBinding;
|
||||||
|
import com.keyboard.glowkeyboard.max.MaxManager;
|
||||||
import com.keyboard.glowkeyboard.ui.adapter.ViewPager2Adapter;
|
import com.keyboard.glowkeyboard.ui.adapter.ViewPager2Adapter;
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity {
|
public class MainActivity extends AppCompatActivity {
|
||||||
@ -52,6 +53,8 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initData() {
|
private void initData() {
|
||||||
|
MaxManager.onLoadAd();
|
||||||
|
|
||||||
ViewPager2Adapter adapter = new ViewPager2Adapter(this);
|
ViewPager2Adapter adapter = new ViewPager2Adapter(this);
|
||||||
binding.viewPager2.setAdapter(adapter);
|
binding.viewPager2.setAdapter(adapter);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,10 +14,16 @@ import com.bumptech.glide.Glide;
|
|||||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
||||||
import com.keyboard.glowkeyboard.R;
|
import com.keyboard.glowkeyboard.R;
|
||||||
import com.keyboard.glowkeyboard.databinding.ActivitySplashBinding;
|
import com.keyboard.glowkeyboard.databinding.ActivitySplashBinding;
|
||||||
|
import com.keyboard.glowkeyboard.max.MaxManager;
|
||||||
|
import com.keyboard.glowkeyboard.max.WelComManager;
|
||||||
|
|
||||||
|
import kotlin.Unit;
|
||||||
|
import kotlin.jvm.functions.Function0;
|
||||||
|
import kotlin.jvm.functions.Function1;
|
||||||
|
|
||||||
public class SplashActivity extends AppCompatActivity {
|
public class SplashActivity extends AppCompatActivity {
|
||||||
private ActivitySplashBinding binding;
|
private ActivitySplashBinding binding;
|
||||||
private static final long TOTAL_TIME = 1000;
|
private static final long TOTAL_TIME = 11000;
|
||||||
private CountDownTimer countDownTimer;
|
private CountDownTimer countDownTimer;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -34,6 +40,8 @@ public class SplashActivity extends AppCompatActivity {
|
|||||||
return insets;
|
return insets;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
MaxManager.onLoadAd();
|
||||||
|
|
||||||
initEvent();
|
initEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,18 +51,20 @@ public class SplashActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void startProgressTimer() {
|
private void startProgressTimer() {
|
||||||
countDownTimer = new CountDownTimer(TOTAL_TIME,100) {
|
countDownTimer = WelComManager.initTimer(this, TOTAL_TIME, new Function1<Long, Unit>() {
|
||||||
@Override
|
@Override
|
||||||
public void onTick(long millisUntilFinished) {
|
public Unit invoke(Long aLong) {
|
||||||
int percentage = (int) (100 - (float) millisUntilFinished / TOTAL_TIME * 100);
|
int percentage = (int) (100 - (float) aLong / TOTAL_TIME * 100);
|
||||||
binding.progressBar.setProgress(percentage);
|
binding.progressBar.setProgress(percentage);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
}, new Function0<Unit>() {
|
||||||
@Override
|
@Override
|
||||||
public void onFinish() {
|
public Unit invoke() {
|
||||||
startMain();
|
startMain();
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
countDownTimer.start();
|
countDownTimer.start();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,14 @@
|
|||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
plugins {
|
plugins {
|
||||||
alias(libs.plugins.android.application) apply false
|
alias(libs.plugins.android.application) apply false
|
||||||
|
|
||||||
|
id("com.google.gms.google-services") version "4.4.2" apply false
|
||||||
|
id ("com.google.firebase.crashlytics") version "3.0.3" apply false
|
||||||
|
alias(libs.plugins.kotlin.android) apply false
|
||||||
|
}
|
||||||
|
|
||||||
|
buildscript {
|
||||||
|
dependencies {
|
||||||
|
classpath("com.applovin.quality:AppLovinQualityServiceGradlePlugin:+")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -7,6 +7,8 @@ appcompat = "1.7.0"
|
|||||||
material = "1.12.0"
|
material = "1.12.0"
|
||||||
activity = "1.10.1"
|
activity = "1.10.1"
|
||||||
constraintlayout = "2.2.1"
|
constraintlayout = "2.2.1"
|
||||||
|
kotlin = "2.1.20"
|
||||||
|
coreKtx = "1.15.0"
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
junit = { group = "junit", name = "junit", version.ref = "junit" }
|
junit = { group = "junit", name = "junit", version.ref = "junit" }
|
||||||
@ -16,7 +18,9 @@ appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "a
|
|||||||
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
|
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
|
||||||
activity = { group = "androidx.activity", name = "activity", version.ref = "activity" }
|
activity = { group = "androidx.activity", name = "activity", version.ref = "activity" }
|
||||||
constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
|
constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
|
||||||
|
core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
|
||||||
|
|
||||||
[plugins]
|
[plugins]
|
||||||
android-application = { id = "com.android.application", version.ref = "agp" }
|
android-application = { id = "com.android.application", version.ref = "agp" }
|
||||||
|
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
|
||||||
|
|
||||||
|
|||||||
@ -9,6 +9,8 @@ pluginManagement {
|
|||||||
}
|
}
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
|
|
||||||
|
maven { url = uri("https://artifacts.applovin.com/android") }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dependencyResolutionManagement {
|
dependencyResolutionManagement {
|
||||||
@ -18,6 +20,11 @@ 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