|
|
@@ -4,14 +4,10 @@ import android.app.Activity;
|
|
|
import android.content.Context;
|
|
|
import android.os.Bundle;
|
|
|
import android.support.multidex.MultiDex;
|
|
|
-import android.util.DisplayMetrics;
|
|
|
|
|
|
import com.kfzs.duanduan.ActMain;
|
|
|
-import com.kfzs.duanduan.event.BigEvent;
|
|
|
-import com.kfzs.duanduan.event.EventTypes;
|
|
|
+import com.kfzs.duanduan.react.ConfigUtil;
|
|
|
import com.kfzs.duanduan.react.SharedPreferences;
|
|
|
-import com.mdad.sdk.mdsdk.AdManager;
|
|
|
-import com.mdad.sdk.mdsdk.AppDownloadListener;
|
|
|
import com.sheep.gamegroup.di.components.DaggerNetComponent;
|
|
|
import com.sheep.gamegroup.di.components.NetComponent;
|
|
|
import com.sheep.gamegroup.di.modules.NetModule;
|
|
|
@@ -22,7 +18,6 @@ import com.sheep.gamegroup.util.ChannelContent;
|
|
|
import com.sheep.gamegroup.util.ConnectAddress;
|
|
|
import com.sheep.gamegroup.util.Jump2View;
|
|
|
import com.sheep.gamegroup.util.LogUtil;
|
|
|
-import com.sheep.gamegroup.util.PreferenceUtils;
|
|
|
import com.sheep.gamegroup.util.SysAppUtil;
|
|
|
import com.sheep.gamegroup.util.UMConfigUtils;
|
|
|
import com.sheep.gamegroup.view.activity.LoginAct;
|
|
|
@@ -33,11 +28,6 @@ import com.sheep.jiuyan.samllsheep.utils.SpUtils;
|
|
|
import com.tencent.bugly.Bugly;
|
|
|
import com.tencent.bugly.beta.Beta;
|
|
|
|
|
|
-import org.afinal.simplecache.ACache;
|
|
|
-import org.greenrobot.eventbus.EventBus;
|
|
|
-
|
|
|
-import java.util.Locale;
|
|
|
-
|
|
|
import rx.functions.Action1;
|
|
|
|
|
|
/**
|
|
|
@@ -128,7 +118,7 @@ public class SheepApp extends BaseApplication {
|
|
|
}
|
|
|
|
|
|
|
|
|
- public int mActivityAount;
|
|
|
+ public int mActivityCount;//显示的activity的个数, 0个时代表暂停或退出应用,1个代表应用正显示在用户面前
|
|
|
private boolean notStop = false;
|
|
|
/**
|
|
|
* Activity 生命周期监听,用于监控app前后台状态切换
|
|
|
@@ -148,46 +138,48 @@ public class SheepApp extends BaseApplication {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- if(mActivityAount == 0) {
|
|
|
- Beta.autoDownloadOnWifi = !BuildConfig.DEBUG;
|
|
|
- Bugly.init(getApplicationContext(), Config.BUGLY_APPID, BuildConfig.DEBUG);
|
|
|
+ if(mActivityCount == 0) {
|
|
|
+ if(ConfigUtil.getInstance().isUpgrade()) {
|
|
|
+ Beta.autoDownloadOnWifi = !BuildConfig.DEBUG;
|
|
|
+ Bugly.init(getApplicationContext(), Config.BUGLY_APPID, BuildConfig.DEBUG);
|
|
|
+ }
|
|
|
AppUsageManager.getInstance().needOpenLookAppUsageStatsPermisson(true);//尝试保存应用使用情况的数据
|
|
|
- LogUtil.println("SheepApp SHEEP_START");
|
|
|
- UMConfigUtils.Event.SHEEP_START.onEvent();
|
|
|
+ LogUtil.println("SheepApp onActivityCreated", mActivityCount);
|
|
|
+ UMConfigUtils.Event.SHEEP_CREATED.onEvent();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void onActivityStarted(Activity activity) {
|
|
|
- mActivityAount++;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onActivityResumed(Activity activity) {
|
|
|
+ mActivityCount++;
|
|
|
UMConfigUtils.onPageStart(activity);
|
|
|
- if (mActivityAount > 0) {
|
|
|
+ if (mActivityCount > 0) {
|
|
|
if(!notStop) {
|
|
|
notStop = true;
|
|
|
- LogUtil.println("SheepApp SHEEP_RESUME");
|
|
|
- UMConfigUtils.Event.SHEEP_RESUME.onEvent();
|
|
|
+ LogUtil.println("SheepApp onActivityStarted", mActivityCount);
|
|
|
+ UMConfigUtils.Event.SHEEP_STARTED.onEvent();
|
|
|
}
|
|
|
Jump2View.getInstance().startFloat(activity, false);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ public void onActivityResumed(Activity activity) {
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
public void onActivityPaused(Activity activity) {
|
|
|
- UMConfigUtils.onPageEnd(activity);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void onActivityStopped(Activity activity) {
|
|
|
- mActivityAount--;
|
|
|
- if (mActivityAount <= 0) {
|
|
|
+ mActivityCount--;
|
|
|
+ UMConfigUtils.onPageEnd(activity);
|
|
|
+ if (mActivityCount <= 0) {
|
|
|
if(notStop) {
|
|
|
notStop = false;
|
|
|
- LogUtil.println("SheepApp SHEEP_PAUSE");
|
|
|
- UMConfigUtils.Event.SHEEP_PAUSE.onEvent();
|
|
|
+ LogUtil.println("SheepApp onActivityStopped", mActivityCount);
|
|
|
+ UMConfigUtils.Event.SHEEP_STOPPED.onEvent();
|
|
|
}
|
|
|
Jump2View.getInstance().startFloat(activity, true);
|
|
|
}
|
|
|
@@ -199,9 +191,9 @@ public class SheepApp extends BaseApplication {
|
|
|
|
|
|
@Override
|
|
|
public void onActivityDestroyed(Activity activity) {
|
|
|
- if(mActivityAount == 0) {
|
|
|
- LogUtil.println("SheepApp SHEEP_STOP");
|
|
|
- UMConfigUtils.Event.SHEEP_STOP.onEvent();
|
|
|
+ if(mActivityCount == 0) {
|
|
|
+ LogUtil.println("SheepApp onActivityDestroyed", mActivityCount);
|
|
|
+ UMConfigUtils.Event.SHEEP_DESTROYED.onEvent();
|
|
|
}
|
|
|
}
|
|
|
};
|