Combo: remove superseeded TDD button and dialog.
This commit is contained in:
parent
828b20e358
commit
e937a777ba
|
@ -40,7 +40,6 @@ public class ComboFragment extends SubscriberFragment implements View.OnClickLis
|
|||
private TextView tempBasalText;
|
||||
private Button refreshButton;
|
||||
private Button alertsButton;
|
||||
private Button tddsButton;
|
||||
private TextView bolusCount;
|
||||
private TextView tbrCount;
|
||||
private Button fullHistoryButton;
|
||||
|
@ -68,10 +67,6 @@ public class ComboFragment extends SubscriberFragment implements View.OnClickLis
|
|||
alertsButton.setOnClickListener(this);
|
||||
alertsButton.setOnLongClickListener(this);
|
||||
|
||||
tddsButton = (Button) view.findViewById(R.id.combo_tdds_button);
|
||||
tddsButton.setOnClickListener(this);
|
||||
tddsButton.setOnLongClickListener(this);
|
||||
|
||||
fullHistoryButton = (Button) view.findViewById(R.id.combo_full_history_button);
|
||||
fullHistoryButton.setOnClickListener(this);
|
||||
fullHistoryButton.setOnLongClickListener(this);
|
||||
|
@ -103,10 +98,6 @@ public class ComboFragment extends SubscriberFragment implements View.OnClickLis
|
|||
ComboAlertHistoryDialog ehd = new ComboAlertHistoryDialog();
|
||||
ehd.show(getFragmentManager(), ComboAlertHistoryDialog.class.getSimpleName());
|
||||
break;
|
||||
case R.id.combo_tdds_button:
|
||||
ComboTddHistoryDialog thd = new ComboTddHistoryDialog();
|
||||
thd.show(getFragmentManager(), ComboTddHistoryDialog.class.getSimpleName());
|
||||
break;
|
||||
case R.id.combo_full_history_button:
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
|
||||
builder.setMessage(R.string.combo_read_full_history_info);
|
||||
|
@ -121,29 +112,12 @@ public class ComboFragment extends SubscriberFragment implements View.OnClickLis
|
|||
switch (view.getId()) {
|
||||
case R.id.combo_alerts_button:
|
||||
alertsButton.setEnabled(false);
|
||||
tddsButton.setEnabled(false);
|
||||
fullHistoryButton.setEnabled(false);
|
||||
new Thread(() -> ComboPlugin.getPlugin().readAlertData(new Callback() {
|
||||
@Override
|
||||
public void run() {
|
||||
runOnUiThread(() -> {
|
||||
alertsButton.setEnabled(true);
|
||||
tddsButton.setEnabled(true);
|
||||
fullHistoryButton.setEnabled(true);
|
||||
});
|
||||
}
|
||||
})).start();
|
||||
return true;
|
||||
case R.id.combo_tdds_button:
|
||||
alertsButton.setEnabled(false);
|
||||
tddsButton.setEnabled(false);
|
||||
fullHistoryButton.setEnabled(false);
|
||||
new Thread(() -> ComboPlugin.getPlugin().readTddData(new Callback() {
|
||||
@Override
|
||||
public void run() {
|
||||
runOnUiThread(() -> {
|
||||
alertsButton.setEnabled(true);
|
||||
tddsButton.setEnabled(true);
|
||||
fullHistoryButton.setEnabled(true);
|
||||
});
|
||||
}
|
||||
|
@ -151,14 +125,12 @@ public class ComboFragment extends SubscriberFragment implements View.OnClickLis
|
|||
return true;
|
||||
case R.id.combo_full_history_button:
|
||||
alertsButton.setEnabled(false);
|
||||
tddsButton.setEnabled(false);
|
||||
fullHistoryButton.setEnabled(false);
|
||||
new Thread(() -> ComboPlugin.getPlugin().readAllPumpData(new Callback() {
|
||||
@Override
|
||||
public void run() {
|
||||
runOnUiThread(() -> {
|
||||
alertsButton.setEnabled(true);
|
||||
tddsButton.setEnabled(true);
|
||||
fullHistoryButton.setEnabled(true);
|
||||
});
|
||||
}
|
||||
|
@ -213,7 +185,6 @@ public class ComboFragment extends SubscriberFragment implements View.OnClickLis
|
|||
refreshButton.setVisibility(View.VISIBLE);
|
||||
if (Config.enableComboBetaFeatures) {
|
||||
alertsButton.setVisibility(View.VISIBLE);
|
||||
tddsButton.setVisibility(View.VISIBLE);
|
||||
}
|
||||
fullHistoryButton.setVisibility(View.VISIBLE);
|
||||
|
||||
|
|
|
@ -1171,23 +1171,6 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
|||
return pumpBolus.timestamp + Math.min(secondsFromBolus, 59 * 1000);
|
||||
}
|
||||
|
||||
// TODO use queue once ready
|
||||
void readTddData(Callback post) {
|
||||
// ConfigBuilderPlugin.getCommandQueue().custom(new Callback() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
readHistory(new PumpHistoryRequest().tddHistory(PumpHistoryRequest.FULL));
|
||||
// }
|
||||
// }, post);
|
||||
if (post != null) {
|
||||
post.run();
|
||||
}
|
||||
CommandQueue commandQueue = ConfigBuilderPlugin.getCommandQueue();
|
||||
if (commandQueue.performing() == null && commandQueue.size() == 0) {
|
||||
ruffyScripter.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
// TODO use queue once ready
|
||||
void readAlertData(Callback post) {
|
||||
// ConfigBuilderPlugin.getCommandQueue().custom(new Callback() {
|
||||
|
|
|
@ -1,58 +0,0 @@
|
|||
package info.nightscout.androidaps.plugins.PumpCombo;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffyscripter.history.Tdd;
|
||||
import info.nightscout.androidaps.R;
|
||||
|
||||
public class ComboTddHistoryDialog extends DialogFragment {
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View layout = inflater.inflate(R.layout.combo_tdd_history_fragment, container, false);
|
||||
TextView text = (TextView) layout.findViewById(R.id.combo_tdd_history_text);
|
||||
List<Tdd> tdds = ComboPlugin.getPlugin().getPump().tddHistory;
|
||||
if (tdds.isEmpty()) {
|
||||
text.setText(R.string.combo_no_tdd_data_note);
|
||||
} else {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
DateFormat dateFormatter = DateFormat.getDateInstance();
|
||||
double avg = 0;
|
||||
double min = 999;
|
||||
double max = 0;
|
||||
int count = 0;
|
||||
for (Tdd tdd : tdds) {
|
||||
if (tdd.total > 0) {
|
||||
avg += tdd.total;
|
||||
count++;
|
||||
}
|
||||
if (tdd.total < min) min = tdd.total;
|
||||
if (tdd.total > max) max = tdd.total;
|
||||
}
|
||||
avg = avg / count;
|
||||
sb.append(String.format(Locale.getDefault(), getString(R.string.combo_tdd_minimum), min));
|
||||
sb.append("\n");
|
||||
sb.append(String.format(Locale.getDefault(), getString(R.string.combo_tdd_average), avg));
|
||||
sb.append("\n");
|
||||
sb.append(String.format(Locale.getDefault(), getString(R.string.combo_tdd_maximum), max));
|
||||
sb.append("\n");
|
||||
for (Tdd tdd : tdds) {
|
||||
sb.append("\n");
|
||||
sb.append(dateFormatter.format(tdd.timestamp));
|
||||
sb.append(" ");
|
||||
sb.append(String.format(Locale.getDefault(), "%3.1f", tdd.total));
|
||||
sb.append(" U");
|
||||
}
|
||||
text.setText(sb.toString());
|
||||
}
|
||||
return layout;
|
||||
}
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".plugins.PumpCombo.ComboFragment">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="@string/combo_tdds"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<View
|
||||
android:id="@+id/profileview_datedelimiter"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dip"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:background="@color/listdelimiter" />
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/combo_tdd_history_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="start"
|
||||
android:padding="10dp"
|
||||
android:textAlignment="textStart" />
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</FrameLayout>
|
|
@ -513,19 +513,6 @@
|
|||
android:visibility="gone"
|
||||
android:text="@string/combo_pump_alerts" />
|
||||
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/combo_tdds_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_danarstats"
|
||||
android:paddingLeft="0dp"
|
||||
android:paddingRight="0dp"
|
||||
android:visibility="gone"
|
||||
android:text="@string/combo_tdds" />
|
||||
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/combo_full_history_button"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
|
|
Loading…
Reference in a new issue