接Max 1.0.1(2)
This commit is contained in:
parent
f0973dc51e
commit
e884467d56
5
.gitignore
vendored
5
.gitignore
vendored
@ -13,3 +13,8 @@
|
|||||||
.externalNativeBuild
|
.externalNativeBuild
|
||||||
.cxx
|
.cxx
|
||||||
local.properties
|
local.properties
|
||||||
|
.idea/
|
||||||
|
.safedk/
|
||||||
|
app/release/AppLocker pro_V1.0.1(2)_07_19_16_40-release.apk
|
||||||
|
app/release/AppLocker pro_V1.0.1(2)_07_19_17_24-release.aab
|
||||||
|
app/release/output-metadata.json
|
||||||
|
|||||||
@ -6,22 +6,29 @@ plugins {
|
|||||||
id("com.android.application")
|
id("com.android.application")
|
||||||
id("org.jetbrains.kotlin.android")
|
id("org.jetbrains.kotlin.android")
|
||||||
id("kotlin-kapt")
|
id("kotlin-kapt")
|
||||||
// id("com.google.gms.google-services")
|
id("com.google.gms.google-services")
|
||||||
// id("com.google.firebase.crashlytics")
|
id("com.google.firebase.crashlytics")
|
||||||
|
id("applovin-quality-service")
|
||||||
|
}
|
||||||
|
applovin {
|
||||||
|
apiKey =
|
||||||
|
"cwxHIA0xwtZC4J0O0D4ud92agwa21fVRElWRTpTok3DQINtfa417bkmh-CGuN7zvHCuIMPK5yzTEsIMe_786de"
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
namespace = "com.tool.app.protectorpro"
|
namespace = "com.tool.app.protectorpro"
|
||||||
compileSdk = 34
|
compileSdk = 34
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
//com.tool.app.protectorpro
|
//com.tool.app.protectorpro
|
||||||
applicationId = "com.tool.app.test"
|
applicationId = "com.tool.app.protectorpro"
|
||||||
minSdk = 23
|
minSdk = 23
|
||||||
targetSdk = 34
|
targetSdk = 34
|
||||||
versionCode = 1
|
versionCode = 2
|
||||||
versionName = "1.0.0"
|
versionName = "1.0.1"
|
||||||
setProperty("archivesBaseName", "AppLocker pro_V" + versionName + "(${versionCode})_$timestamp")
|
setProperty(
|
||||||
|
"archivesBaseName",
|
||||||
|
"AppLocker pro_V" + versionName + "(${versionCode})_$timestamp"
|
||||||
|
)
|
||||||
testInstrumentationRunner = "androidx.protectorpro.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.protectorpro.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,8 +70,11 @@ dependencies {
|
|||||||
implementation("com.google.firebase:firebase-crashlytics")
|
implementation("com.google.firebase:firebase-crashlytics")
|
||||||
implementation("com.google.firebase:firebase-analytics")
|
implementation("com.google.firebase:firebase-analytics")
|
||||||
|
|
||||||
|
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": "46896618954",
|
||||||
|
"project_id": "applock-pro-a4572",
|
||||||
|
"storage_bucket": "applock-pro-a4572.appspot.com"
|
||||||
|
},
|
||||||
|
"client": [
|
||||||
|
{
|
||||||
|
"client_info": {
|
||||||
|
"mobilesdk_app_id": "1:46896618954:android:1c8089340d55ecf215c333",
|
||||||
|
"android_client_info": {
|
||||||
|
"package_name": "com.tool.app.protectorpro"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"oauth_client": [],
|
||||||
|
"api_key": [
|
||||||
|
{
|
||||||
|
"current_key": "AIzaSyD4RBPwCsQf9Hae8tA4Z1h0sa_MP36XwZY"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"services": {
|
||||||
|
"appinvite_service": {
|
||||||
|
"other_platform_oauth_client": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"configuration_version": "1"
|
||||||
|
}
|
||||||
@ -2,6 +2,8 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||||
<uses-permission
|
<uses-permission
|
||||||
android:name="android.permission.PACKAGE_USAGE_STATS"
|
android:name="android.permission.PACKAGE_USAGE_STATS"
|
||||||
|
|||||||
@ -2,8 +2,16 @@ package com.tool.app.protectorpro;
|
|||||||
|
|
||||||
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.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.tool.app.protectorpro.mydb.DataApp;
|
import com.tool.app.protectorpro.mydb.DataApp;
|
||||||
import com.tool.app.protectorpro.mydb.MyDataBase;
|
import com.tool.app.protectorpro.mydb.MyDataBase;
|
||||||
import com.tool.app.protectorpro.tools.Common;
|
import com.tool.app.protectorpro.tools.Common;
|
||||||
@ -32,14 +40,19 @@ public class MyApplication extends Application {
|
|||||||
public static final int type_2 = 2;
|
public static final int type_2 = 2;
|
||||||
public static final String init_pwd_key = "pwd_type";
|
public static final String init_pwd_key = "pwd_type";
|
||||||
public static int userOption = 0;
|
public static int userOption = 0;
|
||||||
|
private static Context context;
|
||||||
|
|
||||||
|
public static final String AD_BROADCAST = "on_success_action";
|
||||||
|
private static final String MAX_SDK = "gOI7_5_DTTS8XFbtBncQSLPuqsKdh7UWwQ73rVxHD72rG3Me88_VMk9flB87BlGCS6TAUy1h8F9uQ8MwRMN0gc";
|
||||||
|
public static Boolean initSDK = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
appContext = this;
|
appContext = this;
|
||||||
|
|
||||||
|
context = getApplicationContext();
|
||||||
|
|
||||||
initSDk();
|
initSDk();
|
||||||
initSp();
|
initSp();
|
||||||
MyThread.runIO(() -> {
|
MyThread.runIO(() -> {
|
||||||
@ -60,8 +73,21 @@ public class MyApplication extends Application {
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void 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(context).sendBroadcast(new Intent(AD_BROADCAST));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
AppLovinSdk.getInstance(this).getSettings().setVerboseLogging(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void updatePwd(String pwd) {
|
public static void updatePwd(String pwd) {
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import android.content.Intent;
|
|||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
@ -18,12 +19,15 @@ import androidx.fragment.app.Fragment;
|
|||||||
import androidx.fragment.app.FragmentStatePagerAdapter;
|
import androidx.fragment.app.FragmentStatePagerAdapter;
|
||||||
import androidx.viewpager.widget.ViewPager;
|
import androidx.viewpager.widget.ViewPager;
|
||||||
|
|
||||||
|
import com.applovin.mediation.MaxAd;
|
||||||
|
import com.applovin.mediation.ads.MaxInterstitialAd;
|
||||||
import com.google.android.material.bottomsheet.BottomSheetDialog;
|
import com.google.android.material.bottomsheet.BottomSheetDialog;
|
||||||
import com.google.android.material.tabs.TabLayout;
|
import com.google.android.material.tabs.TabLayout;
|
||||||
import com.tool.app.protectorpro.MyApplication;
|
import com.tool.app.protectorpro.MyApplication;
|
||||||
import com.tool.app.protectorpro.R;
|
import com.tool.app.protectorpro.R;
|
||||||
import com.tool.app.protectorpro.databinding.ActivityMainLayoutBinding;
|
import com.tool.app.protectorpro.databinding.ActivityMainLayoutBinding;
|
||||||
import com.tool.app.protectorpro.databinding.TabViewBinding;
|
import com.tool.app.protectorpro.databinding.TabViewBinding;
|
||||||
|
import com.tool.app.protectorpro.listener.Adcallback;
|
||||||
import com.tool.app.protectorpro.listener.onPermssionListener;
|
import com.tool.app.protectorpro.listener.onPermssionListener;
|
||||||
import com.tool.app.protectorpro.service.LockService;
|
import com.tool.app.protectorpro.service.LockService;
|
||||||
import com.tool.app.protectorpro.tools.Common;
|
import com.tool.app.protectorpro.tools.Common;
|
||||||
@ -37,6 +41,9 @@ public class ActivityMain extends AppCompatActivity implements SearchView.OnQuer
|
|||||||
private DialogPer dialogPer;
|
private DialogPer dialogPer;
|
||||||
|
|
||||||
List<Fragment> fragmentList = new ArrayList<>();
|
List<Fragment> fragmentList = new ArrayList<>();
|
||||||
|
private static List<MaxInterstitialAd> adsList;
|
||||||
|
|
||||||
|
private BottomSheetDialog bottomSheetDialog;
|
||||||
|
|
||||||
private void initStatusBar() {
|
private void initStatusBar() {
|
||||||
View decorView = getWindow().getDecorView();
|
View decorView = getWindow().getDecorView();
|
||||||
@ -52,6 +59,9 @@ public class ActivityMain extends AppCompatActivity implements SearchView.OnQuer
|
|||||||
binding = ActivityMainLayoutBinding.inflate(getLayoutInflater());
|
binding = ActivityMainLayoutBinding.inflate(getLayoutInflater());
|
||||||
setContentView(binding.getRoot());
|
setContentView(binding.getRoot());
|
||||||
binding.searchItem.setOnQueryTextListener(this);
|
binding.searchItem.setOnQueryTextListener(this);
|
||||||
|
|
||||||
|
adsList = Common.getAllAd();
|
||||||
|
|
||||||
initStatusBar();
|
initStatusBar();
|
||||||
openPermission();
|
openPermission();
|
||||||
startService(new Intent(this, LockService.class));
|
startService(new Intent(this, LockService.class));
|
||||||
@ -148,7 +158,7 @@ public class ActivityMain extends AppCompatActivity implements SearchView.OnQuer
|
|||||||
if (isDestroyed())
|
if (isDestroyed())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(ActivityMain.this);
|
bottomSheetDialog = new BottomSheetDialog(ActivityMain.this);
|
||||||
View bottomSheetView = LayoutInflater.from(ActivityMain.this).inflate(R.layout.set_bottom_sheet_layout, null);
|
View bottomSheetView = LayoutInflater.from(ActivityMain.this).inflate(R.layout.set_bottom_sheet_layout, null);
|
||||||
bottomSheetDialog.setContentView(bottomSheetView);
|
bottomSheetDialog.setContentView(bottomSheetView);
|
||||||
|
|
||||||
@ -161,10 +171,7 @@ public class ActivityMain extends AppCompatActivity implements SearchView.OnQuer
|
|||||||
// 按钮1点击事件
|
// 按钮1点击事件
|
||||||
btnOption1.setOnClickListener(v -> {
|
btnOption1.setOnClickListener(v -> {
|
||||||
// TODO: 2024/7/19
|
// TODO: 2024/7/19
|
||||||
Intent intent = new Intent(ActivityMain.this, ActivitySetPwd.class);
|
showAd();
|
||||||
intent.putExtra(MyApplication.init_pwd_key, MyApplication.type_1);
|
|
||||||
startActivity(intent);
|
|
||||||
bottomSheetDialog.dismiss();
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -179,6 +186,35 @@ public class ActivityMain extends AppCompatActivity implements SearchView.OnQuer
|
|||||||
bottomSheetDialog.show();
|
bottomSheetDialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void showAd() {
|
||||||
|
MaxInterstitialAd cachedAd = Common.onCache(adsList);
|
||||||
|
|
||||||
|
if (cachedAd == null) {
|
||||||
|
goSet();
|
||||||
|
} else {
|
||||||
|
Common.setCallBcak(cachedAd, new Adcallback() {
|
||||||
|
@Override
|
||||||
|
public void onShowFail(MaxAd ad) {
|
||||||
|
goSet();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAdHidden() {
|
||||||
|
goSet();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
cachedAd.showAd(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void goSet() {
|
||||||
|
|
||||||
|
Intent intent = new Intent(ActivityMain.this, ActivitySetPwd.class);
|
||||||
|
intent.putExtra(MyApplication.init_pwd_key, MyApplication.type_1);
|
||||||
|
startActivity(intent);
|
||||||
|
bottomSheetDialog.dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
private void updateTab(TabLayout.Tab tab, boolean isSelected) {
|
private void updateTab(TabLayout.Tab tab, boolean isSelected) {
|
||||||
View customView = tab.getCustomView();
|
View customView = tab.getCustomView();
|
||||||
if (customView == null) return;
|
if (customView == null) return;
|
||||||
|
|||||||
@ -1,15 +1,26 @@
|
|||||||
package com.tool.app.protectorpro.activity;
|
package com.tool.app.protectorpro.activity;
|
||||||
|
|
||||||
|
import android.content.BroadcastReceiver;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.IntentFilter;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.CountDownTimer;
|
import android.os.CountDownTimer;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||||
|
|
||||||
|
import com.applovin.mediation.MaxAd;
|
||||||
|
import com.applovin.mediation.ads.MaxInterstitialAd;
|
||||||
import com.tool.app.protectorpro.MyApplication;
|
import com.tool.app.protectorpro.MyApplication;
|
||||||
import com.tool.app.protectorpro.databinding.ActivityWelBinding;
|
import com.tool.app.protectorpro.databinding.ActivityWelBinding;
|
||||||
|
import com.tool.app.protectorpro.listener.Adcallback;
|
||||||
|
import com.tool.app.protectorpro.tools.Common;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class ActivityWel extends AppCompatActivity {
|
public class ActivityWel extends AppCompatActivity {
|
||||||
|
|
||||||
@ -18,6 +29,8 @@ public class ActivityWel extends AppCompatActivity {
|
|||||||
|
|
||||||
private CountDownTimer countDownTimer;
|
private CountDownTimer countDownTimer;
|
||||||
private long totalTime = 11000;
|
private long totalTime = 11000;
|
||||||
|
private static List<MaxInterstitialAd> adsList;
|
||||||
|
public static boolean isAlreadyShow = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@ -26,8 +39,76 @@ public class ActivityWel extends AppCompatActivity {
|
|||||||
setContentView(binding.getRoot());
|
setContentView(binding.getRoot());
|
||||||
initBar();
|
initBar();
|
||||||
|
|
||||||
|
|
||||||
|
countDownTimer = new CountDownTimer(totalTime, 200) {
|
||||||
|
@Override
|
||||||
|
public void onTick(long millisUntilFinished) {
|
||||||
|
if (!isAlreadyShow) {
|
||||||
|
showAdOrStartView(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFinish() {
|
||||||
|
if (!isAlreadyShow) {
|
||||||
|
showAdOrStartView(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
registerBroadcastReceiver();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showAdOrStartView(boolean go) {
|
||||||
|
MaxInterstitialAd cachedAd = Common.onCache(adsList);
|
||||||
|
if (cachedAd == null) {
|
||||||
|
isAlreadyShow = false;
|
||||||
|
if (go) {
|
||||||
goMain();
|
goMain();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
isAlreadyShow = true;
|
||||||
|
Common.setCallBcak(cachedAd, new Adcallback() {
|
||||||
|
@Override
|
||||||
|
public void onShowFail(MaxAd ad) {
|
||||||
|
isAlreadyShow = false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAdHidden() {
|
||||||
|
isAlreadyShow = true;
|
||||||
|
goMain();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
cachedAd.showAd();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void registerBroadcastReceiver() {
|
||||||
|
if (!MyApplication.initSDK) {
|
||||||
|
BroadcastReceiver receiver = new BroadcastReceiver() {
|
||||||
|
@Override
|
||||||
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
|
||||||
|
loadAndStartAd();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
LocalBroadcastManager.getInstance(this).registerReceiver(receiver, new IntentFilter(MyApplication.AD_BROADCAST));
|
||||||
|
} else {
|
||||||
|
|
||||||
|
loadAndStartAd();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadAndStartAd() {
|
||||||
|
adsList = Common.getAllAd();
|
||||||
|
countDownTimer.start();
|
||||||
|
}
|
||||||
|
|
||||||
private void goMain() {
|
private void goMain() {
|
||||||
String pwd = MyApplication.getPwd();
|
String pwd = MyApplication.getPwd();
|
||||||
|
|||||||
@ -18,11 +18,15 @@ import androidx.annotation.NonNull;
|
|||||||
import androidx.appcompat.widget.SwitchCompat;
|
import androidx.appcompat.widget.SwitchCompat;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.applovin.mediation.MaxAd;
|
||||||
|
import com.applovin.mediation.ads.MaxInterstitialAd;
|
||||||
import com.tool.app.protectorpro.MyApplication;
|
import com.tool.app.protectorpro.MyApplication;
|
||||||
import com.tool.app.protectorpro.R;
|
import com.tool.app.protectorpro.R;
|
||||||
|
import com.tool.app.protectorpro.listener.Adcallback;
|
||||||
import com.tool.app.protectorpro.listener.OnShowDialogMsgListener;
|
import com.tool.app.protectorpro.listener.OnShowDialogMsgListener;
|
||||||
import com.tool.app.protectorpro.mydb.DataApp;
|
import com.tool.app.protectorpro.mydb.DataApp;
|
||||||
import com.tool.app.protectorpro.mydb.MyDataBase;
|
import com.tool.app.protectorpro.mydb.MyDataBase;
|
||||||
|
import com.tool.app.protectorpro.tools.Common;
|
||||||
import com.tool.app.protectorpro.tools.MyThread;
|
import com.tool.app.protectorpro.tools.MyThread;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -36,7 +40,7 @@ public class AdapterAllApp extends RecyclerView.Adapter<AdapterAllApp.AppViewHol
|
|||||||
private Activity mActivity;
|
private Activity mActivity;
|
||||||
private PackageManager packageManager;
|
private PackageManager packageManager;
|
||||||
|
|
||||||
|
private static List<MaxInterstitialAd> adsList;
|
||||||
private OnShowDialogMsgListener listener;
|
private OnShowDialogMsgListener listener;
|
||||||
|
|
||||||
public void setListener(OnShowDialogMsgListener listener) {
|
public void setListener(OnShowDialogMsgListener listener) {
|
||||||
@ -44,6 +48,7 @@ public class AdapterAllApp extends RecyclerView.Adapter<AdapterAllApp.AppViewHol
|
|||||||
}
|
}
|
||||||
|
|
||||||
public AdapterAllApp(Context context, Activity activity) {
|
public AdapterAllApp(Context context, Activity activity) {
|
||||||
|
adsList = Common.getAllAd();
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mActivity = activity;
|
mActivity = activity;
|
||||||
packageManager = context.getPackageManager();
|
packageManager = context.getPackageManager();
|
||||||
@ -98,8 +103,13 @@ public class AdapterAllApp extends RecyclerView.Adapter<AdapterAllApp.AppViewHol
|
|||||||
boolean lock = dataApp.isLock();
|
boolean lock = dataApp.isLock();
|
||||||
holder.switchCompat.setChecked(lock);
|
holder.switchCompat.setChecked(lock);
|
||||||
holder.switchCompat.setOnCheckedChangeListener((CompoundButton buttonView, boolean isChecked) -> {
|
holder.switchCompat.setOnCheckedChangeListener((CompoundButton buttonView, boolean isChecked) -> {
|
||||||
|
MyApplication.userOption++;
|
||||||
if (MyApplication.userOption % 5 == 0) {
|
if (MyApplication.userOption % 5 == 0) {
|
||||||
// TODO: 2024/7/19
|
// TODO: 2024/7/19
|
||||||
|
|
||||||
|
showAd();
|
||||||
|
|
||||||
|
|
||||||
MyThread.runIO(() -> {
|
MyThread.runIO(() -> {
|
||||||
dataApp.setLock(isChecked);
|
dataApp.setLock(isChecked);
|
||||||
MyDataBase.getInstance().getRoomDao().updateData(dataApp);
|
MyDataBase.getInstance().getRoomDao().updateData(dataApp);
|
||||||
@ -126,7 +136,7 @@ public class AdapterAllApp extends RecyclerView.Adapter<AdapterAllApp.AppViewHol
|
|||||||
}
|
}
|
||||||
Toast.makeText(mContext, format, Toast.LENGTH_SHORT).show();
|
Toast.makeText(mContext, format, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
MyApplication.userOption++;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -139,7 +149,25 @@ public class AdapterAllApp extends RecyclerView.Adapter<AdapterAllApp.AppViewHol
|
|||||||
holder.textView.setText(appName);
|
holder.textView.setText(appName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void showAd() {
|
||||||
|
MaxInterstitialAd cachedAd = Common.onCache(adsList);
|
||||||
|
if (cachedAd == null) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Common.setCallBcak(cachedAd, new Adcallback() {
|
||||||
|
@Override
|
||||||
|
public void onShowFail(MaxAd ad) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAdHidden() {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
cachedAd.showAd(mActivity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private Drawable getLogo(String packageName) throws PackageManager.NameNotFoundException {
|
private Drawable getLogo(String packageName) throws PackageManager.NameNotFoundException {
|
||||||
ApplicationInfo appInfo = packageManager.getApplicationInfo(packageName, PackageManager.GET_UNINSTALLED_PACKAGES);
|
ApplicationInfo appInfo = packageManager.getApplicationInfo(packageName, PackageManager.GET_UNINSTALLED_PACKAGES);
|
||||||
|
|||||||
@ -0,0 +1,8 @@
|
|||||||
|
package com.tool.app.protectorpro.listener;
|
||||||
|
|
||||||
|
import com.applovin.mediation.MaxAd;
|
||||||
|
|
||||||
|
public interface Adcallback {
|
||||||
|
void onShowFail(MaxAd ad);
|
||||||
|
void onAdHidden( );
|
||||||
|
}
|
||||||
@ -14,20 +14,112 @@ import android.net.Uri;
|
|||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import androidx.annotation.ColorRes;
|
import androidx.annotation.ColorRes;
|
||||||
import androidx.annotation.DimenRes;
|
import androidx.annotation.DimenRes;
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
|
import com.applovin.mediation.MaxAd;
|
||||||
|
import com.applovin.mediation.MaxAdListener;
|
||||||
|
import com.applovin.mediation.MaxError;
|
||||||
|
import com.applovin.mediation.ads.MaxInterstitialAd;
|
||||||
|
import com.tool.app.protectorpro.MyApplication;
|
||||||
|
import com.tool.app.protectorpro.listener.Adcallback;
|
||||||
import com.tool.app.protectorpro.mydb.DataApp;
|
import com.tool.app.protectorpro.mydb.DataApp;
|
||||||
import com.tool.app.protectorpro.mydb.MyDataBase;
|
import com.tool.app.protectorpro.mydb.MyDataBase;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
public class Common {
|
public class Common {
|
||||||
|
|
||||||
|
private static ArrayList<MaxInterstitialAd> adArrayList;
|
||||||
|
private static final String one_AD = "490a4576e075f605";
|
||||||
|
private static final String two_Ad = "3549738d96239baa";
|
||||||
|
private static final String three_ad = "075263b5dbd29916";
|
||||||
|
|
||||||
|
public static void setCallBcak(MaxInterstitialAd ad, Adcallback adcallback) {
|
||||||
|
ad.setListener(new MaxAdListener() {
|
||||||
|
@Override
|
||||||
|
public void onAdLoaded(@NonNull MaxAd maxAd) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAdDisplayed(@NonNull MaxAd maxAd) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAdHidden(@NonNull MaxAd maxAd) {
|
||||||
|
adcallback.onAdHidden();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAdClicked(@NonNull MaxAd maxAd) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAdLoadFailed(@NonNull String s, @NonNull MaxError maxError) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAdDisplayFailed(@NonNull MaxAd maxAd, @NonNull MaxError maxError) {
|
||||||
|
adcallback.onShowFail(maxAd);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MaxInterstitialAd onCache(List<MaxInterstitialAd> list) {
|
||||||
|
Collections.shuffle(list);
|
||||||
|
for (MaxInterstitialAd ad : list) {
|
||||||
|
if (ad.isReady()) {
|
||||||
|
return ad;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<MaxInterstitialAd> getAllAd() {
|
||||||
|
if (adArrayList == null) {
|
||||||
|
adArrayList = new ArrayList<>();
|
||||||
|
adArrayList.add(createAd(one_AD, MyApplication.appContext));
|
||||||
|
adArrayList.add(createAd(two_Ad, MyApplication.appContext));
|
||||||
|
adArrayList.add(createAd(three_ad, MyApplication.appContext));
|
||||||
|
}
|
||||||
|
for (MaxInterstitialAd ad : adArrayList) {
|
||||||
|
if (!ad.isReady()) {
|
||||||
|
setCallBcak(ad, new Adcallback() {
|
||||||
|
@Override
|
||||||
|
public void onShowFail(MaxAd ad) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAdHidden() {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ad.loadAd();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return adArrayList;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static MaxInterstitialAd createAd(String adUnitId, Context context) {
|
||||||
|
MaxInterstitialAd ad = new MaxInterstitialAd(adUnitId, context);
|
||||||
|
return ad;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static float getPx(Context context, @DimenRes int id) {
|
public static float getPx(Context context, @DimenRes int id) {
|
||||||
return context.getResources().getDimension(id);
|
return context.getResources().getDimension(id);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,3 +5,8 @@ plugins {
|
|||||||
id("com.google.gms.google-services") version "4.3.15" 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
|
id ("com.google.firebase.crashlytics") version "2.9.2" apply false
|
||||||
}
|
}
|
||||||
|
buildscript{
|
||||||
|
dependencies{
|
||||||
|
classpath("com.applovin.quality:AppLovinQualityServiceGradlePlugin:+")
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -3,6 +3,8 @@ pluginManagement {
|
|||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
|
|
||||||
|
maven { url = uri("https://artifacts.applovin.com/android") }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dependencyResolutionManagement {
|
dependencyResolutionManagement {
|
||||||
@ -12,6 +14,8 @@ dependencyResolutionManagement {
|
|||||||
mavenCentral()
|
mavenCentral()
|
||||||
maven (url ="https://jitpack.io" )
|
maven (url ="https://jitpack.io" )
|
||||||
|
|
||||||
|
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