重构磁贴状态更新方法
This commit is contained in:
parent
0d3d691d8a
commit
dabd1271fd
@ -1,8 +1,8 @@
|
|||||||
#Created by .winboll/winboll_app_build.gradle
|
#Created by .winboll/winboll_app_build.gradle
|
||||||
#Tue Apr 15 09:08:44 GMT 2025
|
#Tue Apr 15 09:22:19 GMT 2025
|
||||||
stageCount=1
|
stageCount=1
|
||||||
libraryProject=
|
libraryProject=
|
||||||
baseVersion=15.2
|
baseVersion=15.2
|
||||||
publishVersion=15.2.0
|
publishVersion=15.2.0
|
||||||
buildCount=40
|
buildCount=54
|
||||||
baseBetaVersion=15.2.1
|
baseBetaVersion=15.2.1
|
||||||
|
@ -17,53 +17,27 @@ public class AppBaseTileService extends TileService {
|
|||||||
public void onStartListening() {
|
public void onStartListening() {
|
||||||
super.onStartListening();
|
super.onStartListening();
|
||||||
Tile tile = getQsTile();
|
Tile tile = getQsTile();
|
||||||
|
|
||||||
if (AppConfigs.getInstance(AppBaseTileService.this).isEnableService()) {
|
|
||||||
tile.setState(Tile.STATE_ACTIVE);
|
|
||||||
tile.setIcon(android.graphics.drawable.Icon.createWithResource(this, R.drawable.ic_android));
|
tile.setIcon(android.graphics.drawable.Icon.createWithResource(this, R.drawable.ic_android));
|
||||||
} else {
|
// 更新磁贴状态
|
||||||
tile.setState(Tile.STATE_INACTIVE);
|
tile.setState(AppConfigs.getInstance(getApplicationContext()).isEnableService()?Tile.STATE_ACTIVE: Tile.STATE_INACTIVE);
|
||||||
tile.setIcon(android.graphics.drawable.Icon.createWithResource(this, R.drawable.ic_android));
|
|
||||||
}
|
|
||||||
tile.updateTile();
|
tile.updateTile();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick() {
|
public void onClick() {
|
||||||
super.onClick();
|
super.onClick();
|
||||||
Tile tile = getQsTile();
|
// Tile tile = getQsTile();
|
||||||
|
|
||||||
if (tile.getState() == Tile.STATE_ACTIVE) {
|
|
||||||
AppConfigs.getInstance(AppBaseTileService.this).setIsEnableService(false);
|
|
||||||
AppConfigs.getInstance(AppBaseTileService.this).saveAppConfigs();
|
|
||||||
MainActivity.stopMainService();
|
|
||||||
} else if (tile.getState() == Tile.STATE_INACTIVE) {
|
|
||||||
AppConfigs.getInstance(AppBaseTileService.this).setIsEnableService(true);
|
|
||||||
AppConfigs.getInstance(AppBaseTileService.this).saveAppConfigs();
|
|
||||||
MainActivity.startMainService();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 更新磁贴状态
|
|
||||||
//updateServiceIconStatus(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// 更新磁贴状态
|
// if (tile.getState() == Tile.STATE_ACTIVE) {
|
||||||
//
|
|
||||||
// public static void updateServiceIconStatus(Context context) {
|
|
||||||
// if (_AppBaseTileService == null) {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// Tile tile = _AppBaseTileService.getQsTile();
|
|
||||||
// MainServiceBean bean = MainServiceBean.loadBean(context, MainServiceBean.class);
|
|
||||||
// if (bean != null && bean.isEnable()) {
|
|
||||||
// tile.setState(Tile.STATE_ACTIVE);
|
|
||||||
// tile.setIcon(android.graphics.drawable.Icon.createWithResource(context, R.drawable.ic_cloud));
|
|
||||||
// } else {
|
|
||||||
// tile.setState(Tile.STATE_INACTIVE);
|
// tile.setState(Tile.STATE_INACTIVE);
|
||||||
// tile.setIcon(android.graphics.drawable.Icon.createWithResource(context, R.drawable.ic_cloud_outline));
|
// AppConfigs.getInstance(AppBaseTileService.this).setIsEnableService(false);
|
||||||
// }
|
// AppConfigs.getInstance(AppBaseTileService.this).saveAppConfigs();
|
||||||
// tile.updateTile();
|
// MainActivity.stopMainService();
|
||||||
|
// } else if (tile.getState() == Tile.STATE_INACTIVE) {
|
||||||
|
// tile.setState(Tile.STATE_ACTIVE);
|
||||||
|
// AppConfigs.getInstance(AppBaseTileService.this).setIsEnableService(true);
|
||||||
|
// AppConfigs.getInstance(AppBaseTileService.this).saveAppConfigs();
|
||||||
|
// MainActivity.startMainService();
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user