Merge remote-tracking branch 'origin/dev' into combo-scripter-v2
* origin/dev: Remove dead code. Ctors Android-style. Fix NPE initialising MyPreferencesFragment. RS fix last bolus time RS remove duplicated message RS fix extended bolus result show timeshift if not zero CS translation removed unneeded code long click on name to open settings add link to advanced settings # Conflicts: # app/src/main/java/info/nightscout/androidaps/PreferencesActivity.java
This commit is contained in:
commit
9459dfe321
|
@ -1,11 +1,9 @@
|
||||||
package info.nightscout.androidaps;
|
package info.nightscout.androidaps;
|
||||||
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.EditTextPreference;
|
import android.preference.EditTextPreference;
|
||||||
import android.preference.ListPreference;
|
import android.preference.ListPreference;
|
||||||
import android.preference.MultiSelectListPreference;
|
|
||||||
import android.preference.Preference;
|
import android.preference.Preference;
|
||||||
import android.preference.PreferenceActivity;
|
import android.preference.PreferenceActivity;
|
||||||
import android.preference.PreferenceFragment;
|
import android.preference.PreferenceFragment;
|
||||||
|
@ -24,7 +22,6 @@ import info.nightscout.androidaps.plugins.NSClientInternal.NSClientInternalPlugi
|
||||||
import info.nightscout.androidaps.plugins.OpenAPSAMA.OpenAPSAMAPlugin;
|
import info.nightscout.androidaps.plugins.OpenAPSAMA.OpenAPSAMAPlugin;
|
||||||
import info.nightscout.androidaps.plugins.OpenAPSMA.OpenAPSMAPlugin;
|
import info.nightscout.androidaps.plugins.OpenAPSMA.OpenAPSMAPlugin;
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ComboPlugin;
|
import info.nightscout.androidaps.plugins.PumpCombo.ComboPlugin;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.BluetoothDevicePreference;
|
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPlugin;
|
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPlugin;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaRKorean.DanaRKoreanPlugin;
|
import info.nightscout.androidaps.plugins.PumpDanaRKorean.DanaRKoreanPlugin;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaRS.DanaRSPlugin;
|
import info.nightscout.androidaps.plugins.PumpDanaRS.DanaRSPlugin;
|
||||||
|
@ -73,7 +70,7 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void updatePrefSummary(Preference pref) {
|
private static void updatePrefSummary(Preference pref) {
|
||||||
if (pref instanceof ListPreference || pref instanceof BluetoothDevicePreference) {
|
if (pref instanceof ListPreference) {
|
||||||
ListPreference listPref = (ListPreference) pref;
|
ListPreference listPref = (ListPreference) pref;
|
||||||
pref.setSummary(listPref.getEntry());
|
pref.setSummary(listPref.getEntry());
|
||||||
}
|
}
|
||||||
|
@ -86,14 +83,10 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
|
||||||
} 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());
|
||||||
pref.setSummary(editTextPref.getText());
|
pref.setSummary(editTextPref.getText());
|
||||||
} else if (pref.getKey().contains("smscommunicator_allowednumbers") && TextUtils.isEmpty(editTextPref.getText().toString().trim())) {
|
} else if (pref.getKey().contains("smscommunicator_allowednumbers") && TextUtils.isEmpty(editTextPref.getText().trim())) {
|
||||||
pref.setSummary(MainApp.sResources.getString(R.string.smscommunicator_allowednumbers_summary));
|
pref.setSummary(MainApp.sResources.getString(R.string.smscommunicator_allowednumbers_summary));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pref instanceof MultiSelectListPreference) {
|
|
||||||
EditTextPreference editTextPref = (EditTextPreference) pref;
|
|
||||||
pref.setSummary(editTextPref.getText());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void initSummary(Preference p) {
|
public static void initSummary(Preference p) {
|
||||||
|
@ -125,8 +118,13 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
|
||||||
public void onCreate(final Bundle savedInstanceState) {
|
public void onCreate(final Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
if (savedInstanceState != null && savedInstanceState.containsKey("id")) {
|
||||||
|
id = savedInstanceState.getInt("id");
|
||||||
|
}
|
||||||
|
|
||||||
if (id != -1) {
|
if (id != -1) {
|
||||||
addPreferencesFromResource(id);
|
addPreferencesFromResource(id);
|
||||||
|
addPreferencesFromResource(R.xml.pref_advanced);
|
||||||
} else {
|
} else {
|
||||||
if (!Config.NSCLIENT) {
|
if (!Config.NSCLIENT) {
|
||||||
addPreferencesFromResource(R.xml.pref_password);
|
addPreferencesFromResource(R.xml.pref_password);
|
||||||
|
@ -190,6 +188,12 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
|
||||||
initSummary(getPreferenceScreen());
|
initSummary(getPreferenceScreen());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSaveInstanceState(Bundle outState) {
|
||||||
|
super.onSaveInstanceState(outState);
|
||||||
|
outState.putInt("id", id);
|
||||||
|
}
|
||||||
|
|
||||||
public Preference getPreference(String key) {
|
public Preference getPreference(String key) {
|
||||||
return findPreference(key);
|
return findPreference(key);
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,10 @@ public class ProfileSwitch implements Interval, DataPointWithLabelInterface {
|
||||||
name = DecimalFormatter.to2Decimal(getProfileObject().percentageBasalSum()) + "U ";
|
name = DecimalFormatter.to2Decimal(getProfileObject().percentageBasalSum()) + "U ";
|
||||||
}
|
}
|
||||||
if (isCPP) {
|
if (isCPP) {
|
||||||
name += "(" + percentage + "%," + timeshift + "h)";
|
name += "(" + percentage + "%";
|
||||||
|
if (timeshift != 0)
|
||||||
|
name += "," + timeshift + "h";
|
||||||
|
name += ")";
|
||||||
}
|
}
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
|
@ -270,6 +270,23 @@ public class ConfigBuilderFragment extends Fragment {
|
||||||
}, null);
|
}, null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
holder.name.setOnLongClickListener(new View.OnLongClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onLongClick(View v) {
|
||||||
|
final PluginBase plugin = (PluginBase) v.getTag();
|
||||||
|
PasswordProtection.QueryPassword(getContext(), R.string.settings_password, "settings_password", new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
Intent i = new Intent(getContext(), PreferencesActivity.class);
|
||||||
|
i.putExtra("id", plugin.getPreferencesId());
|
||||||
|
startActivity(i);
|
||||||
|
}
|
||||||
|
}, null);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
holder = (PluginViewHolder) view.getTag();
|
holder = (PluginViewHolder) view.getTag();
|
||||||
}
|
}
|
||||||
|
|
|
@ -553,7 +553,7 @@ public class DanaRPlugin implements PluginBase, PumpInterface, DanaRInterface, C
|
||||||
insulin = configBuilderPlugin.applyBolusConstraints(insulin);
|
insulin = configBuilderPlugin.applyBolusConstraints(insulin);
|
||||||
// needs to be rounded
|
// needs to be rounded
|
||||||
int durationInHalfHours = Math.max(durationInMinutes / 30, 1);
|
int durationInHalfHours = Math.max(durationInMinutes / 30, 1);
|
||||||
insulin = Round.roundTo(insulin, getPumpDescription().extendedBolusStep * (1 + durationInHalfHours % 1));
|
insulin = Round.roundTo(insulin, getPumpDescription().extendedBolusStep);
|
||||||
|
|
||||||
PumpEnactResult result = new PumpEnactResult();
|
PumpEnactResult result = new PumpEnactResult();
|
||||||
ExtendedBolus runningEB = MainApp.getConfigBuilder().getExtendedBolusFromHistory(System.currentTimeMillis());
|
ExtendedBolus runningEB = MainApp.getConfigBuilder().getExtendedBolusFromHistory(System.currentTimeMillis());
|
||||||
|
|
|
@ -550,7 +550,7 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, DanaRInterf
|
||||||
insulin = configBuilderPlugin.applyBolusConstraints(insulin);
|
insulin = configBuilderPlugin.applyBolusConstraints(insulin);
|
||||||
// needs to be rounded
|
// needs to be rounded
|
||||||
int durationInHalfHours = Math.max(durationInMinutes / 30, 1);
|
int durationInHalfHours = Math.max(durationInMinutes / 30, 1);
|
||||||
insulin = Round.roundTo(insulin, getPumpDescription().extendedBolusStep * (1 + durationInHalfHours % 1));
|
insulin = Round.roundTo(insulin, getPumpDescription().extendedBolusStep);
|
||||||
|
|
||||||
PumpEnactResult result = new PumpEnactResult();
|
PumpEnactResult result = new PumpEnactResult();
|
||||||
ExtendedBolus runningEB = MainApp.getConfigBuilder().getExtendedBolusFromHistory(System.currentTimeMillis());
|
ExtendedBolus runningEB = MainApp.getConfigBuilder().getExtendedBolusFromHistory(System.currentTimeMillis());
|
||||||
|
|
|
@ -674,7 +674,7 @@ public class DanaRSPlugin implements PluginBase, PumpInterface, DanaRInterface,
|
||||||
insulin = configBuilderPlugin.applyBolusConstraints(insulin);
|
insulin = configBuilderPlugin.applyBolusConstraints(insulin);
|
||||||
// needs to be rounded
|
// needs to be rounded
|
||||||
int durationInHalfHours = Math.max(durationInMinutes / 30, 1);
|
int durationInHalfHours = Math.max(durationInMinutes / 30, 1);
|
||||||
insulin = Round.roundTo(insulin, getPumpDescription().extendedBolusStep * (1 + durationInHalfHours % 1));
|
insulin = Round.roundTo(insulin, getPumpDescription().extendedBolusStep);
|
||||||
PumpEnactResult result = new PumpEnactResult();
|
PumpEnactResult result = new PumpEnactResult();
|
||||||
ExtendedBolus runningEB = MainApp.getConfigBuilder().getExtendedBolusFromHistory(System.currentTimeMillis());
|
ExtendedBolus runningEB = MainApp.getConfigBuilder().getExtendedBolusFromHistory(System.currentTimeMillis());
|
||||||
if (runningEB != null && Math.abs(runningEB.insulin - insulin) < getPumpDescription().extendedBolusStep) {
|
if (runningEB != null && Math.abs(runningEB.insulin - insulin) < getPumpDescription().extendedBolusStep) {
|
||||||
|
|
|
@ -33,14 +33,14 @@ public class DanaRS_Packet_Bolus_Get_Step_Bolus_Information extends DanaRS_Packe
|
||||||
dataSize = 2;
|
dataSize = 2;
|
||||||
pump.initialBolusAmount = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100d;
|
pump.initialBolusAmount = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100d;
|
||||||
|
|
||||||
Date lastBolusTime = new Date(); // it doesn't provide day only hour+min, workaround: expecting today
|
pump.lastBolusTime = new Date(); // it doesn't provide day only hour+min, workaround: expecting today
|
||||||
dataIndex += dataSize;
|
dataIndex += dataSize;
|
||||||
dataSize = 1;
|
dataSize = 1;
|
||||||
lastBolusTime.setHours(byteArrayToInt(getBytes(data, dataIndex, dataSize)));
|
pump.lastBolusTime.setHours(byteArrayToInt(getBytes(data, dataIndex, dataSize)));
|
||||||
|
|
||||||
dataIndex += dataSize;
|
dataIndex += dataSize;
|
||||||
dataSize = 1;
|
dataSize = 1;
|
||||||
lastBolusTime.setMinutes(byteArrayToInt(getBytes(data, dataIndex, dataSize)));
|
pump.lastBolusTime.setMinutes(byteArrayToInt(getBytes(data, dataIndex, dataSize)));
|
||||||
|
|
||||||
dataIndex += dataSize;
|
dataIndex += dataSize;
|
||||||
dataSize = 2;
|
dataSize = 2;
|
||||||
|
@ -58,7 +58,7 @@ public class DanaRS_Packet_Bolus_Get_Step_Bolus_Information extends DanaRS_Packe
|
||||||
log.debug("Result: " + error);
|
log.debug("Result: " + error);
|
||||||
log.debug("BolusType: " + bolusType);
|
log.debug("BolusType: " + bolusType);
|
||||||
log.debug("Initial bolus amount: " + pump.initialBolusAmount + " U");
|
log.debug("Initial bolus amount: " + pump.initialBolusAmount + " U");
|
||||||
log.debug("Last bolus time: " + lastBolusTime.toLocaleString());
|
log.debug("Last bolus time: " + pump.lastBolusTime.toLocaleString());
|
||||||
log.debug("Last bolus amount: " + pump.lastBolusAmount);
|
log.debug("Last bolus amount: " + pump.lastBolusAmount);
|
||||||
log.debug("Max bolus: " + pump.maxBolus + " U");
|
log.debug("Max bolus: " + pump.maxBolus + " U");
|
||||||
log.debug("Bolus step: " + pump.bolusStep + " U");
|
log.debug("Bolus step: " + pump.bolusStep + " U");
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class DanaRS_Packet_Bolus_Set_Extended_Bolus extends DanaRS_Packet {
|
||||||
public void handleMessage(byte[] data) {
|
public void handleMessage(byte[] data) {
|
||||||
int result = intFromBuff(data, 0, 1);
|
int result = intFromBuff(data, 0, 1);
|
||||||
if (Config.logDanaMessageDetail) {
|
if (Config.logDanaMessageDetail) {
|
||||||
if (result == 0)
|
if (result != 0)
|
||||||
log.debug("Result OK");
|
log.debug("Result OK");
|
||||||
else
|
else
|
||||||
log.error("Result Error: " + result);
|
log.error("Result Error: " + result);
|
||||||
|
|
|
@ -130,7 +130,7 @@ public class DanaRSService extends Service {
|
||||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.gettingextendedbolusstatus)));
|
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.gettingextendedbolusstatus)));
|
||||||
bleComm.sendMessage(new DanaRS_Packet_Bolus_Get_Extended_Bolus_State());
|
bleComm.sendMessage(new DanaRS_Packet_Bolus_Get_Extended_Bolus_State());
|
||||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.gettingbolusstatus)));
|
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.gettingbolusstatus)));
|
||||||
bleComm.sendMessage(new DanaRS_Packet_Bolus_Get_Step_Bolus_Information()); // last bolus
|
bleComm.sendMessage(new DanaRS_Packet_Bolus_Get_Step_Bolus_Information()); // last bolus, bolusStep, maxBolus
|
||||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.gettingtempbasalstatus)));
|
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.gettingtempbasalstatus)));
|
||||||
bleComm.sendMessage(new DanaRS_Packet_Basal_Get_Temporary_Basal_State());
|
bleComm.sendMessage(new DanaRS_Packet_Basal_Get_Temporary_Basal_State());
|
||||||
|
|
||||||
|
@ -141,7 +141,6 @@ public class DanaRSService extends Service {
|
||||||
bleComm.sendMessage(new DanaRS_Packet_General_Get_Pump_Check()); // firmware
|
bleComm.sendMessage(new DanaRS_Packet_General_Get_Pump_Check()); // firmware
|
||||||
bleComm.sendMessage(new DanaRS_Packet_Basal_Get_Profile_Number());
|
bleComm.sendMessage(new DanaRS_Packet_Basal_Get_Profile_Number());
|
||||||
bleComm.sendMessage(new DanaRS_Packet_Bolus_Get_Bolus_Option()); // isExtendedEnabled
|
bleComm.sendMessage(new DanaRS_Packet_Bolus_Get_Bolus_Option()); // isExtendedEnabled
|
||||||
bleComm.sendMessage(new DanaRS_Packet_Bolus_Get_Step_Bolus_Information()); // bolusStep, maxBolus
|
|
||||||
bleComm.sendMessage(new DanaRS_Packet_Basal_Get_Basal_Rate()); // basal profile, basalStep, maxBasal
|
bleComm.sendMessage(new DanaRS_Packet_Basal_Get_Basal_Rate()); // basal profile, basalStep, maxBasal
|
||||||
bleComm.sendMessage(new DanaRS_Packet_Bolus_Get_Calculation_Information()); // target
|
bleComm.sendMessage(new DanaRS_Packet_Bolus_Get_Calculation_Information()); // target
|
||||||
bleComm.sendMessage(new DanaRS_Packet_Bolus_Get_CIR_CF_Array());
|
bleComm.sendMessage(new DanaRS_Packet_Bolus_Get_CIR_CF_Array());
|
||||||
|
|
|
@ -513,7 +513,7 @@ public class DanaRv2Plugin implements PluginBase, PumpInterface, DanaRInterface,
|
||||||
insulin = configBuilderPlugin.applyBolusConstraints(insulin);
|
insulin = configBuilderPlugin.applyBolusConstraints(insulin);
|
||||||
// needs to be rounded
|
// needs to be rounded
|
||||||
int durationInHalfHours = Math.max(durationInMinutes / 30, 1);
|
int durationInHalfHours = Math.max(durationInMinutes / 30, 1);
|
||||||
insulin = Round.roundTo(insulin, getPumpDescription().extendedBolusStep * (1 + durationInHalfHours % 1));
|
insulin = Round.roundTo(insulin, getPumpDescription().extendedBolusStep);
|
||||||
PumpEnactResult result = new PumpEnactResult();
|
PumpEnactResult result = new PumpEnactResult();
|
||||||
ExtendedBolus runningEB = MainApp.getConfigBuilder().getExtendedBolusFromHistory(System.currentTimeMillis());
|
ExtendedBolus runningEB = MainApp.getConfigBuilder().getExtendedBolusFromHistory(System.currentTimeMillis());
|
||||||
if (runningEB != null && Math.abs(runningEB.insulin - insulin) < getPumpDescription().extendedBolusStep) {
|
if (runningEB != null && Math.abs(runningEB.insulin - insulin) < getPumpDescription().extendedBolusStep) {
|
||||||
|
|
|
@ -663,4 +663,13 @@
|
||||||
<string name="bloodsugarmeasurementalert">Výstraha měření glykémie</string>
|
<string name="bloodsugarmeasurementalert">Výstraha měření glykémie</string>
|
||||||
<string name="connectiontimedout">Vypršel čas připojování</string>
|
<string name="connectiontimedout">Vypršel čas připojování</string>
|
||||||
<string name="treatments_wizard_tt_label">DC</string>
|
<string name="treatments_wizard_tt_label">DC</string>
|
||||||
|
<string name="free_peak_oref">Volitelný vrchol - Oref</string>
|
||||||
|
<string name="nsclientinternal_secret_dialogtitle">NS heslo</string>
|
||||||
|
<string name="nsclientinternal_secret_title">NS heslo (API secret)</string>
|
||||||
|
<string name="processinghistory">Zpracovávám</string>
|
||||||
|
<string name="rapid_acting_oref">Rychle působící - Oref</string>
|
||||||
|
<string name="startingbolus">Spouštím bolus</string>
|
||||||
|
<string name="ultrafastactinginsulincomment">Fiasp</string>
|
||||||
|
<string name="ultrarapid_oref">Ultra rychlý - Oref</string>
|
||||||
|
<string name="waitingforestimatedbolusend" formatted="false">Čekání na konec bolusu. Zbývá %d sek.</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -757,7 +757,7 @@
|
||||||
<string name="shortprotein">Pr</string>
|
<string name="shortprotein">Pr</string>
|
||||||
<string name="shortfat">Fat</string>
|
<string name="shortfat">Fat</string>
|
||||||
<string name="active"><![CDATA[<Active>]]></string>
|
<string name="active"><![CDATA[<Active>]]></string>
|
||||||
<string name="waitingforestimatedbolusend" formatted="false">Waiting for estimated bolus end. Remaining %d sec.</string>
|
<string name="waitingforestimatedbolusend" formatted="false">Waiting for bolus end. Remaining %d sec.</string>
|
||||||
<string name="processinghistory">Processing event</string>
|
<string name="processinghistory">Processing event</string>
|
||||||
<string name="startingbolus">Starting bolus delivery</string>
|
<string name="startingbolus">Starting bolus delivery</string>
|
||||||
<string name="bolusstopping">Stopping bolus delivery</string>
|
<string name="bolusstopping">Stopping bolus delivery</string>
|
||||||
|
|
Loading…
Reference in a new issue