Skip to content
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

Merged
merged 6 commits into from
Feb 5, 2025

Conversation

olorinmaia
Copy link
Contributor

@olorinmaia olorinmaia commented Jan 26, 2025

- 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
Copy link
Contributor

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 ....

Copy link
Contributor Author

@olorinmaia olorinmaia Jan 27, 2025

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

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)
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

sonarqubecloud bot commented Feb 4, 2025

@MilosKozak MilosKozak merged commit 76cb24e into nightscout:dev Feb 5, 2025
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants