Combo: remove 'read history' button.

History and basal rate profile are permanently checked and updated. This
functionality would only be needed if driver was fundamentally broken.
This commit is contained in:
Johannes Mockenhaupt 2018-04-06 11:26:33 +02:00
parent db4439f1cc
commit 344d9c1f49
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1
3 changed files with 1 additions and 71 deletions

View file

@ -29,7 +29,7 @@ import info.nightscout.androidaps.queue.events.EventQueueChanged;
import info.nightscout.utils.DateUtil; import info.nightscout.utils.DateUtil;
import info.nightscout.utils.SP; import info.nightscout.utils.SP;
public class ComboFragment extends SubscriberFragment implements View.OnClickListener, View.OnLongClickListener { public class ComboFragment extends SubscriberFragment implements View.OnClickListener {
private TextView stateView; private TextView stateView;
private TextView activityView; private TextView activityView;
private TextView batteryView; private TextView batteryView;
@ -41,7 +41,6 @@ public class ComboFragment extends SubscriberFragment implements View.OnClickLis
private Button refreshButton; private Button refreshButton;
private TextView bolusCount; private TextView bolusCount;
private TextView tbrCount; private TextView tbrCount;
private Button fullHistoryButton;
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
@ -62,10 +61,6 @@ public class ComboFragment extends SubscriberFragment implements View.OnClickLis
refreshButton = view.findViewById(R.id.combo_refresh_button); refreshButton = view.findViewById(R.id.combo_refresh_button);
refreshButton.setOnClickListener(this); refreshButton.setOnClickListener(this);
fullHistoryButton = view.findViewById(R.id.combo_full_history_button);
fullHistoryButton.setOnClickListener(this);
fullHistoryButton.setOnLongClickListener(this);
updateGUI(); updateGUI();
return view; return view;
} }
@ -89,33 +84,9 @@ public class ComboFragment extends SubscriberFragment implements View.OnClickLis
} }
}); });
break; break;
case R.id.combo_full_history_button:
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
builder.setMessage(R.string.combo_read_full_history_info);
builder.show();
break;
} }
} }
// TODO clean up when when queuing
@Override
public boolean onLongClick(View view) {
switch (view.getId()) {
case R.id.combo_full_history_button:
fullHistoryButton.setEnabled(false);
new Thread(() -> ComboPlugin.getPlugin().readAllPumpData(new Callback() {
@Override
public void run() {
runOnUiThread(() -> {
fullHistoryButton.setEnabled(true);
});
}
})).start();
return true;
}
return false;
}
@Subscribe @Subscribe
public void onStatusEvent(final EventComboPumpUpdateGUI ignored) { public void onStatusEvent(final EventComboPumpUpdateGUI ignored) {
updateGUI(); updateGUI();
@ -158,9 +129,6 @@ public class ComboFragment extends SubscriberFragment implements View.OnClickLis
} }
if (plugin.isInitialized()) { if (plugin.isInitialized()) {
refreshButton.setVisibility(View.VISIBLE);
fullHistoryButton.setVisibility(View.VISIBLE);
// battery // battery
batteryView.setTextSize(20); batteryView.setTextSize(20);
if (ps.batteryState == PumpState.EMPTY) { if (ps.batteryState == PumpState.EMPTY) {

View file

@ -1171,30 +1171,6 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
return pumpBolus.timestamp + Math.min(secondsFromBolus, 59 * 1000); return pumpBolus.timestamp + Math.min(secondsFromBolus, 59 * 1000);
} }
// TODO use queue once ready
void readAllPumpData(Callback post) {
// ConfigBuilderPlugin.getCommandQueue().custom(new Callback() {
// @Override
// public void run() {
readHistory(new PumpHistoryRequest()
.bolusHistory(PumpHistoryRequest.FULL)
.pumpErrorHistory(PumpHistoryRequest.FULL)
.tddHistory(PumpHistoryRequest.FULL));
CommandResult readBasalResult = runCommand(MainApp.gs(R.string.combo_actvity_reading_basal_profile), 2, ruffyScripter::readBasalProfile);
if (readBasalResult.success) {
pump.basalProfile = readBasalResult.basalProfile;
}
// }
// }, post);
if (post != null) {
post.run();
}
CommandQueue commandQueue = ConfigBuilderPlugin.getCommandQueue();
if (commandQueue.performing() == null && commandQueue.size() == 0) {
ruffyScripter.disconnect();
}
}
/** /**
* Reads QuickInfo to update reservoir level and determine if new boluses exist on the pump * Reads QuickInfo to update reservoir level and determine if new boluses exist on the pump
* and if so, queries the history for all new records. * and if so, queries the history for all new records.

View file

@ -499,20 +499,6 @@
android:paddingLeft="0dp" android:paddingLeft="0dp"
android:paddingRight="0dp" android:paddingRight="0dp"
android:text="@string/combo_refresh" /> android:text="@string/combo_refresh" />
<info.nightscout.utils.SingleClickButton
android:id="@+id/combo_full_history_button"
style="@style/ButtonSmallFontStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:layout_marginRight="-4dp"
android:drawableTop="@drawable/icon_danarhistory"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:visibility="gone"
android:text="@string/combo_history" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>