Commit 3fe5fc6c authored by mengcuiguang's avatar mengcuiguang

代码优化

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