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
9e72ac93
Commit
9e72ac93
authored
Jul 18, 2012
by
Sébastien Toque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ICS: fix video size when the system bar appears & disappears
parent
642a06cc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
3 deletions
+16
-3
vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
...d/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+16
-3
No files found.
vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
View file @
9e72ac93
...
...
@@ -151,7 +151,10 @@ public class VideoPlayerActivity extends Activity {
getWindow
().
getDecorView
().
findViewById
(
android
.
R
.
id
.
content
).
setOnSystemUiVisibilityChangeListener
(
new
OnSystemUiVisibilityChangeListener
()
{
public
void
onSystemUiVisibilityChange
(
int
visibility
)
{
if
(
visibility
==
View
.
SYSTEM_UI_FLAG_VISIBLE
&&
!
mShowing
&&
visibility
!=
mUiVisibility
)
{
if
(
visibility
==
mUiVisibility
)
return
;
setSurfaceSize
(
mVideoWidth
,
mVideoHeight
);
if
(
visibility
==
View
.
SYSTEM_UI_FLAG_VISIBLE
&&
!
mShowing
)
{
showOverlay
();
mHandler
.
sendMessageDelayed
(
mHandler
.
obtainMessage
(
HIDE_NAV
),
OVERLAY_TIMEOUT
);
}
...
...
@@ -505,8 +508,18 @@ public class VideoPlayerActivity extends Activity {
private
void
changeSurfaceSize
()
{
// get screen size
int
dw
=
getWindowManager
().
getDefaultDisplay
().
getWidth
();
int
dh
=
getWindowManager
().
getDefaultDisplay
().
getHeight
();
int
dw
=
getWindow
().
getDecorView
().
getWidth
();
int
dh
=
getWindow
().
getDecorView
().
getHeight
();
// getWindow().getDecorView() doesn't always take orientation into account, we have to correct the values
boolean
isPortrait
=
getResources
().
getConfiguration
().
orientation
==
Configuration
.
ORIENTATION_PORTRAIT
;
if
(
dw
>
dh
&&
isPortrait
||
dw
<
dh
&&
!
isPortrait
)
{
int
d
=
dw
;
dw
=
dh
;
dh
=
d
;
}
if
(
dw
*
dh
==
0
)
return
;
// calculate aspect ratio
double
ar
=
(
double
)
mVideoWidth
/
(
double
)
mVideoHeight
;
...
...
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