Merge remote-tracking branch 'milosremote/dev' into wear-bolus5
This commit is contained in:
commit
d74ea13937
|
@ -44,7 +44,7 @@ android {
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 23
|
targetSdkVersion 23
|
||||||
versionCode 1100
|
versionCode 1100
|
||||||
versionName "1.1e"
|
versionName "1.1g"
|
||||||
buildConfigField "String", "BUILDVERSION", generateGitBuild()
|
buildConfigField "String", "BUILDVERSION", generateGitBuild()
|
||||||
}
|
}
|
||||||
lintOptions {
|
lintOptions {
|
||||||
|
|
|
@ -49,4 +49,7 @@ public class Constants {
|
||||||
public static final int[] VERY_HARD_LIMIT_TEMP_MIN_BG = {72,180};
|
public static final int[] VERY_HARD_LIMIT_TEMP_MIN_BG = {72,180};
|
||||||
public static final int[] VERY_HARD_LIMIT_TEMP_MAX_BG = {72,270};
|
public static final int[] VERY_HARD_LIMIT_TEMP_MAX_BG = {72,270};
|
||||||
public static final int[] VERY_HARD_LIMIT_TEMP_TARGET_BG = {72,200};
|
public static final int[] VERY_HARD_LIMIT_TEMP_TARGET_BG = {72,200};
|
||||||
|
|
||||||
|
//DanaR
|
||||||
|
public static final double dailyLimitWarning = 0.95d;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,7 @@ import info.nightscout.androidaps.tabs.TabPageAdapter;
|
||||||
import info.nightscout.utils.LogDialog;
|
import info.nightscout.utils.LogDialog;
|
||||||
import info.nightscout.utils.ImportExportPrefs;
|
import info.nightscout.utils.ImportExportPrefs;
|
||||||
import info.nightscout.utils.LocaleHelper;
|
import info.nightscout.utils.LocaleHelper;
|
||||||
|
import info.nightscout.utils.PasswordProtection;
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity {
|
public class MainActivity extends AppCompatActivity {
|
||||||
private static Logger log = LoggerFactory.getLogger(MainActivity.class);
|
private static Logger log = LoggerFactory.getLogger(MainActivity.class);
|
||||||
|
@ -125,8 +126,13 @@ public class MainActivity extends AppCompatActivity {
|
||||||
int id = item.getItemId();
|
int id = item.getItemId();
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case R.id.nav_preferences:
|
case R.id.nav_preferences:
|
||||||
|
PasswordProtection.QueryPassword(this, R.string.settings_password, "settings_password", new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
Intent i = new Intent(getApplicationContext(), PreferencesActivity.class);
|
Intent i = new Intent(getApplicationContext(), PreferencesActivity.class);
|
||||||
startActivity(i);
|
startActivity(i);
|
||||||
|
}
|
||||||
|
}, null);
|
||||||
break;
|
break;
|
||||||
case R.id.nav_resetdb:
|
case R.id.nav_resetdb:
|
||||||
new AlertDialog.Builder(this)
|
new AlertDialog.Builder(this)
|
||||||
|
|
|
@ -19,6 +19,7 @@ import info.nightscout.androidaps.plugins.DanaR.BluetoothDevicePreference;
|
||||||
import info.nightscout.androidaps.plugins.DanaR.DanaRPlugin;
|
import info.nightscout.androidaps.plugins.DanaR.DanaRPlugin;
|
||||||
import info.nightscout.androidaps.plugins.DanaRKorean.DanaRKoreanPlugin;
|
import info.nightscout.androidaps.plugins.DanaRKorean.DanaRKoreanPlugin;
|
||||||
import info.nightscout.androidaps.plugins.OpenAPSAMA.OpenAPSAMAPlugin;
|
import info.nightscout.androidaps.plugins.OpenAPSAMA.OpenAPSAMAPlugin;
|
||||||
|
import info.nightscout.androidaps.plugins.VirtualPump.VirtualPumpPlugin;
|
||||||
import info.nightscout.utils.LocaleHelper;
|
import info.nightscout.utils.LocaleHelper;
|
||||||
|
|
||||||
public class PreferencesActivity extends PreferenceActivity implements SharedPreferences.OnSharedPreferenceChangeListener {
|
public class PreferencesActivity extends PreferenceActivity implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||||
|
@ -54,7 +55,7 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
|
||||||
}
|
}
|
||||||
if (pref instanceof EditTextPreference) {
|
if (pref instanceof EditTextPreference) {
|
||||||
EditTextPreference editTextPref = (EditTextPreference) pref;
|
EditTextPreference editTextPref = (EditTextPreference) pref;
|
||||||
if (pref.getKey().contains("danar_password")) {
|
if (pref.getKey().contains("password")) {
|
||||||
pref.setSummary("******");
|
pref.setSummary("******");
|
||||||
} else if (editTextPref.getText() != null && !editTextPref.getText().equals("")) {
|
} else if (editTextPref.getText() != null && !editTextPref.getText().equals("")) {
|
||||||
((EditTextPreference) pref).setDialogMessage(editTextPref.getDialogMessage());
|
((EditTextPreference) pref).setDialogMessage(editTextPref.getDialogMessage());
|
||||||
|
@ -82,6 +83,7 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(final Bundle savedInstanceState) {
|
public void onCreate(final Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
addPreferencesFromResource(R.xml.pref_password);
|
||||||
addPreferencesFromResource(R.xml.pref_quickwizard);
|
addPreferencesFromResource(R.xml.pref_quickwizard);
|
||||||
addPreferencesFromResource(R.xml.pref_language);
|
addPreferencesFromResource(R.xml.pref_language);
|
||||||
if (Config.CAREPORTALENABLED)
|
if (Config.CAREPORTALENABLED)
|
||||||
|
@ -104,6 +106,10 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
|
||||||
addPreferencesFromResource(R.xml.pref_danarprofile);
|
addPreferencesFromResource(R.xml.pref_danarprofile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
VirtualPumpPlugin virtualPumpPlugin = (VirtualPumpPlugin) MainApp.getSpecificPlugin(VirtualPumpPlugin.class);
|
||||||
|
if (virtualPumpPlugin != null && virtualPumpPlugin.isEnabled(PluginBase.PUMP)) {
|
||||||
|
addPreferencesFromResource(R.xml.pref_virtualpump);
|
||||||
|
}
|
||||||
if (Config.SMSCOMMUNICATORENABLED)
|
if (Config.SMSCOMMUNICATORENABLED)
|
||||||
addPreferencesFromResource(R.xml.pref_smscommunicator);
|
addPreferencesFromResource(R.xml.pref_smscommunicator);
|
||||||
addPreferencesFromResource(R.xml.pref_others);
|
addPreferencesFromResource(R.xml.pref_others);
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class MealData {
|
||||||
List<BgReading> bgReadings = MainApp.getDbHelper().getBgreadingsDataFromTime((long) (new Date().getTime() - 60 * 60 * 1000L * profile.getDia() * 2), false);
|
List<BgReading> bgReadings = MainApp.getDbHelper().getBgreadingsDataFromTime((long) (new Date().getTime() - 60 * 60 * 1000L * profile.getDia() * 2), false);
|
||||||
|
|
||||||
long now = new Date().getTime();
|
long now = new Date().getTime();
|
||||||
long dia_ago = now - (new Double(profile.getDia() * 60 * 60 * 1000l)).longValue();
|
long dia_ago = now - (new Double(1.5d * profile.getDia() * 60 * 60 * 1000l)).longValue();
|
||||||
long t = treatment.created_at.getTime();
|
long t = treatment.created_at.getTime();
|
||||||
if (t > dia_ago && t <= now) {
|
if (t > dia_ago && t <= now) {
|
||||||
if (treatment.carbs >= 1) {
|
if (treatment.carbs >= 1) {
|
||||||
|
|
|
@ -230,6 +230,16 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
scheduleTreatmentChange();
|
scheduleTreatmentChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void delete(Treatment treatment) {
|
||||||
|
try {
|
||||||
|
getDaoTreatments().delete(treatment);
|
||||||
|
latestTreatmentChange = treatment.getTimeIndex();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
scheduleTreatmentChange();
|
||||||
|
}
|
||||||
|
|
||||||
public int delete(String _id) {
|
public int delete(String _id) {
|
||||||
Treatment stored = findTreatmentById(_id);
|
Treatment stored = findTreatmentById(_id);
|
||||||
int removed = 0;
|
int removed = 0;
|
||||||
|
|
|
@ -17,6 +17,8 @@ import info.nightscout.client.data.NSProfile;
|
||||||
public interface PumpInterface {
|
public interface PumpInterface {
|
||||||
|
|
||||||
boolean isInitialized();
|
boolean isInitialized();
|
||||||
|
boolean isSuspended();
|
||||||
|
boolean isBusy();
|
||||||
|
|
||||||
boolean isTempBasalInProgress();
|
boolean isTempBasalInProgress();
|
||||||
boolean isExtendedBoluslInProgress();
|
boolean isExtendedBoluslInProgress();
|
||||||
|
|
|
@ -94,19 +94,19 @@ public class ActionsFragment extends Fragment implements FragmentBase, View.OnCl
|
||||||
activity.runOnUiThread(new Runnable() {
|
activity.runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (!MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable || !MainApp.getConfigBuilder().isInitialized())
|
if (!MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable || !MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended())
|
||||||
profileSwitch.setVisibility(View.GONE);
|
profileSwitch.setVisibility(View.GONE);
|
||||||
else
|
else
|
||||||
profileSwitch.setVisibility(View.VISIBLE);
|
profileSwitch.setVisibility(View.VISIBLE);
|
||||||
if (!MainApp.getConfigBuilder().getPumpDescription().isExtendedBolusCapable || !MainApp.getConfigBuilder().isInitialized())
|
if (!MainApp.getConfigBuilder().getPumpDescription().isExtendedBolusCapable || !MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended())
|
||||||
extendedBolus.setVisibility(View.GONE);
|
extendedBolus.setVisibility(View.GONE);
|
||||||
else
|
else
|
||||||
extendedBolus.setVisibility(View.VISIBLE);
|
extendedBolus.setVisibility(View.VISIBLE);
|
||||||
if (!MainApp.getConfigBuilder().getPumpDescription().isTempBasalCapable || !MainApp.getConfigBuilder().isInitialized())
|
if (!MainApp.getConfigBuilder().getPumpDescription().isTempBasalCapable || !MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended())
|
||||||
tempBasal.setVisibility(View.GONE);
|
tempBasal.setVisibility(View.GONE);
|
||||||
else
|
else
|
||||||
tempBasal.setVisibility(View.VISIBLE);
|
tempBasal.setVisibility(View.VISIBLE);
|
||||||
if (!MainApp.getConfigBuilder().getPumpDescription().isRefillingCapable || !MainApp.getConfigBuilder().isInitialized())
|
if (!MainApp.getConfigBuilder().getPumpDescription().isRefillingCapable || !MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended())
|
||||||
fill.setVisibility(View.GONE);
|
fill.setVisibility(View.GONE);
|
||||||
else
|
else
|
||||||
fill.setVisibility(View.VISIBLE);
|
fill.setVisibility(View.VISIBLE);
|
||||||
|
|
|
@ -13,11 +13,13 @@ import android.support.v4.app.FragmentActivity;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
|
import android.text.format.DateFormat;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
|
import android.widget.CompoundButton;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.RadioButton;
|
import android.widget.RadioButton;
|
||||||
|
@ -44,6 +46,7 @@ import java.util.Date;
|
||||||
import info.nightscout.androidaps.Constants;
|
import info.nightscout.androidaps.Constants;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
|
import info.nightscout.androidaps.data.GlucoseStatus;
|
||||||
import info.nightscout.androidaps.db.TempTarget;
|
import info.nightscout.androidaps.db.TempTarget;
|
||||||
import info.nightscout.androidaps.events.EventNewBasalProfile;
|
import info.nightscout.androidaps.events.EventNewBasalProfile;
|
||||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
|
@ -264,10 +267,32 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
|
||||||
// meterRadioButton.setChecked(true);
|
// meterRadioButton.setChecked(true);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if (units.equals(Constants.MMOL))
|
Double bg = NSProfile.fromMgdlToUnits(GlucoseStatus.getGlucoseStatusData() != null ? GlucoseStatus.getGlucoseStatusData().glucose : 0d, profile != null ? profile.getUnits() : Constants.MGDL);
|
||||||
editBg = new PlusMinusEditText(view, R.id.careportal_newnstreatment_bginput, R.id.careportal_newnstreatment_bg_plus, R.id.careportal_newnstreatment_bg_minus, 0d, 0d, 40d, 0.1d, new DecimalFormat("0.0"), false);
|
if (profile == null)
|
||||||
|
editBg = new PlusMinusEditText(view, R.id.careportal_newnstreatment_bginput, R.id.careportal_newnstreatment_bg_plus, R.id.careportal_newnstreatment_bg_minus, bg, 0d, 500d, 0.1d, new DecimalFormat("0.0"), false);
|
||||||
|
else if (profile.getUnits().equals(Constants.MMOL))
|
||||||
|
editBg = new PlusMinusEditText(view, R.id.careportal_newnstreatment_bginput, R.id.careportal_newnstreatment_bg_plus, R.id.careportal_newnstreatment_bg_minus, bg, 0d, 30d, 0.1d, new DecimalFormat("0.0"), false);
|
||||||
else
|
else
|
||||||
editBg = new PlusMinusEditText(view, R.id.careportal_newnstreatment_bginput, R.id.careportal_newnstreatment_bg_plus, R.id.careportal_newnstreatment_bg_minus, 0d, 0d, 500d, 1d, new DecimalFormat("0"), false);
|
editBg = new PlusMinusEditText(view, R.id.careportal_newnstreatment_bginput, R.id.careportal_newnstreatment_bg_plus, R.id.careportal_newnstreatment_bg_minus, bg, 0d, 500d, 1d, new DecimalFormat("0"), false);
|
||||||
|
bgInputEdit.addTextChangedListener(new TextWatcher() {
|
||||||
|
|
||||||
|
public void afterTextChanged(Editable s) {}
|
||||||
|
|
||||||
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
|
||||||
|
|
||||||
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
|
if (sensorRadioButton.isChecked()) meterRadioButton.setChecked(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
sensorRadioButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
|
NSProfile profile = ConfigBuilderPlugin.getActiveProfile().getProfile();
|
||||||
|
if (profile == null) return;
|
||||||
|
Double bg = NSProfile.fromMgdlToUnits(GlucoseStatus.getGlucoseStatusData() != null ? GlucoseStatus.getGlucoseStatusData().glucose : 0d, profile.getUnits());
|
||||||
|
editBg.setValue(bg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
Integer maxCarbs = MainApp.getConfigBuilder().applyCarbsConstraints(Constants.carbsOnlyForCheckLimit);
|
Integer maxCarbs = MainApp.getConfigBuilder().applyCarbsConstraints(Constants.carbsOnlyForCheckLimit);
|
||||||
editCarbs = new PlusMinusEditText(view, R.id.careportal_newnstreatment_carbsinput, R.id.careportal_newnstreatment_carbs_plus, R.id.careportal_newnstreatment_carbs_minus, 0d, 0d, (double) maxCarbs, 1d, new DecimalFormat("0"), false);
|
editCarbs = new PlusMinusEditText(view, R.id.careportal_newnstreatment_carbsinput, R.id.careportal_newnstreatment_carbs_plus, R.id.careportal_newnstreatment_carbs_minus, 0d, 0d, (double) maxCarbs, 1d, new DecimalFormat("0"), false);
|
||||||
|
@ -330,7 +355,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
|
||||||
this,
|
this,
|
||||||
calendar.get(Calendar.HOUR_OF_DAY),
|
calendar.get(Calendar.HOUR_OF_DAY),
|
||||||
calendar.get(Calendar.MINUTE),
|
calendar.get(Calendar.MINUTE),
|
||||||
df.is24HourFormat(context)
|
DateFormat.is24HourFormat(context)
|
||||||
);
|
);
|
||||||
tpd.setThemeDark(true);
|
tpd.setThemeDark(true);
|
||||||
tpd.dismissOnPause(true);
|
tpd.dismissOnPause(true);
|
||||||
|
@ -588,7 +613,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
String profile = data.getString("profile");
|
String profile = data.getString("profile");
|
||||||
NSProfile nsProfile = MainApp.getConfigBuilder().getActiveProfile().getProfile();
|
NSProfile nsProfile = ConfigBuilderPlugin.getActiveProfile().getProfile();
|
||||||
nsProfile.setActiveProfile(profile);
|
nsProfile.setActiveProfile(profile);
|
||||||
PumpInterface pump = MainApp.getConfigBuilder();
|
PumpInterface pump = MainApp.getConfigBuilder();
|
||||||
if (pump != null) {
|
if (pump != null) {
|
||||||
|
@ -598,8 +623,8 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
|
||||||
} else {
|
} else {
|
||||||
log.error("No active pump selected");
|
log.error("No active pump selected");
|
||||||
}
|
}
|
||||||
if (MainApp.getConfigBuilder().getActiveProfile() instanceof CircadianPercentageProfilePlugin) {
|
if (ConfigBuilderPlugin.getActiveProfile() instanceof CircadianPercentageProfilePlugin) {
|
||||||
CircadianPercentageProfilePlugin cpp = (CircadianPercentageProfilePlugin) MainApp.getConfigBuilder().getActiveProfile();
|
CircadianPercentageProfilePlugin cpp = (CircadianPercentageProfilePlugin) ConfigBuilderPlugin.getActiveProfile();
|
||||||
data.put("CircadianPercentageProfile", true);
|
data.put("CircadianPercentageProfile", true);
|
||||||
data.put("timeshift", cpp.timeshift);
|
data.put("timeshift", cpp.timeshift);
|
||||||
data.put("percentage", cpp.percentage);
|
data.put("percentage", cpp.percentage);
|
||||||
|
@ -623,8 +648,8 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
|
||||||
tempTarget.duration = data.getInt("duration");
|
tempTarget.duration = data.getInt("duration");
|
||||||
tempTarget.reason = data.getString("reason");
|
tempTarget.reason = data.getString("reason");
|
||||||
if(tempTarget.duration != 0) {
|
if(tempTarget.duration != 0) {
|
||||||
tempTarget.low = NSProfile.toMgdl(data.getDouble("targetBottom"), MainApp.getConfigBuilder().getActiveProfile().getProfile().getUnits());
|
tempTarget.low = NSProfile.toMgdl(data.getDouble("targetBottom"), ConfigBuilderPlugin.getActiveProfile().getProfile().getUnits());
|
||||||
tempTarget.high = NSProfile.toMgdl(data.getDouble("targetTop"), MainApp.getConfigBuilder().getActiveProfile().getProfile().getUnits());
|
tempTarget.high = NSProfile.toMgdl(data.getDouble("targetTop"), ConfigBuilderPlugin.getActiveProfile().getProfile().getUnits());
|
||||||
} else {
|
} else {
|
||||||
tempTarget.low = 0;
|
tempTarget.low = 0;
|
||||||
tempTarget.high = 0;
|
tempTarget.high = 0;
|
||||||
|
@ -635,9 +660,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
|
||||||
dao.createIfNotExists(tempTarget);
|
dao.createIfNotExists(tempTarget);
|
||||||
MainApp.bus().post(new EventTempTargetRangeChange());
|
MainApp.bus().post(new EventTempTargetRangeChange());
|
||||||
ConfigBuilderPlugin.uploadCareportalEntryToNS(data);
|
ConfigBuilderPlugin.uploadCareportalEntryToNS(data);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException | SQLException e) {
|
||||||
e.printStackTrace();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import android.os.Bundle;
|
||||||
import android.support.design.widget.Snackbar;
|
import android.support.design.widget.Snackbar;
|
||||||
import android.support.v4.app.DialogFragment;
|
import android.support.v4.app.DialogFragment;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
|
@ -68,7 +69,7 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
|
||||||
ImageView iceditIcon;
|
ImageView iceditIcon;
|
||||||
ImageView isfeditIcon;
|
ImageView isfeditIcon;
|
||||||
BasalEditDialog basalEditDialog;
|
BasalEditDialog basalEditDialog;
|
||||||
LinearLayout ll;
|
FrameLayout fl;
|
||||||
Snackbar mSnackBar;
|
Snackbar mSnackBar;
|
||||||
|
|
||||||
static Boolean percentageViewHint = true;
|
static Boolean percentageViewHint = true;
|
||||||
|
@ -78,8 +79,8 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
View layout = inflater.inflate(R.layout.circadianpercentageprofile_fragment, container, false);
|
View layout = inflater.inflate(R.layout.circadianpercentageprofile_fragment, container, false);
|
||||||
ll = (LinearLayout) layout.findViewById(R.id.circadianpercentageprofile_linearlayout);
|
fl = (FrameLayout) layout.findViewById(R.id.circadianpercentageprofile_framelayout);
|
||||||
ll.requestFocusFromTouch();
|
fl.requestFocusFromTouch();
|
||||||
diaView = (FormEditText) layout.findViewById(R.id.circadianpercentageprofile_dia);
|
diaView = (FormEditText) layout.findViewById(R.id.circadianpercentageprofile_dia);
|
||||||
mgdlView = (RadioButton) layout.findViewById(R.id.circadianpercentageprofile_mgdl);
|
mgdlView = (RadioButton) layout.findViewById(R.id.circadianpercentageprofile_mgdl);
|
||||||
mmolView = (RadioButton) layout.findViewById(R.id.circadianpercentageprofile_mmol);
|
mmolView = (RadioButton) layout.findViewById(R.id.circadianpercentageprofile_mmol);
|
||||||
|
@ -203,7 +204,7 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
|
||||||
mSnackBar.dismiss();
|
mSnackBar.dismiss();
|
||||||
}
|
}
|
||||||
timeshiftView.clearFocus();
|
timeshiftView.clearFocus();
|
||||||
ll.requestFocusFromTouch();
|
fl.requestFocusFromTouch();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (timeshiftViewHint) {
|
if (timeshiftViewHint) {
|
||||||
|
@ -222,7 +223,7 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
|
||||||
mSnackBar.dismiss();
|
mSnackBar.dismiss();
|
||||||
}
|
}
|
||||||
percentageView.clearFocus();
|
percentageView.clearFocus();
|
||||||
ll.requestFocusFromTouch();
|
fl.requestFocusFromTouch();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (percentageViewHint) {
|
if (percentageViewHint) {
|
||||||
|
@ -238,7 +239,7 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
|
||||||
public void onFocusChange(View view, boolean hasFocus) {
|
public void onFocusChange(View view, boolean hasFocus) {
|
||||||
if (!hasFocus) {
|
if (!hasFocus) {
|
||||||
diaView.clearFocus();
|
diaView.clearFocus();
|
||||||
ll.requestFocusFromTouch();
|
fl.requestFocusFromTouch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -249,7 +250,7 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
|
||||||
public void onFocusChange(View view, boolean hasFocus) {
|
public void onFocusChange(View view, boolean hasFocus) {
|
||||||
if (!hasFocus) {
|
if (!hasFocus) {
|
||||||
targethighView.clearFocus();
|
targethighView.clearFocus();
|
||||||
ll.requestFocusFromTouch();
|
fl.requestFocusFromTouch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -260,7 +261,7 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
|
||||||
public void onFocusChange(View view, boolean hasFocus) {
|
public void onFocusChange(View view, boolean hasFocus) {
|
||||||
if (!hasFocus) {
|
if (!hasFocus) {
|
||||||
targetlowView.clearFocus();
|
targetlowView.clearFocus();
|
||||||
ll.requestFocusFromTouch();
|
fl.requestFocusFromTouch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -325,11 +326,9 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
|
||||||
|
|
||||||
this.snackbarCaller = snackbarCaller;
|
this.snackbarCaller = snackbarCaller;
|
||||||
if (timeshiftViewHint || percentageViewHint) {
|
if (timeshiftViewHint || percentageViewHint) {
|
||||||
mSnackBar = Snackbar.make(view,
|
//noinspection WrongConstant
|
||||||
Msg,
|
mSnackBar = Snackbar.make(view, Msg, 7000)
|
||||||
Snackbar.LENGTH_LONG)
|
.setActionTextColor(ContextCompat.getColor(MainApp.instance(), R.color.notificationInfo))
|
||||||
.setDuration(Snackbar.LENGTH_LONG)
|
|
||||||
.setActionTextColor(getResources().getColor(R.color.notificationInfo))
|
|
||||||
.setAction(getString(R.string.dont_show_again), new View.OnClickListener() {
|
.setAction(getString(R.string.dont_show_again), new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -344,9 +343,9 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
|
||||||
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) view.getLayoutParams();
|
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) view.getLayoutParams();
|
||||||
params.gravity = Gravity.CENTER_HORIZONTAL | Gravity.TOP;
|
params.gravity = Gravity.CENTER_HORIZONTAL | Gravity.TOP;
|
||||||
view.setLayoutParams(params);
|
view.setLayoutParams(params);
|
||||||
view.setBackgroundColor(getResources().getColor(R.color.cardview_dark_background));
|
view.setBackgroundColor(ContextCompat.getColor(MainApp.instance(), R.color.cardview_dark_background));
|
||||||
TextView mainTextView = (TextView) (view).findViewById(android.support.design.R.id.snackbar_text);
|
TextView mainTextView = (TextView) (view).findViewById(android.support.design.R.id.snackbar_text);
|
||||||
mainTextView.setTextColor(getResources().getColor(R.color.mdtp_white));
|
mainTextView.setTextColor(ContextCompat.getColor(MainApp.instance(), R.color.mdtp_white));
|
||||||
mSnackBar.show();
|
mSnackBar.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -383,7 +382,7 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
|
||||||
basalEditDialog.dismiss();
|
basalEditDialog.dismiss();
|
||||||
}
|
}
|
||||||
basalEditDialog = null;
|
basalEditDialog = null;
|
||||||
ll.requestFocusFromTouch();
|
fl.requestFocusFromTouch();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class BasalEditDialog extends DialogFragment {
|
public static class BasalEditDialog extends DialogFragment {
|
||||||
|
@ -464,7 +463,7 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
|
||||||
basalEditDialog = null;
|
basalEditDialog = null;
|
||||||
|
|
||||||
MainApp.bus().unregister(this);
|
MainApp.bus().unregister(this);
|
||||||
ll.requestFocusFromTouch();
|
fl.requestFocusFromTouch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -472,7 +471,7 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
|
||||||
super.onResume();
|
super.onResume();
|
||||||
MainApp.bus().register(this);
|
MainApp.bus().register(this);
|
||||||
onStatusEvent(null);
|
onStatusEvent(null);
|
||||||
ll.requestFocusFromTouch();
|
fl.requestFocusFromTouch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
|
@ -482,7 +481,7 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
|
||||||
activity.runOnUiThread(new Runnable() {
|
activity.runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (!MainApp.getConfigBuilder().isInitialized() || !MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable) {
|
if (!MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended() || !MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable) {
|
||||||
profileswitchButton.setVisibility(View.GONE);
|
profileswitchButton.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
profileswitchButton.setVisibility(View.VISIBLE);
|
profileswitchButton.setVisibility(View.VISIBLE);
|
||||||
|
|
|
@ -9,7 +9,9 @@ import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.Button;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
import android.widget.ListAdapter;
|
import android.widget.ListAdapter;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
@ -28,6 +30,7 @@ import info.nightscout.androidaps.interfaces.ProfileInterface;
|
||||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
import info.nightscout.androidaps.plugins.NSProfile.NSProfilePlugin;
|
import info.nightscout.androidaps.plugins.NSProfile.NSProfilePlugin;
|
||||||
import info.nightscout.androidaps.plugins.VirtualPump.VirtualPumpPlugin;
|
import info.nightscout.androidaps.plugins.VirtualPump.VirtualPumpPlugin;
|
||||||
|
import info.nightscout.utils.PasswordProtection;
|
||||||
|
|
||||||
|
|
||||||
public class ConfigBuilderFragment extends Fragment implements FragmentBase {
|
public class ConfigBuilderFragment extends Fragment implements FragmentBase {
|
||||||
|
@ -62,6 +65,8 @@ public class ConfigBuilderFragment extends Fragment implements FragmentBase {
|
||||||
PluginCustomAdapter constraintsDataAdapter = null;
|
PluginCustomAdapter constraintsDataAdapter = null;
|
||||||
PluginCustomAdapter generalDataAdapter = null;
|
PluginCustomAdapter generalDataAdapter = null;
|
||||||
|
|
||||||
|
LinearLayout mainLayout;
|
||||||
|
Button unlock;
|
||||||
|
|
||||||
// TODO: sorting
|
// TODO: sorting
|
||||||
|
|
||||||
|
@ -89,6 +94,25 @@ public class ConfigBuilderFragment extends Fragment implements FragmentBase {
|
||||||
if (ConfigBuilderPlugin.nightscoutVersionCode < 900)
|
if (ConfigBuilderPlugin.nightscoutVersionCode < 900)
|
||||||
nightscoutVerView.setTextColor(Color.RED);
|
nightscoutVerView.setTextColor(Color.RED);
|
||||||
setViews();
|
setViews();
|
||||||
|
|
||||||
|
unlock = (Button) view.findViewById(R.id.configbuilder_unlock);
|
||||||
|
mainLayout = (LinearLayout) view.findViewById(R.id.configbuilder_mainlayout);
|
||||||
|
|
||||||
|
if (PasswordProtection.isLocked("settings_password")) {
|
||||||
|
mainLayout.setVisibility(View.GONE);
|
||||||
|
unlock.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
PasswordProtection.QueryPassword(getContext(), R.string.settings_password, "settings_password", new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
mainLayout.setVisibility(View.VISIBLE);
|
||||||
|
unlock.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}, null);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,10 @@ import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import info.nightscout.androidaps.Config;
|
import info.nightscout.androidaps.Config;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
@ -75,7 +79,8 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
||||||
|
|
||||||
static ArrayList<PluginBase> pluginList;
|
static ArrayList<PluginBase> pluginList;
|
||||||
|
|
||||||
static Date lastDeviceStatusUpload = new Date(0);
|
private static final ScheduledExecutorService worker = Executors.newSingleThreadScheduledExecutor();
|
||||||
|
private static ScheduledFuture<?> scheduledPost = null;
|
||||||
|
|
||||||
PowerManager.WakeLock mWakeLock;
|
PowerManager.WakeLock mWakeLock;
|
||||||
|
|
||||||
|
@ -336,6 +341,16 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
||||||
return activePump.isInitialized();
|
return activePump.isInitialized();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSuspended() {
|
||||||
|
return activePump.isSuspended();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBusy() {
|
||||||
|
return activePump.isBusy();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isTempBasalInProgress() {
|
public boolean isTempBasalInProgress() {
|
||||||
return activePump.isTempBasalInProgress();
|
return activePump.isTempBasalInProgress();
|
||||||
|
@ -608,6 +623,17 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
||||||
result.comment = MainApp.sResources.getString(R.string.pumpNotInitialized);
|
result.comment = MainApp.sResources.getString(R.string.pumpNotInitialized);
|
||||||
result.enacted = false;
|
result.enacted = false;
|
||||||
result.success = false;
|
result.success = false;
|
||||||
|
log.debug("applyAPSRequest: " + MainApp.sResources.getString(R.string.pumpNotInitialized));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isSuspended()) {
|
||||||
|
result = new PumpEnactResult();
|
||||||
|
result.comment = MainApp.sResources.getString(R.string.pumpsuspended);
|
||||||
|
result.enacted = false;
|
||||||
|
result.success = false;
|
||||||
|
log.debug("applyAPSRequest: " + MainApp.sResources.getString(R.string.pumpsuspended));
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.logCongigBuilderActions)
|
if (Config.logCongigBuilderActions)
|
||||||
|
@ -801,22 +827,7 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onStatusEvent(final EventNewBG ev) {
|
public void onStatusEvent(final EventNewBG ev) {
|
||||||
Thread t = new Thread(new Runnable() {
|
uploadDeviceStatus(120);
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
// Give some time to Loop
|
|
||||||
try {
|
|
||||||
Thread.sleep(120 * 1000L);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
// if status not uploaded, upload pump status only
|
|
||||||
if (new Date().getTime() - lastDeviceStatusUpload.getTime() > 120 * 1000L) {
|
|
||||||
uploadDeviceStatus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
t.start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void uploadTempBasalStartAbsolute(Double absolute, double durationInMinutes) {
|
public void uploadTempBasalStartAbsolute(Double absolute, double durationInMinutes) {
|
||||||
|
@ -922,11 +933,11 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void uploadDeviceStatus() {
|
public void doUploadDeviceStatus() {
|
||||||
DeviceStatus deviceStatus = new DeviceStatus();
|
DeviceStatus deviceStatus = new DeviceStatus();
|
||||||
try {
|
try {
|
||||||
LoopPlugin.LastRun lastRun = LoopPlugin.lastRun;
|
LoopPlugin.LastRun lastRun = LoopPlugin.lastRun;
|
||||||
if (lastRun != null && lastRun.lastAPSRun.getTime() > new Date().getTime() - 60 * 1000L) {
|
if (lastRun != null && lastRun.lastAPSRun.getTime() > new Date().getTime() - 300 * 1000L) {
|
||||||
// do not send if result is older than 1 min
|
// do not send if result is older than 1 min
|
||||||
APSResult apsResult = lastRun.request;
|
APSResult apsResult = lastRun.request;
|
||||||
apsResult.json().put("timestamp", DateUtil.toISOString(lastRun.lastAPSRun));
|
apsResult.json().put("timestamp", DateUtil.toISOString(lastRun.lastAPSRun));
|
||||||
|
@ -958,18 +969,36 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
||||||
}
|
}
|
||||||
if (activePump != null) {
|
if (activePump != null) {
|
||||||
deviceStatus.device = "openaps://" + deviceID();
|
deviceStatus.device = "openaps://" + deviceID();
|
||||||
|
JSONObject pumpstatus = getJSONStatus();
|
||||||
|
if (pumpstatus != null) {
|
||||||
deviceStatus.pump = getJSONStatus();
|
deviceStatus.pump = getJSONStatus();
|
||||||
|
}
|
||||||
|
|
||||||
deviceStatus.created_at = DateUtil.toISOString(new Date());
|
deviceStatus.created_at = DateUtil.toISOString(new Date());
|
||||||
|
|
||||||
deviceStatus.sendToNSClient();
|
deviceStatus.sendToNSClient();
|
||||||
lastDeviceStatusUpload = new Date();
|
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static public void uploadDeviceStatus(int sec) {
|
||||||
|
class PostRunnable implements Runnable {
|
||||||
|
public void run() {
|
||||||
|
MainApp.getConfigBuilder().doUploadDeviceStatus();
|
||||||
|
scheduledPost = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// prepare task for execution
|
||||||
|
// cancel waiting task to prevent sending multiple posts
|
||||||
|
if (scheduledPost != null)
|
||||||
|
scheduledPost.cancel(false);
|
||||||
|
Runnable task = new PostRunnable();
|
||||||
|
scheduledPost = worker.schedule(task, sec, TimeUnit.SECONDS);
|
||||||
|
log.debug("Scheduling devicestatus upload in " + sec + " sec");
|
||||||
|
}
|
||||||
|
|
||||||
public void uploadBolusWizardRecord(Treatment t, double glucose, String glucoseType, int carbTime, JSONObject boluscalc) {
|
public void uploadBolusWizardRecord(Treatment t, double glucose, String glucoseType, int carbTime, JSONObject boluscalc) {
|
||||||
JSONObject data = new JSONObject();
|
JSONObject data = new JSONObject();
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -211,6 +211,17 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
||||||
return getDanaRPump().lastConnection.getTime() > 0 && getDanaRPump().isExtendedBolusEnabled;
|
return getDanaRPump().lastConnection.getTime() > 0 && getDanaRPump().isExtendedBolusEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSuspended() {
|
||||||
|
return getDanaRPump().pumpSuspended;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBusy() {
|
||||||
|
if (sExecutionService == null) return false;
|
||||||
|
return sExecutionService.isConnected() || sExecutionService.isConnecting();
|
||||||
|
}
|
||||||
|
|
||||||
// Pump interface
|
// Pump interface
|
||||||
@Override
|
@Override
|
||||||
public boolean isTempBasalInProgress() {
|
public boolean isTempBasalInProgress() {
|
||||||
|
@ -705,7 +716,7 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
||||||
JSONObject extended = new JSONObject();
|
JSONObject extended = new JSONObject();
|
||||||
try {
|
try {
|
||||||
battery.put("percent", getDanaRPump().batteryRemaining);
|
battery.put("percent", getDanaRPump().batteryRemaining);
|
||||||
status.put("status", "normal");
|
status.put("status", getDanaRPump().pumpSuspended ? "suspended" : "normal");
|
||||||
status.put("timestamp", DateUtil.toISOString(getDanaRPump().lastConnection));
|
status.put("timestamp", DateUtil.toISOString(getDanaRPump().lastConnection));
|
||||||
extended.put("Version", BuildConfig.VERSION_NAME + "-" + BuildConfig.BUILDVERSION);
|
extended.put("Version", BuildConfig.VERSION_NAME + "-" + BuildConfig.BUILDVERSION);
|
||||||
extended.put("PumpIOB", getDanaRPump().iob);
|
extended.put("PumpIOB", getDanaRPump().iob);
|
||||||
|
|
|
@ -26,6 +26,7 @@ import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import info.nightscout.androidaps.Config;
|
import info.nightscout.androidaps.Config;
|
||||||
|
import info.nightscout.androidaps.Constants;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.db.Treatment;
|
import info.nightscout.androidaps.db.Treatment;
|
||||||
|
@ -33,6 +34,7 @@ import info.nightscout.androidaps.events.EventAppExit;
|
||||||
import info.nightscout.androidaps.events.EventInitializationChanged;
|
import info.nightscout.androidaps.events.EventInitializationChanged;
|
||||||
import info.nightscout.androidaps.events.EventPreferenceChange;
|
import info.nightscout.androidaps.events.EventPreferenceChange;
|
||||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||||
|
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.plugins.DanaR.DanaRPlugin;
|
import info.nightscout.androidaps.plugins.DanaR.DanaRPlugin;
|
||||||
import info.nightscout.androidaps.plugins.DanaR.DanaRPump;
|
import info.nightscout.androidaps.plugins.DanaR.DanaRPump;
|
||||||
import info.nightscout.androidaps.plugins.DanaR.SerialIOThread;
|
import info.nightscout.androidaps.plugins.DanaR.SerialIOThread;
|
||||||
|
@ -78,6 +80,8 @@ import info.nightscout.androidaps.plugins.DanaR.comm.RecordTypes;
|
||||||
import info.nightscout.androidaps.plugins.DanaR.events.EventDanaRBolusStart;
|
import info.nightscout.androidaps.plugins.DanaR.events.EventDanaRBolusStart;
|
||||||
import info.nightscout.androidaps.plugins.DanaR.events.EventDanaRConnectionStatus;
|
import info.nightscout.androidaps.plugins.DanaR.events.EventDanaRConnectionStatus;
|
||||||
import info.nightscout.androidaps.plugins.DanaR.events.EventDanaRNewStatus;
|
import info.nightscout.androidaps.plugins.DanaR.events.EventDanaRNewStatus;
|
||||||
|
import info.nightscout.androidaps.plugins.Overview.Notification;
|
||||||
|
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
||||||
import info.nightscout.client.data.NSProfile;
|
import info.nightscout.client.data.NSProfile;
|
||||||
import info.nightscout.utils.SafeParse;
|
import info.nightscout.utils.SafeParse;
|
||||||
import info.nightscout.utils.ToastUtils;
|
import info.nightscout.utils.ToastUtils;
|
||||||
|
@ -276,6 +280,7 @@ public class ExecutionService extends Service {
|
||||||
|
|
||||||
private boolean getPumpStatus() {
|
private boolean getPumpStatus() {
|
||||||
try {
|
try {
|
||||||
|
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.gettingpumpstatus)));
|
||||||
MsgStatus statusMsg = new MsgStatus();
|
MsgStatus statusMsg = new MsgStatus();
|
||||||
MsgStatusBasic statusBasicMsg = new MsgStatusBasic();
|
MsgStatusBasic statusBasicMsg = new MsgStatusBasic();
|
||||||
MsgStatusTempBasal tempStatusMsg = new MsgStatusTempBasal();
|
MsgStatusTempBasal tempStatusMsg = new MsgStatusTempBasal();
|
||||||
|
@ -336,6 +341,13 @@ public class ExecutionService extends Service {
|
||||||
danaRPump.lastConnection = now;
|
danaRPump.lastConnection = now;
|
||||||
MainApp.bus().post(new EventDanaRNewStatus());
|
MainApp.bus().post(new EventDanaRNewStatus());
|
||||||
MainApp.bus().post(new EventInitializationChanged());
|
MainApp.bus().post(new EventInitializationChanged());
|
||||||
|
MainApp.getConfigBuilder().uploadDeviceStatus(60);
|
||||||
|
if (danaRPump.dailyTotalUnits > danaRPump.maxDailyTotalUnits * Constants.dailyLimitWarning ) {
|
||||||
|
log.debug("Approaching daily limit: " + danaRPump.dailyTotalUnits + "/" + danaRPump.maxDailyTotalUnits);
|
||||||
|
Notification reportFail = new Notification(Notification.APPROACHING_DAILY_LIMIT, MainApp.sResources.getString(R.string.approachingdailylimit), Notification.URGENT);
|
||||||
|
MainApp.bus().post(new EventNewNotification(reportFail));
|
||||||
|
MainApp.getConfigBuilder().uploadError(MainApp.sResources.getString(R.string.approachingdailylimit) + ": " + danaRPump.dailyTotalUnits + "/" + danaRPump.maxDailyTotalUnits + "U");
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -345,30 +357,37 @@ public class ExecutionService extends Service {
|
||||||
public boolean tempBasal(int percent, int durationInHours) {
|
public boolean tempBasal(int percent, int durationInHours) {
|
||||||
connect("tempBasal");
|
connect("tempBasal");
|
||||||
if (!isConnected()) return false;
|
if (!isConnected()) return false;
|
||||||
|
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.settingtempbasal)));
|
||||||
mSerialIOThread.sendMessage(new MsgSetTempBasalStart(percent, durationInHours));
|
mSerialIOThread.sendMessage(new MsgSetTempBasalStart(percent, durationInHours));
|
||||||
mSerialIOThread.sendMessage(new MsgStatusTempBasal());
|
mSerialIOThread.sendMessage(new MsgStatusTempBasal());
|
||||||
|
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.disconnecting)));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean tempBasalStop() {
|
public boolean tempBasalStop() {
|
||||||
connect("tempBasalStop");
|
connect("tempBasalStop");
|
||||||
if (!isConnected()) return false;
|
if (!isConnected()) return false;
|
||||||
|
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.stoppingtempbasal)));
|
||||||
mSerialIOThread.sendMessage(new MsgSetTempBasalStop());
|
mSerialIOThread.sendMessage(new MsgSetTempBasalStop());
|
||||||
mSerialIOThread.sendMessage(new MsgStatusTempBasal());
|
mSerialIOThread.sendMessage(new MsgStatusTempBasal());
|
||||||
|
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.disconnecting)));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean extendedBolus(double insulin, int durationInHalfHours) {
|
public boolean extendedBolus(double insulin, int durationInHalfHours) {
|
||||||
connect("extendedBolus");
|
connect("extendedBolus");
|
||||||
if (!isConnected()) return false;
|
if (!isConnected()) return false;
|
||||||
|
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.settingextendedbolus)));
|
||||||
mSerialIOThread.sendMessage(new MsgSetExtendedBolusStart(insulin, (byte) (durationInHalfHours & 0xFF)));
|
mSerialIOThread.sendMessage(new MsgSetExtendedBolusStart(insulin, (byte) (durationInHalfHours & 0xFF)));
|
||||||
mSerialIOThread.sendMessage(new MsgStatusBolusExtended());
|
mSerialIOThread.sendMessage(new MsgStatusBolusExtended());
|
||||||
|
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.disconnecting)));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean extendedBolusStop() {
|
public boolean extendedBolusStop() {
|
||||||
connect("extendedBolusStop");
|
connect("extendedBolusStop");
|
||||||
if (!isConnected()) return false;
|
if (!isConnected()) return false;
|
||||||
|
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.stoppingextendedbolus)));
|
||||||
mSerialIOThread.sendMessage(new MsgSetExtendedBolusStop());
|
mSerialIOThread.sendMessage(new MsgSetExtendedBolusStop());
|
||||||
mSerialIOThread.sendMessage(new MsgStatusBolusExtended());
|
mSerialIOThread.sendMessage(new MsgStatusBolusExtended());
|
||||||
return true;
|
return true;
|
||||||
|
@ -482,6 +501,7 @@ public class ExecutionService extends Service {
|
||||||
public boolean updateBasalsInPump(final NSProfile profile) {
|
public boolean updateBasalsInPump(final NSProfile profile) {
|
||||||
connect("updateBasalsInPump");
|
connect("updateBasalsInPump");
|
||||||
if (!isConnected()) return false;
|
if (!isConnected()) return false;
|
||||||
|
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.updatingbasalrates)));
|
||||||
double[] basal = buildDanaRProfileRecord(profile);
|
double[] basal = buildDanaRProfileRecord(profile);
|
||||||
MsgSetBasalProfile msgSet = new MsgSetBasalProfile((byte) 0, basal);
|
MsgSetBasalProfile msgSet = new MsgSetBasalProfile((byte) 0, basal);
|
||||||
mSerialIOThread.sendMessage(msgSet);
|
mSerialIOThread.sendMessage(msgSet);
|
||||||
|
@ -489,6 +509,7 @@ public class ExecutionService extends Service {
|
||||||
mSerialIOThread.sendMessage(msgActivate);
|
mSerialIOThread.sendMessage(msgActivate);
|
||||||
danaRPump.lastSettingsRead = new Date(0); // force read full settings
|
danaRPump.lastSettingsRead = new Date(0); // force read full settings
|
||||||
getPumpStatus();
|
getPumpStatus();
|
||||||
|
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.disconnecting)));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,12 +4,20 @@ public class EventDanaRConnectionStatus {
|
||||||
public static final int CONNECTING = 0;
|
public static final int CONNECTING = 0;
|
||||||
public static final int CONNECTED = 1;
|
public static final int CONNECTED = 1;
|
||||||
public static final int DISCONNECTED = 2;
|
public static final int DISCONNECTED = 2;
|
||||||
|
public static final int PERFORMING = 3;
|
||||||
|
|
||||||
public int sStatus = DISCONNECTED;
|
public int sStatus = DISCONNECTED;
|
||||||
public int sSecondsElapsed = 0;
|
public int sSecondsElapsed = 0;
|
||||||
|
public String sAction = "";
|
||||||
|
|
||||||
public EventDanaRConnectionStatus(int status, int secondsElapsed) {
|
public EventDanaRConnectionStatus(int status, int secondsElapsed) {
|
||||||
sStatus = status;
|
sStatus = status;
|
||||||
sSecondsElapsed = secondsElapsed;
|
sSecondsElapsed = secondsElapsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EventDanaRConnectionStatus(int status, int secondsElapsed, String action) {
|
||||||
|
sStatus = status;
|
||||||
|
sSecondsElapsed = secondsElapsed;
|
||||||
|
sAction = action;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -211,6 +211,17 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints
|
||||||
return getDanaRPump().lastConnection.getTime() > 0 && !getDanaRPump().isConfigUD && !getDanaRPump().isEasyModeEnabled && getDanaRPump().isExtendedBolusEnabled;
|
return getDanaRPump().lastConnection.getTime() > 0 && !getDanaRPump().isConfigUD && !getDanaRPump().isEasyModeEnabled && getDanaRPump().isExtendedBolusEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSuspended() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBusy() {
|
||||||
|
if (sExecutionService == null) return false;
|
||||||
|
return sExecutionService.isConnected() || sExecutionService.isConnecting();
|
||||||
|
}
|
||||||
|
|
||||||
// Pump interface
|
// Pump interface
|
||||||
@Override
|
@Override
|
||||||
public boolean isTempBasalInProgress() {
|
public boolean isTempBasalInProgress() {
|
||||||
|
|
|
@ -26,6 +26,7 @@ import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import info.nightscout.androidaps.Config;
|
import info.nightscout.androidaps.Config;
|
||||||
|
import info.nightscout.androidaps.Constants;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.db.Treatment;
|
import info.nightscout.androidaps.db.Treatment;
|
||||||
|
@ -74,6 +75,8 @@ import info.nightscout.androidaps.plugins.DanaRKorean.comm.MsgSettingShippingInf
|
||||||
import info.nightscout.androidaps.plugins.DanaRKorean.comm.MsgStatusBasic;
|
import info.nightscout.androidaps.plugins.DanaRKorean.comm.MsgStatusBasic;
|
||||||
import info.nightscout.androidaps.plugins.DanaRKorean.comm.MsgStatusBolusExtended;
|
import info.nightscout.androidaps.plugins.DanaRKorean.comm.MsgStatusBolusExtended;
|
||||||
import info.nightscout.androidaps.plugins.DanaRKorean.comm.MsgStatusTempBasal;
|
import info.nightscout.androidaps.plugins.DanaRKorean.comm.MsgStatusTempBasal;
|
||||||
|
import info.nightscout.androidaps.plugins.Overview.Notification;
|
||||||
|
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
||||||
import info.nightscout.client.data.NSProfile;
|
import info.nightscout.client.data.NSProfile;
|
||||||
import info.nightscout.utils.SafeParse;
|
import info.nightscout.utils.SafeParse;
|
||||||
import info.nightscout.utils.ToastUtils;
|
import info.nightscout.utils.ToastUtils;
|
||||||
|
@ -272,6 +275,7 @@ public class ExecutionService extends Service {
|
||||||
|
|
||||||
private boolean getPumpStatus() {
|
private boolean getPumpStatus() {
|
||||||
try {
|
try {
|
||||||
|
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.gettingpumpstatus)));
|
||||||
//MsgStatus statusMsg = new MsgStatus();
|
//MsgStatus statusMsg = new MsgStatus();
|
||||||
MsgStatusBasic statusBasicMsg = new MsgStatusBasic();
|
MsgStatusBasic statusBasicMsg = new MsgStatusBasic();
|
||||||
MsgStatusTempBasal tempStatusMsg = new MsgStatusTempBasal();
|
MsgStatusTempBasal tempStatusMsg = new MsgStatusTempBasal();
|
||||||
|
@ -330,6 +334,13 @@ public class ExecutionService extends Service {
|
||||||
danaRKoreanPump.lastConnection = now;
|
danaRKoreanPump.lastConnection = now;
|
||||||
MainApp.bus().post(new EventDanaRNewStatus());
|
MainApp.bus().post(new EventDanaRNewStatus());
|
||||||
MainApp.bus().post(new EventInitializationChanged());
|
MainApp.bus().post(new EventInitializationChanged());
|
||||||
|
MainApp.getConfigBuilder().uploadDeviceStatus(60);
|
||||||
|
if (danaRKoreanPump.dailyTotalUnits > danaRKoreanPump.maxDailyTotalUnits * Constants.dailyLimitWarning ) {
|
||||||
|
log.debug("Approaching daily limit: " + danaRKoreanPump.dailyTotalUnits + "/" + danaRKoreanPump.maxDailyTotalUnits);
|
||||||
|
Notification reportFail = new Notification(Notification.APPROACHING_DAILY_LIMIT, MainApp.sResources.getString(R.string.approachingdailylimit), Notification.URGENT);
|
||||||
|
MainApp.bus().post(new EventNewNotification(reportFail));
|
||||||
|
MainApp.getConfigBuilder().uploadError(MainApp.sResources.getString(R.string.approachingdailylimit) + ": " + danaRKoreanPump.dailyTotalUnits + "/" + danaRKoreanPump.maxDailyTotalUnits + "U");
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -339,32 +350,40 @@ public class ExecutionService extends Service {
|
||||||
public boolean tempBasal(int percent, int durationInHours) {
|
public boolean tempBasal(int percent, int durationInHours) {
|
||||||
connect("tempBasal");
|
connect("tempBasal");
|
||||||
if (!isConnected()) return false;
|
if (!isConnected()) return false;
|
||||||
|
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.settingtempbasal)));
|
||||||
mSerialIOThread.sendMessage(new MsgSetTempBasalStart(percent, durationInHours));
|
mSerialIOThread.sendMessage(new MsgSetTempBasalStart(percent, durationInHours));
|
||||||
mSerialIOThread.sendMessage(new MsgStatusTempBasal());
|
mSerialIOThread.sendMessage(new MsgStatusTempBasal());
|
||||||
|
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.disconnecting)));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean tempBasalStop() {
|
public boolean tempBasalStop() {
|
||||||
connect("tempBasalStop");
|
connect("tempBasalStop");
|
||||||
if (!isConnected()) return false;
|
if (!isConnected()) return false;
|
||||||
|
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.stoppingtempbasal)));
|
||||||
mSerialIOThread.sendMessage(new MsgSetTempBasalStop());
|
mSerialIOThread.sendMessage(new MsgSetTempBasalStop());
|
||||||
mSerialIOThread.sendMessage(new MsgStatusTempBasal());
|
mSerialIOThread.sendMessage(new MsgStatusTempBasal());
|
||||||
|
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.disconnecting)));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean extendedBolus(double insulin, int durationInHalfHours) {
|
public boolean extendedBolus(double insulin, int durationInHalfHours) {
|
||||||
connect("extendedBolus");
|
connect("extendedBolus");
|
||||||
if (!isConnected()) return false;
|
if (!isConnected()) return false;
|
||||||
|
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.settingextendedbolus)));
|
||||||
mSerialIOThread.sendMessage(new MsgSetExtendedBolusStart(insulin, (byte) (durationInHalfHours & 0xFF)));
|
mSerialIOThread.sendMessage(new MsgSetExtendedBolusStart(insulin, (byte) (durationInHalfHours & 0xFF)));
|
||||||
mSerialIOThread.sendMessage(new MsgStatusBolusExtended());
|
mSerialIOThread.sendMessage(new MsgStatusBolusExtended());
|
||||||
|
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.disconnecting)));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean extendedBolusStop() {
|
public boolean extendedBolusStop() {
|
||||||
connect("extendedBolusStop");
|
connect("extendedBolusStop");
|
||||||
if (!isConnected()) return false;
|
if (!isConnected()) return false;
|
||||||
|
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.stoppingextendedbolus)));
|
||||||
mSerialIOThread.sendMessage(new MsgSetExtendedBolusStop());
|
mSerialIOThread.sendMessage(new MsgSetExtendedBolusStop());
|
||||||
mSerialIOThread.sendMessage(new MsgStatusBolusExtended());
|
mSerialIOThread.sendMessage(new MsgStatusBolusExtended());
|
||||||
|
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.disconnecting)));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -476,11 +495,13 @@ public class ExecutionService extends Service {
|
||||||
public boolean updateBasalsInPump(final NSProfile profile) {
|
public boolean updateBasalsInPump(final NSProfile profile) {
|
||||||
connect("updateBasalsInPump");
|
connect("updateBasalsInPump");
|
||||||
if (!isConnected()) return false;
|
if (!isConnected()) return false;
|
||||||
|
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.updatingbasalrates)));
|
||||||
double[] basal = buildDanaRProfileRecord(profile);
|
double[] basal = buildDanaRProfileRecord(profile);
|
||||||
MsgSetSingleBasalProfile msgSet = new MsgSetSingleBasalProfile(basal);
|
MsgSetSingleBasalProfile msgSet = new MsgSetSingleBasalProfile(basal);
|
||||||
mSerialIOThread.sendMessage(msgSet);
|
mSerialIOThread.sendMessage(msgSet);
|
||||||
danaRKoreanPump.lastSettingsRead = new Date(0); // force read full settings
|
danaRKoreanPump.lastSettingsRead = new Date(0); // force read full settings
|
||||||
getPumpStatus();
|
getPumpStatus();
|
||||||
|
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.disconnecting)));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -156,7 +156,7 @@ public class LocalProfileFragment extends Fragment implements FragmentBase {
|
||||||
activity.runOnUiThread(new Runnable() {
|
activity.runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (!MainApp.getConfigBuilder().isInitialized() || !MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable) {
|
if (!MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended() || !MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable) {
|
||||||
profileswitchButton.setVisibility(View.GONE);
|
profileswitchButton.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
profileswitchButton.setVisibility(View.VISIBLE);
|
profileswitchButton.setVisibility(View.VISIBLE);
|
||||||
|
|
|
@ -76,7 +76,14 @@ public class LoopFragment extends Fragment implements View.OnClickListener, Frag
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
switch (view.getId()) {
|
switch (view.getId()) {
|
||||||
case R.id.loop_run:
|
case R.id.loop_run:
|
||||||
|
lastRunView.setText(MainApp.sResources.getString(R.string.executing));
|
||||||
|
Thread thread = new Thread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
getPlugin().invoke("Loop button", true);
|
getPlugin().invoke("Loop button", true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
thread.start();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -228,7 +228,7 @@ public class LoopPlugin implements PluginBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
MainApp.bus().post(new EventLoopUpdateGui());
|
MainApp.bus().post(new EventLoopUpdateGui());
|
||||||
MainApp.getConfigBuilder().uploadDeviceStatus();
|
MainApp.getConfigBuilder().uploadDeviceStatus(120);
|
||||||
} finally {
|
} finally {
|
||||||
if (Config.logFunctionCalls)
|
if (Config.logFunctionCalls)
|
||||||
log.debug("invoke end");
|
log.debug("invoke end");
|
||||||
|
|
|
@ -115,6 +115,16 @@ public class MDIPlugin implements PluginBase, PumpInterface {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSuspended() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBusy() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isTempBasalInProgress() {
|
public boolean isTempBasalInProgress() {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -22,6 +22,7 @@ public class Notification {
|
||||||
public static final int BASAL_VALUE_BELOW_MINIMUM = 7;
|
public static final int BASAL_VALUE_BELOW_MINIMUM = 7;
|
||||||
public static final int OLD_NSCLIENT = 8;
|
public static final int OLD_NSCLIENT = 8;
|
||||||
public static final int INVALID_PHONE_NUMBER = 9;
|
public static final int INVALID_PHONE_NUMBER = 9;
|
||||||
|
public static final int APPROACHING_DAILY_LIMIT = 10;
|
||||||
|
|
||||||
public int id;
|
public int id;
|
||||||
public Date date;
|
public Date date;
|
||||||
|
|
|
@ -71,6 +71,7 @@ import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialog;
|
import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialog;
|
||||||
import info.nightscout.androidaps.plugins.Careportal.OptionsToShow;
|
import info.nightscout.androidaps.plugins.Careportal.OptionsToShow;
|
||||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||||
|
import info.nightscout.androidaps.plugins.DanaR.events.EventDanaRConnectionStatus;
|
||||||
import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
|
import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
|
||||||
import info.nightscout.androidaps.plugins.Loop.events.EventNewOpenLoopNotification;
|
import info.nightscout.androidaps.plugins.Loop.events.EventNewOpenLoopNotification;
|
||||||
import info.nightscout.androidaps.plugins.Objectives.ObjectivesPlugin;
|
import info.nightscout.androidaps.plugins.Objectives.ObjectivesPlugin;
|
||||||
|
@ -116,7 +117,7 @@ public class OverviewFragment extends Fragment {
|
||||||
TextView iobView;
|
TextView iobView;
|
||||||
TextView apsModeView;
|
TextView apsModeView;
|
||||||
TextView tempTargetView;
|
TextView tempTargetView;
|
||||||
TextView initializingView;
|
TextView pumpStatusView;
|
||||||
GraphView bgGraph;
|
GraphView bgGraph;
|
||||||
CheckBox showPredictionView;
|
CheckBox showPredictionView;
|
||||||
|
|
||||||
|
@ -162,7 +163,7 @@ public class OverviewFragment extends Fragment {
|
||||||
baseBasalView = (TextView) view.findViewById(R.id.overview_basebasal);
|
baseBasalView = (TextView) view.findViewById(R.id.overview_basebasal);
|
||||||
basalLayout = (LinearLayout) view.findViewById(R.id.overview_basallayout);
|
basalLayout = (LinearLayout) view.findViewById(R.id.overview_basallayout);
|
||||||
activeProfileView = (TextView) view.findViewById(R.id.overview_activeprofile);
|
activeProfileView = (TextView) view.findViewById(R.id.overview_activeprofile);
|
||||||
initializingView = (TextView) view.findViewById(R.id.overview_initializing);
|
pumpStatusView = (TextView) view.findViewById(R.id.overview_initializing);
|
||||||
|
|
||||||
iobView = (TextView) view.findViewById(R.id.overview_iob);
|
iobView = (TextView) view.findViewById(R.id.overview_iob);
|
||||||
apsModeView = (TextView) view.findViewById(R.id.overview_apsmode);
|
apsModeView = (TextView) view.findViewById(R.id.overview_apsmode);
|
||||||
|
@ -268,7 +269,7 @@ public class OverviewFragment extends Fragment {
|
||||||
finalLastRun.setByPump = applyResult;
|
finalLastRun.setByPump = applyResult;
|
||||||
finalLastRun.lastEnact = new Date();
|
finalLastRun.lastEnact = new Date();
|
||||||
finalLastRun.lastOpenModeAccept = new Date();
|
finalLastRun.lastOpenModeAccept = new Date();
|
||||||
MainApp.getConfigBuilder().uploadDeviceStatus();
|
MainApp.getConfigBuilder().uploadDeviceStatus(15);
|
||||||
ObjectivesPlugin objectivesPlugin = (ObjectivesPlugin) MainApp.getSpecificPlugin(ObjectivesPlugin.class);
|
ObjectivesPlugin objectivesPlugin = (ObjectivesPlugin) MainApp.getSpecificPlugin(ObjectivesPlugin.class);
|
||||||
if (objectivesPlugin != null) {
|
if (objectivesPlugin != null) {
|
||||||
objectivesPlugin.manualEnacts++;
|
objectivesPlugin.manualEnacts++;
|
||||||
|
@ -287,22 +288,35 @@ public class OverviewFragment extends Fragment {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
pumpStatusView.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
if (MainApp.getConfigBuilder().isSuspended() || !MainApp.getConfigBuilder().isInitialized())
|
||||||
|
sHandler.post(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
MainApp.getConfigBuilder().updateStatus("RefreshClicked");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
updateGUI();
|
updateGUI();
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
void processQuickWizard() {
|
void processQuickWizard() {
|
||||||
final BgReading lastBG = GlucoseStatus.lastBg();
|
final BgReading actualBg = GlucoseStatus.actualBg();
|
||||||
if (MainApp.getConfigBuilder() == null || ConfigBuilderPlugin.getActiveProfile() == null) // app not initialized yet
|
if (MainApp.getConfigBuilder() == null || ConfigBuilderPlugin.getActiveProfile() == null) // app not initialized yet
|
||||||
return;
|
return;
|
||||||
final NSProfile profile = ConfigBuilderPlugin.getActiveProfile().getProfile();
|
final NSProfile profile = ConfigBuilderPlugin.getActiveProfile().getProfile();
|
||||||
|
|
||||||
QuickWizard.QuickWizardEntry quickWizardEntry = getPlugin().quickWizard.getActive();
|
QuickWizard.QuickWizardEntry quickWizardEntry = getPlugin().quickWizard.getActive();
|
||||||
if (quickWizardEntry != null && lastBG != null) {
|
if (quickWizardEntry != null && actualBg != null) {
|
||||||
quickWizardButton.setVisibility(View.VISIBLE);
|
quickWizardButton.setVisibility(View.VISIBLE);
|
||||||
String text = MainApp.sResources.getString(R.string.bolus) + ": " + quickWizardEntry.buttonText();
|
String text = MainApp.sResources.getString(R.string.bolus) + ": " + quickWizardEntry.buttonText();
|
||||||
BolusWizard wizard = new BolusWizard();
|
BolusWizard wizard = new BolusWizard();
|
||||||
wizard.doCalc(profile.getDefaultProfile(), quickWizardEntry.carbs(), lastBG.valueToUnits(profile.getUnits()), 0d, true, true);
|
wizard.doCalc(profile.getDefaultProfile(), quickWizardEntry.carbs(), actualBg.valueToUnits(profile.getUnits()), 0d, true, true);
|
||||||
|
|
||||||
final JSONObject boluscalcJSON = new JSONObject();
|
final JSONObject boluscalcJSON = new JSONObject();
|
||||||
try {
|
try {
|
||||||
|
@ -314,7 +328,7 @@ public class OverviewFragment extends Fragment {
|
||||||
boluscalcJSON.put("iob", -(wizard.insulingFromBolusIOB + wizard.insulingFromBasalsIOB));
|
boluscalcJSON.put("iob", -(wizard.insulingFromBolusIOB + wizard.insulingFromBasalsIOB));
|
||||||
boluscalcJSON.put("bolusiobused", true);
|
boluscalcJSON.put("bolusiobused", true);
|
||||||
boluscalcJSON.put("basaliobused", true);
|
boluscalcJSON.put("basaliobused", true);
|
||||||
boluscalcJSON.put("bg", lastBG.valueToUnits(profile.getUnits()));
|
boluscalcJSON.put("bg", actualBg.valueToUnits(profile.getUnits()));
|
||||||
boluscalcJSON.put("insulinbg", wizard.insulinFromBG);
|
boluscalcJSON.put("insulinbg", wizard.insulinFromBG);
|
||||||
boluscalcJSON.put("insulinbgused", true);
|
boluscalcJSON.put("insulinbgused", true);
|
||||||
boluscalcJSON.put("bgdiff", wizard.bgDiff);
|
boluscalcJSON.put("bgdiff", wizard.bgDiff);
|
||||||
|
@ -361,7 +375,7 @@ public class OverviewFragment extends Fragment {
|
||||||
getContext(),
|
getContext(),
|
||||||
finalInsulinAfterConstraints,
|
finalInsulinAfterConstraints,
|
||||||
finalCarbsAfterConstraints,
|
finalCarbsAfterConstraints,
|
||||||
lastBG.valueToUnits(profile.getUnits()),
|
actualBg.valueToUnits(profile.getUnits()),
|
||||||
"Manual",
|
"Manual",
|
||||||
0,
|
0,
|
||||||
boluscalcJSON
|
boluscalcJSON
|
||||||
|
@ -443,16 +457,41 @@ public class OverviewFragment extends Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onStatusEvent(final EventNewBasalProfile ev) { updateGUIIfVisible(); }
|
public void onStatusEvent(final EventNewBasalProfile ev) {
|
||||||
|
updateGUIIfVisible();
|
||||||
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onStatusEvent(final EventTempTargetRangeChange ev) {updateGUIIfVisible();}
|
public void onStatusEvent(final EventTempTargetRangeChange ev) {
|
||||||
|
updateGUIIfVisible();
|
||||||
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onStatusEvent(final EventNewNotification n) { updateNotifications(); }
|
public void onStatusEvent(final EventNewNotification n) {
|
||||||
|
updateNotifications();
|
||||||
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onStatusEvent(final EventDismissNotification n) { updateNotifications(); }
|
public void onStatusEvent(final EventDismissNotification n) {
|
||||||
|
updateNotifications();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onStatusEvent(final EventDanaRConnectionStatus s) {
|
||||||
|
Activity activity = getActivity();
|
||||||
|
if (activity != null)
|
||||||
|
activity.runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (s.sStatus == EventDanaRConnectionStatus.CONNECTING)
|
||||||
|
updatePumpStatus(String.format(getString(R.string.danar_history_connectingfor), s.sSecondsElapsed));
|
||||||
|
else if (s.sStatus == EventDanaRConnectionStatus.PERFORMING)
|
||||||
|
updatePumpStatus(s.sAction);
|
||||||
|
else if (s.sStatus == EventDanaRConnectionStatus.DISCONNECTED)
|
||||||
|
updatePumpStatus(null);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private void hideTempRecommendation() {
|
private void hideTempRecommendation() {
|
||||||
Activity activity = getActivity();
|
Activity activity = getActivity();
|
||||||
|
@ -476,6 +515,35 @@ public class OverviewFragment extends Fragment {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updatePumpStatus(String status) {
|
||||||
|
PumpInterface pump = MainApp.getConfigBuilder();
|
||||||
|
if (status != null) {
|
||||||
|
pumpStatusView.setText(status);
|
||||||
|
pumpStatusView.setVisibility(View.VISIBLE);
|
||||||
|
} else if (pump.isBusy()) {
|
||||||
|
pumpStatusView.setText(R.string.pumpbusy);
|
||||||
|
pumpStatusView.setVisibility(View.VISIBLE);
|
||||||
|
} else if (pump.isSuspended()) {
|
||||||
|
// disable all treatment buttons because we are not able to check constraints without profile
|
||||||
|
wizardButton.setVisibility(View.INVISIBLE);
|
||||||
|
treatmentButton.setVisibility(View.INVISIBLE);
|
||||||
|
quickWizardButton.setVisibility(View.INVISIBLE);
|
||||||
|
pumpStatusView.setText(R.string.pumpsuspendedclicktorefresh);
|
||||||
|
pumpStatusView.setVisibility(View.VISIBLE);
|
||||||
|
} else if (!pump.isInitialized()) {
|
||||||
|
// disable all treatment buttons because we are not able to check constraints without profile
|
||||||
|
wizardButton.setVisibility(View.INVISIBLE);
|
||||||
|
treatmentButton.setVisibility(View.INVISIBLE);
|
||||||
|
quickWizardButton.setVisibility(View.INVISIBLE);
|
||||||
|
pumpStatusView.setText(R.string.waitingforpumpclicktorefresh);
|
||||||
|
pumpStatusView.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
wizardButton.setVisibility(View.VISIBLE);
|
||||||
|
treatmentButton.setVisibility(View.VISIBLE);
|
||||||
|
pumpStatusView.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
public void updateGUI() {
|
public void updateGUI() {
|
||||||
updateNotifications();
|
updateNotifications();
|
||||||
|
@ -483,11 +551,11 @@ public class OverviewFragment extends Fragment {
|
||||||
BgReading lastBG = GlucoseStatus.lastBg();
|
BgReading lastBG = GlucoseStatus.lastBg();
|
||||||
|
|
||||||
if (MainApp.getConfigBuilder() == null || MainApp.getConfigBuilder().getActiveProfile() == null || MainApp.getConfigBuilder().getActiveProfile().getProfile() == null) {// app not initialized yet
|
if (MainApp.getConfigBuilder() == null || MainApp.getConfigBuilder().getActiveProfile() == null || MainApp.getConfigBuilder().getActiveProfile().getProfile() == null) {// app not initialized yet
|
||||||
initializingView.setText(R.string.noprofileset);
|
pumpStatusView.setText(R.string.noprofileset);
|
||||||
initializingView.setVisibility(View.VISIBLE);
|
pumpStatusView.setVisibility(View.VISIBLE);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
initializingView.setVisibility(View.GONE);
|
pumpStatusView.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skip if not initialized yet
|
// Skip if not initialized yet
|
||||||
|
@ -578,7 +646,7 @@ public class OverviewFragment extends Fragment {
|
||||||
showAcceptButton = showAcceptButton && (finalLastRun.lastOpenModeAccept == null || finalLastRun.lastOpenModeAccept.getTime() < finalLastRun.lastAPSRun.getTime()); // never accepted or before last result
|
showAcceptButton = showAcceptButton && (finalLastRun.lastOpenModeAccept == null || finalLastRun.lastOpenModeAccept.getTime() < finalLastRun.lastAPSRun.getTime()); // never accepted or before last result
|
||||||
showAcceptButton = showAcceptButton && finalLastRun.constraintsProcessed.changeRequested; // change is requested
|
showAcceptButton = showAcceptButton && finalLastRun.constraintsProcessed.changeRequested; // change is requested
|
||||||
|
|
||||||
if (showAcceptButton && pump.isInitialized() && ConfigBuilderPlugin.getActiveLoop() != null) {
|
if (showAcceptButton && pump.isInitialized() && !pump.isSuspended() && ConfigBuilderPlugin.getActiveLoop() != null) {
|
||||||
acceptTempLayout.setVisibility(View.VISIBLE);
|
acceptTempLayout.setVisibility(View.VISIBLE);
|
||||||
acceptTempButton.setText(getContext().getString(R.string.setbasalquestion) + "\n" + finalLastRun.constraintsProcessed);
|
acceptTempButton.setText(getContext().getString(R.string.setbasalquestion) + "\n" + finalLastRun.constraintsProcessed);
|
||||||
} else {
|
} else {
|
||||||
|
@ -644,7 +712,7 @@ public class OverviewFragment extends Fragment {
|
||||||
|
|
||||||
// QuickWizard button
|
// QuickWizard button
|
||||||
QuickWizard.QuickWizardEntry quickWizardEntry = getPlugin().quickWizard.getActive();
|
QuickWizard.QuickWizardEntry quickWizardEntry = getPlugin().quickWizard.getActive();
|
||||||
if (quickWizardEntry != null && lastBG != null && pump.isInitialized()) {
|
if (quickWizardEntry != null && lastBG != null && pump.isInitialized() && !pump.isSuspended()) {
|
||||||
quickWizardButton.setVisibility(View.VISIBLE);
|
quickWizardButton.setVisibility(View.VISIBLE);
|
||||||
String text = MainApp.sResources.getString(R.string.bolus) + ": " + quickWizardEntry.buttonText() + " " + DecimalFormatter.to0Decimal(quickWizardEntry.carbs()) + "g";
|
String text = MainApp.sResources.getString(R.string.bolus) + ": " + quickWizardEntry.buttonText() + " " + DecimalFormatter.to0Decimal(quickWizardEntry.carbs()) + "g";
|
||||||
BolusWizard wizard = new BolusWizard();
|
BolusWizard wizard = new BolusWizard();
|
||||||
|
@ -935,20 +1003,7 @@ public class OverviewFragment extends Fragment {
|
||||||
bgGraph.getGridLabelRenderer().setVerticalLabelsSecondScaleColor(ContextCompat.getColor(MainApp.instance(), R.color.background_material_dark)); // same color as backround = hide
|
bgGraph.getGridLabelRenderer().setVerticalLabelsSecondScaleColor(ContextCompat.getColor(MainApp.instance(), R.color.background_material_dark)); // same color as backround = hide
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pump not initialized message
|
updatePumpStatus(null);
|
||||||
if (!pump.isInitialized()) {
|
|
||||||
// disable all treatment buttons because we are not able to check constraints without profile
|
|
||||||
wizardButton.setVisibility(View.INVISIBLE);
|
|
||||||
treatmentButton.setVisibility(View.INVISIBLE);
|
|
||||||
quickWizardButton.setVisibility(View.INVISIBLE);
|
|
||||||
initializingView.setText(R.string.waitingforpump);
|
|
||||||
initializingView.setVisibility(View.VISIBLE);
|
|
||||||
} else {
|
|
||||||
wizardButton.setVisibility(View.VISIBLE);
|
|
||||||
treatmentButton.setVisibility(View.VISIBLE);
|
|
||||||
initializingView.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Notifications
|
//Notifications
|
||||||
|
@ -1040,5 +1095,4 @@ public class OverviewFragment extends Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,7 +170,7 @@ public class SimpleProfileFragment extends Fragment implements FragmentBase {
|
||||||
activity.runOnUiThread(new Runnable() {
|
activity.runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (!MainApp.getConfigBuilder().isInitialized() || !MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable) {
|
if (!MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended() || !MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable) {
|
||||||
profileswitchButton.setVisibility(View.GONE);
|
profileswitchButton.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
profileswitchButton.setVisibility(View.VISIBLE);
|
profileswitchButton.setVisibility(View.VISIBLE);
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
package info.nightscout.androidaps.plugins.Treatments;
|
package info.nightscout.androidaps.plugins.Treatments;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
import android.graphics.Paint;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
|
@ -55,7 +57,9 @@ public class TreatmentsFragment extends Fragment implements View.OnClickListener
|
||||||
TextView activityTotal;
|
TextView activityTotal;
|
||||||
Button refreshFromNS;
|
Button refreshFromNS;
|
||||||
|
|
||||||
public static class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewAdapter.TreatmentsViewHolder> {
|
Context context;
|
||||||
|
|
||||||
|
public class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewAdapter.TreatmentsViewHolder> {
|
||||||
|
|
||||||
List<Treatment> treatments;
|
List<Treatment> treatments;
|
||||||
|
|
||||||
|
@ -88,6 +92,7 @@ public class TreatmentsFragment extends Fragment implements View.OnClickListener
|
||||||
holder.dateLinearLayout.setBackgroundColor(ContextCompat.getColor(MainApp.instance(), R.color.colorAffectingIOB));
|
holder.dateLinearLayout.setBackgroundColor(ContextCompat.getColor(MainApp.instance(), R.color.colorAffectingIOB));
|
||||||
else
|
else
|
||||||
holder.dateLinearLayout.setBackgroundColor(ContextCompat.getColor(MainApp.instance(), R.color.cardColorBackground));
|
holder.dateLinearLayout.setBackgroundColor(ContextCompat.getColor(MainApp.instance(), R.color.cardColorBackground));
|
||||||
|
holder.remove.setTag(treatments.get(position));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -100,7 +105,7 @@ public class TreatmentsFragment extends Fragment implements View.OnClickListener
|
||||||
super.onAttachedToRecyclerView(recyclerView);
|
super.onAttachedToRecyclerView(recyclerView);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TreatmentsViewHolder extends RecyclerView.ViewHolder {
|
public class TreatmentsViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
|
||||||
CardView cv;
|
CardView cv;
|
||||||
TextView date;
|
TextView date;
|
||||||
TextView insulin;
|
TextView insulin;
|
||||||
|
@ -109,6 +114,7 @@ public class TreatmentsFragment extends Fragment implements View.OnClickListener
|
||||||
TextView activity;
|
TextView activity;
|
||||||
TextView mealOrCorrection;
|
TextView mealOrCorrection;
|
||||||
LinearLayout dateLinearLayout;
|
LinearLayout dateLinearLayout;
|
||||||
|
TextView remove;
|
||||||
|
|
||||||
TreatmentsViewHolder(View itemView) {
|
TreatmentsViewHolder(View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
|
@ -120,6 +126,35 @@ public class TreatmentsFragment extends Fragment implements View.OnClickListener
|
||||||
activity = (TextView) itemView.findViewById(R.id.treatments_activity);
|
activity = (TextView) itemView.findViewById(R.id.treatments_activity);
|
||||||
mealOrCorrection = (TextView) itemView.findViewById(R.id.treatments_mealorcorrection);
|
mealOrCorrection = (TextView) itemView.findViewById(R.id.treatments_mealorcorrection);
|
||||||
dateLinearLayout = (LinearLayout) itemView.findViewById(R.id.treatments_datelinearlayout);
|
dateLinearLayout = (LinearLayout) itemView.findViewById(R.id.treatments_datelinearlayout);
|
||||||
|
remove = (TextView) itemView.findViewById(R.id.treatments_remove);
|
||||||
|
remove.setOnClickListener(this);
|
||||||
|
remove.setPaintFlags(remove.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
final Treatment treatment = (Treatment) v.getTag();
|
||||||
|
final Context finalContext = context;
|
||||||
|
switch (v.getId()) {
|
||||||
|
case R.id.treatments_remove:
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||||
|
builder.setTitle(MainApp.sResources.getString(R.string.confirmation));
|
||||||
|
builder.setMessage(MainApp.sResources.getString(R.string.removerecord) + "\n" + DateUtil.dateAndTimeString(treatment.created_at));
|
||||||
|
builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
final String _id = treatment._id;
|
||||||
|
if (_id != null && !_id.equals("")) {
|
||||||
|
MainApp.getConfigBuilder().removeCareportalEntryFromNS(_id);
|
||||||
|
}
|
||||||
|
MainApp.getDbHelper().delete(treatment);
|
||||||
|
treatmentsPlugin.initializeData();
|
||||||
|
updateGUI();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
builder.setNegativeButton(MainApp.sResources.getString(R.string.cancel), null);
|
||||||
|
builder.show();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -143,6 +178,8 @@ public class TreatmentsFragment extends Fragment implements View.OnClickListener
|
||||||
refreshFromNS = (Button) view.findViewById(R.id.treatments_reshreshfromnightscout);
|
refreshFromNS = (Button) view.findViewById(R.id.treatments_reshreshfromnightscout);
|
||||||
refreshFromNS.setOnClickListener(this);
|
refreshFromNS.setOnClickListener(this);
|
||||||
|
|
||||||
|
context = getContext();
|
||||||
|
|
||||||
updateGUI();
|
updateGUI();
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package info.nightscout.androidaps.plugins.VirtualPump;
|
package info.nightscout.androidaps.plugins.VirtualPump;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
@ -124,6 +126,16 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSuspended() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBusy() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isTempBasalInProgress() {
|
public boolean isTempBasalInProgress() {
|
||||||
return getTempBasal() != null;
|
return getTempBasal() != null;
|
||||||
|
@ -391,6 +403,10 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JSONObject getJSONStatus() {
|
public JSONObject getJSONStatus() {
|
||||||
|
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext());
|
||||||
|
if (!preferences.getBoolean("virtualpump_uploadstatus", false)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
JSONObject pump = new JSONObject();
|
JSONObject pump = new JSONObject();
|
||||||
JSONObject battery = new JSONObject();
|
JSONObject battery = new JSONObject();
|
||||||
JSONObject status = new JSONObject();
|
JSONObject status = new JSONObject();
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class KeepAliveReceiver extends BroadcastReceiver {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
t.start();
|
t.start();
|
||||||
} else if (isStatusOutdated) {
|
} else if (isStatusOutdated && !pump.isBusy()) {
|
||||||
Thread t = new Thread(new Runnable() {
|
Thread t = new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -66,7 +66,7 @@ public class KeepAliveReceiver extends BroadcastReceiver {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
t.start();
|
t.start();
|
||||||
} else if (isBasalOutdated) {
|
} else if (isBasalOutdated && !pump.isBusy()) {
|
||||||
Thread t = new Thread(new Runnable() {
|
Thread t = new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
|
@ -0,0 +1,72 @@
|
||||||
|
package info.nightscout.utils;
|
||||||
|
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
import info.nightscout.androidaps.R;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by mike on 14.02.2017.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class PasswordProtection {
|
||||||
|
static public boolean isLocked(String preference) {
|
||||||
|
SharedPreferences SP = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext());
|
||||||
|
final String password = SP.getString(preference, "");
|
||||||
|
if (password.equals("")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static public void QueryPassword(final Context context, int stringID, String preference, final Runnable ok, final Runnable fail) {
|
||||||
|
SharedPreferences SP = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext());
|
||||||
|
final String password = SP.getString(preference, "");
|
||||||
|
if (password.equals("")) {
|
||||||
|
if (ok != null) ok.run();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
LayoutInflater li = LayoutInflater.from(context);
|
||||||
|
View promptsView = li.inflate(R.layout.passwordprompt, null);
|
||||||
|
|
||||||
|
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context);
|
||||||
|
alertDialogBuilder.setView(promptsView);
|
||||||
|
|
||||||
|
final TextView label = (TextView) promptsView.findViewById(R.id.passwordprompt_text);
|
||||||
|
label.setText(MainApp.sResources.getString(stringID));
|
||||||
|
final EditText userInput = (EditText) promptsView.findViewById(R.id.passwordprompt_pass);
|
||||||
|
|
||||||
|
// set dialog message
|
||||||
|
alertDialogBuilder
|
||||||
|
.setCancelable(false)
|
||||||
|
.setPositiveButton("OK",
|
||||||
|
new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog,int id) {
|
||||||
|
String enteredPassword = userInput.getText().toString();
|
||||||
|
if (password.equals(enteredPassword)) {
|
||||||
|
if (ok != null) ok.run();
|
||||||
|
} else {
|
||||||
|
ToastUtils.showToastInUiThread(context, MainApp.sResources.getString(R.string.wrongpassword));
|
||||||
|
if (fail != null) fail.run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setNegativeButton("Cancel",
|
||||||
|
new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog,int id) {
|
||||||
|
dialog.cancel();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
AlertDialog alertDialog = alertDialogBuilder.create();
|
||||||
|
alertDialog.show();
|
||||||
|
}
|
||||||
|
}
|
|
@ -94,14 +94,15 @@
|
||||||
android:id="@+id/careportal_newnstreatment_meter"
|
android:id="@+id/careportal_newnstreatment_meter"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:checked="true"
|
android:checked="false"
|
||||||
android:text="@string/careportal_newnstreatment_meter" />
|
android:text="@string/careportal_newnstreatment_meter" />
|
||||||
|
|
||||||
<RadioButton
|
<RadioButton
|
||||||
android:id="@+id/careportal_newnstreatment_sensor"
|
android:id="@+id/careportal_newnstreatment_sensor"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/careportal_newnstreatment_sensor" />
|
android:text="@string/careportal_newnstreatment_sensor"
|
||||||
|
android:checked="true" />
|
||||||
|
|
||||||
<RadioButton
|
<RadioButton
|
||||||
android:id="@+id/careportal_newnstreatment_other"
|
android:id="@+id/careportal_newnstreatment_other"
|
||||||
|
|
|
@ -3,6 +3,10 @@
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:id="@+id/circadianpercentageprofile_framelayout"
|
||||||
|
android:focusable="true"
|
||||||
|
android:focusableInTouchMode="true"
|
||||||
|
android:descendantFocusability="beforeDescendants"
|
||||||
tools:context=".plugins.CircadianPercentageProfile.CircadianPercentageProfileFragment">
|
tools:context=".plugins.CircadianPercentageProfile.CircadianPercentageProfileFragment">
|
||||||
|
|
||||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
@ -13,10 +17,7 @@
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical">
|
||||||
android:id="@+id/circadianpercentageprofile_linearlayout"
|
|
||||||
android:focusable="true"
|
|
||||||
android:focusableInTouchMode="true" >
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/circadianpercentageprofile_profileview"
|
android:id="@+id/circadianpercentageprofile_profileview"
|
||||||
|
|
|
@ -13,44 +13,17 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<LinearLayout
|
<Button
|
||||||
android:orientation="horizontal"
|
android:id="@+id/configbuilder_unlock"
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
|
||||||
android:text="@string/configbuilder_nsclientversion_label" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
|
||||||
android:id="@+id/configbuilder_nsclientversion"
|
|
||||||
android:layout_marginLeft="10dp" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="10dp">
|
android:text="@string/unlock_settings" />
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:id="@+id/configbuilder_mainlayout"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
android:layout_height="match_parent"
|
||||||
android:text="@string/configbuilder_nightscoutversion_label" />
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
|
||||||
android:id="@+id/configbuilder_nightscoutversion"
|
|
||||||
android:layout_marginLeft="10dp" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
@ -201,6 +174,47 @@
|
||||||
android:layout_marginLeft="10dp"
|
android:layout_marginLeft="10dp"
|
||||||
android:layout_marginRight="10dp"
|
android:layout_marginRight="10dp"
|
||||||
android:background="@color/cardColorBackground" />
|
android:background="@color/cardColorBackground" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/configbuilder_nsclientversion_label"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/configbuilder_nsclientversion"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/configbuilder_nightscoutversion_label"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/configbuilder_nightscoutversion"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
25
app/src/main/res/layout/passwordprompt.xml
Normal file
25
app/src/main/res/layout/passwordprompt.xml
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/layout_root"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="10dp" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/passwordprompt_text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/passwordprompt_pass"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:inputType="textPassword">
|
||||||
|
|
||||||
|
<requestFocus />
|
||||||
|
|
||||||
|
</EditText>
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -134,6 +134,13 @@
|
||||||
android:layout_marginRight="30dp"
|
android:layout_marginRight="30dp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:text="@string/overview_quickwizard_item_remove_button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/treatments_remove"
|
||||||
|
android:textAlignment="viewEnd"
|
||||||
|
android:textColor="@android:color/holo_orange_light" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
|
@ -246,7 +246,7 @@
|
||||||
<string name="overview_bolusprogress_stoppressed">НАТИСНАТ СТОП</string>
|
<string name="overview_bolusprogress_stoppressed">НАТИСНАТ СТОП</string>
|
||||||
<string name="openapsma_target_bg">КЗ цел за изчисления</string>
|
<string name="openapsma_target_bg">КЗ цел за изчисления</string>
|
||||||
<string name="pumpbusy">Помпата е заета</string>
|
<string name="pumpbusy">Помпата е заета</string>
|
||||||
<string name="waitingforpump">Изчаква за помпа</string>
|
<string name="waitingforpumpclicktorefresh">Изчаква за помпа. Click to refresh.</string>
|
||||||
<string name="wrongpumppassword">Грешна парола за помпата!</string>
|
<string name="wrongpumppassword">Грешна парола за помпата!</string>
|
||||||
<string name="youareonallowedlimit">Достигнахте лимита</string>
|
<string name="youareonallowedlimit">Достигнахте лимита</string>
|
||||||
<string name="danar_alarm">аларма</string>
|
<string name="danar_alarm">аларма</string>
|
||||||
|
@ -434,4 +434,5 @@
|
||||||
<string name="sms_delta">Delta:</string>
|
<string name="sms_delta">Delta:</string>
|
||||||
<string name="sms_iob">IOB:</string>
|
<string name="sms_iob">IOB:</string>
|
||||||
<string name="sms_minago" formatted="false">%dmin ago</string>
|
<string name="sms_minago" formatted="false">%dmin ago</string>
|
||||||
|
<string name="waitingforpump">Изчаква за помпа</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -249,7 +249,7 @@
|
||||||
<string name="danar_glucose">glykémie</string>
|
<string name="danar_glucose">glykémie</string>
|
||||||
<string name="danar_history">Historie</string>
|
<string name="danar_history">Historie</string>
|
||||||
<string name="danar_history_alarm">Alarmy</string>
|
<string name="danar_history_alarm">Alarmy</string>
|
||||||
<string name="danar_history_basalhours">Hodinvé bazály</string>
|
<string name="danar_history_basalhours">Hodinové bazály</string>
|
||||||
<string name="danar_history_bolus">Bolusy</string>
|
<string name="danar_history_bolus">Bolusy</string>
|
||||||
<string name="danar_history_carbohydrates">Sacharidy</string>
|
<string name="danar_history_carbohydrates">Sacharidy</string>
|
||||||
<string name="danar_history_connectingfor" formatted="false">Připojování %d sec</string>
|
<string name="danar_history_connectingfor" formatted="false">Připojování %d sec</string>
|
||||||
|
@ -271,7 +271,7 @@
|
||||||
<string name="overview_bolusprogress_stop">Stop</string>
|
<string name="overview_bolusprogress_stop">Stop</string>
|
||||||
<string name="overview_bolusprogress_stoped">Zastaveno</string>
|
<string name="overview_bolusprogress_stoped">Zastaveno</string>
|
||||||
<string name="overview_bolusprogress_stoppressed">STISKNUTO STOP</string>
|
<string name="overview_bolusprogress_stoppressed">STISKNUTO STOP</string>
|
||||||
<string name="waitingforpump">Čekání na pumpu</string>
|
<string name="waitingforpumpclicktorefresh">Čekání na pumpu. Klik pro připojení.</string>
|
||||||
<string name="overview_bolusprogress_goingtodeliver" formatted="false">Podávání %.2fU inzulínu</string>
|
<string name="overview_bolusprogress_goingtodeliver" formatted="false">Podávání %.2fU inzulínu</string>
|
||||||
<string name="objectives_0_gate">Zkontrolovat, zda jsou glykémie a údaje z pumpy viditelné v Nightscoutu</string>
|
<string name="objectives_0_gate">Zkontrolovat, zda jsou glykémie a údaje z pumpy viditelné v Nightscoutu</string>
|
||||||
<string name="objectives_0_objective">Nastavit vizualizaci a monitoring, analyzovat bazály a koeficienty</string>
|
<string name="objectives_0_objective">Nastavit vizualizaci a monitoring, analyzovat bazály a koeficienty</string>
|
||||||
|
@ -457,6 +457,25 @@
|
||||||
<string name="xdripnotinstalled">xDrip+ není nainstalován</string>
|
<string name="xdripnotinstalled">xDrip+ není nainstalován</string>
|
||||||
<string name="smscommunicator_calibrationfailed">xDrip nepřijímá kalibrace</string>
|
<string name="smscommunicator_calibrationfailed">xDrip nepřijímá kalibrace</string>
|
||||||
<string name="smscommunicator_calibrationreplywithcode" formatted="false">Odeslání kalibrace %.2f potvrďte kódem %s</string>
|
<string name="smscommunicator_calibrationreplywithcode" formatted="false">Odeslání kalibrace %.2f potvrďte kódem %s</string>
|
||||||
<string name="smscommunicator_calibrationsent">Kalibrace odeslána</string>
|
<string name="smscommunicator_calibrationsent">Kalibrace odeslána. Příjem musí být v xDripu povolený.</string>
|
||||||
<string name="smscommunicator_remotecalibrationnotallowed">Vzdálené kalibrace nejsou povoleny</string>
|
<string name="smscommunicator_remotecalibrationnotallowed">Vzdálené kalibrace nejsou povoleny</string>
|
||||||
|
<string name="disconnecting">Odpojuji</string>
|
||||||
|
<string name="dont_show_again">Nezobrazovat znovu</string>
|
||||||
|
<string name="executing">Provádím</string>
|
||||||
|
<string name="gettingpumpstatus">Načítám stav pumpy</string>
|
||||||
|
<string name="pumpsuspended">Pumpa vypnuta</string>
|
||||||
|
<string name="pumpsuspendedclicktorefresh">Pumpa vypnuta. Klik pro obnovení stavu</string>
|
||||||
|
<string name="settingextendedbolus">Nastavuji extended bolus</string>
|
||||||
|
<string name="settingtempbasal">Nastavuji dočasný bazál</string>
|
||||||
|
<string name="stoppingextendedbolus">Zastavuji extended bolus</string>
|
||||||
|
<string name="stoppingtempbasal">Zastavuji dočasný bazál</string>
|
||||||
|
<string name="updatingbasalrates">Aktualizuji bazály</string>
|
||||||
|
<string name="bolusrequested">Spouštím dodávání %.2fU</string>
|
||||||
|
<string name="waitingforpump">Čekání na pumpu</string>
|
||||||
|
<string name="settings_password">Heslo do nastavení</string>
|
||||||
|
<string name="virtualpump_settings">Nastavení virtuální pumpy</string>
|
||||||
|
<string name="virtualpump_uploadstatus_title">Nahrávat status do NS</string>
|
||||||
|
<string name="wrongpassword">Chybné heslo</string>
|
||||||
|
<string name="unlock_settings">Odemknout nastavení</string>
|
||||||
|
<string name="approachingdailylimit">Blíží se denní limit inzulínu</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -242,7 +242,7 @@
|
||||||
<string name="ko_lang">Korean</string>
|
<string name="ko_lang">Korean</string>
|
||||||
<string name="youareonallowedlimit">Limit erreicht</string>
|
<string name="youareonallowedlimit">Limit erreicht</string>
|
||||||
<string name="wrongpumppassword">Falsches Pumpen-Passwort!</string>
|
<string name="wrongpumppassword">Falsches Pumpen-Passwort!</string>
|
||||||
<string name="waitingforpump">Warte auf Pumpe</string>
|
<string name="waitingforpumpclicktorefresh">Warte auf Pumpe. Click to refresh.</string>
|
||||||
<string name="correctionbous">Korr</string>
|
<string name="correctionbous">Korr</string>
|
||||||
<string name="bolusdelivering">Abgabe %.2fU</string>
|
<string name="bolusdelivering">Abgabe %.2fU</string>
|
||||||
<string name="bolusdelivered">%.2fU Bolus erfolgreich abgegeben</string>
|
<string name="bolusdelivered">%.2fU Bolus erfolgreich abgegeben</string>
|
||||||
|
@ -332,4 +332,6 @@
|
||||||
<string name="error_field_must_not_be_empty">Pflichtfeld</string>
|
<string name="error_field_must_not_be_empty">Pflichtfeld</string>
|
||||||
<string name="error_phone_not_valid">Telefonnummer ist nicht gültig.</string>
|
<string name="error_phone_not_valid">Telefonnummer ist nicht gültig.</string>
|
||||||
<string name="error_only_numeric_digits_range_allowed">Bitte verwenden Sie nur Ziffern von %1$s - %2$s</string>
|
<string name="error_only_numeric_digits_range_allowed">Bitte verwenden Sie nur Ziffern von %1$s - %2$s</string>
|
||||||
|
<string name="waitingforpump">Warte auf Pumpe</string>
|
||||||
|
<string name="wear"></string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -283,7 +283,7 @@
|
||||||
<string name="occlusion">Oclusión</string>
|
<string name="occlusion">Oclusión</string>
|
||||||
<string name="overview_bolusprogress_stop">Detener</string>
|
<string name="overview_bolusprogress_stop">Detener</string>
|
||||||
<string name="overview_bolusprogress_stoppressed">Parar pulsado</string>
|
<string name="overview_bolusprogress_stoppressed">Parar pulsado</string>
|
||||||
<string name="waitingforpump">Esperando bomba</string>
|
<string name="waitingforpumpclicktorefresh">Esperando bomba. Click to refresh.</string>
|
||||||
<string formatted="false" name="overview_bolusprogress_goingtodeliver">Va a entregar% .2fU</string>
|
<string formatted="false" name="overview_bolusprogress_goingtodeliver">Va a entregar% .2fU</string>
|
||||||
<string name="objectives_0_objective">Configuración de visualización y monitoreo, y el análisis de los basales y ratios</string>
|
<string name="objectives_0_objective">Configuración de visualización y monitoreo, y el análisis de los basales y ratios</string>
|
||||||
<string name="objectives_0_gate">Comprobar que los datos de BG están disponibles en Nightscout, y que los datos de la bomba de insulina se están subiendo</string>
|
<string name="objectives_0_gate">Comprobar que los datos de BG están disponibles en Nightscout, y que los datos de la bomba de insulina se están subiendo</string>
|
||||||
|
@ -405,4 +405,5 @@
|
||||||
<string name="error_only_numeric_digits_range_allowed">Sólo se permiten dígitos en el rango %1$s - %2$s</string>
|
<string name="error_only_numeric_digits_range_allowed">Sólo se permiten dígitos en el rango %1$s - %2$s</string>
|
||||||
<string name="error_field_must_not_be_empty">Este campo no puede estar vacío</string>
|
<string name="error_field_must_not_be_empty">Este campo no puede estar vacío</string>
|
||||||
<string name="error_phone_not_valid">Número de teléfono inválido</string>
|
<string name="error_phone_not_valid">Número de teléfono inválido</string>
|
||||||
|
<string name="waitingforpump">Esperando bomba</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -286,7 +286,7 @@
|
||||||
<string name="occlusion">막힘</string>
|
<string name="occlusion">막힘</string>
|
||||||
<string name="overview_bolusprogress_stop">정지</string>
|
<string name="overview_bolusprogress_stop">정지</string>
|
||||||
<string name="overview_bolusprogress_stoppressed">정지 누름</string>
|
<string name="overview_bolusprogress_stoppressed">정지 누름</string>
|
||||||
<string name="waitingforpump">펌프를 기다리고 있습니다.</string>
|
<string name="waitingforpumpclicktorefresh">펌프를 기다리고 있습니다. Click to refresh.</string>
|
||||||
<string name="overview_bolusprogress_goingtodeliver" formatted="false">%.2fU을 주입합니다</string>
|
<string name="overview_bolusprogress_goingtodeliver" formatted="false">%.2fU을 주입합니다</string>
|
||||||
<string name="objectives_0_objective">나이트스카우트를 세팅하고, 기초주입과 비율을 분석한다.</string>
|
<string name="objectives_0_objective">나이트스카우트를 세팅하고, 기초주입과 비율을 분석한다.</string>
|
||||||
<string name="objectives_0_gate">나이트스카우트에서 혈당 데이터가 잘 들어오는지, 펌프데이터가 업로드 되는지 확인한다.</string>
|
<string name="objectives_0_gate">나이트스카우트에서 혈당 데이터가 잘 들어오는지, 펌프데이터가 업로드 되는지 확인한다.</string>
|
||||||
|
@ -402,4 +402,5 @@
|
||||||
<string name="error_only_numeric_digits_allowed">숫자만 입력가능합니다.</string>
|
<string name="error_only_numeric_digits_allowed">숫자만 입력가능합니다.</string>
|
||||||
<string name="error_only_numeric_digits_range_allowed">이 범위(%1$s - %2$s)안에 해당하는 숫자만 입력가능합니다.</string>
|
<string name="error_only_numeric_digits_range_allowed">이 범위(%1$s - %2$s)안에 해당하는 숫자만 입력가능합니다.</string>
|
||||||
<string name="error_phone_not_valid">유효한 도메인 이름이 아닙니다.</string>
|
<string name="error_phone_not_valid">유효한 도메인 이름이 아닙니다.</string>
|
||||||
|
<string name="waitingforpump">펌프를 기다리고 있습니다</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -303,6 +303,7 @@
|
||||||
<string name="overview_bolusprogress_stop">Stop</string>
|
<string name="overview_bolusprogress_stop">Stop</string>
|
||||||
<string name="overview_bolusprogress_stoppressed">STOP PRESSED</string>
|
<string name="overview_bolusprogress_stoppressed">STOP PRESSED</string>
|
||||||
<string name="waitingforpump">Waiting for pump</string>
|
<string name="waitingforpump">Waiting for pump</string>
|
||||||
|
<string name="waitingforpumpclicktorefresh">Waiting for pump. Click to refresh.</string>
|
||||||
<string name="overview_bolusprogress_goingtodeliver" formatted="false">Going to deliver %.2fU</string>
|
<string name="overview_bolusprogress_goingtodeliver" formatted="false">Going to deliver %.2fU</string>
|
||||||
<string name="objectives_0_objective">Setting up visualization and monitoring, and analyzing basals and ratios</string>
|
<string name="objectives_0_objective">Setting up visualization and monitoring, and analyzing basals and ratios</string>
|
||||||
<string name="objectives_0_gate">Verify that BG is available in Nightscout, and pump insulin data is being uploaded</string>
|
<string name="objectives_0_gate">Verify that BG is available in Nightscout, and pump insulin data is being uploaded</string>
|
||||||
|
@ -487,7 +488,23 @@
|
||||||
<string name="xdripnotinstalled">xDrip+ not installed</string>
|
<string name="xdripnotinstalled">xDrip+ not installed</string>
|
||||||
<string name="calibrationsent">Calibration sent to xDrip</string>
|
<string name="calibrationsent">Calibration sent to xDrip</string>
|
||||||
<string name="smscommunicator_remotecalibrationnotallowed">Remote calibration not allowed</string>
|
<string name="smscommunicator_remotecalibrationnotallowed">Remote calibration not allowed</string>
|
||||||
<string name="smscommunicator_calibrationsent">Calibration sent</string>
|
<string name="smscommunicator_calibrationsent">Calibration sent. Receiving must be enabled in xDrip.</string>
|
||||||
<string name="smscommunicator_calibrationfailed">xDrip is not receiving calibrations</string>
|
<string name="smscommunicator_calibrationfailed">xDrip is not receiving calibrations</string>
|
||||||
<string name="dont_show_again">Don\'t show again</string>
|
<string name="dont_show_again">Don\'t show again</string>
|
||||||
|
<string name="pumpsuspendedclicktorefresh">Pump suspended. Click to refresh state</string>
|
||||||
|
<string name="pumpsuspended">Pump suspended</string>
|
||||||
|
<string name="gettingpumpstatus">Getting pump status</string>
|
||||||
|
<string name="settingtempbasal">Setting temp basal</string>
|
||||||
|
<string name="stoppingtempbasal">Stopping temp basal</string>
|
||||||
|
<string name="settingextendedbolus">Setting extended bolus</string>
|
||||||
|
<string name="stoppingextendedbolus">Stopping extended bolus</string>
|
||||||
|
<string name="updatingbasalrates">Updating basal rates</string>
|
||||||
|
<string name="disconnecting">Disconnecting</string>
|
||||||
|
<string name="executing">Executing</string>
|
||||||
|
<string name="virtualpump_settings">Virtual pump settings</string>
|
||||||
|
<string name="virtualpump_uploadstatus_title">Upload status to NS</string>
|
||||||
|
<string name="wrongpassword">Wrong password</string>
|
||||||
|
<string name="settings_password">Password for settings</string>
|
||||||
|
<string name="unlock_settings">Unlock settings</string>
|
||||||
|
<string name="approachingdailylimit">Approaching insulin daily limit</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
14
app/src/main/res/xml/pref_password.xml
Normal file
14
app/src/main/res/xml/pref_password.xml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<PreferenceCategory
|
||||||
|
android:key="password"
|
||||||
|
android:title="@string/settings_password">
|
||||||
|
|
||||||
|
<EditTextPreference
|
||||||
|
android:title="@string/settings_password"
|
||||||
|
android:key="settings_password"
|
||||||
|
android:inputType="textPassword">
|
||||||
|
</EditTextPreference>
|
||||||
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
</PreferenceScreen>
|
13
app/src/main/res/xml/pref_virtualpump.xml
Normal file
13
app/src/main/res/xml/pref_virtualpump.xml
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<PreferenceCategory
|
||||||
|
android:key="virtualpump"
|
||||||
|
android:title="@string/virtualpump_settings">
|
||||||
|
|
||||||
|
<SwitchPreference
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:key="virtualpump_uploadstatus"
|
||||||
|
android:title="@string/virtualpump_uploadstatus_title" />
|
||||||
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
</PreferenceScreen>
|
Loading…
Reference in a new issue