Skip to content

Bubble level change color when reach threshold - #3241

Merged
kylecorry31 merged 4 commits into
kylecorry31:mainfrom
AlessandroFrangiamone:improvement/Bubble-level-color-change-when-reach-threshold
Dec 21, 2025
Merged

kylecorry31 merged 4 commits into
kylecorry31:mainfrom
AlessandroFrangiamone:improvement/Bubble-level-color-change-when-reach-threshold

Conversation

@AlessandroFrangiamone

@AlessandroFrangiamone AlessandroFrangiamone commented Nov 24, 2025 •

Copy link
Copy Markdown
Contributor

Description

Overview

Adds a user-configurable threshold setting for the Bubble Level tool in settings. (Persists across app sessions)
The bubble background color changes based on this custom threshold.

Changes:

  • Created BubbleLevelPreferences to store threshold setting (default: 2°)
  • Added BubbleLevelSettingsFragment with number picker
  • Adjust bubble bg color in BubbleLevel based on threshold

Related Issue

The following PR includes the functionality requested in issue #3224

Checklist

  • I have reviewed the CONTRIBUTING.md guide and confirm that I am following it
  • My code attempts to follow the code style of this project
  • I have tested my changes on an Android device or emulator
  • I have added/updated tests where appropriate
  • I have updated documentation where appropriate

Screenshots

screen-20251124-182948.mp4

@kylecorry31

Copy link
Copy Markdown
Owner

I left a few minor comments but functionality wise that looks great

getString(R.string.pref_bubble_level_threshold),
{ prefs.threshold.toInt() },
{ prefs.threshold = it.toFloat() },
minValue = 1,

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Is it possible to make the minimum value 0? That way if a user doesn't want it to show they can set it to 0 and it should never appear

import com.kylecorry.trail_sense.R
import com.kylecorry.trail_sense.shared.preferences.PreferencesSubsystem

class BubbleLevelPreferences(private val context: Context) : IBubbleLevelPreferences {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Can this extend the PreferenceRepo as well?

(that removes the need to define cache)

{ prefs.threshold = it.toFloat() },
minValue = 1,
maxValue = 10,
formatValue = { getString(R.string.degree_format, it.toFloat()) }

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Can the FormatService be used?

Available with AppServiceRegistry.get()

@kylecorry31

Copy link
Copy Markdown
Owner

I'm going to merge this and make those minor changes. Thank you for the contribution!

@kylecorry31
kylecorry31 merged commit be3280b into kylecorry31:main Dec 21, 2025
2 checks passed
@AlessandroFrangiamone

Copy link
Copy Markdown
Contributor Author

@kylecorry31 Thanks! I apologize for not making those changes myself over the last few weeks; unfortunately, I just couldn't find the time to code. I should have some free time next week, so I can open a follow-up PR for those minor changes 😊

@kylecorry31

Copy link
Copy Markdown
Owner

@kylecorry31 Thanks! I apologize for not making those changes myself over the last few weeks; unfortunately, I just couldn't find the time to code. I should have some free time next week, so I can open a follow-up PR for those minor changes 😊

No worries! I fixed all of the minor changes after I merged it in, so it is all set and will be included in the January release.

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