Combo tab: show command queue if non-empty.
This commit is contained in:
parent
1cbfefffb8
commit
86b63cb27d
2 changed files with 30 additions and 0 deletions
|
@ -4,6 +4,7 @@ package info.nightscout.androidaps.plugins.PumpCombo;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.text.Spanned;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
@ -16,7 +17,9 @@ import com.squareup.otto.Subscribe;
|
||||||
import de.jotomo.ruffy.spi.PumpState;
|
import de.jotomo.ruffy.spi.PumpState;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
|
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
|
||||||
|
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.events.EventComboPumpUpdateGUI;
|
import info.nightscout.androidaps.plugins.PumpCombo.events.EventComboPumpUpdateGUI;
|
||||||
|
import info.nightscout.androidaps.queue.events.EventQueueChanged;
|
||||||
import info.nightscout.utils.DateUtil;
|
import info.nightscout.utils.DateUtil;
|
||||||
|
|
||||||
public class ComboFragment extends SubscriberFragment implements View.OnClickListener, View.OnLongClickListener {
|
public class ComboFragment extends SubscriberFragment implements View.OnClickListener, View.OnLongClickListener {
|
||||||
|
@ -28,6 +31,8 @@ public class ComboFragment extends SubscriberFragment implements View.OnClickLis
|
||||||
private TextView lastBolusView;
|
private TextView lastBolusView;
|
||||||
private TextView tempBasalText;
|
private TextView tempBasalText;
|
||||||
private LinearLayout buttonsLayout;
|
private LinearLayout buttonsLayout;
|
||||||
|
private TextView queueView;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
|
@ -42,6 +47,8 @@ public class ComboFragment extends SubscriberFragment implements View.OnClickLis
|
||||||
//lastBolusView = (TextView) view.findViewById(R.id.combo_last_bolus);
|
//lastBolusView = (TextView) view.findViewById(R.id.combo_last_bolus);
|
||||||
tempBasalText = (TextView) view.findViewById(R.id.combo_temp_basal);
|
tempBasalText = (TextView) view.findViewById(R.id.combo_temp_basal);
|
||||||
buttonsLayout = (LinearLayout) view.findViewById(R.id.combo_buttons_layout);
|
buttonsLayout = (LinearLayout) view.findViewById(R.id.combo_buttons_layout);
|
||||||
|
queueView = (TextView) view.findViewById(R.id.combo_queue);
|
||||||
|
|
||||||
|
|
||||||
Button refresh = (Button) view.findViewById(R.id.combo_refresh);
|
Button refresh = (Button) view.findViewById(R.id.combo_refresh);
|
||||||
refresh.setOnClickListener(this);
|
refresh.setOnClickListener(this);
|
||||||
|
@ -89,6 +96,12 @@ public class ComboFragment extends SubscriberFragment implements View.OnClickLis
|
||||||
updateGUI();
|
updateGUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onStatusEvent(final EventQueueChanged ignored) {
|
||||||
|
updateGUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void updateGUI() {
|
public void updateGUI() {
|
||||||
Activity fragmentActivity = getActivity();
|
Activity fragmentActivity = getActivity();
|
||||||
if (fragmentActivity != null)
|
if (fragmentActivity != null)
|
||||||
|
@ -188,6 +201,16 @@ public class ComboFragment extends SubscriberFragment implements View.OnClickLis
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tempBasalText.setText(tbrStr);
|
tempBasalText.setText(tbrStr);
|
||||||
|
|
||||||
|
// TODO clean up & i18n or remove
|
||||||
|
// Queued activities
|
||||||
|
Spanned status = ConfigBuilderPlugin.getCommandQueue().spannedStatus();
|
||||||
|
if (status.toString().equals("")) {
|
||||||
|
queueView.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
queueView.setVisibility(View.VISIBLE);
|
||||||
|
queueView.setText("Queued activities:\n" + status);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -337,6 +337,13 @@
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
android:background="@color/listdelimiter" />
|
android:background="@color/listdelimiter" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/combo_queue"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text=""
|
||||||
|
android:textAlignment="center" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
Loading…
Reference in a new issue