V1.0.2(3) 广告场景:开屏、设置密码成功之后、用户点击解锁图标5的倍数
This commit is contained in:
parent
196e960177
commit
ecc1b0b9ab
@ -14,12 +14,12 @@ android {
|
|||||||
compileSdk = 34
|
compileSdk = 34
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId = "com.tool.lockapp.test"
|
applicationId = "com.tool.lockapp"
|
||||||
minSdk = 23
|
minSdk = 23
|
||||||
targetSdk = 34
|
targetSdk = 34
|
||||||
versionCode = 2
|
versionCode = 3
|
||||||
versionName = "1.0.1"
|
versionName = "1.0.2"
|
||||||
setProperty("archivesBaseName", "lockapp_v" + versionName + "(${versionCode})_$timestamp")
|
setProperty("archivesBaseName", "Lock App_v" + versionName + "(${versionCode})_$timestamp")
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ dependencies {
|
|||||||
implementation("androidx.recyclerview:recyclerview:1.1.0")
|
implementation("androidx.recyclerview:recyclerview:1.1.0")
|
||||||
|
|
||||||
//Tramini
|
//Tramini
|
||||||
implementation("com.anythink.sdk:tramini-plugin-tpn:6.3.68")
|
// implementation("com.anythink.sdk:tramini-plugin-tpn:6.3.68")
|
||||||
|
|
||||||
// Debugger UI Tools
|
// Debugger UI Tools
|
||||||
// implementation ("com.anythink.sdk:debugger-ui:1.0.7")
|
// implementation ("com.anythink.sdk:debugger-ui:1.0.7")
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
"client_info": {
|
"client_info": {
|
||||||
"mobilesdk_app_id": "1:302456749013:android:8bfd1909700112a18c1b5c",
|
"mobilesdk_app_id": "1:302456749013:android:8bfd1909700112a18c1b5c",
|
||||||
"android_client_info": {
|
"android_client_info": {
|
||||||
"package_name": "com.tool.lockapp.test"
|
"package_name": "com.tool.lockapp"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"oauth_client": [],
|
"oauth_client": [],
|
||||||
|
|||||||
@ -1,3 +0,0 @@
|
|||||||
pwd:lockapp
|
|
||||||
alias: lockappkey0
|
|
||||||
packname:com.tool.lockapp
|
|
||||||
@ -1,7 +1,5 @@
|
|||||||
package com.tool.applockpro;
|
package com.tool.applockpro;
|
||||||
|
|
||||||
import static android.content.ContentValues.TAG;
|
|
||||||
|
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
@ -13,6 +11,7 @@ import com.anythink.interstitial.api.ATInterstitial;
|
|||||||
import com.tool.applockpro.data.MyDataBase;
|
import com.tool.applockpro.data.MyDataBase;
|
||||||
import com.tool.applockpro.data.Mydata;
|
import com.tool.applockpro.data.Mydata;
|
||||||
import com.tool.applockpro.tool.Mytools;
|
import com.tool.applockpro.tool.Mytools;
|
||||||
|
import com.tool.applockpro.topon.AdManager;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -21,9 +20,12 @@ public class ApplockSkin extends Application {
|
|||||||
public static final String DB_Name = "lock_database";
|
public static final String DB_Name = "lock_database";
|
||||||
public static final String Table_Name = "lock_table";
|
public static final String Table_Name = "lock_table";
|
||||||
public static final int DB_Version = 1;
|
public static final int DB_Version = 1;
|
||||||
private static Context context;
|
|
||||||
|
private static Context mContext;
|
||||||
private static final String PREFS_NAME = "MyPrefs";
|
private static final String PREFS_NAME = "MyPrefs";
|
||||||
private static final String KEY_PWD = "key_pwd";
|
private static final String KEY_PWD = "key_pwd";
|
||||||
|
|
||||||
|
private static final String KEY_LOCK_MY_APP = "key_lock_my_app";
|
||||||
public static SharedPreferences sp;
|
public static SharedPreferences sp;
|
||||||
public static SharedPreferences.Editor et;
|
public static SharedPreferences.Editor et;
|
||||||
public static final int checkpwd_0 = 0;
|
public static final int checkpwd_0 = 0;
|
||||||
@ -43,16 +45,18 @@ public class ApplockSkin extends Application {
|
|||||||
public static List<Mydata> getLock() {
|
public static List<Mydata> getLock() {
|
||||||
return lock;
|
return lock;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String TOP_ID = "h66a7349cb62fb";
|
private static final String TOP_ID = "h66a7349cb62fb";
|
||||||
private static final String TOP_KEY = "a32d537b2e12a9fcabe2f2fe77628864c";
|
private static final String TOP_KEY = "a32d537b2e12a9fcabe2f2fe77628864c";
|
||||||
private static final String TOP_DEBUG = "5c12401a5c59afe9a3ac946dd22ae5f1fecd8c1c";
|
private static final String TOP_DEBUG = "5c12401a5c59afe9a3ac946dd22ae5f1fecd8c1c";
|
||||||
public static List<ATInterstitial> ads;
|
public static List<ATInterstitial> ads;
|
||||||
|
|
||||||
public static String TAG = "LOCK_APP----------";
|
public static String TAG = "LOCK_APP----------";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
context = getApplicationContext();
|
mContext = this;
|
||||||
Mytools.getapplist(this);
|
Mytools.getapplist(this);
|
||||||
|
|
||||||
|
|
||||||
@ -65,8 +69,8 @@ public class ApplockSkin extends Application {
|
|||||||
@Override
|
@Override
|
||||||
public void onResultCallback(boolean isEU) {
|
public void onResultCallback(boolean isEU) {
|
||||||
Log.e(TAG, "onResultCallback:" + isEU);
|
Log.e(TAG, "onResultCallback:" + isEU);
|
||||||
if (isEU && ATSDK.getGDPRDataLevel(context) == ATSDK.UNKNOWN) {
|
if (isEU && ATSDK.getGDPRDataLevel(mContext) == ATSDK.UNKNOWN) {
|
||||||
ATSDK.showGdprAuth(context);
|
ATSDK.showGdprAuth(mContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -80,6 +84,8 @@ public class ApplockSkin extends Application {
|
|||||||
initSdk();
|
initSdk();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -87,29 +93,47 @@ public class ApplockSkin extends Application {
|
|||||||
|
|
||||||
// ATSDK.integrationChecking(context);
|
// ATSDK.integrationChecking(context);
|
||||||
|
|
||||||
ATSDK.init(context, TOP_ID, TOP_KEY);
|
ATSDK.init(mContext, TOP_ID, TOP_KEY);
|
||||||
|
AdManager.loadAllAd();
|
||||||
|
|
||||||
ads = Mytools.getAllAd();
|
|
||||||
// ATSDK.setNetworkLogDebug(true);
|
// ATSDK.setNetworkLogDebug(true);
|
||||||
// ATDebuggerUITest.showDebuggerUI(context,TOP_DEBUG);
|
// ATDebuggerUITest.showDebuggerUI(context,TOP_DEBUG);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<ATInterstitial> lodAd() {
|
|
||||||
|
|
||||||
return ads;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void savePWD(String pwd) {
|
public static void savePWD(String pwd) {
|
||||||
et.putString(KEY_PWD, pwd);
|
et.putString(KEY_PWD, pwd);
|
||||||
et.apply();
|
et.apply();
|
||||||
}
|
}
|
||||||
|
public static void setLockMyAppFlag() {
|
||||||
|
et.putBoolean(KEY_LOCK_MY_APP, true);
|
||||||
|
et.apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean getFlag() {
|
||||||
|
return sp.getBoolean(KEY_LOCK_MY_APP, false);
|
||||||
|
}
|
||||||
public static String getPWD() {
|
public static String getPWD() {
|
||||||
return sp.getString(KEY_PWD, "");
|
return sp.getString(KEY_PWD, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Context getContext() {
|
|
||||||
return context;
|
public static void lockMyApp() {
|
||||||
|
Mytools.runIO(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
Mydata mydata = MyDataBase.getINSTANCE().mydao().getappislock(mContext.getPackageName());
|
||||||
|
mydata.setLock(true);
|
||||||
|
MyDataBase.getINSTANCE().mydao().update(mydata);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
setLockMyAppFlag();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Context getContext() {
|
||||||
|
return mContext;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,11 +20,15 @@ import android.widget.TextView;
|
|||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.google.android.material.tabs.TabLayout;
|
import com.google.android.material.tabs.TabLayout;
|
||||||
|
import com.tool.applockpro.ApplockSkin;
|
||||||
import com.tool.applockpro.R;
|
import com.tool.applockpro.R;
|
||||||
import com.tool.applockpro.adapter.PageAdapter;
|
import com.tool.applockpro.adapter.PageAdapter;
|
||||||
|
import com.tool.applockpro.data.MyDataBase;
|
||||||
|
import com.tool.applockpro.data.Mydata;
|
||||||
import com.tool.applockpro.databinding.ActivityMainBinding;
|
import com.tool.applockpro.databinding.ActivityMainBinding;
|
||||||
import com.tool.applockpro.fragment.AllFragment;
|
import com.tool.applockpro.fragment.AllFragment;
|
||||||
import com.tool.applockpro.tool.Myservice;
|
import com.tool.applockpro.tool.Myservice;
|
||||||
|
import com.tool.applockpro.tool.Mytools;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -55,6 +59,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
startService(new Intent(this, Myservice.class));
|
startService(new Intent(this, Myservice.class));
|
||||||
initTab();
|
initTab();
|
||||||
|
|
||||||
|
|
||||||
binding.mainSeeting.setOnClickListener(new View.OnClickListener() {
|
binding.mainSeeting.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
@ -120,6 +125,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void setTabIcons(int position) {
|
private void setTabIcons(int position) {
|
||||||
|
|
||||||
for (int i = 0; i < binding.mainTabLayout.getTabCount(); i++) {
|
for (int i = 0; i < binding.mainTabLayout.getTabCount(); i++) {
|
||||||
@ -140,6 +146,14 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPause() {
|
||||||
|
super.onPause();
|
||||||
|
if(!ApplockSkin.getFlag()){
|
||||||
|
ApplockSkin.lockMyApp();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
|
|||||||
@ -15,6 +15,7 @@ import com.tool.applockpro.R;
|
|||||||
import com.tool.applockpro.databinding.ActivityPermissionBinding;
|
import com.tool.applockpro.databinding.ActivityPermissionBinding;
|
||||||
import com.tool.applockpro.tool.Myservice;
|
import com.tool.applockpro.tool.Myservice;
|
||||||
import com.tool.applockpro.tool.Mytools;
|
import com.tool.applockpro.tool.Mytools;
|
||||||
|
import com.tool.applockpro.topon.AdManager;
|
||||||
|
|
||||||
public class PermissionActivity extends AppCompatActivity {
|
public class PermissionActivity extends AppCompatActivity {
|
||||||
ActivityPermissionBinding binding;
|
ActivityPermissionBinding binding;
|
||||||
@ -24,7 +25,7 @@ public class PermissionActivity extends AppCompatActivity {
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
binding = ActivityPermissionBinding.inflate(getLayoutInflater());
|
binding = ActivityPermissionBinding.inflate(getLayoutInflater());
|
||||||
setContentView(binding.getRoot());
|
setContentView(binding.getRoot());
|
||||||
|
AdManager.loadAllAd();
|
||||||
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.activity_Permission), (v, insets) -> {
|
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.activity_Permission), (v, insets) -> {
|
||||||
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
||||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||||
@ -51,26 +52,18 @@ public class PermissionActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void starMainactivity() {
|
|
||||||
if (Mytools.hasUsagePermission(this) && Mytools.hasOverlayPermission(this)) {
|
|
||||||
Intent intent = new Intent(PermissionActivity.this, SetPWDActivity.class);
|
|
||||||
startActivity(intent);
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
binding.step1Text.setSelected(Mytools.hasOverlayPermission(this));
|
binding.step1Text.setSelected(Mytools.hasOverlayPermission(this));
|
||||||
binding.step2Text.setSelected(Mytools.hasUsagePermission(this));
|
binding.step2Text.setSelected(Mytools.hasUsagePermission(this));
|
||||||
if (ApplockSkin.getPWD().isEmpty()) {
|
if (Mytools.hasUsagePermission(this) && Mytools.hasOverlayPermission(this)) {
|
||||||
starMainactivity();
|
Intent intent = new Intent(PermissionActivity.this, SetPWDActivity.class);
|
||||||
} else {
|
|
||||||
Intent intent = new Intent(PermissionActivity.this, MainActivity.class);
|
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -26,6 +26,7 @@ import com.tool.applockpro.databinding.ActivitySearchBinding;
|
|||||||
import com.tool.applockpro.fragment.OkDialogFragment;
|
import com.tool.applockpro.fragment.OkDialogFragment;
|
||||||
import com.tool.applockpro.tool.Mytools;
|
import com.tool.applockpro.tool.Mytools;
|
||||||
import com.tool.applockpro.tool.ShowAdDialogCallback;
|
import com.tool.applockpro.tool.ShowAdDialogCallback;
|
||||||
|
import com.tool.applockpro.topon.AdManager;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -39,7 +40,7 @@ public class SearchActivity extends AppCompatActivity {
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
binding = ActivitySearchBinding.inflate(getLayoutInflater());
|
binding = ActivitySearchBinding.inflate(getLayoutInflater());
|
||||||
setContentView(binding.getRoot());
|
setContentView(binding.getRoot());
|
||||||
|
AdManager.loadAllAd();
|
||||||
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.activity_search), (v, insets) -> {
|
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.activity_search), (v, insets) -> {
|
||||||
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
||||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||||
|
|||||||
@ -24,6 +24,8 @@ import com.tool.applockpro.R;
|
|||||||
import com.tool.applockpro.databinding.ActivitySetPwdactivityBinding;
|
import com.tool.applockpro.databinding.ActivitySetPwdactivityBinding;
|
||||||
import com.tool.applockpro.tool.Adcallback;
|
import com.tool.applockpro.tool.Adcallback;
|
||||||
import com.tool.applockpro.tool.Mytools;
|
import com.tool.applockpro.tool.Mytools;
|
||||||
|
import com.tool.applockpro.topon.AdManager;
|
||||||
|
import com.tool.applockpro.topon.onActionListener;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -33,7 +35,7 @@ public class SetPWDActivity extends AppCompatActivity {
|
|||||||
ActivitySetPwdactivityBinding binding;
|
ActivitySetPwdactivityBinding binding;
|
||||||
private List<EditText> etlis = new ArrayList<>();
|
private List<EditText> etlis = new ArrayList<>();
|
||||||
private int chewkpwd;
|
private int chewkpwd;
|
||||||
private List<ATInterstitial> ads;
|
|
||||||
private String firstPwd = "";
|
private String firstPwd = "";
|
||||||
private String secondPwd = "";
|
private String secondPwd = "";
|
||||||
|
|
||||||
@ -47,7 +49,7 @@ public class SetPWDActivity extends AppCompatActivity {
|
|||||||
showClose = getIntent().getBooleanExtra(KEY_SHOW_CLOSE, showClose);
|
showClose = getIntent().getBooleanExtra(KEY_SHOW_CLOSE, showClose);
|
||||||
binding = ActivitySetPwdactivityBinding.inflate(getLayoutInflater());
|
binding = ActivitySetPwdactivityBinding.inflate(getLayoutInflater());
|
||||||
setContentView(binding.getRoot());
|
setContentView(binding.getRoot());
|
||||||
|
AdManager.loadAllAd();
|
||||||
if(showClose){
|
if(showClose){
|
||||||
binding.close.setVisibility(View.VISIBLE);
|
binding.close.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
@ -66,7 +68,7 @@ public class SetPWDActivity extends AppCompatActivity {
|
|||||||
return insets;
|
return insets;
|
||||||
});
|
});
|
||||||
|
|
||||||
ads = ApplockSkin.lodAd();
|
|
||||||
chewkpwd = getIntent().getIntExtra("1", 0);
|
chewkpwd = getIntent().getIntExtra("1", 0);
|
||||||
etlis.add(binding.et1);
|
etlis.add(binding.et1);
|
||||||
etlis.add(binding.et2);
|
etlis.add(binding.et2);
|
||||||
@ -77,24 +79,13 @@ public class SetPWDActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void showAd() {
|
private void showAd() {
|
||||||
ATInterstitial mInterstitialAd = Mytools.onCache(ads);
|
AdManager.showTopOn(SetPWDActivity.this, new onActionListener() {
|
||||||
if (mInterstitialAd == null) {
|
@Override
|
||||||
finish();
|
public void onAction() {
|
||||||
} else {
|
Toast.makeText(SetPWDActivity.this, getString(R.string.changelock_tips), Toast.LENGTH_SHORT).show();
|
||||||
Mytools.setCallback(mInterstitialAd, new Adcallback() {
|
finish();
|
||||||
@Override
|
}
|
||||||
public void onShowFail(AdError ad) {
|
});
|
||||||
finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAdHidden() {
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
mInterstitialAd.show(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initEvent() {
|
private void initEvent() {
|
||||||
@ -112,9 +103,6 @@ public class SetPWDActivity extends AppCompatActivity {
|
|||||||
if (TextUtils.isEmpty(firstPwd)) {
|
if (TextUtils.isEmpty(firstPwd)) {
|
||||||
firstPwd = stringBuilder.toString();
|
firstPwd = stringBuilder.toString();
|
||||||
|
|
||||||
Log.e("zzj", "---first set pwd---" + stringBuilder.toString());
|
|
||||||
|
|
||||||
Log.e("zzj", "---clear stringBuilder---" + stringBuilder.toString());
|
|
||||||
binding.et1.setText("");
|
binding.et1.setText("");
|
||||||
binding.et2.setText("");
|
binding.et2.setText("");
|
||||||
binding.et3.setText("");
|
binding.et3.setText("");
|
||||||
@ -144,7 +132,6 @@ public class SetPWDActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
Toast.makeText(SetPWDActivity.this, getString(R.string.changelock_tips), Toast.LENGTH_SHORT).show();
|
|
||||||
showAd();
|
showAd();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,6 +13,7 @@ import android.view.View;
|
|||||||
import com.tool.applockpro.ApplockSkin;
|
import com.tool.applockpro.ApplockSkin;
|
||||||
import com.tool.applockpro.R;
|
import com.tool.applockpro.R;
|
||||||
import com.tool.applockpro.databinding.ActivitySettingBinding;
|
import com.tool.applockpro.databinding.ActivitySettingBinding;
|
||||||
|
import com.tool.applockpro.topon.AdManager;
|
||||||
|
|
||||||
|
|
||||||
public class SettingActivity extends AppCompatActivity {
|
public class SettingActivity extends AppCompatActivity {
|
||||||
@ -29,7 +30,7 @@ public class SettingActivity extends AppCompatActivity {
|
|||||||
return insets;
|
return insets;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
AdManager.loadAllAd();
|
||||||
initEvent();
|
initEvent();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,20 +14,26 @@ import com.anythink.core.api.AdError;
|
|||||||
import com.anythink.interstitial.api.ATInterstitial;
|
import com.anythink.interstitial.api.ATInterstitial;
|
||||||
import com.tool.applockpro.ApplockSkin;
|
import com.tool.applockpro.ApplockSkin;
|
||||||
import com.tool.applockpro.R;
|
import com.tool.applockpro.R;
|
||||||
|
import com.tool.applockpro.data.MyDataBase;
|
||||||
|
import com.tool.applockpro.data.Mydata;
|
||||||
import com.tool.applockpro.databinding.ActivitySplashBinding;
|
import com.tool.applockpro.databinding.ActivitySplashBinding;
|
||||||
import com.tool.applockpro.tool.Adcallback;
|
import com.tool.applockpro.tool.Adcallback;
|
||||||
import com.tool.applockpro.tool.Mytools;
|
import com.tool.applockpro.tool.Mytools;
|
||||||
|
import com.tool.applockpro.topon.AdManager;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import kotlin.Unit;
|
||||||
|
import kotlin.jvm.functions.Function0;
|
||||||
|
import kotlin.jvm.functions.Function1;
|
||||||
|
|
||||||
public class SplashActivity extends AppCompatActivity {
|
public class SplashActivity extends AppCompatActivity {
|
||||||
ActivitySplashBinding binding;
|
ActivitySplashBinding binding;
|
||||||
private CountDownTimer countDownTimer;
|
private CountDownTimer countDownTimer;
|
||||||
private List<ATInterstitial> ads;
|
|
||||||
|
|
||||||
private boolean isAlreadyShow = false;
|
|
||||||
private float i = 0;
|
private float i = 0;
|
||||||
|
|
||||||
|
private long time = 1000;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -40,64 +46,42 @@ public class SplashActivity extends AppCompatActivity {
|
|||||||
return insets;
|
return insets;
|
||||||
});
|
});
|
||||||
|
|
||||||
ads = ApplockSkin.lodAd();
|
|
||||||
countDownTimer = new CountDownTimer(1000, 100) {
|
|
||||||
@Override
|
|
||||||
public void onTick(long l) {
|
|
||||||
i++;
|
|
||||||
binding.splashPg.setProgress(i);
|
|
||||||
if (!isAlreadyShow) {
|
|
||||||
showAd(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
countDownTimer = AdManager.showWelcomeAd(SplashActivity.this, time, new Function1<Long, Unit>() {
|
||||||
@Override
|
@Override
|
||||||
public void onFinish() {
|
public Unit invoke(Long aLong) {
|
||||||
if (!isAlreadyShow) {
|
Float percentage = 100 - (float) aLong / time * 100;
|
||||||
showAd(true);
|
binding.splashPg.setProgress(percentage);
|
||||||
}
|
return null;
|
||||||
}
|
}
|
||||||
};
|
}, new Function0<Unit>() {
|
||||||
|
@Override
|
||||||
|
public Unit invoke() {
|
||||||
|
|
||||||
|
starMainactivity();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
countDownTimer.start();
|
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() {
|
private void starMainactivity() {
|
||||||
Intent intent = new Intent(SplashActivity.this, PermissionActivity.class);
|
binding.splashPg.setProgress(100);
|
||||||
startActivity(intent);
|
if (Mytools.hasUsagePermission(this) && Mytools.hasOverlayPermission(this)) {
|
||||||
|
if(ApplockSkin.getPWD().isEmpty()){
|
||||||
|
Intent intent = new Intent(SplashActivity.this, SetPWDActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
}else {
|
||||||
|
Intent intent = new Intent(SplashActivity.this, MainActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Intent intent = new Intent(SplashActivity.this, PermissionActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -14,6 +14,7 @@ import android.webkit.WebViewClient;
|
|||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
|
||||||
import com.tool.applockpro.R;
|
import com.tool.applockpro.R;
|
||||||
|
import com.tool.applockpro.topon.AdManager;
|
||||||
|
|
||||||
|
|
||||||
public class WebActivity extends AppCompatActivity {
|
public class WebActivity extends AppCompatActivity {
|
||||||
@ -29,7 +30,7 @@ public class WebActivity extends AppCompatActivity {
|
|||||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||||
return insets;
|
return insets;
|
||||||
});
|
});
|
||||||
|
AdManager.loadAllAd();
|
||||||
|
|
||||||
WebView webView = findViewById(R.id.web);
|
WebView webView = findViewById(R.id.web);
|
||||||
webView.getSettings().setJavaScriptEnabled(true);
|
webView.getSettings().setJavaScriptEnabled(true);
|
||||||
|
|||||||
@ -33,6 +33,8 @@ import com.tool.applockpro.tool.Adcallback;
|
|||||||
import com.tool.applockpro.tool.Mytools;
|
import com.tool.applockpro.tool.Mytools;
|
||||||
import com.tool.applockpro.tool.OkDialogCallback;
|
import com.tool.applockpro.tool.OkDialogCallback;
|
||||||
import com.tool.applockpro.tool.ShowAdDialogCallback;
|
import com.tool.applockpro.tool.ShowAdDialogCallback;
|
||||||
|
import com.tool.applockpro.topon.AdManager;
|
||||||
|
import com.tool.applockpro.topon.onActionListener;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -42,20 +44,19 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.AppVH> {
|
|||||||
private List<Mydata> mydataList = new ArrayList<>();
|
private List<Mydata> mydataList = new ArrayList<>();
|
||||||
private PackageManager packageManager;
|
private PackageManager packageManager;
|
||||||
private Activity mactivity;
|
private Activity mactivity;
|
||||||
private List<ATInterstitial> ads;
|
|
||||||
private int a = 0;
|
|
||||||
|
|
||||||
|
|
||||||
private ShowAdDialogCallback mShowAdDialogCallback;
|
private ShowAdDialogCallback mShowAdDialogCallback;
|
||||||
|
|
||||||
@SuppressLint("NotifyDataSetChanged")
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
public AppAdapter(Context context, Activity activity, ShowAdDialogCallback showAdDialogCallback) {
|
public AppAdapter(Context context, Activity activity, ShowAdDialogCallback showAdDialogCallback) {
|
||||||
ads = ApplockSkin.lodAd();
|
|
||||||
mycontext = context;
|
mycontext = context;
|
||||||
mactivity = activity;
|
mactivity = activity;
|
||||||
packageManager = context.getPackageManager();
|
packageManager = context.getPackageManager();
|
||||||
mShowAdDialogCallback = showAdDialogCallback;
|
mShowAdDialogCallback = showAdDialogCallback;
|
||||||
a = ApplockSkin.keyad;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update(List<Mydata> list) {
|
public void update(List<Mydata> list) {
|
||||||
@ -74,7 +75,6 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.AppVH> {
|
|||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(@NonNull AppVH holder, @SuppressLint("RecyclerView") int position) {
|
public void onBindViewHolder(@NonNull AppVH holder, @SuppressLint("RecyclerView") int position) {
|
||||||
Mydata mydata = mydataList.get(position);
|
Mydata mydata = mydataList.get(position);
|
||||||
String appname = mydata.getAppName();
|
|
||||||
boolean lock = mydata.isLock();
|
boolean lock = mydata.isLock();
|
||||||
holder.switchCompat.setSelected(lock);
|
holder.switchCompat.setSelected(lock);
|
||||||
holder.lockView.setOnClickListener(new View.OnClickListener() {
|
holder.lockView.setOnClickListener(new View.OnClickListener() {
|
||||||
@ -83,7 +83,7 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.AppVH> {
|
|||||||
ApplockSkin.keyad++;
|
ApplockSkin.keyad++;
|
||||||
if (ApplockSkin.keyad % 5 == 0 || ApplockSkin.keyad == 1) {
|
if (ApplockSkin.keyad % 5 == 0 || ApplockSkin.keyad == 1) {
|
||||||
String msg = updateStatus(holder.switchCompat, mydata, false);
|
String msg = updateStatus(holder.switchCompat, mydata, false);
|
||||||
showAd(new AdActionListener() {
|
AdManager.showTopOn(mactivity, new onActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onAction() {
|
public void onAction() {
|
||||||
if (mShowAdDialogCallback != null) {
|
if (mShowAdDialogCallback != null) {
|
||||||
@ -111,10 +111,11 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.AppVH> {
|
|||||||
String s;
|
String s;
|
||||||
if (imageView.isSelected()) {
|
if (imageView.isSelected()) {
|
||||||
imageView.setSelected(false);
|
imageView.setSelected(false);
|
||||||
s = String.format(mycontext.getString(R.string.text_locked), curData.getAppName());
|
s = String.format(mycontext.getString(R.string.text_unlocked), curData.getAppName());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
imageView.setSelected(true);
|
imageView.setSelected(true);
|
||||||
s = String.format(mycontext.getString(R.string.text_unlocked), curData.getAppName());
|
s = String.format(mycontext.getString(R.string.text_locked), curData.getAppName());
|
||||||
}
|
}
|
||||||
Mytools.runIO(new Runnable() {
|
Mytools.runIO(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
@ -158,25 +159,6 @@ 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,8 @@ public interface Mydao {
|
|||||||
@Query("SELECT * FROM lock_table WHERE isLock = :islock")
|
@Query("SELECT * FROM lock_table WHERE isLock = :islock")
|
||||||
List<Mydata> getlockapp(boolean islock);
|
List<Mydata> getlockapp(boolean islock);
|
||||||
|
|
||||||
@Query("SELECT * FROM lock_table WHERE system = :issystem")
|
@Query("SELECT * FROM lock_table WHERE system = :issystem AND packageName != :removePackName")
|
||||||
List<Mydata> getappissystem(boolean issystem);
|
List<Mydata> getappissystem(boolean issystem,String removePackName);
|
||||||
|
|
||||||
@Query("SELECT * FROM lock_table WHERE packageName = :packagename")
|
@Query("SELECT * FROM lock_table WHERE packageName = :packagename")
|
||||||
Mydata getappislock(String packagename);
|
Mydata getappislock(String packagename);
|
||||||
@ -32,8 +32,8 @@ public interface Mydao {
|
|||||||
@Update
|
@Update
|
||||||
void update(Mydata myData);
|
void update(Mydata myData);
|
||||||
|
|
||||||
@Query("SELECT * FROM lock_table WHERE isLock = :islock")
|
@Query("SELECT * FROM lock_table WHERE isLock = :islock AND packageName != :removePackName")
|
||||||
LiveData<List<Mydata>> getLockApps(boolean islock);
|
LiveData<List<Mydata>> getLockApps(boolean islock,String removePackName);
|
||||||
|
|
||||||
@Query("SELECT * FROM lock_table WHERE system = :issystem")
|
@Query("SELECT * FROM lock_table WHERE system = :issystem")
|
||||||
LiveData<List<Mydata>> getAppsBySystem(boolean issystem);
|
LiveData<List<Mydata>> getAppsBySystem(boolean issystem);
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import android.view.LayoutInflater;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import com.tool.applockpro.ApplockSkin;
|
||||||
import com.tool.applockpro.adapter.AppAdapter;
|
import com.tool.applockpro.adapter.AppAdapter;
|
||||||
import com.tool.applockpro.data.MyDataBase;
|
import com.tool.applockpro.data.MyDataBase;
|
||||||
import com.tool.applockpro.data.Mydao;
|
import com.tool.applockpro.data.Mydao;
|
||||||
@ -31,6 +32,8 @@ public class AllFragment extends Fragment {
|
|||||||
private OkDialogFragment okDialogFragment;
|
private OkDialogFragment okDialogFragment;
|
||||||
// private List<Mydata> list1 = new ArrayList<>();
|
// private List<Mydata> list1 = new ArrayList<>();
|
||||||
|
|
||||||
|
private String packageName;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
@ -41,6 +44,7 @@ public class AllFragment extends Fragment {
|
|||||||
showDialog(msg);
|
showDialog(msg);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
packageName = ApplockSkin.getContext().getPackageName();
|
||||||
binding.allRv.setLayoutManager(new LinearLayoutManager(requireContext()));
|
binding.allRv.setLayoutManager(new LinearLayoutManager(requireContext()));
|
||||||
binding.allRv.setAdapter(thumAdapter);
|
binding.allRv.setAdapter(thumAdapter);
|
||||||
mydao = MyDataBase.getINSTANCE().mydao();
|
mydao = MyDataBase.getINSTANCE().mydao();
|
||||||
@ -50,10 +54,11 @@ public class AllFragment extends Fragment {
|
|||||||
|
|
||||||
return binding.getRoot();
|
return binding.getRoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showDialog(String string) {
|
private void showDialog(String string) {
|
||||||
if (okDialogFragment == null) {
|
if (okDialogFragment == null) {
|
||||||
okDialogFragment = OkDialogFragment.newInstance(string);
|
okDialogFragment = OkDialogFragment.newInstance(string);
|
||||||
}else {
|
} else {
|
||||||
okDialogFragment.updateContent(string);
|
okDialogFragment.updateContent(string);
|
||||||
}
|
}
|
||||||
okDialogFragment.show(requireActivity().getSupportFragmentManager(), "");
|
okDialogFragment.show(requireActivity().getSupportFragmentManager(), "");
|
||||||
@ -69,7 +74,7 @@ public class AllFragment extends Fragment {
|
|||||||
Mytools.runIO(new Runnable() {
|
Mytools.runIO(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
List<Mydata> list1 = MyDataBase.getINSTANCE().mydao().getappissystem(false);
|
List<Mydata> list1 = MyDataBase.getINSTANCE().mydao().getappissystem(false, packageName);
|
||||||
requireActivity().runOnUiThread(new Runnable() {
|
requireActivity().runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -94,7 +99,7 @@ public class AllFragment extends Fragment {
|
|||||||
Mytools.runIO(new Runnable() {
|
Mytools.runIO(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
List<Mydata> list = MyDataBase.getINSTANCE().mydao().getappissystem(true);
|
List<Mydata> list = MyDataBase.getINSTANCE().mydao().getappissystem(true, packageName);
|
||||||
requireActivity().runOnUiThread(new Runnable() {
|
requireActivity().runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -107,7 +112,7 @@ public class AllFragment extends Fragment {
|
|||||||
Mytools.runIO(new Runnable() {
|
Mytools.runIO(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
List<Mydata> list1 = MyDataBase.getINSTANCE().mydao().getappissystem(false);
|
List<Mydata> list1 = MyDataBase.getINSTANCE().mydao().getappissystem(false, packageName);
|
||||||
requireActivity().runOnUiThread(new Runnable() {
|
requireActivity().runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -117,7 +122,7 @@ public class AllFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (tabargs.equals("Lock")) {
|
} else if (tabargs.equals("Lock")) {
|
||||||
mydao.getLockApps(true).observe(getViewLifecycleOwner(), new Observer<List<Mydata>>() {
|
mydao.getLockApps(true, packageName).observe(getViewLifecycleOwner(), new Observer<List<Mydata>>() {
|
||||||
@Override
|
@Override
|
||||||
public void onChanged(@Nullable List<Mydata> mydataList) {
|
public void onChanged(@Nullable List<Mydata> mydataList) {
|
||||||
updateRecyclerView(mydataList);
|
updateRecyclerView(mydataList);
|
||||||
|
|||||||
@ -30,98 +30,6 @@ import java.util.concurrent.Executors;
|
|||||||
|
|
||||||
public class Mytools {
|
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) {
|
public static String checkTopapp(Context context) {
|
||||||
UsageStatsManager sUsageStatsManager = (UsageStatsManager) context.getSystemService(Context.USAGE_STATS_SERVICE);
|
UsageStatsManager sUsageStatsManager = (UsageStatsManager) context.getSystemService(Context.USAGE_STATS_SERVICE);
|
||||||
|
|||||||
11
app/src/main/java/com/tool/applockpro/topon/AdListener.kt
Normal file
11
app/src/main/java/com/tool/applockpro/topon/AdListener.kt
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
package com.tool.applockpro.topon
|
||||||
|
|
||||||
|
interface AdListener {
|
||||||
|
|
||||||
|
fun loadFail(placeId: String)
|
||||||
|
fun showSuccess()
|
||||||
|
|
||||||
|
fun showFail()
|
||||||
|
|
||||||
|
fun showClose()
|
||||||
|
}
|
||||||
221
app/src/main/java/com/tool/applockpro/topon/AdManager.kt
Normal file
221
app/src/main/java/com/tool/applockpro/topon/AdManager.kt
Normal file
@ -0,0 +1,221 @@
|
|||||||
|
package com.tool.applockpro.topon
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.os.CountDownTimer
|
||||||
|
import android.util.Log
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
|
object AdManager {
|
||||||
|
|
||||||
|
//上次广告展示时刻
|
||||||
|
var LAST_AD_SHOW = 0L
|
||||||
|
|
||||||
|
const val type_no_cache = 0
|
||||||
|
const val type_has_cache = 1
|
||||||
|
const val type_show_success = 2
|
||||||
|
const val type_show_close = 3
|
||||||
|
const val type_show_fail = 4
|
||||||
|
|
||||||
|
/**
|
||||||
|
private static final String one_AD = "n66a73512bc4e5";
|
||||||
|
private static final String two_Ad = "n66a734ffdcb74";
|
||||||
|
private static final String three_ad = "n66a734e31e902";
|
||||||
|
*/
|
||||||
|
|
||||||
|
const val place1Id = "n66a73512bc4e5"
|
||||||
|
const val place2Id = "n66a734ffdcb74"
|
||||||
|
const val place3Id = "n66a734e31e902"
|
||||||
|
|
||||||
|
|
||||||
|
var place1LoadFail = false
|
||||||
|
var place2LoadFail = false
|
||||||
|
var place3LoadFail = false
|
||||||
|
|
||||||
|
val list = mutableListOf<ATInterstitial>()
|
||||||
|
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun loadAllAd() {
|
||||||
|
if (list.size <= 0) {
|
||||||
|
val mInterstitialAd1 = ATInterstitial(ApplockSkin.getContext(), place1Id)
|
||||||
|
val mInterstitialAd2 = ATInterstitial(ApplockSkin.getContext(), place2Id)
|
||||||
|
val mInterstitialAd3 = ATInterstitial(ApplockSkin.getContext(), place3Id)
|
||||||
|
list.add(mInterstitialAd1)
|
||||||
|
list.add(mInterstitialAd2)
|
||||||
|
list.add(mInterstitialAd3)
|
||||||
|
}
|
||||||
|
for (ad in list) {
|
||||||
|
if (!ad.isAdReady) {
|
||||||
|
setCallBack(ad, object : AdListener {
|
||||||
|
override fun loadFail(placeId: String) {
|
||||||
|
if (placeId == place1Id) {
|
||||||
|
place1LoadFail = true
|
||||||
|
}
|
||||||
|
if (placeId == place2Id) {
|
||||||
|
place2LoadFail = true
|
||||||
|
}
|
||||||
|
if (placeId == place3Id) {
|
||||||
|
place3LoadFail = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun showSuccess() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun showFail() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun showClose() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
// ad.load()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun getReadyAd(): ATInterstitial? {
|
||||||
|
list.shuffle()
|
||||||
|
for (ad in list) {
|
||||||
|
if (ad.isAdReady) {
|
||||||
|
Log.d(ApplockSkin.TAG, "-has cache------------")
|
||||||
|
return ad
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Log.d(ApplockSkin.TAG, "-no cache-----------")
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun showWelcomeAd(
|
||||||
|
activity: Activity,
|
||||||
|
totalTim: Long,
|
||||||
|
countAction: (millisUntilFinished: Long) -> Unit,
|
||||||
|
goMain: () -> Unit
|
||||||
|
): CountDownTimer {
|
||||||
|
var alreadyShow = false
|
||||||
|
var timer = object : CountDownTimer(totalTim, 100) {
|
||||||
|
override fun onTick(millisUntilFinished: Long) {
|
||||||
|
countAction.invoke(millisUntilFinished)
|
||||||
|
if (!alreadyShow) {
|
||||||
|
showAD(activity) {
|
||||||
|
if (it == type_has_cache) {
|
||||||
|
alreadyShow = true
|
||||||
|
}
|
||||||
|
if (it == type_show_close || it == type_show_fail) {
|
||||||
|
goMain.invoke()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onFinish() {
|
||||||
|
if (!alreadyShow) {
|
||||||
|
showAD(activity) {
|
||||||
|
if (it == type_show_close || it == type_show_fail || it == type_no_cache) {
|
||||||
|
goMain.invoke()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return timer
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setCallBack(ad: ATInterstitial, listener: AdListener) {
|
||||||
|
ad.setAdListener(object : ATInterstitialListener {
|
||||||
|
override fun onInterstitialAdLoaded() {
|
||||||
|
Log.d(ApplockSkin.TAG, "LoadLoaded ${ad.mPlacementId}")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onInterstitialAdLoadFail(p0: AdError?) {
|
||||||
|
Log.d(ApplockSkin.TAG, "LoadFail:${p0?.code} ${p0?.desc}")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onInterstitialAdClicked(p0: ATAdInfo?) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onInterstitialAdShow(p0: ATAdInfo?) {
|
||||||
|
Log.d(ApplockSkin.TAG, "AdShow ${p0?.showId} ")
|
||||||
|
listener.showSuccess()
|
||||||
|
// ad.load()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onInterstitialAdClose(p0: ATAdInfo?) {
|
||||||
|
listener.showClose()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onInterstitialAdVideoStart(p0: ATAdInfo?) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onInterstitialAdVideoEnd(p0: ATAdInfo?) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onInterstitialAdVideoError(p0: AdError?) {
|
||||||
|
listener.showFail()
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
private fun showAD(activity: Activity, action: (type: Int) -> Unit) {
|
||||||
|
val readyAd = getReadyAd()
|
||||||
|
if (readyAd != null) {
|
||||||
|
Log.d(ApplockSkin.TAG, "readyAd ${readyAd.mPlacementId} ")
|
||||||
|
action.invoke(type_has_cache)
|
||||||
|
setCallBack(readyAd, object : AdListener {
|
||||||
|
override fun loadFail(placeId: String) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun showSuccess() {
|
||||||
|
action.invoke(type_show_success)
|
||||||
|
LAST_AD_SHOW = System.currentTimeMillis()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun showFail() {
|
||||||
|
action.invoke(type_show_fail)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun showClose() {
|
||||||
|
action.invoke(type_show_close)
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
readyAd.show(activity)
|
||||||
|
} else {
|
||||||
|
action.invoke(type_no_cache)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun showTopOn(activity: Activity, listener: onActionListener) {
|
||||||
|
showAD(activity) { type ->
|
||||||
|
if (type == type_no_cache || type == type_show_close || type == type_show_fail) {
|
||||||
|
listener.onAction()
|
||||||
|
Log.d(ApplockSkin.TAG, "-show Ad-----------")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
package com.tool.applockpro.topon;
|
||||||
|
|
||||||
|
public interface onActionListener {
|
||||||
|
|
||||||
|
void onAction();
|
||||||
|
}
|
||||||
@ -24,14 +24,20 @@
|
|||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent" />
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
<ImageView
|
<androidx.cardview.widget.CardView
|
||||||
android:layout_width="70dp"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="70dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="12dp"
|
android:layout_marginBottom="182dp"
|
||||||
android:src="@mipmap/icon_logo"
|
app:cardCornerRadius="12dp"
|
||||||
app:layout_constraintBottom_toTopOf="@id/splash_title"
|
app:layout_constraintBottom_toTopOf="@id/splash_title"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent" />
|
app:layout_constraintStart_toStartOf="parent">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="110dp"
|
||||||
|
android:layout_height="110dp"
|
||||||
|
android:src="@mipmap/icon_logo" />
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
<com.tool.applockpro.tool.CustomProgressBar
|
<com.tool.applockpro.tool.CustomProgressBar
|
||||||
android:id="@+id/splash_pg"
|
android:id="@+id/splash_pg"
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
||||||
<!-- Customize your theme here. -->
|
<!-- Customize your theme here. -->
|
||||||
<item name="android:windowBackground">@android:color/white</item>
|
<item name="android:windowBackground">@mipmap/bg_main</item>
|
||||||
<item name="colorOnPrimary">@color/white</item>
|
<item name="colorOnPrimary">@color/white</item>
|
||||||
<item name="android:statusBarColor" />
|
<item name="android:statusBarColor" />
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
6
keystore.properties
Normal file
6
keystore.properties
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
app_name=Lock App
|
||||||
|
package_name=com.tool.lockapp
|
||||||
|
keystoreFile=app/lockapp.jks
|
||||||
|
key_alias=lockappkey0
|
||||||
|
key_store_password=lockapp
|
||||||
|
key_password=lockapp
|
||||||
Loading…
Reference in New Issue
Block a user