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
8f164505
Commit
8f164505
authored
Aug 14, 2012
by
Alexandre Perraud
Committed by
Jean-Baptiste Kempf
Aug 14, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Seek gesture : change progression formula and fix some bugs
Signed-off-by:
Jean-Baptiste Kempf
<
jb@videolan.org
>
parent
c6e31f21
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
10 deletions
+23
-10
vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
...d/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+23
-10
No files found.
vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
View file @
8f164505
...
...
@@ -637,6 +637,7 @@ public class VideoPlayerActivity extends Activity {
* show/hide the overlay
*/
@SuppressWarnings
(
"deprecation"
)
@Override
public
boolean
onTouchEvent
(
MotionEvent
event
)
{
...
...
@@ -649,7 +650,6 @@ public class VideoPlayerActivity extends Activity {
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
())
{
...
...
@@ -690,16 +690,29 @@ public class VideoPlayerActivity extends Activity {
}
}
// Seek
// 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
int
jump
=
(
int
)
(
600000
*
Math
.
pow
(
(
x_changed
/
screen
.
widthPixels
),
3
));
// Tools to get the xdpi resolution for the cubic progression
DisplayMetrics
screen
=
new
DisplayMetrics
();
getWindowManager
().
getDefaultDisplay
().
getMetrics
(
screen
);
float
gesturesize
=
(
float
)
((
x_changed
/
screen
.
xdpi
)
*
2.54
);
// No seek action if coef > 0.5 and gesturesize < 1cm
if
((
Math
.
abs
(
y_changed
)
<
Math
.
abs
(
x_changed
))
&&
(
coef
<
0.5
)
&&
(
Math
.
abs
(
gesturesize
)
>
1
))
{
// Size of the jump, 10 minutes max (600000), with a bi-cubic progression, for a 8cm gesture
int
jump
=
(
int
)
(
Math
.
signum
(
gesturesize
)
*
((
600000
*
Math
.
pow
((
gesturesize
/
8
),
4
))
+
3000
));
// Adjust the jump
if
((
jump
>
0
)
&&
((
mLibVLC
.
getTime
()
+
jump
)
>
mLibVLC
.
getLength
()))
jump
=
(
int
)
(
mLibVLC
.
getLength
()
-
mLibVLC
.
getTime
());
if
((
jump
<
0
)
&&
((
mLibVLC
.
getTime
()
+
jump
)
<
0
))
jump
=
(
int
)
-
mLibVLC
.
getTime
();
//Jump !
mPlayerControlListener
.
onSeek
(
jump
);
//Show the jump's size
showInfo
(
String
.
format
(
"%s%ss"
,
jump
>=
0
?
"+"
:
""
,
Util
.
millisToString
(
jump
)),
1000
);
}
break
;
...
...
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