Cancel ongoing notification when plugin is disabled.
This commit is contained in:
parent
62527ab33b
commit
e28e5685f6
1 changed files with 9 additions and 6 deletions
|
@ -95,25 +95,28 @@ public class PersistentNotificationPlugin implements PluginBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
||||||
|
|
||||||
if (getType() == type) {
|
if (getType() == type) {
|
||||||
this.fragmentEnabled = fragmentEnabled;
|
this.fragmentEnabled = fragmentEnabled;
|
||||||
|
enableDisableNotification(fragmentEnabled);
|
||||||
checkBusRegistration();
|
checkBusRegistration();
|
||||||
//updateNotification();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateNotification() {
|
private void enableDisableNotification(boolean fragmentEnabled) {
|
||||||
|
|
||||||
if (!fragmentEnabled) {
|
if (!fragmentEnabled) {
|
||||||
NotificationManager mNotificationManager =
|
NotificationManager mNotificationManager =
|
||||||
(NotificationManager) ctx.getSystemService(Context.NOTIFICATION_SERVICE);
|
(NotificationManager) ctx.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||||
mNotificationManager.cancel(ONGOING_NOTIFICATION_ID);
|
mNotificationManager.cancel(ONGOING_NOTIFICATION_ID);
|
||||||
|
} else {
|
||||||
|
updateNotification();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateNotification() {
|
||||||
|
if (!fragmentEnabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
String line1 = ctx.getString(R.string.noprofile);
|
String line1 = ctx.getString(R.string.noprofile);
|
||||||
|
|
||||||
if (MainApp.getConfigBuilder().getActiveProfileInterface() == null || MainApp.getConfigBuilder().getProfile() == null)
|
if (MainApp.getConfigBuilder().getActiveProfileInterface() == null || MainApp.getConfigBuilder().getProfile() == null)
|
||||||
|
|
Loading…
Reference in a new issue