Merge remote-tracking branch 'origin/dev' into combo-scripter-v2
* origin/dev: Cancel ongoing notification when plugin is disabled. Fix typo in fragment name. Nitpicky symmetry. PersistentNotification unregister workaround. Make PumpEnactResult fluent. Minor code cleanup. # Conflicts: # app/src/main/java/info/nightscout/androidaps/data/PumpEnactResult.java # app/src/main/java/info/nightscout/androidaps/plugins/Persistentnotification/PersistentNotificationPlugin.java
This commit is contained in:
commit
1a8c0fcf52
|
@ -95,25 +95,28 @@ public class PersistentNotificationPlugin implements PluginBase {
|
|||
|
||||
@Override
|
||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
||||
|
||||
if (getType() == type) {
|
||||
this.fragmentEnabled = fragmentEnabled;
|
||||
enableDisableNotification(fragmentEnabled);
|
||||
checkBusRegistration();
|
||||
//updateNotification();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void updateNotification() {
|
||||
|
||||
private void enableDisableNotification(boolean fragmentEnabled) {
|
||||
if (!fragmentEnabled) {
|
||||
NotificationManager mNotificationManager =
|
||||
(NotificationManager) ctx.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
mNotificationManager.cancel(ONGOING_NOTIFICATION_ID);
|
||||
} else {
|
||||
updateNotification();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateNotification() {
|
||||
if (!fragmentEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
String line1 = ctx.getString(R.string.noprofile);
|
||||
|
||||
if (MainApp.getConfigBuilder().getActiveProfileInterface() == null || MainApp.getConfigBuilder().getProfile() == null)
|
||||
|
@ -194,11 +197,13 @@ public class PersistentNotificationPlugin implements PluginBase {
|
|||
try {
|
||||
MainApp.bus().register(this);
|
||||
} catch (IllegalArgumentException e) {
|
||||
// already registered
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
MainApp.bus().unregister(this);
|
||||
} catch (IllegalArgumentException e) {
|
||||
// already unregistered
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ public class VirtualPumpFragment extends SubscriberFragment {
|
|||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
try {
|
||||
View view = inflater.inflate(R.layout.vitualpump_fragment, container, false);
|
||||
View view = inflater.inflate(R.layout.virtualpump_fragment, container, false);
|
||||
basaBasalRateView = (TextView) view.findViewById(R.id.virtualpump_basabasalrate);
|
||||
tempBasalView = (TextView) view.findViewById(R.id.virtualpump_tempbasal);
|
||||
extendedBolusView = (TextView) view.findViewById(R.id.virtualpump_extendedbolus);
|
||||
|
|
Loading…
Reference in a new issue