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
58c4347d
Commit
58c4347d
authored
8 years ago
by
Geoffrey Métais
Browse files
Options
Downloads
Patches
Plain Diff
Notification for popup
parent
a0fab7f2
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
vlc-android/res/values/strings.xml
+2
-0
2 additions, 0 deletions
vlc-android/res/values/strings.xml
vlc-android/src/org/videolan/vlc/gui/video/PopupManager.java
+42
-1
42 additions, 1 deletion
vlc-android/src/org/videolan/vlc/gui/video/PopupManager.java
with
44 additions
and
1 deletion
vlc-android/res/values/strings.xml
+
2
−
0
View file @
58c4347d
...
...
@@ -615,6 +615,8 @@
<string
name=
"encryption_warning"
>
Warning, encryption is not available for this Android version, password will be stored in a private space but not encrypted
</string>
<string
name=
"store_password"
>
Remember password
</string>
<string
name=
"add_to_playlist"
>
Add to playlist
</string>
<string
name=
"popup_playback"
>
Playing in a Pop-Up window
</string>
<string
name=
"popup_expand"
>
Expand video
</string>
<string-array
name=
"chroma_formats"
translatable=
"false"
>
<item>
RGB 32-bit
</item>
...
...
This diff is collapsed.
Click to expand it.
vlc-android/src/org/videolan/vlc/gui/video/PopupManager.java
+
42
−
1
View file @
58c4347d
...
...
@@ -24,11 +24,16 @@
package
org.videolan.vlc.gui.video
;
import
android.app.Notification
;
import
android.app.PendingIntent
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.graphics.PixelFormat
;
import
android.os.Handler
;
import
android.os.Looper
;
import
android.os.Message
;
import
android.support.v4.app.NotificationCompat
;
import
android.support.v4.app.NotificationManagerCompat
;
import
android.support.v4.view.GestureDetectorCompat
;
import
android.util.Log
;
import
android.view.GestureDetector
;
...
...
@@ -38,7 +43,6 @@ import android.view.MotionEvent;
import
android.view.ScaleGestureDetector
;
import
android.view.SurfaceView
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.ViewGroup.LayoutParams
;
import
android.view.WindowManager
;
import
android.widget.ImageButton
;
...
...
@@ -79,6 +83,7 @@ public class PopupManager implements PlaybackService.Callback, GestureDetector.O
}
public
void
removePopup
()
{
hideNotification
();
if
(
mRootView
==
null
)
return
;
mService
.
setVideoTrackEnabled
(
false
);
...
...
@@ -159,6 +164,7 @@ public class PopupManager implements PlaybackService.Callback, GestureDetector.O
vlcVout
.
addCallback
(
mVoutCallBack
);
if
(!
mService
.
isPlaying
())
mService
.
playIndex
(
mService
.
getCurrentMediaPosition
());
showNotification
();
}
@Override
...
...
@@ -291,9 +297,11 @@ public class PopupManager implements PlaybackService.Callback, GestureDetector.O
break
;
case
MediaPlayer
.
Event
.
Playing
:
mPlayPauseButton
.
setImageResource
(
R
.
drawable
.
ic_pause
);
showNotification
();
break
;
case
MediaPlayer
.
Event
.
Paused
:
mPlayPauseButton
.
setImageResource
(
R
.
drawable
.
ic_play
);
showNotification
();
break
;
}
}
...
...
@@ -363,4 +371,37 @@ public class PopupManager implements PlaybackService.Callback, GestureDetector.O
mScaleFactor
=
1.0d
;
windowManager
.
updateViewLayout
(
mRootView
,
mRootView
.
getLayoutParams
());
}
private
void
showNotification
()
{
PendingIntent
piStop
=
PendingIntent
.
getBroadcast
(
mService
,
0
,
new
Intent
(
PlaybackService
.
ACTION_REMOTE_STOP
),
PendingIntent
.
FLAG_UPDATE_CURRENT
);
NotificationCompat
.
Builder
builder
=
new
NotificationCompat
.
Builder
(
mService
)
.
setSmallIcon
(
R
.
drawable
.
ic_stat_vlc
)
.
setVisibility
(
NotificationCompat
.
VISIBILITY_PUBLIC
)
.
setContentTitle
(
mService
.
getTitle
())
.
setContentText
(
mService
.
getString
(
R
.
string
.
popup_playback
))
.
setAutoCancel
(
false
)
.
setOngoing
(
true
)
.
setDeleteIntent
(
piStop
);
//Switch
final
Intent
notificationIntent
=
new
Intent
(
PlaybackService
.
ACTION_REMOTE_SWITCH_VIDEO
);
PendingIntent
piExpand
=
PendingIntent
.
getBroadcast
(
mService
,
0
,
notificationIntent
,
PendingIntent
.
FLAG_UPDATE_CURRENT
);
//PLay Pause
PendingIntent
piPlay
=
PendingIntent
.
getBroadcast
(
mService
,
0
,
new
Intent
(
PlaybackService
.
ACTION_REMOTE_PLAYPAUSE
),
PendingIntent
.
FLAG_UPDATE_CURRENT
);
if
(
mService
.
isPlaying
())
builder
.
addAction
(
R
.
drawable
.
ic_pause_w
,
mService
.
getString
(
R
.
string
.
pause
),
piPlay
);
else
builder
.
addAction
(
R
.
drawable
.
ic_play_w
,
mService
.
getString
(
R
.
string
.
play
),
piPlay
);
builder
.
addAction
(
android
.
R
.
drawable
.
ic_menu_set_as
,
mService
.
getString
(
R
.
string
.
popup_expand
),
piExpand
);
Notification
notification
=
builder
.
build
();
mService
.
startService
(
new
Intent
(
mService
,
PlaybackService
.
class
));
NotificationManagerCompat
.
from
(
mService
).
notify
(
42
,
notification
);
}
private
void
hideNotification
()
{
NotificationManagerCompat
.
from
(
mService
).
cancel
(
42
);
}
}
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