Commit 6464f500 authored by mengcuiguang's avatar mengcuiguang

代码优化

parent 0d89916e
...@@ -58,6 +58,9 @@ public class MintsApplication extends MultiDexApplication { ...@@ -58,6 +58,9 @@ public class MintsApplication extends MultiDexApplication {
// UmengManager.INSTANCE.preInit(this, // UmengManager.INSTANCE.preInit(this,
// MateUtils.INSTANCE.getAppMetaData(this, "CHANNEL_NAME")); // MateUtils.INSTANCE.getAppMetaData(this, "CHANNEL_NAME"));
// 判断应用是否在前台
ForegroundOrBackground.init(this);
// 三方配置 // 三方配置
thirdConfig(); thirdConfig();
} }
...@@ -83,8 +86,6 @@ public class MintsApplication extends MultiDexApplication { ...@@ -83,8 +86,6 @@ public class MintsApplication extends MultiDexApplication {
TXCSDKService.init(this); TXCSDKService.init(this);
// 判断应用是否在前台
ForegroundOrBackground.init(this);
// PR下载附件 // PR下载附件
initPRDownloader(); initPRDownloader();
......
...@@ -388,7 +388,6 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR ...@@ -388,7 +388,6 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
val mainFirstRecommend = val mainFirstRecommend =
AppPreferencesManager.get().getBoolean(Constant.MAIN_FIRST_RECOMMEND, false) AppPreferencesManager.get().getBoolean(Constant.MAIN_FIRST_RECOMMEND, false)
if (!mainFirstRecommend) { if (!mainFirstRecommend) {
// if (mainFirstRecommend) {
AppPreferencesManager.get().put(Constant.MAIN_FIRST_RECOMMEND, true) AppPreferencesManager.get().put(Constant.MAIN_FIRST_RECOMMEND, true)
Handler(Looper.getMainLooper()).postDelayed({ Handler(Looper.getMainLooper()).postDelayed({
......
...@@ -78,6 +78,8 @@ public class ForegroundOrBackground implements Application.ActivityLifecycleCall ...@@ -78,6 +78,8 @@ public class ForegroundOrBackground implements Application.ActivityLifecycleCall
TextUtils.equals(simpleName, "SplashForeAdActivity") || TextUtils.equals(simpleName, "SplashForeAdActivity") ||
TextUtils.equals(simpleName, "VipActivity")) { TextUtils.equals(simpleName, "VipActivity")) {
count++; count++;
System.out.println("mcg __>>>>>>>:: onActivityStarted simpleName="+simpleName+" 进入 count=" + count);
return; return;
} }
...@@ -91,11 +93,16 @@ public class ForegroundOrBackground implements Application.ActivityLifecycleCall ...@@ -91,11 +93,16 @@ public class ForegroundOrBackground implements Application.ActivityLifecycleCall
} }
} }
count++; count++;
System.out.println("mcg __>>>>>>>:: onActivityStarted simpleName="+simpleName+" 进入 count=" + count);
} }
@Override @Override
public void onActivityStopped(Activity activity) { public void onActivityStopped(Activity activity) {
String simpleName = activity.getClass().getSimpleName();
count--; count--;
System.out.println("mcg __>>>>>>>:: onActivityStopped simpleName="+simpleName+" 关闭 count=" + count);
if (count < 0) { if (count < 0) {
count = 0; count = 0;
} }
......
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