V1.0.1(2)集成max
This commit is contained in:
parent
d508e79d27
commit
2b09da0b6e
@ -4,6 +4,12 @@ plugins {
|
||||
id("com.android.application")
|
||||
id("org.jetbrains.kotlin.android")
|
||||
id("io.objectbox")
|
||||
id("com.google.gms.google-services")
|
||||
id("com.google.firebase.crashlytics")
|
||||
id("applovin-quality-service")
|
||||
}
|
||||
applovin {
|
||||
apiKey = "9R04G8ET68L4N0hKZEtPU6lKu1hXCLuRlLrmRoPxx4xFQ3k2tMQnsOaqu0C1OD1ChMQK8sWZ5DOT9GdantTTvF"
|
||||
}
|
||||
val timestamp = SimpleDateFormat("MM_dd_HH_mm").format(Date())
|
||||
android {
|
||||
@ -15,8 +21,8 @@ android {
|
||||
applicationId = "com.prank.funny.pranks"
|
||||
minSdk = 23
|
||||
targetSdk = 34
|
||||
versionCode = 1
|
||||
versionName = "1.0.0"
|
||||
versionCode = 2
|
||||
versionName = "1.0.1"
|
||||
setProperty("archivesBaseName", "Funny Pranks_V" + versionName + "(${versionCode})_$timestamp")
|
||||
testInstrumentationRunner = "androidx.sounds.runner.AndroidJUnitRunner"
|
||||
vectorDrawables {
|
||||
@ -41,12 +47,12 @@ android {
|
||||
jvmTarget = "17"
|
||||
}
|
||||
buildFeatures {
|
||||
compose = true
|
||||
// compose = true
|
||||
viewBinding = true
|
||||
}
|
||||
composeOptions {
|
||||
kotlinCompilerExtensionVersion = "1.4.3"
|
||||
}
|
||||
// composeOptions {
|
||||
// kotlinCompilerExtensionVersion = "1.0.0"
|
||||
// }
|
||||
packaging {
|
||||
resources {
|
||||
excludes += "/META-INF/{AL2.0,LGPL2.1}"
|
||||
@ -59,8 +65,30 @@ implementation("androidx.appcompat:appcompat:1.6.1")
|
||||
implementation("com.google.android.material:material:1.12.0")
|
||||
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
|
||||
implementation("androidx.legacy:legacy-support-v4:1.0.0")
|
||||
implementation("androidx.recyclerview:recyclerview:1.3.2")
|
||||
implementation("androidx.recyclerview:recyclerview:1.1.0")
|
||||
implementation ("com.github.bumptech.glide:glide:4.16.0")
|
||||
implementation ("com.airbnb.android:lottie:5.2.0")
|
||||
|
||||
|
||||
|
||||
implementation(platform("com.google.firebase:firebase-bom:33.7.0"))
|
||||
implementation("com.google.firebase:firebase-crashlytics")
|
||||
implementation("com.google.firebase:firebase-analytics")
|
||||
implementation("com.google.firebase:firebase-config")
|
||||
|
||||
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:+")
|
||||
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": "448104053775",
|
||||
"project_id": "funny-pranks-53172",
|
||||
"storage_bucket": "funny-pranks-53172.firebasestorage.app"
|
||||
},
|
||||
"client": [
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:448104053775:android:248320451d9529bd72777a",
|
||||
"android_client_info": {
|
||||
"package_name": "com.prank.funny.pranks"
|
||||
}
|
||||
},
|
||||
"oauth_client": [],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyCmvQSvgxNKvKn_XVKctEGC2N2z1HBb75A"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"appinvite_service": {
|
||||
"other_platform_oauth_client": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"configuration_version": "1"
|
||||
}
|
||||
@ -1,9 +1,16 @@
|
||||
package com.prank.funny.pranks;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Intent;
|
||||
import android.content.res.AssetManager;
|
||||
import android.graphics.Typeface;
|
||||
|
||||
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.prank.funny.pranks.bean.Info;
|
||||
|
||||
import com.prank.funny.pranks.bean.MyBean;
|
||||
@ -20,6 +27,11 @@ public class FunnyApp extends Application {
|
||||
public static FunnyApp app;
|
||||
public static Typeface defaultFont;
|
||||
public static List<MyBean> bean;
|
||||
public static String TAG = "===========";
|
||||
|
||||
public static boolean initSDkOK = false;
|
||||
public static String initAction = "INIT_SDK";
|
||||
private String SDK_KEY = "A8q_8gENDJGKqq6bzfJLd8yNn0brHCopf1iv1xT0Tudcg5MafTgslq2IByc8cPySOfOieiKTJqCr9cd8Vw4bCz";
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
@ -28,6 +40,7 @@ public class FunnyApp extends Application {
|
||||
AssetManager assets = getAssets();
|
||||
defaultFont = Typeface.createFromAsset(assets, "prankfont.ttf");
|
||||
DataBase.init(this);
|
||||
initMAxSDk();
|
||||
if (bean != null)
|
||||
return;
|
||||
try {
|
||||
@ -36,7 +49,7 @@ public class FunnyApp extends Application {
|
||||
if (!string.isEmpty()) {
|
||||
bean = Common.getBean(string);
|
||||
Collections.shuffle(bean);
|
||||
for (MyBean category:bean){
|
||||
for (MyBean category : bean) {
|
||||
for (Info info1 : category.getInfoList()) {
|
||||
info1.setLike(false);
|
||||
DataBase.getBoxBean().put(info1);
|
||||
@ -47,4 +60,18 @@ public class FunnyApp extends Application {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void initMAxSDk() {
|
||||
AppLovinSdkInitializationConfiguration initConfig = AppLovinSdkInitializationConfiguration.builder(SDK_KEY, this)
|
||||
.setMediationProvider(AppLovinMediationProvider.MAX)
|
||||
.build();
|
||||
AppLovinSdk.getInstance(this).initialize(initConfig, new AppLovinSdk.SdkInitializationListener() {
|
||||
@Override
|
||||
public void onSdkInitialized(AppLovinSdkConfiguration appLovinSdkConfiguration) {
|
||||
initSDkOK = true;
|
||||
LocalBroadcastManager.getInstance(FunnyApp.this).sendBroadcast(new Intent(initAction));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,11 @@
|
||||
package com.prank.funny.pranks.max;
|
||||
|
||||
import com.applovin.mediation.MaxAd;
|
||||
|
||||
public interface MaxListener {
|
||||
void onFail(MaxAd ad);
|
||||
|
||||
void onShowSuccess(MaxAd ad);
|
||||
|
||||
void onHidden();
|
||||
}
|
||||
171
app/src/main/java/com/prank/funny/pranks/max/MaxManager.java
Normal file
171
app/src/main/java/com/prank/funny/pranks/max/MaxManager.java
Normal file
@ -0,0 +1,171 @@
|
||||
package com.prank.funny.pranks.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.prank.funny.pranks.FunnyApp;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class MaxManager {
|
||||
|
||||
private static final String one_AD = "889e0fa22ec24651";
|
||||
private static final String two_Ad = "65a283ca58749b4d";
|
||||
private static final String three_ad = "b1b772652371cee1";
|
||||
|
||||
|
||||
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, FunnyApp.app);
|
||||
MaxInterstitialAd AdOne = new MaxInterstitialAd(one_AD, FunnyApp.app);
|
||||
MaxInterstitialAd AdThree = new MaxInterstitialAd(three_ad, FunnyApp.app);
|
||||
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(FunnyApp.TAG, "-------onAdLoaded-----maxAd=" + maxAd.getAdUnitId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdDisplayed(@NonNull MaxAd maxAd) {
|
||||
Log.d(FunnyApp.TAG, "-------onAdDisplayed-----maxAd=" + maxAd.getAdUnitId());
|
||||
maxListener.onShowSuccess(maxAd);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdHidden(@NonNull MaxAd maxAd) {
|
||||
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(FunnyApp.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,77 @@
|
||||
package com.prank.funny.pranks.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.prank.funny.pranks.FunnyApp
|
||||
|
||||
|
||||
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(FunnyApp.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(FunnyApp.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(FunnyApp.TAG, "--onFinish---------enter")
|
||||
goMainAction.invoke()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
startAd(activity)
|
||||
return timer
|
||||
}
|
||||
|
||||
private fun startAd(activity: Activity) {
|
||||
if (!FunnyApp.initSDkOK) {
|
||||
LocalBroadcastManager.getInstance(activity)
|
||||
.registerReceiver(object : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context?, intent: Intent?) {
|
||||
lists = MaxManager.onLoadAd()
|
||||
timer.start()
|
||||
Log.d(FunnyApp.TAG, "------------1sucess")
|
||||
}
|
||||
}, IntentFilter(FunnyApp.initAction))
|
||||
} else {
|
||||
lists = MaxManager.onLoadAd()
|
||||
timer.start()
|
||||
Log.d(FunnyApp.TAG, "------------2sucess")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
package com.prank.funny.pranks.max;
|
||||
|
||||
public interface onAdAfterAction {
|
||||
|
||||
void onAction();
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
package com.prank.funny.pranks.max;
|
||||
|
||||
public interface onAdStatusListener {
|
||||
|
||||
void onAdStatus(int type);
|
||||
}
|
||||
@ -12,6 +12,8 @@ import com.prank.funny.pranks.bean.Info;
|
||||
import com.prank.funny.pranks.bean.MyBean;
|
||||
import com.prank.funny.pranks.databinding.LayoutInfoBinding;
|
||||
import com.prank.funny.pranks.listener.PranksListener;
|
||||
import com.prank.funny.pranks.max.MaxManager;
|
||||
import com.prank.funny.pranks.max.onAdAfterAction;
|
||||
import com.prank.funny.pranks.tools.Common;
|
||||
import com.prank.funny.pranks.tools.ItemSpace;
|
||||
|
||||
@ -30,8 +32,15 @@ public class ActivityClass extends AppCompatActivity implements View.OnClickList
|
||||
data = (MyBean) getIntent().getSerializableExtra(Common.KEY_LIST_DATA);
|
||||
colorIndex = getIntent().getIntExtra(Common.KEY_LIST_COLOR_POS,0);
|
||||
activityListBinding.categoryName.setText(data.getName());
|
||||
MaxManager.onLoadAd();
|
||||
onList();
|
||||
activityListBinding.back.setOnClickListener(this);
|
||||
MaxManager.startShowMaxAd(ActivityClass.this, new onAdAfterAction() {
|
||||
@Override
|
||||
public void onAction() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void onList() {
|
||||
@ -46,7 +55,15 @@ public class ActivityClass extends AppCompatActivity implements View.OnClickList
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if(v.equals(activityListBinding.back)){
|
||||
finish();
|
||||
|
||||
|
||||
MaxManager.startShowMaxAd(ActivityClass.this, new onAdAfterAction() {
|
||||
@Override
|
||||
public void onAction() {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -19,6 +19,7 @@ import androidx.viewpager2.widget.ViewPager2;
|
||||
|
||||
import com.prank.funny.pranks.R;
|
||||
import com.prank.funny.pranks.databinding.LayoutMainBinding;
|
||||
import com.prank.funny.pranks.max.MaxManager;
|
||||
import com.prank.funny.pranks.tools.Common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -39,6 +40,7 @@ public class ActivityMain extends AppCompatActivity implements View.OnClickListe
|
||||
activityMainBinding = LayoutMainBinding.inflate(getLayoutInflater());
|
||||
setContentView(activityMainBinding.getRoot());
|
||||
Common.setStatusBarTextColor(this, true);
|
||||
MaxManager.onLoadAd();
|
||||
initVp2();
|
||||
activityMainBinding.frameHome.setOnClickListener(this);
|
||||
activityMainBinding.frameAdd.setOnClickListener(this);
|
||||
|
||||
@ -21,6 +21,8 @@ import com.prank.funny.pranks.bean.Info;
|
||||
import com.prank.funny.pranks.databinding.LayoutPlayBinding;
|
||||
import com.prank.funny.pranks.listener.PranksListener;
|
||||
import com.prank.funny.pranks.listener.TimerListener;
|
||||
import com.prank.funny.pranks.max.MaxManager;
|
||||
import com.prank.funny.pranks.max.onAdAfterAction;
|
||||
import com.prank.funny.pranks.tools.Common;
|
||||
import com.prank.funny.pranks.tools.DataBase;
|
||||
import com.prank.funny.pranks.tools.ItemSpace;
|
||||
@ -43,7 +45,7 @@ public class ActivityPlayPranks extends AppCompatActivity implements View.OnClic
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
MaxManager.onLoadAd();
|
||||
playBinding = LayoutPlayBinding.inflate(getLayoutInflater());
|
||||
setContentView(playBinding.getRoot());
|
||||
Common.setStatusBarTextColor(this, true);
|
||||
@ -67,7 +69,12 @@ public class ActivityPlayPranks extends AppCompatActivity implements View.OnClic
|
||||
playBinding.imLoop.setOnClickListener(this);
|
||||
playBinding.imTimer.setOnClickListener(this);
|
||||
Common.setVolume(this, playBinding.seekbar);
|
||||
MaxManager.startShowMaxAd(ActivityPlayPranks.this, new onAdAfterAction() {
|
||||
@Override
|
||||
public void onAction() {
|
||||
|
||||
}
|
||||
});
|
||||
initLike();
|
||||
loadMore();
|
||||
volumeReceiver();
|
||||
@ -169,17 +176,23 @@ public class ActivityPlayPranks extends AppCompatActivity implements View.OnClic
|
||||
if (v.equals(playBinding.back)) {
|
||||
finish();
|
||||
} else if (v.equals(playBinding.btnPlay)) {
|
||||
boolean selected = playBinding.btnPlay.isSelected();
|
||||
if (selected) {
|
||||
if (mediaPlayer.isPlaying()) {
|
||||
mediaPlayer.pause();
|
||||
MaxManager.startShowMaxAd(ActivityPlayPranks.this, new onAdAfterAction() {
|
||||
@Override
|
||||
public void onAction() {
|
||||
boolean selected = playBinding.btnPlay.isSelected();
|
||||
if (selected) {
|
||||
if (mediaPlayer.isPlaying()) {
|
||||
mediaPlayer.pause();
|
||||
}
|
||||
} else {
|
||||
if (!mediaPlayer.isPlaying()) {
|
||||
mediaPlayer.start();
|
||||
}
|
||||
}
|
||||
playBinding.btnPlay.setSelected(!selected);
|
||||
}
|
||||
} else {
|
||||
if (!mediaPlayer.isPlaying()) {
|
||||
mediaPlayer.start();
|
||||
}
|
||||
}
|
||||
playBinding.btnPlay.setSelected(!selected);
|
||||
});
|
||||
|
||||
|
||||
} else if (v.equals(playBinding.imLike)) {
|
||||
playBinding.imLike.setSelected(!playBinding.imLike.isSelected());
|
||||
@ -197,7 +210,14 @@ public class ActivityPlayPranks extends AppCompatActivity implements View.OnClic
|
||||
if (popupTimer == null) {
|
||||
popupTimer = new PopupTimer(ActivityPlayPranks.this, this);
|
||||
}
|
||||
popupTimer.showTop(playBinding.imTimer);
|
||||
|
||||
MaxManager.startShowMaxAd(ActivityPlayPranks.this, new onAdAfterAction() {
|
||||
@Override
|
||||
public void onAction() {
|
||||
popupTimer.showTop(playBinding.imTimer);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -11,6 +11,7 @@ import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.prank.funny.pranks.R;
|
||||
import com.prank.funny.pranks.databinding.LayoutRecordBinding;
|
||||
import com.prank.funny.pranks.max.MaxManager;
|
||||
import com.prank.funny.pranks.tools.Common;
|
||||
import com.prank.funny.pranks.tools.Record;
|
||||
|
||||
@ -31,7 +32,7 @@ public class ActivityRecorder extends AppCompatActivity {
|
||||
setContentView(binding.getRoot());
|
||||
Common.setStatusBarTextColor(this, true);
|
||||
record = new Record(this);
|
||||
|
||||
MaxManager.onLoadAd();
|
||||
binding.audioTime.setText(R.string.time_init);
|
||||
|
||||
initEvent();
|
||||
|
||||
@ -19,6 +19,8 @@ import androidx.appcompat.app.AppCompatActivity;
|
||||
import com.prank.funny.pranks.R;
|
||||
import com.prank.funny.pranks.bean.Info;
|
||||
import com.prank.funny.pranks.databinding.LayoutSaveBinding;
|
||||
import com.prank.funny.pranks.max.MaxManager;
|
||||
import com.prank.funny.pranks.max.onAdAfterAction;
|
||||
import com.prank.funny.pranks.tools.Common;
|
||||
import com.prank.funny.pranks.tools.DataBase;
|
||||
|
||||
@ -47,7 +49,7 @@ public class ActivitySavePrank extends AppCompatActivity {
|
||||
super.onCreate(savedInstanceState);
|
||||
binding = LayoutSaveBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
|
||||
MaxManager.onLoadAd();
|
||||
Common.setStatusBarTextColor(this, true);
|
||||
binding.audioTime.setText(R.string.time_init);
|
||||
initData();
|
||||
@ -136,20 +138,30 @@ public class ActivitySavePrank extends AppCompatActivity {
|
||||
}
|
||||
});
|
||||
binding.save.setOnClickListener(v -> {
|
||||
String name = binding.saveEdit.getText().toString().trim();
|
||||
boolean b = DataBase.checkName(name);
|
||||
if (!TextUtils.isEmpty(name)) {
|
||||
if(!b){
|
||||
binding.saveEdit.setText("");
|
||||
Toast.makeText(ActivitySavePrank.this, getString(R.string.name_hint), Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
|
||||
|
||||
MaxManager.startShowMaxAd(ActivitySavePrank.this, new onAdAfterAction() {
|
||||
@Override
|
||||
public void onAction() {
|
||||
String name = binding.saveEdit.getText().toString().trim();
|
||||
boolean b = DataBase.checkName(name);
|
||||
if (!TextUtils.isEmpty(name)) {
|
||||
if(!b){
|
||||
binding.saveEdit.setText("");
|
||||
Toast.makeText(ActivitySavePrank.this, getString(R.string.name_hint), Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
saveData(name);
|
||||
Toast.makeText(ActivitySavePrank.this, getString(R.string.save_tips), Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
} else {
|
||||
Toast.makeText(ActivitySavePrank.this, getString(R.string.save_tip), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
saveData(name);
|
||||
Toast.makeText(ActivitySavePrank.this, getString(R.string.save_tips), Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
} else {
|
||||
Toast.makeText(ActivitySavePrank.this, getString(R.string.save_tip), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -7,13 +7,18 @@ import android.os.CountDownTimer;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.prank.funny.pranks.databinding.LayoutWelcomeBinding;
|
||||
import com.prank.funny.pranks.max.WelComManager;
|
||||
import com.prank.funny.pranks.tools.Common;
|
||||
|
||||
import kotlin.Unit;
|
||||
import kotlin.jvm.functions.Function0;
|
||||
import kotlin.jvm.functions.Function1;
|
||||
|
||||
public class ActivitySplash extends AppCompatActivity {
|
||||
|
||||
private long time = 1000;
|
||||
private long time = 12000;
|
||||
private LayoutWelcomeBinding binding;
|
||||
private CountDownTimer countDownTimer;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@ -21,21 +26,24 @@ public class ActivitySplash extends AppCompatActivity {
|
||||
binding = LayoutWelcomeBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
Common.setStatusBarTextColor(this, true);
|
||||
countDownTimer = new CountDownTimer(time, 200) {
|
||||
|
||||
|
||||
WelComManager.initTimer(ActivitySplash.this, time, new Function1<Long, Unit>() {
|
||||
@Override
|
||||
public void onTick(long millisUntilFinished) {
|
||||
int progressPercentage = (int) ((100 * millisUntilFinished) / time);
|
||||
public Unit invoke(Long aLong) {
|
||||
int progressPercentage = (int) ((100 * aLong) / time);
|
||||
int Percentage = 100 - progressPercentage;
|
||||
binding.loadingPb.setProgress(Percentage);
|
||||
return null;
|
||||
}
|
||||
|
||||
}, new Function0<Unit>() {
|
||||
@Override
|
||||
public void onFinish() {
|
||||
public Unit invoke() {
|
||||
welcomeMain();
|
||||
return null;
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
countDownTimer.start();
|
||||
}
|
||||
|
||||
private void welcomeMain() {
|
||||
@ -48,8 +56,6 @@ public class ActivitySplash extends AppCompatActivity {
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (countDownTimer != null) {
|
||||
countDownTimer.cancel();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -22,6 +22,8 @@ import com.prank.funny.pranks.adapter.AdLike;
|
||||
import com.prank.funny.pranks.bean.Info;
|
||||
import com.prank.funny.pranks.databinding.FragRecorderBinding;
|
||||
import com.prank.funny.pranks.listener.RecordListener;
|
||||
import com.prank.funny.pranks.max.MaxManager;
|
||||
import com.prank.funny.pranks.max.onAdAfterAction;
|
||||
import com.prank.funny.pranks.tools.Common;
|
||||
import com.prank.funny.pranks.tools.DataBase;
|
||||
import com.prank.funny.pranks.tools.ItemSpace;
|
||||
@ -159,10 +161,16 @@ public class FragmentRecorder extends Fragment implements View.OnClickListener ,
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if(v.equals(binding.menu)){
|
||||
if (popRecorder == null) {
|
||||
popRecorder = new PopImport(requireActivity(), this);
|
||||
}
|
||||
popRecorder.showBottom(binding.menu);
|
||||
MaxManager.startShowMaxAd(requireActivity(), new onAdAfterAction() {
|
||||
@Override
|
||||
public void onAction() {
|
||||
if (popRecorder == null) {
|
||||
popRecorder = new PopImport(requireActivity(), FragmentRecorder.this);
|
||||
}
|
||||
popRecorder.showBottom(binding.menu);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -5,7 +5,6 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
|
||||
android:paddingTop="34dp"
|
||||
tools:context="com.prank.funny.pranks.pager.ActivityClass">
|
||||
|
||||
@ -34,7 +33,7 @@
|
||||
android:layout_height="45dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:padding="10dp"
|
||||
android:src="@drawable/im_back" />
|
||||
android:src="@drawable/my_back" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
android:layout_height="45dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:padding="10dp"
|
||||
android:src="@drawable/im_back" />
|
||||
android:src="@drawable/my_back" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
android:layout_height="45dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:padding="10dp"
|
||||
android:src="@drawable/im_back" />
|
||||
android:src="@drawable/my_back" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
android:layout_height="45dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:padding="10dp"
|
||||
android:src="@drawable/im_back" />
|
||||
android:src="@drawable/my_back" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
android:layout_marginBottom="35dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:progress="90"
|
||||
android:progress="1"
|
||||
android:progressDrawable="@drawable/progress_welcome" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
plugins {
|
||||
id("com.android.application") version "8.1.3" apply false
|
||||
id("org.jetbrains.kotlin.android") version "1.8.10" apply false
|
||||
id("org.jetbrains.kotlin.android") version "1.9.0" apply false
|
||||
id ("com.google.gms.google-services") version "4.4.2" apply false
|
||||
id ("com.google.firebase.crashlytics") version "3.0.2" apply false
|
||||
}
|
||||
|
||||
buildscript {
|
||||
@ -17,5 +19,6 @@ buildscript {
|
||||
// Android Gradle Plugin 4.1.0 or later supported.
|
||||
// classpath("com.android.tools.build:gradle:8.1.0")
|
||||
classpath("io.objectbox:objectbox-gradle-plugin:$objectboxVersion")
|
||||
classpath ("com.applovin.quality:AppLovinQualityServiceGradlePlugin:+")
|
||||
}
|
||||
}
|
||||
@ -3,7 +3,7 @@ pluginManagement {
|
||||
google()
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
|
||||
maven { url = uri("https://artifacts.applovin.com/android") }
|
||||
|
||||
}
|
||||
}
|
||||
@ -12,6 +12,10 @@ dependencyResolutionManagement {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
|
||||
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