Skip to content

Conversation

@AlessandroFrangiamone
Copy link
Contributor

@AlessandroFrangiamone AlessandroFrangiamone commented Nov 24, 2025

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
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
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
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
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()

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