Add FeatureRunning event triggered by activities
This commit is contained in:
parent
d3bf4fd026
commit
448ebbc7bf
3 changed files with 40 additions and 3 deletions
|
@ -35,9 +35,9 @@ import com.squareup.otto.Subscribe;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import info.nightscout.androidaps.Services.AlarmSoundService;
|
|
||||||
import info.nightscout.androidaps.data.Profile;
|
import info.nightscout.androidaps.data.Profile;
|
||||||
import info.nightscout.androidaps.events.EventAppExit;
|
import info.nightscout.androidaps.events.EventAppExit;
|
||||||
|
import info.nightscout.androidaps.events.EventFeatureRunning;
|
||||||
import info.nightscout.androidaps.events.EventPreferenceChange;
|
import info.nightscout.androidaps.events.EventPreferenceChange;
|
||||||
import info.nightscout.androidaps.events.EventRefreshGui;
|
import info.nightscout.androidaps.events.EventRefreshGui;
|
||||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||||
|
@ -209,6 +209,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
|
||||||
super.onResume();
|
super.onResume();
|
||||||
askForSMSPermissions();
|
askForSMSPermissions();
|
||||||
askForLocationPermissions();
|
askForLocationPermissions();
|
||||||
|
MainApp.bus().post(new EventFeatureRunning(EventFeatureRunning.Feature.MAIN));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
package info.nightscout.androidaps.events;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by jamorham on 07/02/2018.
|
||||||
|
*
|
||||||
|
* Event to indicate that an app feature is being used, for example bolus wizard being opened
|
||||||
|
*
|
||||||
|
* The purpose this has been created for is to enable opportunistic connection to the pump
|
||||||
|
* so that it is already connected before the user wishes to enact a pump function
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class EventFeatureRunning extends Event {
|
||||||
|
|
||||||
|
private Feature feature = Feature.UNKNOWN;
|
||||||
|
|
||||||
|
public EventFeatureRunning() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public EventFeatureRunning(Feature feature) {
|
||||||
|
this.feature = feature;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Feature getFeature() {
|
||||||
|
return feature;
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum Feature {
|
||||||
|
UNKNOWN,
|
||||||
|
MAIN,
|
||||||
|
WIZARD,
|
||||||
|
|
||||||
|
JUST_ADD_MORE_HERE
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -50,6 +50,7 @@ import info.nightscout.androidaps.db.CareportalEvent;
|
||||||
import info.nightscout.androidaps.db.DatabaseHelper;
|
import info.nightscout.androidaps.db.DatabaseHelper;
|
||||||
import info.nightscout.androidaps.db.Source;
|
import info.nightscout.androidaps.db.Source;
|
||||||
import info.nightscout.androidaps.db.TempTarget;
|
import info.nightscout.androidaps.db.TempTarget;
|
||||||
|
import info.nightscout.androidaps.events.EventFeatureRunning;
|
||||||
import info.nightscout.androidaps.events.EventNewBG;
|
import info.nightscout.androidaps.events.EventNewBG;
|
||||||
import info.nightscout.androidaps.events.EventRefreshOverview;
|
import info.nightscout.androidaps.events.EventRefreshOverview;
|
||||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||||
|
@ -57,8 +58,6 @@ import info.nightscout.androidaps.plugins.IobCobCalculator.AutosensData;
|
||||||
import info.nightscout.androidaps.plugins.IobCobCalculator.IobCobCalculatorPlugin;
|
import info.nightscout.androidaps.plugins.IobCobCalculator.IobCobCalculatorPlugin;
|
||||||
import info.nightscout.androidaps.plugins.IobCobCalculator.events.EventAutosensCalculationFinished;
|
import info.nightscout.androidaps.plugins.IobCobCalculator.events.EventAutosensCalculationFinished;
|
||||||
import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
|
import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
|
||||||
import info.nightscout.androidaps.plugins.OpenAPSAMA.OpenAPSAMAPlugin;
|
|
||||||
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateGui;
|
|
||||||
import info.nightscout.androidaps.queue.Callback;
|
import info.nightscout.androidaps.queue.Callback;
|
||||||
import info.nightscout.utils.BolusWizard;
|
import info.nightscout.utils.BolusWizard;
|
||||||
import info.nightscout.utils.DateUtil;
|
import info.nightscout.utils.DateUtil;
|
||||||
|
@ -132,6 +131,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
MainApp.bus().register(this);
|
MainApp.bus().register(this);
|
||||||
|
MainApp.bus().post(new EventFeatureRunning(EventFeatureRunning.Feature.WIZARD));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue