-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve Profile Switch Negative Timeshift and string for Wear Loop State #3784
Improve Profile Switch Negative Timeshift and string for Wear Loop State #3784
Conversation
olorinmaia
commented
Jan 26, 2025
•
edited
Loading
edited
- Wear: Allow negative timeshift values for profile switch.
- Align timeshift limits in wear/phone to -23h/+23h from 0h/+23h (wear) and -6h/+23h (phone). I can see in wiki that -10h and +10h example is provided, which isn't possible in present code: https://androidaps.readthedocs.io/en/latest/DailyLifeWithAaps/ProfileSwitch-ProfilePercentage.html#time-shift-of-the-circadian-percentage-profile
- Wear: Set the step value for percentage in profile switch from 1 to 5 for better user experience (aligned with phone).
- Wear: Use a more appropriate string for duration in minutes used in Loop State Disconnect Pump.
- Wear: Improve string used for profile switch in wear by adding current name of profile and "h" to timeshift
- Allow negative timeshift values for profile switch to allow for earlier profile times. - Align timeshift limits in wear/phone to -23h/+23h from 0h/+23h (wear) and -6h/+23h (phone). - Set the step value for percentage in profile switch from 1 to 5 for better user experience. - Use a more appropriate string for duration in minutes used in Loop State Disconnect Pump.
@@ -30,7 +30,6 @@ class ProfileSwitchActivity : ViewSelectorActivity() { | |||
finish() | |||
return | |||
} | |||
if (timeshift < 0) timeshift += 24 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be afraid to remove this. it makes timeshit always positive value. I'm not sure what will happen elsewhere ....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for feedback!
Profile switch in wear checks phone what current timeshift and percentage is. So if f.ex. a - 2h timeshift and 120% profile is set in phone it automatically preselect these values in wear app when using wear profile switch button.
Problem is when a negative timeshift is set on phone, with this line of code, wear app adds +24h to the -2h from phone and displays +22h instead which is wrong.
I don't know if there is any way to avoid this except removing it, limits are set to -23/+23 so user can't enter higher or lower?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (timeshift < 0) timeshift += 24
This was ensuring the timeshift remained in a 0-23 range, but it's no longer needed if we go for aligning phone/wear range.
var initValue = SafeParse.stringToDouble(editTimeshift?.editText?.text.toString(), timeshift.toDouble()) | ||
editTimeshift = PlusMinusEditText(viewAdapter, initValue, 0.0, 23.0, 1.0, DecimalFormat("0"), true, getString(R.string.action_timeshift), true) | ||
val initValue = SafeParse.stringToDouble(editTimeshift?.editText?.text.toString(), timeshift.toDouble()) | ||
editTimeshift = PlusMinusEditText(viewAdapter, initValue, -23.0, 23.0, 1.0, DecimalFormat("0"), true, getString(R.string.action_timeshift), true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use Constants here too
add implementation(project(":core:data"))
to gradle script
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|