添加用磁贴启动小部件功能
This commit is contained in:
parent
26cdacf1c6
commit
83ab4f9417
@ -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
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user