From 9fe4b7682f991dbafa4a5b991b1c3de4b203f96b Mon Sep 17 00:00:00 2001 From: Philoul Date: Sun, 12 Jul 2020 15:36:55 +0200 Subject: [PATCH 1/3] Add Compare Profile icon I used Color palet to align colors with ProfileViewerDialog --- .../main/res/drawable/ic_compare_profiles.xml | 12 +++++++++ icons/compare_profiles.svg | 26 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 core/src/main/res/drawable/ic_compare_profiles.xml create mode 100644 icons/compare_profiles.svg diff --git a/core/src/main/res/drawable/ic_compare_profiles.xml b/core/src/main/res/drawable/ic_compare_profiles.xml new file mode 100644 index 0000000000..d63aae66b2 --- /dev/null +++ b/core/src/main/res/drawable/ic_compare_profiles.xml @@ -0,0 +1,12 @@ + + + + diff --git a/icons/compare_profiles.svg b/icons/compare_profiles.svg new file mode 100644 index 0000000000..123653d167 --- /dev/null +++ b/icons/compare_profiles.svg @@ -0,0 +1,26 @@ + + + + + + + + From fc859acc6607a392d4e70ac9cbdbda9fc4ea13d0 Mon Sep 17 00:00:00 2001 From: Philoul Date: Fri, 17 Jul 2020 01:07:16 +0200 Subject: [PATCH 2/3] ProfileViewer Compare icon and colors Icon : change white single star with double blue and red stars Profile names colored according to profiles (blue and red) --- .../androidaps/dialogs/ProfileViewerDialog.kt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/info/nightscout/androidaps/dialogs/ProfileViewerDialog.kt b/core/src/main/java/info/nightscout/androidaps/dialogs/ProfileViewerDialog.kt index 1fb90c7da3..9b642d1c53 100644 --- a/core/src/main/java/info/nightscout/androidaps/dialogs/ProfileViewerDialog.kt +++ b/core/src/main/java/info/nightscout/androidaps/dialogs/ProfileViewerDialog.kt @@ -97,6 +97,7 @@ class ProfileViewerDialog : DaggerDialogFragment() { profile = Profile(injector, JSONObject(customProfileJson), customProfileUnits) profile2 = Profile(injector, JSONObject(customProfileJson2), customProfileUnits) profileName = customProfileName + header_icon.setImageResource(R.drawable.ic_compare_profiles) date = "" profileview_datelayout.visibility = View.GONE } @@ -117,7 +118,8 @@ class ProfileViewerDialog : DaggerDialogFragment() { profile2?.let { profile2 -> profileview_units.text = profile1.units profileview_dia.text = HtmlHelper.fromHtml(formatColors("", profile1.dia, profile1.dia, DecimalFormat("0.00"), resourceHelper.gs(R.string.shorthour))) - profileview_activeprofile.text = profileName + val profileNames =profileName!!.split("\n").toTypedArray() + profileview_activeprofile.text = HtmlHelper.fromHtml(formatColors(profileNames[0], profileNames[1])) profileview_date.text = date profileview_ic.text = ics(profile1, profile2) profileview_isf.text = isfs(profile1, profile2) @@ -177,6 +179,13 @@ class ProfileViewerDialog : DaggerDialogFragment() { return s } + private fun formatColors(text1: String, text2: String): String { + var s = "$text1" + s += "
" + s += "$text2" + return s + } + private fun basals(profile1: Profile, profile2: Profile): Spanned { var prev1 = 0.0 var prev2 = 0.0 From 507e04a30b968daa24e87b9d56bbb998842ac3a8 Mon Sep 17 00:00:00 2001 From: Philoul Date: Fri, 17 Jul 2020 01:09:30 +0200 Subject: [PATCH 3/3] Compare Profile icon and tab2 color Change tab 2 color (to red) and Profile type label color (to red when tab 2 selected) --- .../nightscout/androidaps/activities/ProfileHelperActivity.kt | 4 +++- app/src/main/res/layout/activity_profilehelper.xml | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/activities/ProfileHelperActivity.kt b/app/src/main/java/info/nightscout/androidaps/activities/ProfileHelperActivity.kt index df32da9a79..749913c9a1 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/ProfileHelperActivity.kt +++ b/app/src/main/java/info/nightscout/androidaps/activities/ProfileHelperActivity.kt @@ -1,5 +1,6 @@ package info.nightscout.androidaps.activities +import android.content.res.ColorStateList import android.os.Bundle import android.text.Editable import android.text.TextWatcher @@ -251,6 +252,7 @@ class ProfileHelperActivity : NoSplashAppCompatActivity() { tabSelected = tab typeSelected[tabSelected] = newContent + profilehelper_profiletype_title.setDefaultHintTextColor(ColorStateList.valueOf(resourceHelper.gc(if (tab == 0) R.color.tabBgColorSelected else R.color.examinedProfile))) // show new content profilehelper_profiletype.setText( @@ -281,6 +283,6 @@ class ProfileHelperActivity : NoSplashAppCompatActivity() { private fun setBackgroundColorOnSelected(tab: Int) { profilehelper_menu1.setBackgroundColor(resourceHelper.gc(if (tab == 1) R.color.defaultbackground else R.color.tabBgColorSelected)) - profilehelper_menu2.setBackgroundColor(resourceHelper.gc(if (tab == 0) R.color.defaultbackground else R.color.tabBgColorSelected)) + profilehelper_menu2.setBackgroundColor(resourceHelper.gc(if (tab == 0) R.color.defaultbackground else R.color.examinedProfile)) } } diff --git a/app/src/main/res/layout/activity_profilehelper.xml b/app/src/main/res/layout/activity_profilehelper.xml index f7cee31409..effa56b112 100644 --- a/app/src/main/res/layout/activity_profilehelper.xml +++ b/app/src/main/res/layout/activity_profilehelper.xml @@ -17,7 +17,7 @@ style="@style/ButtonMediumFontStyle" android:layout_width="match_parent" android:layout_height="wrap_content" - android:drawableStart="@drawable/ic_auto_delta" + android:drawableStart="@drawable/ic_compare_profiles" android:text="@string/comapareprofile" />