diff --git a/appbase/build.properties b/appbase/build.properties index 414130f..737a4cd 100644 --- a/appbase/build.properties +++ b/appbase/build.properties @@ -1,8 +1,8 @@ #Created by .winboll/winboll_app_build.gradle -#Mon Feb 17 03:42:39 GMT 2025 +#Mon Feb 17 04:04:01 GMT 2025 stageCount=2 libraryProject=libappbase baseVersion=1.5 publishVersion=1.5.1 -buildCount=185 +buildCount=190 baseBetaVersion=1.5.2 diff --git a/appbase/src/main/java/cc/winboll/studio/appbase/MyTileService.java b/appbase/src/main/java/cc/winboll/studio/appbase/MyTileService.java index 407a73a..ab3b255 100644 --- a/appbase/src/main/java/cc/winboll/studio/appbase/MyTileService.java +++ b/appbase/src/main/java/cc/winboll/studio/appbase/MyTileService.java @@ -42,19 +42,22 @@ public class MyTileService extends TileService { @Override public void onClick() { super.onClick(); + Tile tile = getQsTile(); MainServiceBean bean = MainServiceBean.loadBean(this, MainServiceBean.class); if (bean == null) { bean = new MainServiceBean(); + } + + if (tile.getState() == Tile.STATE_ACTIVE) { + bean.setIsEnable(false); + MainServiceBean.saveBean(this, bean); + MainService.stopMainService(this); + } else if (tile.getState() == Tile.STATE_INACTIVE) { bean.setIsEnable(true); MainServiceBean.saveBean(this, bean); MainService.startMainService(this); - } else { - if (bean.isEnable()) { - MainService.stopMainService(this); - } else { - MainService.startMainService(this); - } } + updateServiceIconStatus(this); } public static void updateServiceIconStatus(Context context) { diff --git a/appbase/src/main/java/cc/winboll/studio/appbase/services/MainService.java b/appbase/src/main/java/cc/winboll/studio/appbase/services/MainService.java index 848443d..17d8791 100644 --- a/appbase/src/main/java/cc/winboll/studio/appbase/services/MainService.java +++ b/appbase/src/main/java/cc/winboll/studio/appbase/services/MainService.java @@ -17,13 +17,14 @@ import android.content.Intent; import android.content.ServiceConnection; import android.os.Binder; import android.os.IBinder; +import cc.winboll.studio.appbase.MyTileService; import cc.winboll.studio.appbase.beans.MainServiceBean; import cc.winboll.studio.appbase.handlers.MainServiceHandler; import cc.winboll.studio.appbase.receivers.MainReceiver; import cc.winboll.studio.appbase.services.AssistantService; import cc.winboll.studio.appbase.threads.MainServiceThread; import cc.winboll.studio.libappbase.LogUtils; -import cc.winboll.studio.appbase.MyTileService; +import cc.winboll.studio.libappbase.widgets.APPSOSReportWidget; public class MainService extends Service { @@ -93,6 +94,12 @@ public class MainService extends Service { mMainReceiver = new MainReceiver(this); mMainReceiver.registerAction(this); } + + // 启动小部件 + Intent intentTimeWidget = new Intent(this, APPSOSReportWidget.class); + intentTimeWidget.setAction(APPSOSReportWidget.ACTION_RELOAD_SOS_REPORT); + this.sendBroadcast(intentTimeWidget); + startMainServiceThread(); MyTileService.updateServiceIconStatus(this); diff --git a/appbase/src/main/java/cc/winboll/studio/appbase/threads/MainServiceThread.java b/appbase/src/main/java/cc/winboll/studio/appbase/threads/MainServiceThread.java index 14e94d2..25d7231 100644 --- a/appbase/src/main/java/cc/winboll/studio/appbase/threads/MainServiceThread.java +++ b/appbase/src/main/java/cc/winboll/studio/appbase/threads/MainServiceThread.java @@ -5,10 +5,8 @@ package cc.winboll.studio.appbase.threads; * @Date 2025/02/14 03:46:44 */ import android.content.Context; -import android.content.Intent; import cc.winboll.studio.appbase.handlers.MainServiceHandler; import cc.winboll.studio.libappbase.LogUtils; -import cc.winboll.studio.libappbase.widgets.APPSOSReportWidget; import java.lang.ref.WeakReference; public class MainServiceThread extends Thread { @@ -42,11 +40,7 @@ public class MainServiceThread extends Thread { while (!isExist()) { //ToastUtils.show("run()"); - LogUtils.d(TAG, "run()"); - Intent intentTimeWidget = new Intent(mContext, APPSOSReportWidget.class); - intentTimeWidget.setAction(APPSOSReportWidget.ACTION_ADD_SOS_REPORT); - intentTimeWidget.putExtra("appName", "TestName"); - mContext.sendBroadcast(intentTimeWidget); + //LogUtils.d(TAG, "run()"); try { Thread.sleep(1000); diff --git a/libappbase/build.properties b/libappbase/build.properties index 414130f..737a4cd 100644 --- a/libappbase/build.properties +++ b/libappbase/build.properties @@ -1,8 +1,8 @@ #Created by .winboll/winboll_app_build.gradle -#Mon Feb 17 03:42:39 GMT 2025 +#Mon Feb 17 04:04:01 GMT 2025 stageCount=2 libraryProject=libappbase baseVersion=1.5 publishVersion=1.5.1 -buildCount=185 +buildCount=190 baseBetaVersion=1.5.2