Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC-Android
Manage
Activity
Members
Labels
Plan
Issues
528
Issue boards
Milestones
Wiki
Code
Merge requests
14
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
522c1c20
Commit
522c1c20
authored
8 years ago
by
Geoffrey Métais
Browse files
Options
Downloads
Patches
Plain Diff
Try to keep popup in screen bounds
parent
0f9d2a04
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
vlc-android/src/org/videolan/vlc/gui/video/PopupManager.java
+22
-7
22 additions, 7 deletions
vlc-android/src/org/videolan/vlc/gui/video/PopupManager.java
with
22 additions
and
7 deletions
vlc-android/src/org/videolan/vlc/gui/video/PopupManager.java
+
22
−
7
View file @
522c1c20
...
...
@@ -29,6 +29,7 @@ import android.app.PendingIntent;
import
android.content.Context
;
import
android.content.Intent
;
import
android.graphics.PixelFormat
;
import
android.graphics.Point
;
import
android.os.Handler
;
import
android.os.Looper
;
import
android.os.Message
;
...
...
@@ -70,7 +71,7 @@ public class PopupManager implements PlaybackService.Callback, GestureDetector.O
private
double
mScaleFactor
=
1
.
d
;
private
int
mPopupWidth
,
mPopupHeight
;
private
WindowManager
w
indowManager
;
private
WindowManager
mW
indowManager
;
private
RelativeLayout
mRootView
;
private
SurfaceView
mSurfaceView
;
private
ImageView
mExpandButton
;
...
...
@@ -79,7 +80,7 @@ public class PopupManager implements PlaybackService.Callback, GestureDetector.O
public
PopupManager
(
PlaybackService
service
)
{
mService
=
service
;
w
indowManager
=
(
WindowManager
)
VLCApplication
.
getAppContext
().
getSystemService
(
Context
.
WINDOW_SERVICE
);
mW
indowManager
=
(
WindowManager
)
VLCApplication
.
getAppContext
().
getSystemService
(
Context
.
WINDOW_SERVICE
);
}
public
void
removePopup
()
{
...
...
@@ -90,7 +91,7 @@ public class PopupManager implements PlaybackService.Callback, GestureDetector.O
mService
.
removeCallback
(
this
);
final
IVLCVout
vlcVout
=
mService
.
getVLCVout
();
mRootView
.
setKeepScreenOn
(
false
);
w
indowManager
.
removeView
(
mRootView
);
mW
indowManager
.
removeView
(
mRootView
);
vlcVout
.
detachViews
();
vlcVout
.
removeCallback
(
mVoutCallBack
);
mRootView
=
null
;
...
...
@@ -151,7 +152,7 @@ public class PopupManager implements PlaybackService.Callback, GestureDetector.O
if
(
mScaleGestureDetector
==
null
||
!
mScaleGestureDetector
.
isInProgress
())
{
params
.
x
=
initialX
+
(
int
)
(
event
.
getRawX
()
-
initialTouchX
);
params
.
y
=
initialY
-
(
int
)
(
event
.
getRawY
()
-
initialTouchY
);
w
indowManager
.
updateViewLayout
(
mRootView
,
params
);
mW
indowManager
.
updateViewLayout
(
mRootView
,
params
);
return
true
;
}
}
...
...
@@ -159,7 +160,7 @@ public class PopupManager implements PlaybackService.Callback, GestureDetector.O
}
});
w
indowManager
.
addView
(
mRootView
,
params
);
mW
indowManager
.
addView
(
mRootView
,
params
);
final
IVLCVout
vlcVout
=
mService
.
getVLCVout
();
vlcVout
.
setVideoView
(
mSurfaceView
);
...
...
@@ -273,10 +274,24 @@ public class PopupManager implements PlaybackService.Callback, GestureDetector.O
};
private
void
setViewSize
(
int
width
,
int
height
)
{
WindowManager
.
LayoutParams
lp
=
(
WindowManager
.
LayoutParams
)
mRootView
.
getLayoutParams
();
Point
size
=
new
Point
();
WindowManager
.
LayoutParams
lp
=
null
;
if
(
AndroidUtil
.
isHoneycombOrLater
())
{
mWindowManager
.
getDefaultDisplay
().
getSize
(
size
);
lp
=
(
WindowManager
.
LayoutParams
)
mRootView
.
getLayoutParams
();
if
(
width
>
size
.
x
)
{
height
=
height
*
size
.
x
/
width
;
width
=
size
.
x
;
}
else
if
(
height
>
size
.
y
){
width
=
width
*
size
.
y
/
height
;
height
=
size
.
y
;
}
}
lp
.
width
=
width
;
lp
.
height
=
height
;
windowManager
.
updateViewLayout
(
mRootView
,
lp
);
lp
.
x
=
Math
.
max
(
lp
.
x
,
0
);
lp
.
y
=
Math
.
max
(
lp
.
y
,
0
);
mWindowManager
.
updateViewLayout
(
mRootView
,
lp
);
}
@Override
...
...
This diff is collapsed.
Click to expand it.
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