Add 'Fix brightness control' setting to resolve torch strength level …#140
Open
yoyo53 wants to merge 1 commit intocyb3rko:mainfrom
Open
Add 'Fix brightness control' setting to resolve torch strength level …#140yoyo53 wants to merge 1 commit intocyb3rko:mainfrom
yoyo53 wants to merge 1 commit intocyb3rko:mainfrom
Conversation
…issues This commit adds a new user setting to fix devices where the flashlight ignores brightness level changes when using turnOnTorchWithStrengthLevel(). Problem: On some Android devices, calling turnOnTorchWithStrengthLevel() when the torch is off results in the torch turning on at default brightness instead of the requested level. The Quick Settings tile was particularly affected, always activating at default level instead of the configured preferred level. Solution: - Added new 'Fix brightness control' setting (disabled by default) - When enabled and torch is OFF, the code now calls setTorchMode(true) before turnOnTorchWithStrengthLevel() to ensure the level is applied correctly - Optimization: Pre-activation only happens when torch is currently off, avoiding unnecessary flickering when changing levels during active use Changes: - Safe.kt: Added TORCH_PREACTIVATION constant - strings.xml: Added user-friendly setting strings - preferences.xml: Added switch preference in Flashlight controls category - Camera.kt: Refactored sendLightLevel() methods to accept preactivate parameter - MainActivity.kt: Load and pass setting to all torch activation calls - SettingsTile.kt: Read setting and apply pre-activation logic - VolumeButtonService.kt: Read setting and pass to Camera.sendLightLevel() The setting is automatically reloaded in onResume() so changes take effect immediately without requiring app restart.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit adds a new user setting to fix devices where the flashlight ignores brightness level changes when using turnOnTorchWithStrengthLevel().
Problem:
On some Android devices, calling turnOnTorchWithStrengthLevel() when the torch is off results in the torch turning on at default brightness instead of the requested level. The Quick Settings tile was particularly affected, always activating at default level instead of the configured preferred level.
Solution:
Changes:
The setting is automatically reloaded in onResume() so changes take effect immediately without requiring app restart.