From 2cb6e275c070b0e83f5e730d79126813aec94142 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Sun, 30 Apr 2017 13:17:59 +0200 Subject: [PATCH] allign design of status pills --- .../plugins/Overview/OverviewFragment.java | 21 +++++++++------- .../main/res/drawable/initializingborder.xml | 7 ------ app/src/main/res/drawable/loopmodeborder.xml | 7 ------ .../res/drawable/loopmodedisabledborder.xml | 7 ------ .../res/drawable/loopmodesuspendedborder.xml | 7 ------ .../main/res/drawable/temptargetborder.xml | 7 ------ .../res/drawable/temptargetborderdisabled.xml | 7 ------ .../main/res/layout/danar_historyactivity.xml | 2 +- app/src/main/res/layout/overview_fragment.xml | 25 +++++-------------- app/src/main/res/values/colors.xml | 4 +++ 10 files changed, 23 insertions(+), 71 deletions(-) delete mode 100644 app/src/main/res/drawable/initializingborder.xml delete mode 100644 app/src/main/res/drawable/loopmodeborder.xml delete mode 100644 app/src/main/res/drawable/loopmodedisabledborder.xml delete mode 100644 app/src/main/res/drawable/loopmodesuspendedborder.xml delete mode 100644 app/src/main/res/drawable/temptargetborder.xml delete mode 100644 app/src/main/res/drawable/temptargetborderdisabled.xml diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java index e07caf2994..8befbc1ede 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java @@ -202,6 +202,8 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, loopStatusLayout = (LinearLayout) view.findViewById(R.id.overview_looplayout); pumpStatusLayout = (LinearLayout) view.findViewById(R.id.overview_pumpstatuslayout); + pumpStatusView.setBackgroundColor(MainApp.sResources.getColor(R.color.colorInitializingBorder)); + iobView = (TextView) view.findViewById(R.id.overview_iob); apsModeView = (TextView) view.findViewById(R.id.overview_apsmode); 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) { - PumpInterface pump = MainApp.getConfigBuilder(); if (!status.equals("")) { pumpStatusView.setText(status); pumpStatusLayout.setVisibility(View.VISIBLE); @@ -838,19 +839,19 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, final LoopPlugin.LastRun finalLastRun = LoopPlugin.lastRun; if (Config.APS && MainApp.getConfigBuilder().getPumpDescription().isTempBasalCapable) { apsModeView.setVisibility(View.VISIBLE); - apsModeView.setBackgroundResource(R.drawable.loopmodeborder); + apsModeView.setBackgroundColor(MainApp.sResources.getColor(R.color.loopenabled)); apsModeView.setTextColor(Color.BLACK); final LoopPlugin activeloop = MainApp.getConfigBuilder().getActiveLoop(); 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.setTextColor(Color.WHITE); } 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.setTextColor(Color.WHITE); } 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.setTextColor(Color.WHITE); } 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)); } } else { - apsModeView.setBackgroundResource(R.drawable.loopmodedisabledborder); + apsModeView.setBackgroundColor(MainApp.sResources.getColor(R.color.loopdisabled)); apsModeView.setText(MainApp.sResources.getString(R.string.disabledloop)); apsModeView.setTextColor(Color.WHITE); } @@ -875,7 +876,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, TempTarget tempTarget = tempTargetRangePlugin.getTempTargetInProgress(new Date().getTime()); if (tempTarget != null) { tempTargetView.setTextColor(Color.BLACK); - tempTargetView.setBackgroundResource(R.drawable.temptargetborder); + tempTargetView.setBackgroundColor(MainApp.sResources.getColor(R.color.tempTargetBackground)); 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())); } else { @@ -887,7 +888,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, minBgDefault = Constants.MIN_BG_DEFAULT_MMOL; } 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.setVisibility(View.VISIBLE); } @@ -933,8 +934,10 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, basalLayout.setVisibility(View.GONE); } - if (profile != null && profile.getActiveProfile() != null) + if (profile != null && profile.getActiveProfile() != null) { activeProfileView.setText(profile.getActiveProfile()); + activeProfileView.setBackgroundColor(Color.GRAY); + } activeProfileView.setOnLongClickListener(new View.OnLongClickListener() { @Override diff --git a/app/src/main/res/drawable/initializingborder.xml b/app/src/main/res/drawable/initializingborder.xml deleted file mode 100644 index 7a46a6f1eb..0000000000 --- a/app/src/main/res/drawable/initializingborder.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/loopmodeborder.xml b/app/src/main/res/drawable/loopmodeborder.xml deleted file mode 100644 index 95f3c114e6..0000000000 --- a/app/src/main/res/drawable/loopmodeborder.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/loopmodedisabledborder.xml b/app/src/main/res/drawable/loopmodedisabledborder.xml deleted file mode 100644 index 2326b5ca14..0000000000 --- a/app/src/main/res/drawable/loopmodedisabledborder.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/loopmodesuspendedborder.xml b/app/src/main/res/drawable/loopmodesuspendedborder.xml deleted file mode 100644 index 9caa1789c1..0000000000 --- a/app/src/main/res/drawable/loopmodesuspendedborder.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/temptargetborder.xml b/app/src/main/res/drawable/temptargetborder.xml deleted file mode 100644 index 8dc85926e2..0000000000 --- a/app/src/main/res/drawable/temptargetborder.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/temptargetborderdisabled.xml b/app/src/main/res/drawable/temptargetborderdisabled.xml deleted file mode 100644 index 60a46f667e..0000000000 --- a/app/src/main/res/drawable/temptargetborderdisabled.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/danar_historyactivity.xml b/app/src/main/res/layout/danar_historyactivity.xml index d21ecfd2ff..e3d8ea2f2d 100644 --- a/app/src/main/res/layout/danar_historyactivity.xml +++ b/app/src/main/res/layout/danar_historyactivity.xml @@ -35,7 +35,7 @@ android:layout_gravity="right" android:layout_marginRight="5dp" android:layout_weight="1" - android:background="@drawable/loopmodeborder" + android:background="@drawable/pillborder" android:gravity="center_horizontal" android:text="DanaR History" /> diff --git a/app/src/main/res/layout/overview_fragment.xml b/app/src/main/res/layout/overview_fragment.xml index 2bac2cb13e..985395009f 100644 --- a/app/src/main/res/layout/overview_fragment.xml +++ b/app/src/main/res/layout/overview_fragment.xml @@ -32,13 +32,9 @@ android:id="@+id/overview_apsmode" android:layout_width="wrap_content" android:layout_height="match_parent" - android:layout_marginLeft="10dp" - android:layout_marginRight="10dp" + android:layout_marginRight="5dp" android:layout_weight="0.1" - android:background="@drawable/loopmodeborder" android:gravity="center_vertical|center_horizontal" - android:paddingLeft="10dp" - android:paddingRight="10dp" android:text="Open Loop" android:textAppearance="?android:attr/textAppearanceSmall" /> @@ -48,29 +44,21 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="right" - android:layout_marginRight="10dp" + android:layout_marginRight="5dp" android:layout_weight="0.5" - android:background="@drawable/pillborder" android:gravity="center_vertical|center_horizontal" - android:paddingLeft="10dp" - android:paddingRight="10dp" android:text="Profile" - android:textAppearance="?android:attr/textAppearanceMedium" - android:textColor="@color/colorProfileSwitchButton" /> + android:textAppearance="?android:attr/textAppearanceSmall" /> @@ -86,9 +74,8 @@ android:id="@+id/overview_pumpstatus" android:layout_width="match_parent" android:layout_height="match_parent" - android:layout_marginLeft="10dp" - android:layout_marginRight="10dp" - android:background="@drawable/initializingborder" + android:layout_marginLeft="5dp" + android:layout_marginRight="5dp" android:gravity="center_vertical|center_horizontal" android:text="@string/initializing" android:textAppearance="?android:attr/textAppearanceMedium" /> diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 6c3aaebf16..cc665a46c8 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -10,6 +10,10 @@ #505050 #f0003f59 + #77dd77 + #303F9F + + #3F51B5 #303F9F #FF4081