V1.0.1(2)接入Max和firebase
This commit is contained in:
parent
546c90b7be
commit
34dc9d18cc
@ -3,6 +3,13 @@ import java.util.Date
|
||||
|
||||
plugins {
|
||||
alias(libs.plugins.android.application)
|
||||
id("com.google.gms.google-services")
|
||||
id("com.google.firebase.crashlytics")
|
||||
id("applovin-quality-service")
|
||||
alias(libs.plugins.kotlin.android)
|
||||
}
|
||||
applovin{
|
||||
apiKey = "z9LuVGqI3n3UbGeQdWFqDBtsNwy_Ex1ZUdA6WEmpTvrTIVrQLpf_ATE1EpembT_12xh5tX2T6DoCxSVzLeGLX5"
|
||||
}
|
||||
val timestamp: String = SimpleDateFormat("MM_dd_HH_mm").format(Date())
|
||||
android {
|
||||
@ -13,8 +20,8 @@ android {
|
||||
applicationId = "com.ardraw.ardrawingflow"
|
||||
minSdk = 23
|
||||
targetSdk = 35
|
||||
versionCode = 1
|
||||
versionName = "1.0.0"
|
||||
versionCode = 2
|
||||
versionName = "1.0.1"
|
||||
setProperty("archivesBaseName", "AR Drawing Flow_V " + versionName + "(${versionCode})_$timestamp")
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
@ -36,6 +43,9 @@ android {
|
||||
sourceCompatibility = JavaVersion.VERSION_11
|
||||
targetCompatibility = JavaVersion.VERSION_11
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = "11"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@ -44,6 +54,7 @@ dependencies {
|
||||
implementation(libs.material)
|
||||
implementation(libs.activity)
|
||||
implementation(libs.constraintlayout)
|
||||
implementation(libs.core.ktx)
|
||||
testImplementation(libs.junit)
|
||||
androidTestImplementation(libs.ext.junit)
|
||||
androidTestImplementation(libs.espresso.core)
|
||||
@ -59,4 +70,20 @@ dependencies {
|
||||
implementation ("androidx.camera:camera-view:1.4.1")
|
||||
implementation ("androidx.camera:camera-extensions:1.4.1")
|
||||
implementation ("androidx.camera:camera-camera2:1.4.1")
|
||||
|
||||
// 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:vungle-adapter:+")
|
||||
implementation("com.applovin.mediation:mintegral-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": "931996651428",
|
||||
"project_id": "ar-drawing-flow",
|
||||
"storage_bucket": "ar-drawing-flow.firebasestorage.app"
|
||||
},
|
||||
"client": [
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:931996651428:android:8d0db4faf8686c286bbb31",
|
||||
"android_client_info": {
|
||||
"package_name": "com.ardraw.ardrawingflow"
|
||||
}
|
||||
},
|
||||
"oauth_client": [],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyDa8DpA4a9NEKkzAwjv3FV4eTXH-VI4z6A"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"appinvite_service": {
|
||||
"other_platform_oauth_client": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"configuration_version": "1"
|
||||
}
|
||||
@ -2,9 +2,18 @@ package com.ardraw.ardrawingflow;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.util.Log;
|
||||
|
||||
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.ardraw.ardrawingflow.util.InitDatabase;
|
||||
import com.google.firebase.FirebaseApp;
|
||||
|
||||
public class MyApplication extends Application {
|
||||
public static MyApplication application;
|
||||
@ -13,12 +22,30 @@ public class MyApplication extends Application {
|
||||
private static final String PREF_NAME = "preferences";
|
||||
private static final String KEY_INITIALIZED = "initRoom";
|
||||
|
||||
public static final String TAG = "--------------";
|
||||
|
||||
public static final String AD_BROADCAST = "on_success_action";
|
||||
private static final String MAX_SDK = "os4_cxdNCbSNNKBlfTkCd_TVBRkGvcT12MSpwSAyNcOXbqSpEdv0QrmmzC0mh4C_fBhKypHEWPW3Cr5JLSobVL";
|
||||
public static Boolean initSDK = false;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
|
||||
application = this;
|
||||
|
||||
// //确保Firebase初始化
|
||||
// FirebaseApp.initializeApp(this);
|
||||
//
|
||||
// // 输出日志以确认Firebase初始化
|
||||
// if (!FirebaseApp.getApps(this).isEmpty()) {
|
||||
// Log.d(TAG, "Firebase 初始化成功1");
|
||||
// } else {
|
||||
// Log.e(TAG, "Firebase 初始化失败0");
|
||||
// }
|
||||
|
||||
initSdk();
|
||||
|
||||
SharedPreferences preferences = getSharedPreferences(PREF_NAME, MODE_PRIVATE);
|
||||
boolean init = preferences.getBoolean(KEY_INITIALIZED, false);
|
||||
|
||||
@ -28,6 +55,24 @@ public class MyApplication extends Application {
|
||||
}
|
||||
}
|
||||
|
||||
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 initDatabase() {
|
||||
InitDatabase initDatabase = new InitDatabase(getContext());
|
||||
initDatabase.insertImagesToDatabase();
|
||||
|
||||
@ -0,0 +1,11 @@
|
||||
package com.ardraw.ardrawingflow.max;
|
||||
|
||||
import com.applovin.mediation.MaxAd;
|
||||
|
||||
public interface MaxListener {
|
||||
void onFail(MaxAd ad);
|
||||
|
||||
void onShowSuccess(MaxAd ad);
|
||||
|
||||
void onHidden();
|
||||
}
|
||||
180
app/src/main/java/com/ardraw/ardrawingflow/max/MaxManager.java
Normal file
180
app/src/main/java/com/ardraw/ardrawingflow/max/MaxManager.java
Normal file
@ -0,0 +1,180 @@
|
||||
package com.ardraw.ardrawingflow.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.ardraw.ardrawingflow.MyApplication;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class MaxManager {
|
||||
/**
|
||||
AR_Drawing_Flow_INST_1
|
||||
6ceb45d5ee9b09b7
|
||||
AR_Drawing_Flow_INST_2
|
||||
3f67aba8a438708f
|
||||
AR_Drawing_Flow_INST_3
|
||||
af6f4a2a5ade052c
|
||||
*/
|
||||
private static final String one_AD = "6ceb45d5ee9b09b7";
|
||||
private static final String two_Ad = "3f67aba8a438708f";
|
||||
private static final String three_ad = "af6f4a2a5ade052c";
|
||||
|
||||
|
||||
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,45 @@
|
||||
package com.ardraw.ardrawingflow.max
|
||||
|
||||
import android.app.Activity
|
||||
import android.os.CountDownTimer
|
||||
import android.util.Log
|
||||
import com.ardraw.ardrawingflow.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.ardraw.ardrawingflow.max;
|
||||
|
||||
public interface onAdAfterAction {
|
||||
|
||||
void onAction();
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
package com.ardraw.ardrawingflow.max;
|
||||
|
||||
public interface onAdStatusListener {
|
||||
|
||||
void onAdStatus(int type);
|
||||
}
|
||||
@ -35,6 +35,8 @@ import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
import com.ardraw.ardrawingflow.R;
|
||||
import com.ardraw.ardrawingflow.databinding.ActivityDetailBinding;
|
||||
import com.ardraw.ardrawingflow.max.MaxManager;
|
||||
import com.ardraw.ardrawingflow.max.onAdAfterAction;
|
||||
import com.ardraw.ardrawingflow.util.FileUtil;
|
||||
import com.ardraw.ardrawingflow.util.PermissionUtil;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
@ -87,15 +89,37 @@ public class DetailActivity extends AppCompatActivity implements SeekBar.OnSeekB
|
||||
return;
|
||||
}
|
||||
|
||||
MaxManager.onLoadAd();
|
||||
MaxManager.startShowMaxAd(this, new onAdAfterAction() {
|
||||
@Override
|
||||
public void onAction() {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
FileUtil.loadImage(imagePath, binding.imageView, this);
|
||||
}
|
||||
|
||||
private void initEvents() {
|
||||
binding.imageView.setOnTouchListener(this);
|
||||
binding.seekbar.setOnSeekBarChangeListener(this);
|
||||
binding.photo.setOnClickListener(v -> openImagePicker());
|
||||
binding.photo.setOnClickListener(v -> {
|
||||
MaxManager.startShowMaxAd(this, new onAdAfterAction() {
|
||||
@Override
|
||||
public void onAction() {
|
||||
openImagePicker();
|
||||
}
|
||||
});
|
||||
});
|
||||
binding.flash.setOnClickListener(v -> toggleFlash());
|
||||
binding.back.setOnClickListener(v -> finish());
|
||||
binding.back.setOnClickListener(v -> {
|
||||
MaxManager.startShowMaxAd(this, new onAdAfterAction() {
|
||||
@Override
|
||||
public void onAction() {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
});
|
||||
binding.camera.setOnClickListener(v -> takePhotoAndSave());
|
||||
|
||||
checkPermissionsAndStartCamera();
|
||||
|
||||
@ -13,6 +13,7 @@ import androidx.core.view.WindowInsetsCompat;
|
||||
import com.ardraw.ardrawingflow.R;
|
||||
import com.ardraw.ardrawingflow.databinding.ActivityMainBinding;
|
||||
import com.ardraw.ardrawingflow.databinding.TabCustomBinding;
|
||||
import com.ardraw.ardrawingflow.max.MaxManager;
|
||||
import com.ardraw.ardrawingflow.ui.adapter.MainViewPager2Adapter;
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
import com.google.android.material.tabs.TabLayoutMediator;
|
||||
@ -50,6 +51,8 @@ public class MainActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
private void prepareData() {
|
||||
MaxManager.onLoadAd();
|
||||
|
||||
MainViewPager2Adapter pagerAdapter = new MainViewPager2Adapter(this);
|
||||
viewBinding.viewpager2.setAdapter(pagerAdapter);
|
||||
}
|
||||
|
||||
@ -15,6 +15,8 @@ import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import com.ardraw.ardrawingflow.R;
|
||||
import com.ardraw.ardrawingflow.data.database.entity.FlowData;
|
||||
import com.ardraw.ardrawingflow.databinding.ActivitySecondBinding;
|
||||
import com.ardraw.ardrawingflow.max.MaxManager;
|
||||
import com.ardraw.ardrawingflow.max.onAdAfterAction;
|
||||
import com.ardraw.ardrawingflow.ui.adapter.FlowItemAdapter;
|
||||
import com.ardraw.ardrawingflow.ui.viewmodel.FlowViewModel;
|
||||
import com.ardraw.ardrawingflow.util.ItemDecoration;
|
||||
@ -51,6 +53,14 @@ public class SecondActivity extends AppCompatActivity {
|
||||
return;
|
||||
}
|
||||
|
||||
MaxManager.onLoadAd();
|
||||
MaxManager.startShowMaxAd(this, new onAdAfterAction() {
|
||||
@Override
|
||||
public void onAction() {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
String[] parts = path.split("/");
|
||||
title = parts[0].split("_")[1];
|
||||
|
||||
@ -66,7 +76,12 @@ public class SecondActivity extends AppCompatActivity {
|
||||
|
||||
private void initEvent() {
|
||||
binding.back.setOnClickListener(v -> {
|
||||
finish();
|
||||
MaxManager.startShowMaxAd(this, new onAdAfterAction() {
|
||||
@Override
|
||||
public void onAction() {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
});
|
||||
binding.text.setText(title);
|
||||
loadImage();
|
||||
|
||||
@ -12,13 +12,19 @@ import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
import com.ardraw.ardrawingflow.R;
|
||||
import com.ardraw.ardrawingflow.databinding.ActivitySplashBinding;
|
||||
import com.ardraw.ardrawingflow.max.MaxManager;
|
||||
import com.ardraw.ardrawingflow.max.WelComManager;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
||||
|
||||
import kotlin.Unit;
|
||||
import kotlin.jvm.functions.Function0;
|
||||
import kotlin.jvm.functions.Function1;
|
||||
|
||||
public class SplashActivity extends AppCompatActivity {
|
||||
|
||||
private ActivitySplashBinding binding;
|
||||
private static final long TOTAL_TIME = 3000;
|
||||
private static final long TOTAL_TIME = 11000;
|
||||
private CountDownTimer countDownTimer;
|
||||
|
||||
@Override
|
||||
@ -35,23 +41,40 @@ public class SplashActivity extends AppCompatActivity {
|
||||
return insets;
|
||||
});
|
||||
|
||||
MaxManager.onLoadAd();
|
||||
|
||||
Glide.with(this)
|
||||
.load(R.mipmap.ic_launcher)
|
||||
.transform(new RoundedCorners(16))
|
||||
.into(binding.splashImage);
|
||||
|
||||
countDownTimer = new CountDownTimer(TOTAL_TIME, 100) {
|
||||
@Override
|
||||
public void onTick(long millisUntilFinished) {
|
||||
int percentage = (int) (100 - (float) millisUntilFinished / TOTAL_TIME * 100);
|
||||
binding.progressBar.setProgress(percentage);
|
||||
}
|
||||
// countDownTimer = new CountDownTimer(TOTAL_TIME, 100) {
|
||||
// @Override
|
||||
// public void onTick(long millisUntilFinished) {
|
||||
// int percentage = (int) (100 - (float) millisUntilFinished / TOTAL_TIME * 100);
|
||||
// binding.progressBar.setProgress(percentage);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onFinish() {
|
||||
// startMain();
|
||||
// }
|
||||
// };
|
||||
|
||||
countDownTimer = WelComManager.initTimer(this, TOTAL_TIME, new Function1<Long, Unit>() {
|
||||
@Override
|
||||
public void onFinish() {
|
||||
startMain();
|
||||
public Unit invoke(Long aLong) {
|
||||
int percentage = (int) (100 - (float) aLong / TOTAL_TIME * 100);
|
||||
binding.progressBar.setProgress(percentage);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}, new Function0<Unit>() {
|
||||
@Override
|
||||
public Unit invoke() {
|
||||
startMain();
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
countDownTimer.start();
|
||||
}
|
||||
|
||||
@ -1,4 +1,14 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
plugins {
|
||||
alias(libs.plugins.android.application) apply false
|
||||
|
||||
id("com.google.gms.google-services") version "4.3.15" apply false
|
||||
id ("com.google.firebase.crashlytics") version "2.9.2" apply false
|
||||
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"
|
||||
activity = "1.10.1"
|
||||
constraintlayout = "2.2.1"
|
||||
kotlin = "2.1.10"
|
||||
coreKtx = "1.15.0"
|
||||
|
||||
[libraries]
|
||||
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" }
|
||||
activity = { group = "androidx.activity", name = "activity", version.ref = "activity" }
|
||||
constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
|
||||
core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
|
||||
|
||||
[plugins]
|
||||
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()
|
||||
gradlePluginPortal()
|
||||
|
||||
maven { url = uri("https://artifacts.applovin.com/android") }
|
||||
}
|
||||
}
|
||||
dependencyResolutionManagement {
|
||||
@ -16,6 +18,9 @@ dependencyResolutionManagement {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
|
||||
maven { url = uri("https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea") }
|
||||
maven { url = uri("https://artifact.bytedance.com/repository/pangle") }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user