SW warn if exported configuration is missing
This commit is contained in:
parent
337a3d9776
commit
ff2cc04408
|
@ -11,13 +11,13 @@ import org.slf4j.LoggerFactory;
|
|||
public class SWButton extends SWItem {
|
||||
private static Logger log = LoggerFactory.getLogger(SWButton.class);
|
||||
|
||||
Runnable buttonRunnable;
|
||||
int buttonText;
|
||||
SWValidator buttonValidator;
|
||||
private Runnable buttonRunnable;
|
||||
private int buttonText;
|
||||
private SWValidator buttonValidator;
|
||||
|
||||
Button button;
|
||||
private Button button;
|
||||
|
||||
public SWButton() {
|
||||
SWButton() {
|
||||
super(Type.BUTTON);
|
||||
}
|
||||
|
||||
|
|
|
@ -74,6 +74,9 @@ public class SWDefinition {
|
|||
.text(R.string.nav_import)
|
||||
.action(() -> ImportExportPrefs.importSharedPreferences(getActivity()))
|
||||
.visibility(ImportExportPrefs.file::exists))
|
||||
.add(new SWInfotext()
|
||||
.label(R.string.backupismissing)
|
||||
.visibility(() -> !ImportExportPrefs.file.exists()))
|
||||
.add(new SWButton()
|
||||
.text(R.string.exitwizard)
|
||||
.action(() -> getActivity().finish()))
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
package info.nightscout.androidaps.startupwizard;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.Editable;
|
||||
import android.text.InputType;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
@ -17,21 +13,34 @@ public class SWInfotext extends SWItem {
|
|||
private static Logger log = LoggerFactory.getLogger(SWInfotext.class);
|
||||
private String textLabel = null;
|
||||
|
||||
public SWInfotext() {
|
||||
private TextView l;
|
||||
private SWValidator visibilityValidator;
|
||||
|
||||
SWInfotext() {
|
||||
super(Type.TEXT);
|
||||
}
|
||||
|
||||
public SWInfotext label(int label) {
|
||||
this.label = label;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SWInfotext label(String newLabel){
|
||||
this.textLabel = newLabel;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SWInfotext visibility(SWValidator visibilityValidator) {
|
||||
this.visibilityValidator = visibilityValidator;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateDialog(View view, LinearLayout layout) {
|
||||
Context context = view.getContext();
|
||||
|
||||
TextView l = new TextView(context);
|
||||
l.setId(view.generateViewId());
|
||||
l = new TextView(context);
|
||||
l.setId(View.generateViewId());
|
||||
if(textLabel != null)
|
||||
l.setText(textLabel);
|
||||
else
|
||||
|
@ -40,4 +49,11 @@ public class SWInfotext extends SWItem {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processVisibility() {
|
||||
if (visibilityValidator != null && !visibilityValidator.isValid())
|
||||
l.setVisibility(View.GONE);
|
||||
else
|
||||
l.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1059,15 +1059,16 @@
|
|||
<string name="wear_display_settings">Display Settings</string>
|
||||
<string name="wear_general_settings">General Settings</string>
|
||||
<string name="enable_nsclient">Enable NSClient</string>
|
||||
<string name="welcometosetupwizard">Welcome to setup wizard. It will guide you through the setup process</string>
|
||||
<string name="welcometosetupwizard">Welcome to setup wizard. It will guide you through the setup process\n</string>
|
||||
<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">Skip setup wizard</string>
|
||||
<string name="setupwizard_bgsource_description">Where should blood glucose(BG) data be comming from ?</string>
|
||||
<string name="setupwizard_loop_description">Press the button below to enable AndroidAPS to suggest/make basal changes</string>
|
||||
<string name="setupwizard_objectives_description">Press the button below to enable Objectives. Look in the Objectives tab, after you finish this wizard, to make AndroidAPS completely functional.</string>
|
||||
<string name="setupwizard_bgsource_description">Where should blood glucose(BG) data be comming from ?\n</string>
|
||||
<string name="setupwizard_loop_description">Press the button below to enable AndroidAPS to suggest/make basal changes\n</string>
|
||||
<string name="setupwizard_objectives_description">Press the button below to enable Objectives. Look in the Objectives tab, after you finish this wizard, to make AndroidAPS completely functional.\n</string>
|
||||
<string name="enableobjectives">Enable Objectives</string>
|
||||
<string name="apssetup">Configure APS plugin</string>
|
||||
<string name="backupismissing">Exported configuration is missing thus import configuration is not possible.\n</string>
|
||||
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue