allign design of status pills

This commit is contained in:
Milos Kozak 2017-04-30 13:17:59 +02:00
parent 1abdadceca
commit 2cb6e275c0
10 changed files with 23 additions and 71 deletions

View file

@ -202,6 +202,8 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
loopStatusLayout = (LinearLayout) view.findViewById(R.id.overview_looplayout); loopStatusLayout = (LinearLayout) view.findViewById(R.id.overview_looplayout);
pumpStatusLayout = (LinearLayout) view.findViewById(R.id.overview_pumpstatuslayout); pumpStatusLayout = (LinearLayout) view.findViewById(R.id.overview_pumpstatuslayout);
pumpStatusView.setBackgroundColor(MainApp.sResources.getColor(R.color.colorInitializingBorder));
iobView = (TextView) view.findViewById(R.id.overview_iob); iobView = (TextView) view.findViewById(R.id.overview_iob);
apsModeView = (TextView) view.findViewById(R.id.overview_apsmode); apsModeView = (TextView) view.findViewById(R.id.overview_apsmode);
tempTargetView = (TextView) view.findViewById(R.id.overview_temptarget); tempTargetView = (TextView) view.findViewById(R.id.overview_temptarget);
@ -772,7 +774,6 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
} }
private void updatePumpStatus(String status) { private void updatePumpStatus(String status) {
PumpInterface pump = MainApp.getConfigBuilder();
if (!status.equals("")) { if (!status.equals("")) {
pumpStatusView.setText(status); pumpStatusView.setText(status);
pumpStatusLayout.setVisibility(View.VISIBLE); pumpStatusLayout.setVisibility(View.VISIBLE);
@ -838,19 +839,19 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
final LoopPlugin.LastRun finalLastRun = LoopPlugin.lastRun; final LoopPlugin.LastRun finalLastRun = LoopPlugin.lastRun;
if (Config.APS && MainApp.getConfigBuilder().getPumpDescription().isTempBasalCapable) { if (Config.APS && MainApp.getConfigBuilder().getPumpDescription().isTempBasalCapable) {
apsModeView.setVisibility(View.VISIBLE); apsModeView.setVisibility(View.VISIBLE);
apsModeView.setBackgroundResource(R.drawable.loopmodeborder); apsModeView.setBackgroundColor(MainApp.sResources.getColor(R.color.loopenabled));
apsModeView.setTextColor(Color.BLACK); apsModeView.setTextColor(Color.BLACK);
final LoopPlugin activeloop = MainApp.getConfigBuilder().getActiveLoop(); final LoopPlugin activeloop = MainApp.getConfigBuilder().getActiveLoop();
if (activeloop != null && activeloop.isEnabled(activeloop.getType()) && activeloop.isSuperBolus()) { if (activeloop != null && activeloop.isEnabled(activeloop.getType()) && activeloop.isSuperBolus()) {
apsModeView.setBackgroundResource(R.drawable.loopmodesuspendedborder); apsModeView.setBackgroundColor(MainApp.sResources.getColor(R.color.looppumpsuspended));
apsModeView.setText(String.format(MainApp.sResources.getString(R.string.loopsuperbolusfor), activeloop.minutesToEndOfSuspend())); apsModeView.setText(String.format(MainApp.sResources.getString(R.string.loopsuperbolusfor), activeloop.minutesToEndOfSuspend()));
apsModeView.setTextColor(Color.WHITE); apsModeView.setTextColor(Color.WHITE);
} else if (activeloop != null && activeloop.isEnabled(activeloop.getType()) && activeloop.isSuspended()) { } else if (activeloop != null && activeloop.isEnabled(activeloop.getType()) && activeloop.isSuspended()) {
apsModeView.setBackgroundResource(R.drawable.loopmodesuspendedborder); apsModeView.setBackgroundColor(MainApp.sResources.getColor(R.color.looppumpsuspended));
apsModeView.setText(String.format(MainApp.sResources.getString(R.string.loopsuspendedfor), activeloop.minutesToEndOfSuspend())); apsModeView.setText(String.format(MainApp.sResources.getString(R.string.loopsuspendedfor), activeloop.minutesToEndOfSuspend()));
apsModeView.setTextColor(Color.WHITE); apsModeView.setTextColor(Color.WHITE);
} else if (pump.isSuspended()) { } else if (pump.isSuspended()) {
apsModeView.setBackgroundResource(R.drawable.loopmodesuspendedborder); apsModeView.setBackgroundColor(MainApp.sResources.getColor(R.color.looppumpsuspended));
apsModeView.setText(MainApp.sResources.getString(R.string.pumpsuspended)); apsModeView.setText(MainApp.sResources.getString(R.string.pumpsuspended));
apsModeView.setTextColor(Color.WHITE); apsModeView.setTextColor(Color.WHITE);
} else if (activeloop != null && activeloop.isEnabled(activeloop.getType())) { } else if (activeloop != null && activeloop.isEnabled(activeloop.getType())) {
@ -860,7 +861,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
apsModeView.setText(MainApp.sResources.getString(R.string.openloop)); apsModeView.setText(MainApp.sResources.getString(R.string.openloop));
} }
} else { } else {
apsModeView.setBackgroundResource(R.drawable.loopmodedisabledborder); apsModeView.setBackgroundColor(MainApp.sResources.getColor(R.color.loopdisabled));
apsModeView.setText(MainApp.sResources.getString(R.string.disabledloop)); apsModeView.setText(MainApp.sResources.getString(R.string.disabledloop));
apsModeView.setTextColor(Color.WHITE); apsModeView.setTextColor(Color.WHITE);
} }
@ -875,7 +876,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
TempTarget tempTarget = tempTargetRangePlugin.getTempTargetInProgress(new Date().getTime()); TempTarget tempTarget = tempTargetRangePlugin.getTempTargetInProgress(new Date().getTime());
if (tempTarget != null) { if (tempTarget != null) {
tempTargetView.setTextColor(Color.BLACK); tempTargetView.setTextColor(Color.BLACK);
tempTargetView.setBackgroundResource(R.drawable.temptargetborder); tempTargetView.setBackgroundColor(MainApp.sResources.getColor(R.color.tempTargetBackground));
tempTargetView.setVisibility(View.VISIBLE); tempTargetView.setVisibility(View.VISIBLE);
tempTargetView.setText(NSProfile.toUnitsString(tempTarget.low, NSProfile.fromMgdlToUnits(tempTarget.low, profile.getUnits()), profile.getUnits()) + " - " + NSProfile.toUnitsString(tempTarget.high, NSProfile.fromMgdlToUnits(tempTarget.high, profile.getUnits()), profile.getUnits())); tempTargetView.setText(NSProfile.toUnitsString(tempTarget.low, NSProfile.fromMgdlToUnits(tempTarget.low, profile.getUnits()), profile.getUnits()) + " - " + NSProfile.toUnitsString(tempTarget.high, NSProfile.fromMgdlToUnits(tempTarget.high, profile.getUnits()), profile.getUnits()));
} else { } else {
@ -887,7 +888,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
minBgDefault = Constants.MIN_BG_DEFAULT_MMOL; minBgDefault = Constants.MIN_BG_DEFAULT_MMOL;
} }
tempTargetView.setTextColor(Color.WHITE); tempTargetView.setTextColor(Color.WHITE);
tempTargetView.setBackgroundResource(R.drawable.temptargetborderdisabled); tempTargetView.setBackgroundColor(MainApp.sResources.getColor(R.color.tempTargetDisabledBackground));
tempTargetView.setText(SP.getDouble("openapsma_min_bg", minBgDefault) + " - " + SP.getDouble("openapsma_max_bg", maxBgDefault)); tempTargetView.setText(SP.getDouble("openapsma_min_bg", minBgDefault) + " - " + SP.getDouble("openapsma_max_bg", maxBgDefault));
tempTargetView.setVisibility(View.VISIBLE); tempTargetView.setVisibility(View.VISIBLE);
} }
@ -933,8 +934,10 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
basalLayout.setVisibility(View.GONE); basalLayout.setVisibility(View.GONE);
} }
if (profile != null && profile.getActiveProfile() != null) if (profile != null && profile.getActiveProfile() != null) {
activeProfileView.setText(profile.getActiveProfile()); activeProfileView.setText(profile.getActiveProfile());
activeProfileView.setBackgroundColor(Color.GRAY);
}
activeProfileView.setOnLongClickListener(new View.OnLongClickListener() { activeProfileView.setOnLongClickListener(new View.OnLongClickListener() {
@Override @Override

View file

@ -1,7 +0,0 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<solid android:color="@color/colorInitializingBorder" />
<stroke android:width="1dip" android:color="@android:color/white"/>
<corners
android:radius="2dp" >
</corners>
</shape>

View file

@ -1,7 +0,0 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<solid android:color="@color/loopenabled" />
<stroke android:width="1dip" android:color="@android:color/white"/>
<corners
android:radius="2dp" >
</corners>
</shape>

View file

@ -1,7 +0,0 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<solid android:color="@color/loopdisabled" />
<stroke android:width="1dip" android:color="@android:color/white"/>
<corners
android:radius="2dp" >
</corners>
</shape>

View file

@ -1,7 +0,0 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<solid android:color="@color/looppumpsuspended" />
<stroke android:width="1dip" android:color="@android:color/white"/>
<corners
android:radius="2dp" >
</corners>
</shape>

View file

@ -1,7 +0,0 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<solid android:color="@color/colorWizardButton" />
<stroke android:width="1dip" android:color="@android:color/white"/>
<corners
android:radius="2dp" >
</corners>
</shape>

View file

@ -1,7 +0,0 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<solid android:color="@color/colorPrimaryDark" />
<stroke android:width="1dip" android:color="@android:color/white"/>
<corners
android:radius="2dp" >
</corners>
</shape>

View file

@ -35,7 +35,7 @@
android:layout_gravity="right" android:layout_gravity="right"
android:layout_marginRight="5dp" android:layout_marginRight="5dp"
android:layout_weight="1" android:layout_weight="1"
android:background="@drawable/loopmodeborder" android:background="@drawable/pillborder"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:text="DanaR History" /> android:text="DanaR History" />

View file

@ -32,13 +32,9 @@
android:id="@+id/overview_apsmode" android:id="@+id/overview_apsmode"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginLeft="10dp" android:layout_marginRight="5dp"
android:layout_marginRight="10dp"
android:layout_weight="0.1" android:layout_weight="0.1"
android:background="@drawable/loopmodeborder"
android:gravity="center_vertical|center_horizontal" android:gravity="center_vertical|center_horizontal"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="Open Loop" android:text="Open Loop"
android:textAppearance="?android:attr/textAppearanceSmall" /> android:textAppearance="?android:attr/textAppearanceSmall" />
@ -48,29 +44,21 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="right" android:layout_gravity="right"
android:layout_marginRight="10dp" android:layout_marginRight="5dp"
android:layout_weight="0.5" android:layout_weight="0.5"
android:background="@drawable/pillborder"
android:gravity="center_vertical|center_horizontal" android:gravity="center_vertical|center_horizontal"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="Profile" android:text="Profile"
android:textAppearance="?android:attr/textAppearanceMedium" android:textAppearance="?android:attr/textAppearanceSmall" />
android:textColor="@color/colorProfileSwitchButton" />
<TextView <TextView
android:id="@+id/overview_temptarget" android:id="@+id/overview_temptarget"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="right" android:layout_gravity="right"
android:layout_marginRight="10dp"
android:layout_weight="0.2" android:layout_weight="0.2"
android:background="@drawable/temptargetborder"
android:gravity="center_vertical|center_horizontal" android:gravity="center_vertical|center_horizontal"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="TempTarget" android:text="TempTarget"
android:textAppearance="?android:attr/textAppearanceMedium" android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/mdtp_white" /> android:textColor="@color/mdtp_white" />
</LinearLayout> </LinearLayout>
@ -86,9 +74,8 @@
android:id="@+id/overview_pumpstatus" android:id="@+id/overview_pumpstatus"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginLeft="10dp" android:layout_marginLeft="5dp"
android:layout_marginRight="10dp" android:layout_marginRight="5dp"
android:background="@drawable/initializingborder"
android:gravity="center_vertical|center_horizontal" android:gravity="center_vertical|center_horizontal"
android:text="@string/initializing" android:text="@string/initializing"
android:textAppearance="?android:attr/textAppearanceMedium" /> android:textAppearance="?android:attr/textAppearanceMedium" />

View file

@ -10,6 +10,10 @@
<color name="listdelimiter">#505050</color> <color name="listdelimiter">#505050</color>
<color name="tabBgColor">#f0003f59</color> <color name="tabBgColor">#f0003f59</color>
<color name="tempTargetBackground">#77dd77</color>
<color name="tempTargetDisabledBackground">#303F9F</color>
<color name="colorPrimary">#3F51B5</color> <color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color> <color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color> <color name="colorAccent">#FF4081</color>