show status on Dana fragment too
This commit is contained in:
parent
02c57fb9a3
commit
3b90d02e05
2 changed files with 35 additions and 0 deletions
|
@ -12,6 +12,7 @@ import android.view.LayoutInflater;
|
|||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.crashlytics.android.Crashlytics;
|
||||
|
@ -61,6 +62,9 @@ public class DanaRFragment extends SubscriberFragment {
|
|||
Button historyButton;
|
||||
Button statsButton;
|
||||
|
||||
LinearLayout pumpStatusLayout;
|
||||
TextView pumpStatusView;
|
||||
|
||||
static Runnable connectRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -115,6 +119,9 @@ public class DanaRFragment extends SubscriberFragment {
|
|||
bolusStepView = (TextView) view.findViewById(R.id.danar_bolusstep);
|
||||
serialNumberView = (TextView) view.findViewById(R.id.danar_serialnumber);
|
||||
|
||||
pumpStatusView = (TextView) view.findViewById(R.id.overview_pumpstatus);
|
||||
pumpStatusView.setBackgroundColor(MainApp.sResources.getColor(R.color.colorInitializingBorder));
|
||||
pumpStatusLayout = (LinearLayout) view.findViewById(R.id.overview_pumpstatuslayout);
|
||||
|
||||
viewProfileButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -159,6 +166,7 @@ public class DanaRFragment extends SubscriberFragment {
|
|||
@Subscribe
|
||||
public void onStatusEvent(final EventPumpStatusChanged c) {
|
||||
Activity activity = getActivity();
|
||||
final String status = c.textStatus();
|
||||
if (activity != null) {
|
||||
activity.runOnUiThread(
|
||||
new Runnable() {
|
||||
|
@ -170,6 +178,13 @@ public class DanaRFragment extends SubscriberFragment {
|
|||
btConnectionView.setText("{fa-bluetooth}");
|
||||
else if (c.sStatus == EventPumpStatusChanged.DISCONNECTED)
|
||||
btConnectionView.setText("{fa-bluetooth-b}");
|
||||
|
||||
if (!status.equals("")) {
|
||||
pumpStatusView.setText(status);
|
||||
pumpStatusLayout.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
pumpStatusLayout.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
|
@ -20,6 +20,26 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/overview_pumpstatuslayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingBottom="5dp"
|
||||
android:paddingTop="2dp"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_pumpstatus"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:gravity="center_vertical|center_horizontal"
|
||||
android:text="@string/initializing"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
Loading…
Reference in a new issue