接Top On 1.0.1(2)
This commit is contained in:
parent
54f404ed15
commit
c9c62df82b
@ -1,9 +1,12 @@
|
||||
import java.util.Date
|
||||
import java.text.SimpleDateFormat
|
||||
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
id("org.jetbrains.kotlin.android")
|
||||
id("kotlin-kapt")
|
||||
id("com.google.gms.google-services")
|
||||
id("com.google.firebase.crashlytics")
|
||||
}
|
||||
val timestamp = SimpleDateFormat("MM_dd_HH_mm").format(Date())
|
||||
android {
|
||||
@ -14,15 +17,15 @@ android {
|
||||
applicationId = "com.tool.lockapp"
|
||||
minSdk = 23
|
||||
targetSdk = 34
|
||||
versionCode = 1
|
||||
versionName = "1.0.0"
|
||||
versionCode = 2
|
||||
versionName = "1.0.1"
|
||||
setProperty("archivesBaseName", "lockapp_v" + versionName + "(${versionCode})_$timestamp")
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
isShrinkResources =true
|
||||
isShrinkResources = true
|
||||
isMinifyEnabled = true
|
||||
proguardFiles(
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
@ -59,4 +62,69 @@ dependencies {
|
||||
testImplementation("androidx.room:room-testing:$room_version")
|
||||
implementation("androidx.room:room-paging:$room_version")
|
||||
|
||||
|
||||
implementation(platform("com.google.firebase:firebase-bom:32.3.1"))
|
||||
implementation("com.google.firebase:firebase-analytics-ktx")
|
||||
implementation("com.google.firebase:firebase-crashlytics-ktx")
|
||||
|
||||
|
||||
//-----------------------------------------------TopOn(pangle、IronSource、mintegral、unityads、liftoff(vungle)、Bigo)
|
||||
//Anythink (Necessary)
|
||||
implementation("com.anythink.sdk:core-tpn:6.3.68")
|
||||
implementation("com.anythink.sdk:nativead-tpn:6.3.68")
|
||||
implementation("com.anythink.sdk:banner-tpn:6.3.68")
|
||||
implementation("com.anythink.sdk:interstitial-tpn:6.3.68")
|
||||
implementation("com.anythink.sdk:rewardedvideo-tpn:6.3.68")
|
||||
implementation("com.anythink.sdk:splash-tpn:6.3.68")
|
||||
|
||||
//Androidx (Necessary)
|
||||
implementation("androidx.appcompat:appcompat:1.1.0")
|
||||
implementation("androidx.browser:browser:1.4.0")
|
||||
|
||||
//Vungle
|
||||
implementation("com.anythink.sdk:adapter-tpn-vungle:6.3.68")
|
||||
implementation("com.vungle:vungle-ads:7.3.2")
|
||||
implementation("com.google.android.gms:play-services-basement:18.1.0")
|
||||
implementation("com.google.android.gms:play-services-ads-identifier:18.0.1")
|
||||
|
||||
//UnityAds
|
||||
implementation("com.anythink.sdk:adapter-tpn-unityads:6.3.68")
|
||||
implementation("com.unity3d.ads:unity-ads:4.9.3")
|
||||
|
||||
//Ironsource
|
||||
implementation("com.anythink.sdk:adapter-tpn-ironsource:6.3.68")
|
||||
implementation("com.ironsource.sdk:mediationsdk:8.1.0")
|
||||
implementation("com.google.android.gms:play-services-appset:16.0.2")
|
||||
implementation("com.google.android.gms:play-services-ads-identifier:18.0.1")
|
||||
implementation("com.google.android.gms:play-services-basement:18.1.0")
|
||||
|
||||
//Bigo
|
||||
implementation("com.anythink.sdk:adapter-tpn-bigo:6.3.68")
|
||||
implementation("com.bigossp:bigo-ads:4.7.4")
|
||||
|
||||
//Pangle
|
||||
implementation("com.anythink.sdk:adapter-tpn-pangle-nonchina:6.3.68.1")
|
||||
implementation("com.pangle.global:ads-sdk:6.0.0.3")
|
||||
implementation("com.google.android.gms:play-services-ads-identifier:18.0.1")
|
||||
|
||||
//Mintegral
|
||||
implementation("com.anythink.sdk:adapter-tpn-mintegral-nonchina:6.3.68")
|
||||
implementation("com.mbridge.msdk.oversea:reward:16.7.51")
|
||||
implementation("com.mbridge.msdk.oversea:newinterstitial:16.7.51")
|
||||
implementation("com.mbridge.msdk.oversea:mbnative:16.7.51")
|
||||
implementation("com.mbridge.msdk.oversea:mbnativeadvanced:16.7.51")
|
||||
implementation("com.mbridge.msdk.oversea:mbsplash:16.7.51")
|
||||
implementation("com.mbridge.msdk.oversea:mbbanner:16.7.51")
|
||||
implementation("com.mbridge.msdk.oversea:mbbid:16.7.51")
|
||||
implementation("androidx.recyclerview:recyclerview:1.1.0")
|
||||
|
||||
//Tramini
|
||||
implementation("com.anythink.sdk:tramini-plugin-tpn:6.3.68")
|
||||
|
||||
// Debugger UI Tools
|
||||
// implementation ("com.anythink.sdk:debugger-ui:1.0.7")
|
||||
|
||||
//----------------------------------------------TopOn
|
||||
|
||||
|
||||
}
|
||||
29
app/google-services.json
Normal file
29
app/google-services.json
Normal file
@ -0,0 +1,29 @@
|
||||
{
|
||||
"project_info": {
|
||||
"project_number": "302456749013",
|
||||
"project_id": "lock-app---app-locker",
|
||||
"storage_bucket": "lock-app---app-locker.appspot.com"
|
||||
},
|
||||
"client": [
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:302456749013:android:8bfd1909700112a18c1b5c",
|
||||
"android_client_info": {
|
||||
"package_name": "com.tool.lockapp"
|
||||
}
|
||||
},
|
||||
"oauth_client": [],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyD1JkIyb-GrMeg4rwZfTsQChGP0zhlljjo"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"appinvite_service": {
|
||||
"other_platform_oauth_client": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"configuration_version": "1"
|
||||
}
|
||||
94
app/proguard-rules.pro
vendored
94
app/proguard-rules.pro
vendored
@ -32,3 +32,97 @@
|
||||
-keep class com.tool.applockpro.data.Mydata { *; }
|
||||
-keep class com.omicronapplications.** { *; }
|
||||
-keep class net.sf.sevenzipjbinding.** { *; }
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------Topon
|
||||
# Vungle
|
||||
-dontwarn com.vungle.ads.**
|
||||
-keepclassmembers class com.vungle.ads.** {
|
||||
*;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
# Google
|
||||
-keep class com.google.android.gms.** { *; }
|
||||
-dontwarn com.google.android.gms.**
|
||||
|
||||
|
||||
|
||||
|
||||
# START OkHttp + Okio
|
||||
# JSR 305 annotations are for embedding nullability information.
|
||||
-dontwarn javax.annotation.**
|
||||
|
||||
|
||||
# A resource is loaded with a relative path so the package of this class must be preserved.
|
||||
-adaptresourcefilenames okhttp3/internal/publicsuffix/PublicSuffixDatabase.gz
|
||||
|
||||
|
||||
# Animal Sniffer compileOnly dependency to ensure APIs are compatible with older versions of Java.
|
||||
-dontwarn org.codehaus.mojo.animal_sniffer.*
|
||||
|
||||
|
||||
# OkHttp platform used only on JVM and when Conscrypt and other security providers are available.
|
||||
-dontwarn okhttp3.internal.platform.**
|
||||
-dontwarn org.conscrypt.**
|
||||
-dontwarn org.bouncycastle.**
|
||||
-dontwarn org.openjsse.**
|
||||
|
||||
|
||||
# Animal Sniffer compileOnly dependency to ensure APIs are compatible with older versions of Java.
|
||||
-dontwarn org.codehaus.mojo.animal_sniffer.*
|
||||
|
||||
|
||||
# END OkHttp + Okio
|
||||
|
||||
|
||||
# START Protobuf
|
||||
-dontwarn com.google.protobuf.**
|
||||
-keepclassmembers class com.google.protobuf.** {
|
||||
*;
|
||||
}
|
||||
-keep class * extends com.google.protobuf.GeneratedMessageLite { *; }
|
||||
|
||||
|
||||
# END Protobuf
|
||||
-keepclassmembers class com.ironsource.sdk.controller.IronSourceWebView$JSInterface {
|
||||
public *;
|
||||
}
|
||||
-keepclassmembers class * implements android.os.Parcelable {
|
||||
public static final android.os.Parcelable$Creator *;
|
||||
}
|
||||
-keep public class com.google.android.gms.ads.** {
|
||||
public *;
|
||||
}
|
||||
-keep class com.ironsource.adapters.** { *;
|
||||
}
|
||||
-dontwarn com.ironsource.mediationsdk.**
|
||||
-dontwarn com.ironsource.adapters.**
|
||||
-keepattributes JavascriptInterface
|
||||
-keepclassmembers class * {
|
||||
@android.webkit.JavascriptInterface <methods>;
|
||||
}
|
||||
-keep class com.bytedance.sdk.** { *; }
|
||||
-keepattributes Signature
|
||||
-keepattributes *Annotation*
|
||||
-keep class com.mbridge.** {*; }
|
||||
-keep interface com.mbridge.** {*; }
|
||||
-keep class android.support.v4.** { *; }
|
||||
-dontwarn com.mbridge.**
|
||||
-keep class **.R$* { public static final int mbridge*; }
|
||||
-keep public class com.mbridge.* extends androidx.** { *; }
|
||||
-keep public class androidx.viewpager.widget.PagerAdapter{ *; }
|
||||
-keep public class androidx.viewpager.widget.ViewPager.OnPageChangeListener{ *; }
|
||||
-keep interface androidx.annotation.IntDef{ *; }
|
||||
-keep interface androidx.annotation.Nullable{ *; }
|
||||
-keep interface androidx.annotation.CheckResult{ *; }
|
||||
-keep interface androidx.annotation.NonNull{ *; }
|
||||
-keep public class androidx.fragment.app.Fragment{ *; }
|
||||
-keep public class androidx.core.content.FileProvider{ *; }
|
||||
-keep public class androidx.core.app.NotificationCompat{ *; }
|
||||
-keep public class androidx.appcompat.widget.AppCompatImageView { *; }
|
||||
-keep public class androidx.recyclerview.*{ *; }
|
||||
#---------------------------------------------Topon
|
||||
|
||||
@ -25,6 +25,15 @@
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme"
|
||||
tools:targetApi="31">
|
||||
<activity
|
||||
android:name=".activity.SplashActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.SearchActivity"
|
||||
android:exported="false"
|
||||
@ -34,13 +43,7 @@
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".activity.PermissionActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
android:exported="true" />
|
||||
|
||||
<service
|
||||
android:name=".tool.Myservice"
|
||||
|
||||
@ -1,10 +1,15 @@
|
||||
package com.tool.applockpro;
|
||||
|
||||
import static android.content.ContentValues.TAG;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.util.Log;
|
||||
|
||||
import com.anythink.core.api.ATSDK;
|
||||
import com.anythink.core.api.NetTrafficeCallback;
|
||||
import com.anythink.interstitial.api.ATInterstitial;
|
||||
import com.tool.applockpro.data.MyDataBase;
|
||||
import com.tool.applockpro.data.Mydata;
|
||||
import com.tool.applockpro.tool.Mytools;
|
||||
@ -25,6 +30,7 @@ public class ApplockSkin extends Application {
|
||||
public static List<Mydata> system = new ArrayList<>();
|
||||
public static List<Mydata> third = new ArrayList<>();
|
||||
public static List<Mydata> lock = new ArrayList<>();
|
||||
public static int keyad = 0;
|
||||
|
||||
public static List<Mydata> getSystem() {
|
||||
return system;
|
||||
@ -37,7 +43,10 @@ public class ApplockSkin extends Application {
|
||||
public static List<Mydata> getLock() {
|
||||
return lock;
|
||||
}
|
||||
|
||||
private static final String TOP_ID = "h66a7349cb62fb";
|
||||
private static final String TOP_KEY = "a32d537b2e12a9fcabe2f2fe77628864c";
|
||||
private static final String TOP_DEBUG = "5c12401a5c59afe9a3ac946dd22ae5f1fecd8c1c";
|
||||
public static List<ATInterstitial> ads;
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
@ -48,27 +57,50 @@ public class ApplockSkin extends Application {
|
||||
sp = getSharedPreferences(PREFS_NAME, MODE_PRIVATE);
|
||||
et = sp.edit();
|
||||
|
||||
initData();
|
||||
|
||||
ATSDK.checkIsEuTraffic(this, new NetTrafficeCallback() {
|
||||
|
||||
@Override
|
||||
public void onResultCallback(boolean isEU) {
|
||||
Log.e(TAG, "onResultCallback:" + isEU);
|
||||
if (isEU && ATSDK.getGDPRDataLevel(context) == ATSDK.UNKNOWN) {
|
||||
ATSDK.showGdprAuth(context);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onErrorCallback(String errorMsg) {
|
||||
Log.e(TAG, "onErrorCallback:" + errorMsg);
|
||||
}
|
||||
});
|
||||
|
||||
initSdk();
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
|
||||
// Mytools.runIO(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// system = MyDataBase.getINSTANCE().mydao().getappissystem(true);
|
||||
// third = MyDataBase.getINSTANCE().mydao().getappissystem(false);
|
||||
// lock = MyDataBase.getINSTANCE().mydao().getlockapp(true);
|
||||
//
|
||||
// }
|
||||
// });
|
||||
private void initSdk() {
|
||||
|
||||
// ATSDK.integrationChecking(context);
|
||||
|
||||
ATSDK.init(context, TOP_ID, TOP_KEY);
|
||||
|
||||
ads = Mytools.getAllAd();
|
||||
// ATSDK.setNetworkLogDebug(true);
|
||||
// ATDebuggerUITest.showDebuggerUI(context,TOP_DEBUG);
|
||||
|
||||
}
|
||||
|
||||
public static List<ATInterstitial> lodAd() {
|
||||
|
||||
return ads;
|
||||
}
|
||||
|
||||
public static void savePWD(String pwd) {
|
||||
et.putString(KEY_PWD, pwd);
|
||||
et.apply();
|
||||
// Log.e("zzj", "--------savepwd----------" + pwd);
|
||||
}
|
||||
|
||||
public static String getPWD() {
|
||||
|
||||
@ -85,7 +85,7 @@ public class SearchActivity extends AppCompatActivity {
|
||||
} else {
|
||||
binding.searchTips.setVisibility(View.GONE);
|
||||
binding.searchRv.setVisibility(View.VISIBLE);
|
||||
binding.searchRv.setAdapter(new AppAdapter(SearchActivity.this, searchdata));
|
||||
binding.searchRv.setAdapter(new AppAdapter(SearchActivity.this, searchdata, SearchActivity.this));
|
||||
binding.searchRv.setLayoutManager(new LinearLayoutManager(SearchActivity.this));
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,9 +16,13 @@ import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.anythink.core.api.AdError;
|
||||
import com.anythink.interstitial.api.ATInterstitial;
|
||||
import com.tool.applockpro.ApplockSkin;
|
||||
import com.tool.applockpro.R;
|
||||
import com.tool.applockpro.databinding.ActivitySetPwdactivityBinding;
|
||||
import com.tool.applockpro.tool.Adcallback;
|
||||
import com.tool.applockpro.tool.Mytools;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -28,6 +32,7 @@ public class SetPWDActivity extends AppCompatActivity {
|
||||
ActivitySetPwdactivityBinding binding;
|
||||
private List<EditText> etlis = new ArrayList<>();
|
||||
private int chewkpwd;
|
||||
private List<ATInterstitial> ads;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@ -41,6 +46,7 @@ public class SetPWDActivity extends AppCompatActivity {
|
||||
return insets;
|
||||
});
|
||||
|
||||
ads = ApplockSkin.lodAd();
|
||||
|
||||
chewkpwd = getIntent().getIntExtra("1", 0);
|
||||
|
||||
@ -58,6 +64,27 @@ public class SetPWDActivity extends AppCompatActivity {
|
||||
initEvent();
|
||||
}
|
||||
|
||||
private void showAd() {
|
||||
ATInterstitial mInterstitialAd = Mytools.onCache(ads);
|
||||
if (mInterstitialAd == null) {
|
||||
finish();
|
||||
} else {
|
||||
Mytools.setCallback(mInterstitialAd, new Adcallback() {
|
||||
@Override
|
||||
public void onShowFail(AdError ad) {
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdHidden() {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
mInterstitialAd.show(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void initEvent() {
|
||||
|
||||
binding.btnContinue.setOnClickListener(new View.OnClickListener() {
|
||||
@ -75,12 +102,13 @@ public class SetPWDActivity extends AppCompatActivity {
|
||||
Toast.makeText(SetPWDActivity.this, getString(R.string.setlock_tips), Toast.LENGTH_SHORT).show();
|
||||
startActivity(intent);
|
||||
finish();
|
||||
// showAd();
|
||||
} else {
|
||||
// Intent intent = new Intent(SetPWDActivity.this, MainActivity.class);
|
||||
//
|
||||
// startActivity(intent);
|
||||
Toast.makeText(SetPWDActivity.this, getString(R.string.changelock_tips), Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
showAd();
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
@ -0,0 +1,112 @@
|
||||
package com.tool.applockpro.activity;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Bundle;
|
||||
import android.os.CountDownTimer;
|
||||
|
||||
import com.anythink.core.api.AdError;
|
||||
import com.anythink.interstitial.api.ATInterstitial;
|
||||
import com.tool.applockpro.ApplockSkin;
|
||||
import com.tool.applockpro.R;
|
||||
import com.tool.applockpro.databinding.ActivitySplashBinding;
|
||||
import com.tool.applockpro.tool.Adcallback;
|
||||
import com.tool.applockpro.tool.Mytools;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SplashActivity extends AppCompatActivity {
|
||||
ActivitySplashBinding binding;
|
||||
private CountDownTimer countDownTimer;
|
||||
private List<ATInterstitial> ads;
|
||||
|
||||
private boolean isAlreadyShow = false;
|
||||
private float i = 0;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
binding = ActivitySplashBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
|
||||
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.activity_splash), (v, insets) -> {
|
||||
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||
return insets;
|
||||
});
|
||||
|
||||
ads = ApplockSkin.lodAd();
|
||||
countDownTimer = new CountDownTimer(10100, 100) {
|
||||
@Override
|
||||
public void onTick(long l) {
|
||||
i++;
|
||||
binding.splashPg.setProgress(i);
|
||||
if (!isAlreadyShow) {
|
||||
showAd(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
if (!isAlreadyShow) {
|
||||
showAd(true);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
countDownTimer.start();
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void showAd(boolean go) {
|
||||
ATInterstitial mInterstitialAd = Mytools.onCache(ads);
|
||||
if (mInterstitialAd == null) {
|
||||
isAlreadyShow = false;
|
||||
if (go) {
|
||||
starMainactivity();
|
||||
}
|
||||
} else {
|
||||
isAlreadyShow = true;
|
||||
Mytools.setCallback(mInterstitialAd, new Adcallback() {
|
||||
@Override
|
||||
public void onShowFail(AdError ad) {
|
||||
if (countDownTimer != null) {
|
||||
countDownTimer.cancel();
|
||||
countDownTimer = null;
|
||||
}
|
||||
starMainactivity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdHidden() {
|
||||
isAlreadyShow = true;
|
||||
starMainactivity();
|
||||
}
|
||||
});
|
||||
mInterstitialAd.show(this);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void starMainactivity() {
|
||||
Intent intent = new Intent(SplashActivity.this, PermissionActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (countDownTimer != null) {
|
||||
countDownTimer.cancel();
|
||||
countDownTimer = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -6,7 +6,9 @@ import android.animation.AnimatorSet;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
@ -27,9 +29,14 @@ import androidx.recyclerview.widget.DiffUtil;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
|
||||
import com.anythink.core.api.AdError;
|
||||
import com.anythink.interstitial.api.ATInterstitial;
|
||||
import com.tool.applockpro.ApplockSkin;
|
||||
import com.tool.applockpro.R;
|
||||
import com.tool.applockpro.data.MyDataBase;
|
||||
import com.tool.applockpro.data.Mydata;
|
||||
import com.tool.applockpro.tool.AdActionListener;
|
||||
import com.tool.applockpro.tool.Adcallback;
|
||||
import com.tool.applockpro.tool.Mytools;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -43,21 +50,19 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.AppVH> {
|
||||
private Context mycontext;
|
||||
private List<Mydata> mydataList = new ArrayList<>();
|
||||
private PackageManager packageManager;
|
||||
private boolean mtost = true;
|
||||
public static SharedPreferences keysp;
|
||||
public static SharedPreferences.Editor keyeditor;
|
||||
private int keyid;
|
||||
private ObjectAnimator animator1, animator2;
|
||||
private Activity activity;
|
||||
|
||||
private Activity mactivity;
|
||||
private List<ATInterstitial> ads;
|
||||
private int a = 0;
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
public AppAdapter(Context context, List<Mydata> list) {
|
||||
public AppAdapter(Context context, List<Mydata> list, Activity activity) {
|
||||
ads = ApplockSkin.lodAd();
|
||||
mydataList = list;
|
||||
mycontext = context;
|
||||
mactivity = activity;
|
||||
packageManager = context.getPackageManager();
|
||||
keysp = mycontext.getSharedPreferences("key", Context.MODE_PRIVATE);
|
||||
notifyDataSetChanged();
|
||||
a = ApplockSkin.keyad;
|
||||
}
|
||||
|
||||
|
||||
@ -72,45 +77,56 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.AppVH> {
|
||||
public void onBindViewHolder(@NonNull AppVH holder, @SuppressLint("RecyclerView") int position) {
|
||||
Mydata mydata = mydataList.get(position);
|
||||
String appname = mydata.getAppName();
|
||||
|
||||
|
||||
boolean lock = mydata.isLock();
|
||||
// Log.e("zzj", mydata.getAppName() + "------mydata.isLock-----" + lock);
|
||||
holder.switchCompat.setSelected(lock);
|
||||
holder.lock.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
keyid = getkey();
|
||||
keyid++;
|
||||
keyeditor = keysp.edit();
|
||||
if (keyid % 5 == 0) {
|
||||
keyeditor.putInt("key", keyid);
|
||||
keyeditor.apply();
|
||||
// Log.e("zzj", String.valueOf(keyid));
|
||||
if (holder.switchCompat.isSelected()) {
|
||||
holder.switchCompat.setSelected(false);
|
||||
} else {
|
||||
holder.switchCompat.setSelected(true);
|
||||
}
|
||||
Mytools.runIO(new Runnable() {
|
||||
ApplockSkin.keyad++;
|
||||
if (ApplockSkin.keyad % 5 == 0 || ApplockSkin.keyad == 1) {
|
||||
showAd(new AdActionListener() {
|
||||
@Override
|
||||
public void run() {
|
||||
mydata.setLock(holder.switchCompat.isSelected());
|
||||
MyDataBase.getINSTANCE().mydao().update(mydata);
|
||||
public void onAction() {
|
||||
String strLock = holder.switchCompat.isSelected() ? "unlock" : "lock";
|
||||
new AlertDialog.Builder(mycontext)
|
||||
.setTitle("Tips")
|
||||
.setMessage("Are you sure you want to " + strLock + " " + appname)
|
||||
.setPositiveButton("Sure", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
if (holder.switchCompat.isSelected()) {
|
||||
holder.switchCompat.setSelected(false);
|
||||
} else {
|
||||
holder.switchCompat.setSelected(true);
|
||||
}
|
||||
Mytools.runIO(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mydata.setLock(holder.switchCompat.isSelected());
|
||||
MyDataBase.getINSTANCE().mydao().update(mydata);
|
||||
|
||||
}
|
||||
});
|
||||
String s;
|
||||
if (holder.switchCompat.isSelected()) {
|
||||
s = String.format(mycontext.getString(R.string.text_locked), appname);
|
||||
} else {
|
||||
s = String.format(mycontext.getString(R.string.text_unlocked), appname);
|
||||
}
|
||||
Toast.makeText(mycontext, s, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
})
|
||||
.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
||||
}
|
||||
})
|
||||
.show();
|
||||
}
|
||||
});
|
||||
String s;
|
||||
if (holder.switchCompat.isSelected()) {
|
||||
s = String.format(mycontext.getString(R.string.text_locked), appname);
|
||||
} else {
|
||||
s = String.format(mycontext.getString(R.string.text_unlocked), appname);
|
||||
}
|
||||
|
||||
Toast.makeText(mycontext, s, Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
keyeditor.putInt("key", keyid);
|
||||
keyeditor.apply();
|
||||
|
||||
if (holder.switchCompat.isSelected()) {
|
||||
holder.switchCompat.setSelected(false);
|
||||
} else {
|
||||
@ -139,7 +155,6 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.AppVH> {
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
holder.textView.setText(mydata.getAppName());
|
||||
try {
|
||||
Drawable appLogo = getLogo(mydata.getPackageName());
|
||||
@ -149,11 +164,6 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.AppVH> {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static int getkey() {
|
||||
return keysp.getInt("key", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mydataList.size();
|
||||
@ -181,4 +191,26 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.AppVH> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void showAd(AdActionListener listener) {
|
||||
ATInterstitial mInterstitialAd = Mytools.onCache(ads);
|
||||
if (mInterstitialAd == null) {
|
||||
listener.onAction();
|
||||
} else {
|
||||
Mytools.setCallback(mInterstitialAd, new Adcallback() {
|
||||
@Override
|
||||
public void onShowFail(AdError ad) {
|
||||
listener.onAction();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdHidden() {
|
||||
listener.onAction();
|
||||
}
|
||||
});
|
||||
mInterstitialAd.show(mactivity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ public class AllFragment extends Fragment {
|
||||
}
|
||||
|
||||
|
||||
public void refesh(){
|
||||
public void refesh() {
|
||||
mydao.getAppsBySystem(false).observe(getViewLifecycleOwner(), new Observer<List<Mydata>>() {
|
||||
@Override
|
||||
public void onChanged(List<Mydata> mydata) {
|
||||
@ -66,10 +66,11 @@ public class AllFragment extends Fragment {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
mydao = MyDataBase.getINSTANCE().mydao();
|
||||
tabargs = getArguments().getString("tab");
|
||||
Log.e("zzj", tabargs);
|
||||
// Log.e("zzj", tabargs);
|
||||
if (tabargs.equals("System")) {
|
||||
Mytools.runIO(new Runnable() {
|
||||
@Override
|
||||
@ -104,7 +105,7 @@ public class AllFragment extends Fragment {
|
||||
}
|
||||
|
||||
private void updateRecyclerView(List<Mydata> mydataList) {
|
||||
thumAdapter = new AppAdapter(requireContext(), mydataList);
|
||||
thumAdapter = new AppAdapter(requireContext(), mydataList, requireActivity());
|
||||
binding.allRv.setLayoutManager(new LinearLayoutManager(requireContext()));
|
||||
binding.allRv.setAdapter(thumAdapter);
|
||||
}
|
||||
|
||||
@ -0,0 +1,6 @@
|
||||
package com.tool.applockpro.tool;
|
||||
|
||||
public interface AdActionListener {
|
||||
|
||||
void onAction();
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package com.tool.applockpro.tool;
|
||||
|
||||
|
||||
import com.anythink.core.api.AdError;
|
||||
|
||||
public interface Adcallback {
|
||||
void onShowFail(AdError ad);
|
||||
void onAdHidden( );
|
||||
}
|
||||
@ -0,0 +1,62 @@
|
||||
package com.tool.applockpro.tool
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Canvas
|
||||
import android.graphics.Color
|
||||
import android.graphics.LinearGradient
|
||||
import android.graphics.Paint
|
||||
import android.graphics.RectF
|
||||
import android.graphics.Shader
|
||||
import android.util.AttributeSet
|
||||
import android.view.View
|
||||
|
||||
class CustomProgressBar(context: Context, attrs: AttributeSet?) : View(context, attrs) {
|
||||
private var progress = 0f // 当前进度
|
||||
private val maxProgress = 100f // 最大进度
|
||||
private val progressBarHeight = 20f // 进度条高度
|
||||
private val cornerRadius = 10f // 圆角半径
|
||||
private val backgroundColor = Color.parseColor("#26FFFFFF")
|
||||
private val startColor = Color.parseColor("#FF9ce8ff") // 起始颜色
|
||||
private val middleColor = Color.parseColor("#FFa4c4fb") // 中间颜色
|
||||
private val endColor = Color.parseColor("#FFbfa4ee") // 结束颜色
|
||||
private val paint = Paint()
|
||||
private val paintTow = Paint()
|
||||
|
||||
init {
|
||||
paint.style = Paint.Style.FILL
|
||||
paint.isAntiAlias = true
|
||||
paintTow.style = Paint.Style.FILL
|
||||
paintTow.isAntiAlias = true
|
||||
}
|
||||
|
||||
override fun onDraw(canvas: Canvas) {
|
||||
super.onDraw(canvas)
|
||||
// 绘制底色矩形
|
||||
paint.shader = null // 重置着色器
|
||||
paint.color = backgroundColor
|
||||
val backgroundRect = RectF(0f, (height / 2 - progressBarHeight / 2), width.toFloat(), (height / 2 + progressBarHeight / 2))
|
||||
canvas.drawRoundRect(backgroundRect, cornerRadius, cornerRadius, paint)
|
||||
|
||||
|
||||
// 计算进度条的宽度
|
||||
val progressBarWidth = (width * progress / maxProgress)
|
||||
|
||||
// 创建颜色渐变对象
|
||||
val gradient = LinearGradient(0f, 0f, width.toFloat(), 0f, intArrayOf(startColor, middleColor, endColor), null, Shader.TileMode.CLAMP)
|
||||
paintTow.shader = gradient
|
||||
|
||||
// 绘制带圆角的进度条矩形
|
||||
val rect = RectF(0f, (height / 2 - progressBarHeight / 2), progressBarWidth.toFloat(), (height / 2 + progressBarHeight / 2))
|
||||
canvas.drawRoundRect(rect, cornerRadius, cornerRadius, paintTow)
|
||||
}
|
||||
|
||||
fun getProgress():Float{
|
||||
return progress
|
||||
}
|
||||
|
||||
// 设置进度
|
||||
fun setProgress(progress: Float) {
|
||||
this.progress = progress
|
||||
invalidate() // 请求重绘
|
||||
}
|
||||
}
|
||||
@ -11,10 +11,16 @@ import android.content.pm.ResolveInfo;
|
||||
import android.os.Build;
|
||||
import android.provider.Settings;
|
||||
|
||||
import com.anythink.core.api.ATAdInfo;
|
||||
import com.anythink.core.api.AdError;
|
||||
import com.anythink.interstitial.api.ATInterstitial;
|
||||
import com.anythink.interstitial.api.ATInterstitialListener;
|
||||
import com.tool.applockpro.ApplockSkin;
|
||||
import com.tool.applockpro.data.MyDataBase;
|
||||
import com.tool.applockpro.data.Mydata;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@ -23,6 +29,100 @@ import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
public class Mytools {
|
||||
|
||||
private static final String one_AD = "n66a73512bc4e5";
|
||||
private static final String two_Ad = "n66a734ffdcb74";
|
||||
private static final String three_ad = "n66a734e31e902";
|
||||
private static ArrayList<ATInterstitial> adArrayList;
|
||||
|
||||
|
||||
public static void setCallback(ATInterstitial ad, Adcallback adcallback) {
|
||||
ad.setAdListener(new ATInterstitialListener() {
|
||||
@Override
|
||||
public void onInterstitialAdLoaded() {
|
||||
// Log.e("zzj", "---------onInterstitialAdLoaded--------" + ad.mPlacementId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInterstitialAdLoadFail(AdError adError) {
|
||||
// Log.e("zzj", "---------onInterstitialAdLoadFail--------" + adError.getFullErrorInfo());
|
||||
adcallback.onShowFail(adError);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInterstitialAdClicked(ATAdInfo atAdInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInterstitialAdShow(ATAdInfo atAdInfo) {
|
||||
ad.load();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInterstitialAdClose(ATAdInfo atAdInfo) {
|
||||
adcallback.onAdHidden();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInterstitialAdVideoStart(ATAdInfo atAdInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInterstitialAdVideoEnd(ATAdInfo atAdInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInterstitialAdVideoError(AdError adError) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static ATInterstitial onCache(List<ATInterstitial> list) {
|
||||
Collections.shuffle(list);
|
||||
for (ATInterstitial ad : list) {
|
||||
if (ad.isAdReady()) {
|
||||
return ad;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static List<ATInterstitial> getAllAd() {
|
||||
if (adArrayList == null) {
|
||||
adArrayList = new ArrayList<>();
|
||||
adArrayList.add(createAd(one_AD, ApplockSkin.getContext()));
|
||||
adArrayList.add(createAd(two_Ad, ApplockSkin.getContext()));
|
||||
adArrayList.add(createAd(three_ad, ApplockSkin.getContext()));
|
||||
}
|
||||
for (ATInterstitial ad : adArrayList) {
|
||||
if (!ad.isAdReady()) {
|
||||
setCallback(ad, new Adcallback() {
|
||||
@Override
|
||||
public void onShowFail(AdError ad) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdHidden() {
|
||||
|
||||
}
|
||||
});
|
||||
ad.load();
|
||||
}
|
||||
}
|
||||
return adArrayList;
|
||||
}
|
||||
|
||||
private static ATInterstitial createAd(String adUnitId, Context context) {
|
||||
ATInterstitial ad = new ATInterstitial(context, adUnitId);
|
||||
return ad;
|
||||
}
|
||||
|
||||
|
||||
public static String checkTopapp(Context context) {
|
||||
UsageStatsManager sUsageStatsManager = (UsageStatsManager) context.getSystemService(Context.USAGE_STATS_SERVICE);
|
||||
long endTime = System.currentTimeMillis();
|
||||
@ -38,6 +138,7 @@ public class Mytools {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static List<Mydata> getapplist(Context context) {
|
||||
PackageManager packageManager = context.getPackageManager();
|
||||
Intent intent = new Intent(Intent.ACTION_MAIN, null);
|
||||
|
||||
47
app/src/main/res/layout/activity_splash.xml
Normal file
47
app/src/main/res/layout/activity_splash.xml
Normal file
@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/activity_splash"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".activity.SplashActivity">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@mipmap/bg_main">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/splash_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="90dp"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="28sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="70dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:src="@mipmap/icon_logo"
|
||||
app:layout_constraintBottom_toTopOf="@id/splash_title"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<com.tool.applockpro.tool.CustomProgressBar
|
||||
android:id="@+id/splash_pg"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginTop="10dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/splash_title" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@ -2,4 +2,6 @@
|
||||
plugins {
|
||||
id("com.android.application") version "8.1.3" apply false
|
||||
id("org.jetbrains.kotlin.android") version "1.9.0" 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
|
||||
}
|
||||
@ -10,6 +10,18 @@ dependencyResolutionManagement {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
maven("https://jitpack.io")
|
||||
//Anythink(Core)
|
||||
maven("https://jfrog.anythinktech.com/artifactory/overseas_sdk")
|
||||
//Ironsource
|
||||
maven("https://android-sdk.is.com/")
|
||||
//Mintegral
|
||||
maven("https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea")
|
||||
//Pangle
|
||||
maven ( "https://artifact.bytedance.com/repository/pangle")
|
||||
|
||||
//TopOn集成测试工具
|
||||
// maven ( "https://jfrog.anythinktech.com/artifactory/debugger")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user