Merge pull request #2822 from Philoul/ProfileHelperImprovement
Profile helper UI improvement (color & icon)
This commit is contained in:
commit
35a2692d25
5 changed files with 53 additions and 3 deletions
|
@ -1,5 +1,6 @@
|
||||||
package info.nightscout.androidaps.activities
|
package info.nightscout.androidaps.activities
|
||||||
|
|
||||||
|
import android.content.res.ColorStateList
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.text.Editable
|
import android.text.Editable
|
||||||
import android.text.TextWatcher
|
import android.text.TextWatcher
|
||||||
|
@ -251,6 +252,7 @@ class ProfileHelperActivity : NoSplashAppCompatActivity() {
|
||||||
|
|
||||||
tabSelected = tab
|
tabSelected = tab
|
||||||
typeSelected[tabSelected] = newContent
|
typeSelected[tabSelected] = newContent
|
||||||
|
profilehelper_profiletype_title.setDefaultHintTextColor(ColorStateList.valueOf(resourceHelper.gc(if (tab == 0) R.color.tabBgColorSelected else R.color.examinedProfile)))
|
||||||
|
|
||||||
// show new content
|
// show new content
|
||||||
profilehelper_profiletype.setText(
|
profilehelper_profiletype.setText(
|
||||||
|
@ -281,6 +283,6 @@ class ProfileHelperActivity : NoSplashAppCompatActivity() {
|
||||||
|
|
||||||
private fun setBackgroundColorOnSelected(tab: Int) {
|
private fun setBackgroundColorOnSelected(tab: Int) {
|
||||||
profilehelper_menu1.setBackgroundColor(resourceHelper.gc(if (tab == 1) R.color.defaultbackground else R.color.tabBgColorSelected))
|
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))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
style="@style/ButtonMediumFontStyle"
|
style="@style/ButtonMediumFontStyle"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:drawableStart="@drawable/ic_auto_delta"
|
android:drawableStart="@drawable/ic_compare_profiles"
|
||||||
android:text="@string/comapareprofile" />
|
android:text="@string/comapareprofile" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
@ -51,6 +51,7 @@
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||||
|
android:id="@+id/profilehelper_profiletype_title"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:hint="@string/profiletype"
|
android:hint="@string/profiletype"
|
||||||
|
|
|
@ -97,6 +97,7 @@ class ProfileViewerDialog : DaggerDialogFragment() {
|
||||||
profile = Profile(injector, JSONObject(customProfileJson), customProfileUnits)
|
profile = Profile(injector, JSONObject(customProfileJson), customProfileUnits)
|
||||||
profile2 = Profile(injector, JSONObject(customProfileJson2), customProfileUnits)
|
profile2 = Profile(injector, JSONObject(customProfileJson2), customProfileUnits)
|
||||||
profileName = customProfileName
|
profileName = customProfileName
|
||||||
|
header_icon.setImageResource(R.drawable.ic_compare_profiles)
|
||||||
date = ""
|
date = ""
|
||||||
profileview_datelayout.visibility = View.GONE
|
profileview_datelayout.visibility = View.GONE
|
||||||
}
|
}
|
||||||
|
@ -117,7 +118,8 @@ class ProfileViewerDialog : DaggerDialogFragment() {
|
||||||
profile2?.let { profile2 ->
|
profile2?.let { profile2 ->
|
||||||
profileview_units.text = profile1.units
|
profileview_units.text = profile1.units
|
||||||
profileview_dia.text = HtmlHelper.fromHtml(formatColors("", profile1.dia, profile1.dia, DecimalFormat("0.00"), resourceHelper.gs(R.string.shorthour)))
|
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_date.text = date
|
||||||
profileview_ic.text = ics(profile1, profile2)
|
profileview_ic.text = ics(profile1, profile2)
|
||||||
profileview_isf.text = isfs(profile1, profile2)
|
profileview_isf.text = isfs(profile1, profile2)
|
||||||
|
@ -177,6 +179,13 @@ class ProfileViewerDialog : DaggerDialogFragment() {
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun formatColors(text1: String, text2: String): String {
|
||||||
|
var s = "<font color='${resourceHelper.gc(R.color.tempbasal)}'>$text1</font>"
|
||||||
|
s += "<BR/>"
|
||||||
|
s += "<font color='${resourceHelper.gc(R.color.examinedProfile)}'>$text2</font>"
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
private fun basals(profile1: Profile, profile2: Profile): Spanned {
|
private fun basals(profile1: Profile, profile2: Profile): Spanned {
|
||||||
var prev1 = 0.0
|
var prev1 = 0.0
|
||||||
var prev2 = 0.0
|
var prev2 = 0.0
|
||||||
|
|
12
core/src/main/res/drawable/ic_compare_profiles.xml
Normal file
12
core/src/main/res/drawable/ic_compare_profiles.xml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="48dp"
|
||||||
|
android:height="48dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:pathData="M18.307,8.927c-0.135,-0.417 -0.494,-0.72 -0.928,-0.783l-3.997,-0.581l-1.789,-3.622c-0.387,-0.786 -1.675,-0.786 -2.061,0L7.743,7.563L3.746,8.145C3.313,8.207 2.953,8.511 2.818,8.927C2.683,9.343 2.795,9.8 3.109,10.105l2.894,2.819l-0.683,3.983c-0.074,0.432 0.103,0.868 0.457,1.125c0.2,0.146 0.437,0.22 0.676,0.22c0.183,0 0.367,-0.044 0.535,-0.133l3.576,-1.879l3.576,1.879c0.39,0.203 0.855,0.173 1.212,-0.087c0.353,-0.257 0.531,-0.694 0.456,-1.125l-0.683,-3.983l2.893,-2.819C18.329,9.8 18.443,9.343 18.307,8.927zM17.252,9.488l-3.16,3.081l0.746,4.35c0.014,0.087 -0.021,0.174 -0.092,0.225c-0.04,0.03 -0.087,0.044 -0.135,0.044c-0.036,0 -0.073,-0.008 -0.108,-0.027l-3.907,-2.053l-3.907,2.053c-0.075,0.044 -0.17,0.036 -0.242,-0.017c-0.07,-0.051 -0.106,-0.138 -0.091,-0.225l0.746,-4.35L3.94,9.488C3.877,9.427 3.855,9.335 3.882,9.252s0.099,-0.143 0.185,-0.156l4.369,-0.634l1.954,-3.959c0.078,-0.158 0.334,-0.158 0.412,0l1.953,3.959l4.369,0.634c0.087,0.013 0.158,0.073 0.185,0.156S17.315,9.427 17.252,9.488z"
|
||||||
|
android:fillColor="@color/tempbasal"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M21.182,11.032c-0.135,-0.417 -0.494,-0.72 -0.928,-0.783l-3.997,-0.581l-1.789,-3.622c-0.387,-0.786 -1.675,-0.786 -2.061,0l-1.789,3.622l-3.998,0.581c-0.432,0.063 -0.793,0.366 -0.928,0.783c-0.135,0.416 -0.023,0.873 0.291,1.178l2.894,2.819l-0.683,3.983c-0.074,0.432 0.103,0.868 0.457,1.125c0.2,0.146 0.437,0.22 0.676,0.22c0.183,0 0.367,-0.044 0.535,-0.133l3.576,-1.879l3.576,1.879c0.39,0.203 0.855,0.173 1.212,-0.087c0.353,-0.257 0.531,-0.694 0.456,-1.125l-0.683,-3.983l2.893,-2.819C21.204,11.905 21.318,11.448 21.182,11.032zM20.127,11.593l-3.16,3.081l0.746,4.35c0.014,0.087 -0.021,0.174 -0.092,0.225c-0.04,0.03 -0.087,0.044 -0.135,0.044c-0.036,0 -0.073,-0.008 -0.108,-0.027l-3.907,-2.053l-3.907,2.053c-0.075,0.044 -0.17,0.036 -0.242,-0.017c-0.07,-0.051 -0.106,-0.138 -0.091,-0.225l0.746,-4.35l-3.162,-3.081c-0.063,-0.061 -0.085,-0.153 -0.058,-0.236c0.027,-0.083 0.099,-0.143 0.185,-0.156l4.369,-0.634l1.954,-3.959c0.078,-0.158 0.334,-0.158 0.412,0l1.953,3.959L20,11.201c0.087,0.013 0.158,0.073 0.185,0.156S20.19,11.532 20.127,11.593z"
|
||||||
|
android:fillColor="@color/examinedProfile"/>
|
||||||
|
</vector>
|
26
icons/compare_profiles.svg
Normal file
26
icons/compare_profiles.svg
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px"
|
||||||
|
height="24px" viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve">
|
||||||
|
<g id="cp_x5F_compare_x5F_profile">
|
||||||
|
<rect display="none" width="24" height="24"/>
|
||||||
|
<path fill="#03A9F4" d="M18.307,8.927c-0.135-0.417-0.494-0.72-0.928-0.783l-3.997-0.581l-1.789-3.622
|
||||||
|
c-0.387-0.786-1.675-0.786-2.061,0L7.743,7.563L3.746,8.145C3.313,8.207,2.953,8.511,2.818,8.927
|
||||||
|
C2.683,9.343,2.795,9.8,3.109,10.105l2.894,2.819l-0.683,3.983c-0.074,0.432,0.103,0.868,0.457,1.125
|
||||||
|
c0.2,0.146,0.437,0.22,0.676,0.22c0.183,0,0.367-0.044,0.535-0.133l3.576-1.879l3.576,1.879c0.39,0.203,0.855,0.173,1.212-0.087
|
||||||
|
c0.353-0.257,0.531-0.694,0.456-1.125l-0.683-3.983l2.893-2.819C18.329,9.8,18.443,9.343,18.307,8.927z M17.252,9.488l-3.16,3.081
|
||||||
|
l0.746,4.35c0.014,0.087-0.021,0.174-0.092,0.225c-0.04,0.03-0.087,0.044-0.135,0.044c-0.036,0-0.073-0.008-0.108-0.027
|
||||||
|
l-3.907-2.053l-3.907,2.053c-0.075,0.044-0.17,0.036-0.242-0.017c-0.07-0.051-0.106-0.138-0.091-0.225l0.746-4.35L3.94,9.488
|
||||||
|
C3.877,9.427,3.855,9.335,3.882,9.252s0.099-0.143,0.185-0.156l4.369-0.634l1.954-3.959c0.078-0.158,0.334-0.158,0.412,0
|
||||||
|
l1.953,3.959l4.369,0.634c0.087,0.013,0.158,0.073,0.185,0.156S17.315,9.427,17.252,9.488z"/>
|
||||||
|
<path fill="#FF5555" d="M21.182,11.032c-0.135-0.417-0.494-0.72-0.928-0.783l-3.997-0.581l-1.789-3.622
|
||||||
|
c-0.387-0.786-1.675-0.786-2.061,0l-1.789,3.622l-3.998,0.581c-0.432,0.063-0.793,0.366-0.928,0.783
|
||||||
|
c-0.135,0.416-0.023,0.873,0.291,1.178l2.894,2.819l-0.683,3.983c-0.074,0.432,0.103,0.868,0.457,1.125
|
||||||
|
c0.2,0.146,0.437,0.22,0.676,0.22c0.183,0,0.367-0.044,0.535-0.133l3.576-1.879l3.576,1.879c0.39,0.203,0.855,0.173,1.212-0.087
|
||||||
|
c0.353-0.257,0.531-0.694,0.456-1.125l-0.683-3.983l2.893-2.819C21.204,11.905,21.318,11.448,21.182,11.032z M20.127,11.593
|
||||||
|
l-3.16,3.081l0.746,4.35c0.014,0.087-0.021,0.174-0.092,0.225c-0.04,0.03-0.087,0.044-0.135,0.044
|
||||||
|
c-0.036,0-0.073-0.008-0.108-0.027l-3.907-2.053l-3.907,2.053c-0.075,0.044-0.17,0.036-0.242-0.017
|
||||||
|
c-0.07-0.051-0.106-0.138-0.091-0.225l0.746-4.35l-3.162-3.081c-0.063-0.061-0.085-0.153-0.058-0.236
|
||||||
|
c0.027-0.083,0.099-0.143,0.185-0.156l4.369-0.634l1.954-3.959c0.078-0.158,0.334-0.158,0.412,0l1.953,3.959L20,11.201
|
||||||
|
c0.087,0.013,0.158,0.073,0.185,0.156S20.19,11.532,20.127,11.593z"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 2.4 KiB |
Loading…
Reference in a new issue