Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Casanowow Life for love
VLC-Android
Commits
c37fa949
Commit
c37fa949
authored
Aug 13, 2012
by
Alexandre Perraud
Committed by
Jean-Baptiste Kempf
Aug 13, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Seek gesture : add neutral zone
Signed-off-by:
Jean-Baptiste Kempf
<
jb@videolan.org
>
parent
04b66b08
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
...d/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+9
-5
No files found.
vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
View file @
c37fa949
...
...
@@ -647,6 +647,9 @@ public class VideoPlayerActivity extends Activity {
float
y_changed
=
event
.
getRawY
()
-
mTouchY
;
float
x_changed
=
event
.
getRawX
()
-
mTouchX
;
// coef is the gradient's move to determine a neutral zone
float
coef
=
Math
.
abs
(
y_changed
/
x_changed
);
Log
.
i
(
TAG
,
"coef "
+
Float
.
toString
(
coef
));
switch
(
event
.
getAction
())
{
...
...
@@ -660,8 +663,9 @@ public class VideoPlayerActivity extends Activity {
break
;
case
MotionEvent
.
ACTION_MOVE
:
if
(
Math
.
abs
(
y_changed
)
>
Math
.
abs
(
x_changed
))
{
// Audio
// Audio
// No audio action if coef < 2
if
((
Math
.
abs
(
y_changed
)
>
Math
.
abs
(
x_changed
))
&&
(
coef
>
2
)){
int
delta
=
-(
int
)
((
y_changed
/
mAudioDisplayRange
)
*
mAudioMax
);
int
vol
=
(
int
)
Math
.
min
(
Math
.
max
(
mVol
+
delta
,
0
),
mAudioMax
);
if
(
delta
!=
0
)
{
...
...
@@ -686,13 +690,13 @@ public class VideoPlayerActivity extends Activity {
}
}
// Seek
if
(
Math
.
abs
(
y_changed
)
<
Math
.
abs
(
x_changed
))
{
// No seek action if coef > 0.5
if
((
Math
.
abs
(
y_changed
)
<
Math
.
abs
(
x_changed
))
&&
(
coef
<
0.5
)){
// Tools to get the screen size for the cubic progression
DisplayMetrics
screen
=
new
DisplayMetrics
();
getWindowManager
().
getDefaultDisplay
().
getMetrics
(
screen
);
// Size of the jump, 10 minutes max (600000) with a cubic
// progression
// Size of the jump, 10 minutes max (600000) with a cubic progression
int
jump
=
(
int
)
(
600000
*
Math
.
pow
(
(
x_changed
/
screen
.
widthPixels
),
3
));
mPlayerControlListener
.
onSeek
(
jump
);
...
...
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