Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
VLC-Android
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ewout ter Hoeven
VLC-Android
Commits
a8084723
Commit
a8084723
authored
Nov 03, 2014
by
Geoffrey Métais
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Nicer touch behaviour for volume and brightness
parent
1862583d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
11 deletions
+16
-11
vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
...d/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+16
-11
No files found.
vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
View file @
a8084723
...
...
@@ -215,7 +215,8 @@ public class VideoPlayerActivity extends Activity implements IVideoPlayer {
private
int
mAudioMax
;
private
OnAudioFocusChangeListener
mAudioFocusListener
;
private
boolean
mMute
=
false
;
private
int
mVol
,
mVolSave
;
private
int
mVolSave
;
private
float
mVol
;
//Touch Events
private
static
final
int
TOUCH_NONE
=
0
;
...
...
@@ -1383,6 +1384,8 @@ public class VideoPlayerActivity extends Activity implements IVideoPlayer {
// No volume/brightness action if coef < 2 or a secondary display is connected
//TODO : Volume action when a secondary display is connected
if
(
coef
>
2
&&
mPresentation
==
null
)
{
mTouchY
=
event
.
getRawY
();
mTouchX
=
event
.
getRawX
();
// Volume (Up or Down - Right side)
if
(!
mEnableBrightnessGesture
||
(
int
)
mTouchX
>
(
screen
.
widthPixels
/
2
)){
doVolumeTouch
(
y_changed
);
...
...
@@ -1397,9 +1400,10 @@ public class VideoPlayerActivity extends Activity implements IVideoPlayer {
// Nexus), gestures can't be made without activating the UI.
if
(
AndroidDevices
.
hasNavBar
())
showOverlay
();
}
}
else
{
// Seek (Right or Left move)
doSeekTouch
(
coef
,
xgesturesize
,
false
);
}
break
;
case
MotionEvent
.
ACTION_UP
:
...
...
@@ -1462,9 +1466,10 @@ public class VideoPlayerActivity extends Activity implements IVideoPlayer {
private
void
doVolumeTouch
(
float
y_changed
)
{
if
(
mTouchAction
!=
TOUCH_NONE
&&
mTouchAction
!=
TOUCH_VOLUME
)
return
;
int
delta
=
-(
int
)
((
y_changed
/
mSurfaceYDisplayRange
)
*
mAudioMax
);
int
vol
=
(
int
)
Math
.
min
(
Math
.
max
(
mVol
+
delta
,
0
),
mAudioMax
);
if
(
delta
!=
0
)
{
float
delta
=
-
((
y_changed
*
2
f
/
mSurfaceYDisplayRange
)
*
mAudioMax
);
mVol
+=
delta
;
int
vol
=
(
int
)
Math
.
min
(
Math
.
max
(
mVol
,
0
),
mAudioMax
);
if
(
delta
!=
0
f
)
{
setAudioVolume
(
vol
);
}
}
...
...
@@ -1477,14 +1482,14 @@ public class VideoPlayerActivity extends Activity implements IVideoPlayer {
private
void
updateMute
()
{
if
(!
mMute
)
{
mVolSave
=
mVol
;
mVolSave
=
Float
.
floatToIntBits
(
mVol
)
;
mMute
=
true
;
mAudioManager
.
setStreamVolume
(
AudioManager
.
STREAM_MUSIC
,
0
,
0
);
showInfo
(
R
.
string
.
sound_off
,
1000
);
}
else
{
mVol
=
mVolSave
;
mMute
=
false
;
mAudioManager
.
setStreamVolume
(
AudioManager
.
STREAM_MUSIC
,
mVol
,
0
);
mAudioManager
.
setStreamVolume
(
AudioManager
.
STREAM_MUSIC
,
Float
.
floatToIntBits
(
mVol
)
,
0
);
showInfo
(
R
.
string
.
sound_on
,
1000
);
}
}
...
...
@@ -1511,8 +1516,8 @@ public class VideoPlayerActivity extends Activity implements IVideoPlayer {
if
(
mIsFirstBrightnessGesture
)
initBrightnessTouch
();
mTouchAction
=
TOUCH_BRIGHTNESS
;
// Set delta :
0.07
f is arbitrary for now, it possibly will change in the future
float
delta
=
-
y_changed
/
mSurfaceYDisplayRange
*
0.07
f
;
// Set delta :
2
f is arbitrary for now, it possibly will change in the future
float
delta
=
-
y_changed
/
mSurfaceYDisplayRange
*
2
f
;
changeBrightness
(
delta
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment