Merge pull request #1120 from schmitzn/sync-butterknife-eventbus
Synchronize Butterknife / Eventbus (#1090)
This commit is contained in:
commit
9dc667817b
5 changed files with 197 additions and 125 deletions
|
@ -176,13 +176,19 @@ public class HistoryBrowseActivity extends AppCompatActivity {
|
||||||
activity.runOnUiThread(new Runnable() {
|
activity.runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
updateGUI("EventAutosensCalculationFinished");
|
synchronized (HistoryBrowseActivity.this) {
|
||||||
|
updateGUI("EventAutosensCalculationFinished");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateGUI(String from) {
|
void updateGUI(String from) {
|
||||||
|
|
||||||
|
if (noProfile == null || buttonDate == null || buttonZoom == null || bgGraph == null || iobGraph == null || seekBar == null)
|
||||||
|
return;
|
||||||
|
|
||||||
final PumpInterface pump = ConfigBuilderPlugin.getActivePump();
|
final PumpInterface pump = ConfigBuilderPlugin.getActivePump();
|
||||||
final Profile profile = MainApp.getConfigBuilder().getProfile();
|
final Profile profile = MainApp.getConfigBuilder().getProfile();
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ public class LoopFragment extends SubscriberFragment {
|
||||||
clearGUI();
|
clearGUI();
|
||||||
final Activity activity = getActivity();
|
final Activity activity = getActivity();
|
||||||
if (activity != null)
|
if (activity != null)
|
||||||
activity.runOnUiThread(() -> lastRunView.setText(ev.text));
|
activity.runOnUiThread(() -> { synchronized (LoopFragment.this) { if (lastRunView != null) lastRunView.setText(ev.text); } });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -89,26 +89,29 @@ public class LoopFragment extends SubscriberFragment {
|
||||||
Activity activity = getActivity();
|
Activity activity = getActivity();
|
||||||
if (activity != null)
|
if (activity != null)
|
||||||
activity.runOnUiThread(() -> {
|
activity.runOnUiThread(() -> {
|
||||||
LoopPlugin.LastRun lastRun = LoopPlugin.lastRun;
|
synchronized (LoopFragment.this) {
|
||||||
if (lastRun != null) {
|
if (!isBound()) return;
|
||||||
requestView.setText(lastRun.request != null ? lastRun.request.toSpanned() : "");
|
LoopPlugin.LastRun lastRun = LoopPlugin.lastRun;
|
||||||
constraintsProcessedView.setText(lastRun.constraintsProcessed != null ? lastRun.constraintsProcessed.toSpanned() : "");
|
if (lastRun != null) {
|
||||||
sourceView.setText(lastRun.source != null ? lastRun.source : "");
|
requestView.setText(lastRun.request != null ? lastRun.request.toSpanned() : "");
|
||||||
lastRunView.setText(lastRun.lastAPSRun != null && lastRun.lastAPSRun.getTime() != 0 ? lastRun.lastAPSRun.toLocaleString() : "");
|
constraintsProcessedView.setText(lastRun.constraintsProcessed != null ? lastRun.constraintsProcessed.toSpanned() : "");
|
||||||
lastEnactView.setText(lastRun.lastEnact != null && lastRun.lastEnact.getTime() != 0 ? lastRun.lastEnact.toLocaleString() : "");
|
sourceView.setText(lastRun.source != null ? lastRun.source : "");
|
||||||
tbrSetByPumpView.setText(lastRun.tbrSetByPump != null ? Html.fromHtml(lastRun.tbrSetByPump.toHtml()) : "");
|
lastRunView.setText(lastRun.lastAPSRun != null && lastRun.lastAPSRun.getTime() != 0 ? lastRun.lastAPSRun.toLocaleString() : "");
|
||||||
smbSetByPumpView.setText(lastRun.smbSetByPump != null ? Html.fromHtml(lastRun.smbSetByPump.toHtml()) : "");
|
lastEnactView.setText(lastRun.lastEnact != null && lastRun.lastEnact.getTime() != 0 ? lastRun.lastEnact.toLocaleString() : "");
|
||||||
|
tbrSetByPumpView.setText(lastRun.tbrSetByPump != null ? Html.fromHtml(lastRun.tbrSetByPump.toHtml()) : "");
|
||||||
|
smbSetByPumpView.setText(lastRun.smbSetByPump != null ? Html.fromHtml(lastRun.smbSetByPump.toHtml()) : "");
|
||||||
|
|
||||||
String constraints = "";
|
String constraints = "";
|
||||||
if (lastRun.constraintsProcessed != null) {
|
if (lastRun.constraintsProcessed != null) {
|
||||||
Constraint<Double> allConstraints = new Constraint<>(0d);
|
Constraint<Double> allConstraints = new Constraint<>(0d);
|
||||||
if (lastRun.constraintsProcessed.rateConstraint != null)
|
if (lastRun.constraintsProcessed.rateConstraint != null)
|
||||||
allConstraints.copyReasons(lastRun.constraintsProcessed.rateConstraint);
|
allConstraints.copyReasons(lastRun.constraintsProcessed.rateConstraint);
|
||||||
if (lastRun.constraintsProcessed.smbConstraint != null)
|
if (lastRun.constraintsProcessed.smbConstraint != null)
|
||||||
allConstraints.copyReasons(lastRun.constraintsProcessed.smbConstraint);
|
allConstraints.copyReasons(lastRun.constraintsProcessed.smbConstraint);
|
||||||
constraints = allConstraints.getMostLimitedReasons();
|
constraints = allConstraints.getMostLimitedReasons();
|
||||||
|
}
|
||||||
|
constraintsView.setText(constraints);
|
||||||
}
|
}
|
||||||
constraintsView.setText(constraints);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -117,13 +120,29 @@ public class LoopFragment extends SubscriberFragment {
|
||||||
Activity activity = getActivity();
|
Activity activity = getActivity();
|
||||||
if (activity != null)
|
if (activity != null)
|
||||||
activity.runOnUiThread(() -> {
|
activity.runOnUiThread(() -> {
|
||||||
requestView.setText("");
|
synchronized (LoopFragment.this) {
|
||||||
constraintsProcessedView.setText("");
|
if (isBound()) {
|
||||||
sourceView.setText("");
|
requestView.setText("");
|
||||||
lastRunView.setText("");
|
constraintsProcessedView.setText("");
|
||||||
lastEnactView.setText("");
|
sourceView.setText("");
|
||||||
tbrSetByPumpView.setText("");
|
lastRunView.setText("");
|
||||||
smbSetByPumpView.setText("");
|
lastEnactView.setText("");
|
||||||
|
tbrSetByPumpView.setText("");
|
||||||
|
smbSetByPumpView.setText("");
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean isBound() {
|
||||||
|
return requestView != null
|
||||||
|
&& constraintsProcessedView != null
|
||||||
|
&& sourceView != null
|
||||||
|
&& lastRunView != null
|
||||||
|
&& lastEnactView != null
|
||||||
|
&& tbrSetByPumpView != null
|
||||||
|
&& smbSetByPumpView != null
|
||||||
|
&& constraintsView != null
|
||||||
|
&& runNowButton != null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,34 +87,37 @@ public class OpenAPSSMBFragment extends SubscriberFragment {
|
||||||
activity.runOnUiThread(new Runnable() {
|
activity.runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
OpenAPSSMBPlugin plugin = OpenAPSSMBPlugin.getPlugin();
|
synchronized (OpenAPSSMBFragment.this) {
|
||||||
DetermineBasalResultSMB lastAPSResult = plugin.lastAPSResult;
|
if (!isBound()) return;
|
||||||
if (lastAPSResult != null) {
|
OpenAPSSMBPlugin plugin = OpenAPSSMBPlugin.getPlugin();
|
||||||
resultView.setText(JSONFormatter.format(lastAPSResult.json));
|
DetermineBasalResultSMB lastAPSResult = plugin.lastAPSResult;
|
||||||
requestView.setText(lastAPSResult.toSpanned());
|
if (lastAPSResult != null) {
|
||||||
}
|
resultView.setText(JSONFormatter.format(lastAPSResult.json));
|
||||||
DetermineBasalAdapterSMBJS determineBasalAdapterSMBJS = plugin.lastDetermineBasalAdapterSMBJS;
|
requestView.setText(lastAPSResult.toSpanned());
|
||||||
if (determineBasalAdapterSMBJS != null) {
|
}
|
||||||
glucoseStatusView.setText(JSONFormatter.format(determineBasalAdapterSMBJS.getGlucoseStatusParam()).toString().trim());
|
DetermineBasalAdapterSMBJS determineBasalAdapterSMBJS = plugin.lastDetermineBasalAdapterSMBJS;
|
||||||
currentTempView.setText(JSONFormatter.format(determineBasalAdapterSMBJS.getCurrentTempParam()).toString().trim());
|
if (determineBasalAdapterSMBJS != null) {
|
||||||
try {
|
glucoseStatusView.setText(JSONFormatter.format(determineBasalAdapterSMBJS.getGlucoseStatusParam()).toString().trim());
|
||||||
JSONArray iobArray = new JSONArray(determineBasalAdapterSMBJS.getIobDataParam());
|
currentTempView.setText(JSONFormatter.format(determineBasalAdapterSMBJS.getCurrentTempParam()).toString().trim());
|
||||||
iobDataView.setText((String.format(MainApp.gs(R.string.array_of_elements), iobArray.length()) + "\n" + JSONFormatter.format(iobArray.getString(0))).trim());
|
try {
|
||||||
} catch (JSONException e) {
|
JSONArray iobArray = new JSONArray(determineBasalAdapterSMBJS.getIobDataParam());
|
||||||
log.error("Unhandled exception", e);
|
iobDataView.setText((String.format(MainApp.gs(R.string.array_of_elements), iobArray.length()) + "\n" + JSONFormatter.format(iobArray.getString(0))).trim());
|
||||||
iobDataView.setText("JSONException see log for details");
|
} catch (JSONException e) {
|
||||||
|
log.error("Unhandled exception", e);
|
||||||
|
iobDataView.setText("JSONException see log for details");
|
||||||
|
}
|
||||||
|
profileView.setText(JSONFormatter.format(determineBasalAdapterSMBJS.getProfileParam()).toString().trim());
|
||||||
|
mealDataView.setText(JSONFormatter.format(determineBasalAdapterSMBJS.getMealDataParam()).toString().trim());
|
||||||
|
scriptdebugView.setText(determineBasalAdapterSMBJS.getScriptDebug().trim());
|
||||||
|
if (lastAPSResult != null && lastAPSResult.inputConstraints != null)
|
||||||
|
constraintsView.setText(lastAPSResult.inputConstraints.getReasons().trim());
|
||||||
|
}
|
||||||
|
if (plugin.lastAPSRun != null) {
|
||||||
|
lastRunView.setText(plugin.lastAPSRun.toLocaleString().trim());
|
||||||
|
}
|
||||||
|
if (plugin.lastAutosensResult != null) {
|
||||||
|
autosensDataView.setText(JSONFormatter.format(plugin.lastAutosensResult.json()).toString().trim());
|
||||||
}
|
}
|
||||||
profileView.setText(JSONFormatter.format(determineBasalAdapterSMBJS.getProfileParam()).toString().trim());
|
|
||||||
mealDataView.setText(JSONFormatter.format(determineBasalAdapterSMBJS.getMealDataParam()).toString().trim());
|
|
||||||
scriptdebugView.setText(determineBasalAdapterSMBJS.getScriptDebug().trim());
|
|
||||||
if (lastAPSResult != null && lastAPSResult.inputConstraints != null)
|
|
||||||
constraintsView.setText(lastAPSResult.inputConstraints.getReasons().trim());
|
|
||||||
}
|
|
||||||
if (plugin.lastAPSRun != null) {
|
|
||||||
lastRunView.setText(plugin.lastAPSRun.toLocaleString().trim());
|
|
||||||
}
|
|
||||||
if (plugin.lastAutosensResult != null) {
|
|
||||||
autosensDataView.setText(JSONFormatter.format(plugin.lastAutosensResult.json()).toString().trim());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -126,17 +129,36 @@ public class OpenAPSSMBFragment extends SubscriberFragment {
|
||||||
activity.runOnUiThread(new Runnable() {
|
activity.runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
resultView.setText(text);
|
synchronized (OpenAPSSMBFragment.this) {
|
||||||
glucoseStatusView.setText("");
|
if (isBound()) {
|
||||||
currentTempView.setText("");
|
resultView.setText(text);
|
||||||
iobDataView.setText("");
|
glucoseStatusView.setText("");
|
||||||
profileView.setText("");
|
currentTempView.setText("");
|
||||||
mealDataView.setText("");
|
iobDataView.setText("");
|
||||||
autosensDataView.setText("");
|
profileView.setText("");
|
||||||
scriptdebugView.setText("");
|
mealDataView.setText("");
|
||||||
requestView.setText("");
|
autosensDataView.setText("");
|
||||||
lastRunView.setText("");
|
scriptdebugView.setText("");
|
||||||
|
requestView.setText("");
|
||||||
|
lastRunView.setText("");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isBound() {
|
||||||
|
return run != null
|
||||||
|
&& lastRunView != null
|
||||||
|
&& constraintsView != null
|
||||||
|
&& glucoseStatusView != null
|
||||||
|
&& currentTempView != null
|
||||||
|
&& iobDataView != null
|
||||||
|
&& profileView != null
|
||||||
|
&& mealDataView != null
|
||||||
|
&& autosensDataView != null
|
||||||
|
&& resultView != null
|
||||||
|
&& scriptdebugView != null
|
||||||
|
&& requestView != null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,11 +79,14 @@ public class NSProfileFragment extends SubscriberFragment {
|
||||||
public void onStatusEvent(final EventNSProfileUpdateGUI ev) {
|
public void onStatusEvent(final EventNSProfileUpdateGUI ev) {
|
||||||
Activity activity = getActivity();
|
Activity activity = getActivity();
|
||||||
if (activity != null)
|
if (activity != null)
|
||||||
activity.runOnUiThread(() -> updateGUI());
|
activity.runOnUiThread(() -> { synchronized (NSProfileFragment.this) { updateGUI(); } });
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void updateGUI() {
|
protected void updateGUI() {
|
||||||
|
if (noProfile == null || profileSpinner == null)
|
||||||
|
return;
|
||||||
|
|
||||||
ProfileStore profileStore = NSProfilePlugin.getPlugin().getProfile();
|
ProfileStore profileStore = NSProfilePlugin.getPlugin().getProfile();
|
||||||
if (profileStore != null) {
|
if (profileStore != null) {
|
||||||
ArrayList<CharSequence> profileList = profileStore.getProfileList();
|
ArrayList<CharSequence> profileList = profileStore.getProfileList();
|
||||||
|
|
|
@ -216,74 +216,96 @@ public class DanaRFragment extends SubscriberFragment {
|
||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
DanaRPump pump = DanaRPump.getInstance();
|
synchronized(DanaRFragment.this) {
|
||||||
if (pump.lastConnection != 0) {
|
if (!isBound()) return;
|
||||||
Long agoMsec = System.currentTimeMillis() - pump.lastConnection;
|
|
||||||
int agoMin = (int) (agoMsec / 60d / 1000d);
|
|
||||||
lastConnectionView.setText(DateUtil.timeString(pump.lastConnection) + " (" + String.format(MainApp.gs(R.string.minago), agoMin) + ")");
|
|
||||||
SetWarnColor.setColor(lastConnectionView, agoMin, 16d, 31d);
|
|
||||||
}
|
|
||||||
if (pump.lastBolusTime.getTime() != 0) {
|
|
||||||
Long agoMsec = System.currentTimeMillis() - pump.lastBolusTime.getTime();
|
|
||||||
double agoHours = agoMsec / 60d / 60d / 1000d;
|
|
||||||
if (agoHours < 6) // max 6h back
|
|
||||||
lastBolusView.setText(DateUtil.timeString(pump.lastBolusTime) + " " + DateUtil.sinceString(pump.lastBolusTime.getTime()) + " " + DecimalFormatter.to2Decimal(DanaRPump.getInstance().lastBolusAmount) + " U");
|
|
||||||
else lastBolusView.setText("");
|
|
||||||
}
|
|
||||||
|
|
||||||
dailyUnitsView.setText(DecimalFormatter.to0Decimal(pump.dailyTotalUnits) + " / " + pump.maxDailyTotalUnits + " U");
|
DanaRPump pump = DanaRPump.getInstance();
|
||||||
SetWarnColor.setColor(dailyUnitsView, pump.dailyTotalUnits, pump.maxDailyTotalUnits * 0.75d, pump.maxDailyTotalUnits * 0.9d);
|
if (pump.lastConnection != 0) {
|
||||||
basaBasalRateView.setText("( " + (pump.activeProfile + 1) + " ) " + DecimalFormatter.to2Decimal(ConfigBuilderPlugin.getActivePump().getBaseBasalRate()) + " U/h");
|
Long agoMsec = System.currentTimeMillis() - pump.lastConnection;
|
||||||
// DanaRPlugin, DanaRKoreanPlugin
|
int agoMin = (int) (agoMsec / 60d / 1000d);
|
||||||
if (ConfigBuilderPlugin.getActivePump().isFakingTempsByExtendedBoluses()) {
|
lastConnectionView.setText(DateUtil.timeString(pump.lastConnection) + " (" + String.format(MainApp.gs(R.string.minago), agoMin) + ")");
|
||||||
if (TreatmentsPlugin.getPlugin().isInHistoryRealTempBasalInProgress()) {
|
SetWarnColor.setColor(lastConnectionView, agoMin, 16d, 31d);
|
||||||
tempBasalView.setText(TreatmentsPlugin.getPlugin().getRealTempBasalFromHistory(System.currentTimeMillis()).toStringFull());
|
|
||||||
} else {
|
|
||||||
tempBasalView.setText("");
|
|
||||||
}
|
}
|
||||||
} else {
|
if (pump.lastBolusTime.getTime() != 0) {
|
||||||
// v2 plugin
|
Long agoMsec = System.currentTimeMillis() - pump.lastBolusTime.getTime();
|
||||||
if (TreatmentsPlugin.getPlugin().isTempBasalInProgress()) {
|
double agoHours = agoMsec / 60d / 60d / 1000d;
|
||||||
tempBasalView.setText(TreatmentsPlugin.getPlugin().getTempBasalFromHistory(System.currentTimeMillis()).toStringFull());
|
if (agoHours < 6) // max 6h back
|
||||||
} else {
|
lastBolusView.setText(DateUtil.timeString(pump.lastBolusTime) + " " + DateUtil.sinceString(pump.lastBolusTime.getTime()) + " " + DecimalFormatter.to2Decimal(DanaRPump.getInstance().lastBolusAmount) + " U");
|
||||||
tempBasalView.setText("");
|
else lastBolusView.setText("");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
ExtendedBolus activeExtendedBolus = TreatmentsPlugin.getPlugin().getExtendedBolusFromHistory(System.currentTimeMillis());
|
dailyUnitsView.setText(DecimalFormatter.to0Decimal(pump.dailyTotalUnits) + " / " + pump.maxDailyTotalUnits + " U");
|
||||||
if (activeExtendedBolus != null) {
|
SetWarnColor.setColor(dailyUnitsView, pump.dailyTotalUnits, pump.maxDailyTotalUnits * 0.75d, pump.maxDailyTotalUnits * 0.9d);
|
||||||
extendedBolusView.setText(activeExtendedBolus.toString());
|
basaBasalRateView.setText("( " + (pump.activeProfile + 1) + " ) " + DecimalFormatter.to2Decimal(ConfigBuilderPlugin.getActivePump().getBaseBasalRate()) + " U/h");
|
||||||
} else {
|
// DanaRPlugin, DanaRKoreanPlugin
|
||||||
extendedBolusView.setText("");
|
if (ConfigBuilderPlugin.getActivePump().isFakingTempsByExtendedBoluses()) {
|
||||||
}
|
if (TreatmentsPlugin.getPlugin().isInHistoryRealTempBasalInProgress()) {
|
||||||
reservoirView.setText(DecimalFormatter.to0Decimal(pump.reservoirRemainingUnits) + " / 300 U");
|
tempBasalView.setText(TreatmentsPlugin.getPlugin().getRealTempBasalFromHistory(System.currentTimeMillis()).toStringFull());
|
||||||
SetWarnColor.setColorInverse(reservoirView, pump.reservoirRemainingUnits, 50d, 20d);
|
} else {
|
||||||
batteryView.setText("{fa-battery-" + (pump.batteryRemaining / 25) + "}");
|
tempBasalView.setText("");
|
||||||
SetWarnColor.setColorInverse(batteryView, pump.batteryRemaining, 51d, 26d);
|
}
|
||||||
iobView.setText(pump.iob + " U");
|
|
||||||
if (pump.model != 0 || pump.protocol != 0 || pump.productCode != 0) {
|
|
||||||
firmwareView.setText(String.format(MainApp.gs(R.string.danar_model), pump.model, pump.protocol, pump.productCode));
|
|
||||||
} else {
|
|
||||||
firmwareView.setText("OLD");
|
|
||||||
}
|
|
||||||
basalStepView.setText("" + pump.basalStep);
|
|
||||||
bolusStepView.setText("" + pump.bolusStep);
|
|
||||||
serialNumberView.setText("" + pump.serialNumber);
|
|
||||||
if (queueView != null) {
|
|
||||||
Spanned status = ConfigBuilderPlugin.getCommandQueue().spannedStatus();
|
|
||||||
if (status.toString().equals("")) {
|
|
||||||
queueView.setVisibility(View.GONE);
|
|
||||||
} else {
|
} else {
|
||||||
queueView.setVisibility(View.VISIBLE);
|
// v2 plugin
|
||||||
queueView.setText(status);
|
if (TreatmentsPlugin.getPlugin().isTempBasalInProgress()) {
|
||||||
|
tempBasalView.setText(TreatmentsPlugin.getPlugin().getTempBasalFromHistory(System.currentTimeMillis()).toStringFull());
|
||||||
|
} else {
|
||||||
|
tempBasalView.setText("");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ExtendedBolus activeExtendedBolus = TreatmentsPlugin.getPlugin().getExtendedBolusFromHistory(System.currentTimeMillis());
|
||||||
|
if (activeExtendedBolus != null) {
|
||||||
|
extendedBolusView.setText(activeExtendedBolus.toString());
|
||||||
|
} else {
|
||||||
|
extendedBolusView.setText("");
|
||||||
|
}
|
||||||
|
reservoirView.setText(DecimalFormatter.to0Decimal(pump.reservoirRemainingUnits) + " / 300 U");
|
||||||
|
SetWarnColor.setColorInverse(reservoirView, pump.reservoirRemainingUnits, 50d, 20d);
|
||||||
|
batteryView.setText("{fa-battery-" + (pump.batteryRemaining / 25) + "}");
|
||||||
|
SetWarnColor.setColorInverse(batteryView, pump.batteryRemaining, 51d, 26d);
|
||||||
|
iobView.setText(pump.iob + " U");
|
||||||
|
if (pump.model != 0 || pump.protocol != 0 || pump.productCode != 0) {
|
||||||
|
firmwareView.setText(String.format(MainApp.gs(R.string.danar_model), pump.model, pump.protocol, pump.productCode));
|
||||||
|
} else {
|
||||||
|
firmwareView.setText("OLD");
|
||||||
|
}
|
||||||
|
basalStepView.setText("" + pump.basalStep);
|
||||||
|
bolusStepView.setText("" + pump.bolusStep);
|
||||||
|
serialNumberView.setText("" + pump.serialNumber);
|
||||||
|
if (queueView != null) {
|
||||||
|
Spanned status = ConfigBuilderPlugin.getCommandQueue().spannedStatus();
|
||||||
|
if (status.toString().equals("")) {
|
||||||
|
queueView.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
queueView.setVisibility(View.VISIBLE);
|
||||||
|
queueView.setText(status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//hide user options button if not an RS pump
|
||||||
|
boolean isKorean = MainApp.getSpecificPlugin(DanaRKoreanPlugin.class) != null && MainApp.getSpecificPlugin(DanaRKoreanPlugin.class).isEnabled(PluginType.PUMP);
|
||||||
|
if (isKorean) {
|
||||||
|
danar_user_options.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
//hide user options button if not an RS pump
|
|
||||||
boolean isKorean = MainApp.getSpecificPlugin(DanaRKoreanPlugin.class) != null && MainApp.getSpecificPlugin(DanaRKoreanPlugin.class).isEnabled(PluginType.PUMP);
|
|
||||||
if (isKorean ) {
|
|
||||||
danar_user_options.setVisibility(View.GONE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isBound() {
|
||||||
|
return lastConnectionView != null
|
||||||
|
&& lastBolusView != null
|
||||||
|
&& dailyUnitsView != null
|
||||||
|
&& basaBasalRateView != null
|
||||||
|
&& tempBasalView != null
|
||||||
|
&& extendedBolusView != null
|
||||||
|
&& reservoirView != null
|
||||||
|
&& batteryView != null
|
||||||
|
&& iobView != null
|
||||||
|
&& firmwareView != null
|
||||||
|
&& basalStepView != null
|
||||||
|
&& bolusStepView != null
|
||||||
|
&& serialNumberView != null
|
||||||
|
&& danar_user_options != null
|
||||||
|
&& queueView != null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue