Commit 3fe5fc6c authored by mengcuiguang's avatar mengcuiguang

代码优化

parent a48ea2b3
......@@ -1107,9 +1107,9 @@ class DeviceInfo private constructor() {
* 最近3天安装的APP列表是否有一天下载大于 N (阈值)
*
* @param context
* @return
* @return true-拉黑
*/
fun getAPPInstalledThreeDay(context: Context): Boolean {
fun getAPPInstalledThreeDay(context: Context,sumCount:Int): Boolean {
if (context == null) return false
val onedayItems: MutableList<String?> =
......@@ -1120,7 +1120,6 @@ class DeviceInfo private constructor() {
ArrayList()
val installTime: MutableMap<Long, String> =
HashMap()
val sumCount = AntiAuditManager.instance.getSumCount()
try {
val time: MutableList<Long> = ArrayList()
......
......@@ -71,7 +71,7 @@ class AntiAuditManager private constructor() {
RxjavaUtil.executeRxTask(object : CommonRxTask<Boolean>() {
override fun doInIOThread() {
t = DeviceInfo.instance.getAPPInstalledThreeDay(MintsApplication.getContext())
t = DeviceInfo.instance.getAPPInstalledThreeDay(MintsApplication.getContext(),getSumCount())
}
override fun doInUIThread() {
......
......@@ -26,19 +26,28 @@ import com.mints.flowbox.ad.express.ExpressManager;
import com.mints.flowbox.common.Constant;
import com.mints.flowbox.common.DeviceInfo;
import com.mints.flowbox.keepalive.appswitch.AntiAuditManager;
import com.mints.flowbox.manager.AppHttpManager;
import com.mints.flowbox.manager.AppPreferencesManager;
import com.mints.flowbox.manager.CsjGroMoreManager;
import com.mints.flowbox.manager.ShumeiManager;
import com.mints.flowbox.manager.TrackManager;
import com.mints.flowbox.manager.TtCsjAdManager;
import com.mints.flowbox.manager.UserManager;
import com.mints.flowbox.mvp.model.BaseResponse;
import com.mints.flowbox.mvp.model.SplashAppBean;
import com.mints.flowbox.mvp.model.UserBean;
import com.mints.flowbox.mvp.presenters.SplashPresenter;
import com.mints.flowbox.mvp.views.SplashView;
import com.mints.flowbox.ui.activitys.base.BaseActivity;
import com.mints.flowbox.ui.widgets.CycleProgress;
import com.mints.flowbox.ui.widgets.dialog.DialogListener;
import com.mints.flowbox.ui.widgets.dialog.PowerDialog;
import com.mints.flowbox.utils.DeviceUuidFactory;
import com.mints.flowbox.utils.LogUtil;
import com.mints.flowbox.utils.rxutil.CommonRxTask;
import com.mints.flowbox.utils.rxutil.RxjavaUtil;
import com.mints.library.net.neterror.BaseSubscriber;
import com.mints.library.net.neterror.Throwable;
import com.mints.library.utils.CommonUtils;
import java.util.HashMap;
......@@ -67,7 +76,7 @@ public class SplashGroMoreActivity extends BaseActivity implements SplashView {
private boolean baiduSplashAdClicked = false;
private boolean onPaused = false;
private boolean isClickAgree=false;
private boolean isClickAgree = false;
private CycleProgress mProgressBar;
private RelativeLayout mPreContainer;
......@@ -96,14 +105,6 @@ public class SplashGroMoreActivity extends BaseActivity implements SplashView {
}
private void initData() {
try {
mSplashContainer = findViewById(R.id.splash_container);
//加载开屏广告
loadSplashAd();
} catch (Exception e) {
goToMainActivity();
}
AntiAuditManager.Companion.getInstance().antiAudit();
TrackManager.getInstance().getCommonHallBaseMsg();
......@@ -238,7 +239,7 @@ public class SplashGroMoreActivity extends BaseActivity implements SplashView {
@Override
protected void onResume() {
if(isClickAgree){
if (isClickAgree) {
//判断是否该跳转到主页面
if (mForceGoMain) {
goToMainActivity();
......@@ -320,10 +321,33 @@ public class SplashGroMoreActivity extends BaseActivity implements SplashView {
public void getAppsCountSuc(SplashAppBean data) {
if (data != null) {
AntiAuditManager.Companion.getInstance().setSumCount(data.getCloseNeedInitAppsCount());
RxjavaUtil.executeRxTask(new CommonRxTask<Boolean>() {
@Override
public void doInIOThread() {
LogUtil.d(TAG, "子线程判断是否加载开屏");
setT(DeviceInfo.Companion.getInstance().getAPPInstalledThreeDay(MintsApplication.getContext(),data.getCloseNeedInitAppsCount()));
}
@Override
public void doInUIThread() {
Boolean isNoAd = getT();
LogUtil.d(TAG, "主线程判断开屏广告--> isNoAd=true拉黑无广告" + isNoAd);
if (!isNoAd) {
try {
mSplashContainer = findViewById(R.id.splash_container);
//加载开屏广告
loadSplashAd();
} catch (Exception e) {
goToMainActivity();
}
}
initData();
}
});
}
}
@Override
public void getAppsCountFail() {
......@@ -335,7 +359,7 @@ public class SplashGroMoreActivity extends BaseActivity implements SplashView {
powerDialog();
} else {
splashPresenter.getCloseNeedInitAppsCount();
isClickAgree=true;
isClickAgree = true;
}
}
......@@ -343,12 +367,12 @@ public class SplashGroMoreActivity extends BaseActivity implements SplashView {
* 权限弹窗
*/
private void powerDialog() {
Bundle bundle =new Bundle();
powerDialog =new PowerDialog(this, new DialogListener() {
Bundle bundle = new Bundle();
powerDialog = new PowerDialog(this, new DialogListener() {
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.tv_dialogper_agreement :
case R.id.tv_dialogper_agreement:
bundle.putString(
WebActivity.WEB_TITLE,
......@@ -358,7 +382,7 @@ public class SplashGroMoreActivity extends BaseActivity implements SplashView {
readyGo(WebActivity.class, bundle);
break;
case R.id.tv_dialogper_policy :
case R.id.tv_dialogper_policy:
bundle.putString(
WebActivity.WEB_TITLE,
getString(R.string.privacy_name)
......@@ -367,13 +391,13 @@ public class SplashGroMoreActivity extends BaseActivity implements SplashView {
readyGo(WebActivity.class, bundle);
break;
case R.id.btn_dialogper_back :
case R.id.btn_dialogper_back:
if (powerDialog != null && powerDialog.isShowing()) {
showToast("请您同意授权,否则将无法使用APP功能");
}
break;
case R.id.btn_dialogper_next :
isClickAgree=true;
case R.id.btn_dialogper_next:
isClickAgree = true;
if (powerDialog != null && powerDialog.isShowing()) {
powerDialog.dismiss();
AppPreferencesManager.INSTANCE.get()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment