Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC-Android
Manage
Activity
Members
Labels
Plan
Issues
530
Issue boards
Milestones
Wiki
Code
Merge requests
15
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoLAN
VLC-Android
Commits
b2c96ea3
Commit
b2c96ea3
authored
5 years ago
by
Nicolas Pomepuy
Committed by
Geoffrey Métais
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Mitigate the default video brightness jump
parent
58af3c9e
No related branches found
No related tags found
1 merge request
!72
Mitigate the default video brightness jump
Pipeline
#6226
passed with stage
in 3 minutes and 50 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
vlc-android/src/org/videolan/vlc/gui/video/VideoTouchDelegate.kt
+19
-6
19 additions, 6 deletions
...roid/src/org/videolan/vlc/gui/video/VideoTouchDelegate.kt
with
19 additions
and
6 deletions
vlc-android/src/org/videolan/vlc/gui/video/VideoTouchDelegate.kt
+
19
−
6
View file @
b2c96ea3
...
...
@@ -2,6 +2,7 @@ package org.videolan.vlc.gui.video
import
android.content.res.Configuration
import
android.media.AudioManager
import
android.provider.Settings
import
android.util.DisplayMetrics
import
android.view.*
import
androidx.core.view.GestureDetectorCompat
...
...
@@ -28,9 +29,9 @@ private const val MAX_FOV = 150f
private
const
val
JOYSTICK_INPUT_DELAY
=
300
class
VideoTouchDelegate
(
private
val
player
:
VideoPlayerActivity
,
private
val
mTouchControls
:
Int
,
var
screenConfig
:
ScreenConfig
,
private
val
tv
:
Boolean
)
{
private
val
mTouchControls
:
Int
,
var
screenConfig
:
ScreenConfig
,
private
val
tv
:
Boolean
)
{
private
var
mTouchAction
=
TOUCH_NONE
private
var
mInitTouchY
=
0f
...
...
@@ -285,7 +286,19 @@ class VideoTouchDelegate(private val player: VideoPlayerActivity,
private
fun
initBrightnessTouch
()
{
val
lp
=
player
.
window
.
attributes
val
brightnesstemp
=
if
(
lp
.
screenBrightness
!=
-
1f
)
lp
.
screenBrightness
else
0.6f
//Check if we already have a brightness
val
brightnesstemp
=
if
(
lp
.
screenBrightness
!=
-
1f
)
lp
.
screenBrightness
else
{
//Check if the device is in auto mode
val
contentResolver
=
player
.
applicationContext
.
contentResolver
if
(
Settings
.
System
.
getInt
(
contentResolver
,
Settings
.
System
.
SCREEN_BRIGHTNESS_MODE
)
==
Settings
.
System
.
SCREEN_BRIGHTNESS_MODE_AUTOMATIC
)
{
//cannot retrieve a value -> 0.5
0.5f
}
else
Settings
.
System
.
getInt
(
contentResolver
,
Settings
.
System
.
SCREEN_BRIGHTNESS
,
128
).
toFloat
()
/
255
}
lp
.
screenBrightness
=
brightnesstemp
player
.
window
.
attributes
=
lp
mIsFirstBrightnessGesture
=
false
...
...
@@ -304,7 +317,7 @@ class VideoTouchDelegate(private val player: VideoPlayerActivity,
private
val
mScaleListener
=
object
:
ScaleGestureDetector
.
SimpleOnScaleGestureListener
()
{
private
var
savedScale
:
MediaPlayer
.
ScaleType
?
=
null
private
var
savedScale
:
MediaPlayer
.
ScaleType
?
=
null
override
fun
onScaleBegin
(
detector
:
ScaleGestureDetector
):
Boolean
{
return
screenConfig
.
xRange
!=
0
||
player
.
fov
==
0f
}
...
...
@@ -366,7 +379,7 @@ class VideoTouchDelegate(private val player: VideoPlayerActivity,
return
false
}
override
fun
onFling
(
e1
:
MotionEvent
?,
e2
:
MotionEvent
?,
velocityX
:
Float
,
velocityY
:
Float
)
=
false
override
fun
onFling
(
e1
:
MotionEvent
?,
e2
:
MotionEvent
?,
velocityX
:
Float
,
velocityY
:
Float
)
=
false
}
}
...
...
This diff is collapsed.
Click to expand it.
Geoffrey Métais
@Dekans
mentioned in commit
45fc67f2
·
5 years ago
mentioned in commit
45fc67f2
mentioned in commit 45fc67f22c529a74b413155bfd89cb5d33d63be9
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment