|
@@ -39,6 +39,7 @@ import com.sheep.gamegroup.view.activity.LoginAct;
|
|
|
import com.sheep.jiuyan.samllsheep.service.DownloadService;
|
|
import com.sheep.jiuyan.samllsheep.service.DownloadService;
|
|
|
import com.sheep.jiuyan.samllsheep.service.FloatService;
|
|
import com.sheep.jiuyan.samllsheep.service.FloatService;
|
|
|
import com.sheep.jiuyan.samllsheep.service.FloatShotScreenService;
|
|
import com.sheep.jiuyan.samllsheep.service.FloatShotScreenService;
|
|
|
|
|
+import com.sheep.jiuyan.samllsheep.service.ListenerShotService;
|
|
|
import com.sheep.jiuyan.samllsheep.utils.G;
|
|
import com.sheep.jiuyan.samllsheep.utils.G;
|
|
|
import com.sheep.jiuyan.samllsheep.utils.SpUtils;
|
|
import com.sheep.jiuyan.samllsheep.utils.SpUtils;
|
|
|
import com.tencent.bugly.Bugly;
|
|
import com.tencent.bugly.Bugly;
|
|
@@ -330,7 +331,6 @@ public class SheepApp extends MultiDexApplication {
|
|
|
* Activity 生命周期监听,用于监控app前后台状态切换
|
|
* Activity 生命周期监听,用于监控app前后台状态切换
|
|
|
*/
|
|
*/
|
|
|
ActivityLifecycleCallbacks activityLifecycleCallbacks = new ActivityLifecycleCallbacks() {
|
|
ActivityLifecycleCallbacks activityLifecycleCallbacks = new ActivityLifecycleCallbacks() {
|
|
|
- private ScreenShotListenManager manager;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void onActivityCreated(final Activity activity, Bundle savedInstanceState) {
|
|
public void onActivityCreated(final Activity activity, Bundle savedInstanceState) {
|
|
@@ -352,18 +352,7 @@ public class SheepApp extends MultiDexApplication {
|
|
|
Bugly.init(getApplicationContext(), Config.BUGLY_APPID, BuildConfig.DEBUG);
|
|
Bugly.init(getApplicationContext(), Config.BUGLY_APPID, BuildConfig.DEBUG);
|
|
|
}
|
|
}
|
|
|
AppUsageManager.getInstance().needOpenLookAppUsageStatsPermisson(true);//尝试保存应用使用情况的数据
|
|
AppUsageManager.getInstance().needOpenLookAppUsageStatsPermisson(true);//尝试保存应用使用情况的数据
|
|
|
- LogUtil.println("SheepApp onActivityCreated", mActivityCount);
|
|
|
|
|
- if (DataUtil.IS_LISTEN_SCREEN_SHOT) {
|
|
|
|
|
- manager = ScreenShotListenManager.newInstance(activity.getApplicationContext());
|
|
|
|
|
- manager.setListener(
|
|
|
|
|
- new ScreenShotListenManager.OnScreenShotListener() {
|
|
|
|
|
- public void onShot(String imagePath) {
|
|
|
|
|
- DataUtil.getInstance().addPng(imagePath);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- );
|
|
|
|
|
- manager.startListen();
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ LogUtil.println("SheepApp onActivityCreated", activity.getClass().getSimpleName(), mActivityCount);
|
|
|
UMConfigUtils.Event.SHEEP_CREATED.onEvent();
|
|
UMConfigUtils.Event.SHEEP_CREATED.onEvent();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -375,9 +364,12 @@ public class SheepApp extends MultiDexApplication {
|
|
|
if (mActivityCount > 0) {
|
|
if (mActivityCount > 0) {
|
|
|
if (!notStop) {
|
|
if (!notStop) {
|
|
|
notStop = true;
|
|
notStop = true;
|
|
|
- LogUtil.println("SheepApp onActivityStarted", mActivityCount);
|
|
|
|
|
|
|
+ LogUtil.println("SheepApp onActivityStarted", activity.getClass().getSimpleName(), mActivityCount);
|
|
|
UMConfigUtils.Event.SHEEP_STARTED.onEvent();
|
|
UMConfigUtils.Event.SHEEP_STARTED.onEvent();
|
|
|
startService(new Intent(activity, DownloadService.class));
|
|
startService(new Intent(activity, DownloadService.class));
|
|
|
|
|
+ if (DataUtil.IS_LISTEN_SCREEN_SHOT) {
|
|
|
|
|
+ startService(new Intent(activity, ListenerShotService.class));
|
|
|
|
|
+ }
|
|
|
Jump2View.getInstance().startFloat(activity, false);
|
|
Jump2View.getInstance().startFloat(activity, false);
|
|
|
Jump2View.getInstance().startShotScreenFloat(activity, false);
|
|
Jump2View.getInstance().startShotScreenFloat(activity, false);
|
|
|
}
|
|
}
|
|
@@ -399,7 +391,7 @@ public class SheepApp extends MultiDexApplication {
|
|
|
if (mActivityCount <= 0) {
|
|
if (mActivityCount <= 0) {
|
|
|
if (notStop) {
|
|
if (notStop) {
|
|
|
notStop = false;
|
|
notStop = false;
|
|
|
- LogUtil.println("SheepApp onActivityStopped", mActivityCount);
|
|
|
|
|
|
|
+ LogUtil.println("SheepApp onActivityStopped", activity.getClass().getSimpleName(), mActivityCount);
|
|
|
UMConfigUtils.Event.SHEEP_STOPPED.onEvent();
|
|
UMConfigUtils.Event.SHEEP_STOPPED.onEvent();
|
|
|
Jump2View.getInstance().startFloat(activity, true);
|
|
Jump2View.getInstance().startFloat(activity, true);
|
|
|
Jump2View.getInstance().startShotScreenFloat(activity, true);
|
|
Jump2View.getInstance().startShotScreenFloat(activity, true);
|
|
@@ -413,19 +405,19 @@ public class SheepApp extends MultiDexApplication {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void onActivityDestroyed(Activity activity) {
|
|
public void onActivityDestroyed(Activity activity) {
|
|
|
- Log.e("act_destroy_----", "in");
|
|
|
|
|
if (!TextUtils.isEmpty(gamePackgeName) && isGameFlag() && (activity instanceof GameCertificationActivity || activity instanceof LoginAct)) {
|
|
if (!TextUtils.isEmpty(gamePackgeName) && isGameFlag() && (activity instanceof GameCertificationActivity || activity instanceof LoginAct)) {
|
|
|
CertificationUtil.newInstance().doCertification(activity, gamePackgeName, "cancel");
|
|
CertificationUtil.newInstance().doCertification(activity, gamePackgeName, "cancel");
|
|
|
}
|
|
}
|
|
|
if (mActivityCount == 0) {
|
|
if (mActivityCount == 0) {
|
|
|
- LogUtil.println("SheepApp onActivityDestroyed", mActivityCount);
|
|
|
|
|
|
|
+ LogUtil.println("SheepApp onActivityDestroyed", activity.getClass().getSimpleName(), mActivityCount);
|
|
|
DataUtil.getInstance().resetIsNewSmallSheep();
|
|
DataUtil.getInstance().resetIsNewSmallSheep();
|
|
|
stopService(new Intent(SheepApp.this, DownloadService.class));
|
|
stopService(new Intent(SheepApp.this, DownloadService.class));
|
|
|
|
|
+// if (DataUtil.IS_LISTEN_SCREEN_SHOT) {
|
|
|
|
|
+// stopService(new Intent(activity, ListenerShotService.class));
|
|
|
|
|
+// }
|
|
|
stopService(new Intent(SheepApp.this, FloatService.class));
|
|
stopService(new Intent(SheepApp.this, FloatService.class));
|
|
|
if (DataUtil.IS_USE_SCREEN_SHOT)
|
|
if (DataUtil.IS_USE_SCREEN_SHOT)
|
|
|
stopService(new Intent(SheepApp.this, FloatShotScreenService.class));
|
|
stopService(new Intent(SheepApp.this, FloatShotScreenService.class));
|
|
|
- if (manager != null)
|
|
|
|
|
- manager.stopListen();
|
|
|
|
|
SpUtils.saveOrder("order", 1);
|
|
SpUtils.saveOrder("order", 1);
|
|
|
UMConfigUtils.Event.SHEEP_DESTROYED.onEvent();
|
|
UMConfigUtils.Event.SHEEP_DESTROYED.onEvent();
|
|
|
}
|
|
}
|
|
@@ -457,6 +449,7 @@ public class SheepApp extends MultiDexApplication {
|
|
|
super.onLowMemory();
|
|
super.onLowMemory();
|
|
|
/* 内存不足时让Glide清空内存缓存数据 */
|
|
/* 内存不足时让Glide清空内存缓存数据 */
|
|
|
Glide.get(this).clearMemory();
|
|
Glide.get(this).clearMemory();
|
|
|
|
|
+ LogUtil.println("SheepApp", "onLowMemory");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -466,6 +459,7 @@ public class SheepApp extends MultiDexApplication {
|
|
|
Glide.get(this).clearMemory();
|
|
Glide.get(this).clearMemory();
|
|
|
}
|
|
}
|
|
|
Glide.get(this).onTrimMemory(level);
|
|
Glide.get(this).onTrimMemory(level);
|
|
|
|
|
+ LogUtil.println("SheepApp", "onTrimMemory");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|