SW profile switch
This commit is contained in:
parent
1ba828d20a
commit
fb7067b207
|
@ -18,6 +18,9 @@ import info.nightscout.androidaps.events.EventConfigBuilderChange;
|
|||
import info.nightscout.androidaps.events.EventPumpStatusChanged;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.interfaces.PluginType;
|
||||
import info.nightscout.androidaps.plugins.Careportal.CareportalFragment;
|
||||
import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialog;
|
||||
import info.nightscout.androidaps.plugins.Careportal.OptionsToShow;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderFragment;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.NSClientPlugin;
|
||||
|
@ -151,6 +154,22 @@ public class SWDefinition {
|
|||
.validator(() -> SimpleProfilePlugin.getPlugin().getProfile() != null && SimpleProfilePlugin.getPlugin().getProfile().getDefaultProfile().isValid("StartupWizard"))
|
||||
.visibility(() -> SimpleProfilePlugin.getPlugin().isEnabled(PluginType.PROFILE))
|
||||
)
|
||||
.add(new SWScreen(R.string.profileswitch)
|
||||
.skippable(false)
|
||||
.add(new SWInfotext()
|
||||
.label(R.string.profileswitch_ismissing))
|
||||
.add(new SWButton()
|
||||
.text(R.string.profileswitch)
|
||||
.action(() -> {
|
||||
NewNSTreatmentDialog newDialog = new NewNSTreatmentDialog();
|
||||
final OptionsToShow profileswitch = CareportalFragment.PROFILESWITCHDIRECT;
|
||||
profileswitch.executeProfileSwitch = true;
|
||||
newDialog.setOptions(profileswitch, R.string.careportal_profileswitch);
|
||||
newDialog.show(getActivity().getSupportFragmentManager(), "NewNSTreatmentDialog");
|
||||
}))
|
||||
.validator(() -> MainApp.getConfigBuilder().getProfile() != null)
|
||||
.visibility(() -> MainApp.getConfigBuilder().getProfile() == null)
|
||||
)
|
||||
.add(new SWScreen(R.string.configbuilder_pump)
|
||||
.skippable(false)
|
||||
.add(new SWPlugin()
|
||||
|
|
|
@ -1,29 +1,25 @@
|
|||
package info.nightscout.androidaps.startupwizard;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
|
||||
|
||||
|
||||
public class SWFragment extends SWItem {
|
||||
private static Logger log = LoggerFactory.getLogger(SWFragment.class);
|
||||
|
||||
SWDefinition definition;
|
||||
SubscriberFragment fragment;
|
||||
Fragment fragment;
|
||||
|
||||
public SWFragment(SWDefinition definition) {
|
||||
super(Type.FRAGMENT);
|
||||
this.definition = definition;
|
||||
}
|
||||
|
||||
public SWFragment add(SubscriberFragment fragment) {
|
||||
public SWFragment add(Fragment fragment) {
|
||||
this.fragment = fragment;
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ import info.nightscout.androidaps.events.EventPumpStatusChanged;
|
|||
import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientStatus;
|
||||
import info.nightscout.androidaps.startupwizard.events.EventSWUpdate;
|
||||
import info.nightscout.utils.LocaleHelper;
|
||||
import info.nightscout.utils.OKDialog;
|
||||
|
||||
public class SetupWizardActivity extends AppCompatActivity {
|
||||
//logging
|
||||
|
@ -54,6 +55,11 @@ public class SetupWizardActivity extends AppCompatActivity {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
OKDialog.showConfirmation(this, MainApp.gs(R.string.exitwizard), this::finish);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
|
|
|
@ -1062,5 +1062,6 @@
|
|||
<string name="pumpsetup">Pump setup</string>
|
||||
<string name="readstatus">Read status</string>
|
||||
<string name="adjustprofileinns">Changes must be done in NS</string>
|
||||
<string name="exitwizard">Exit setup wizard?</string>
|
||||
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue