daily pastebin goal
54%
SHARE
TWEET

Untitled

a guest Dec 19th, 2018 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. object : PlayerNotificationManager.CustomActionReceiver {
  2.             override fun createCustomActions(context: Context?, instanceId: Int): MutableMap<String,
  3.     NotificationCompat.Action> {
  4.     //                return mutableMapOf()
  5.                 val prevAction = Intent()
  6.                 prevAction.putExtra("action", actions[0])
  7.                 val backwordAction = Intent()
  8.                 backwordAction.putExtra("action", actions[1])
  9.                 val playAction = Intent()
  10.                 playAction.putExtra("action", actions[2])
  11.                 val pauseAction = Intent()
  12.                 pauseAction.putExtra("action", actions[3])
  13.                 val forwardAction = Intent()
  14.                 forwardAction.putExtra("action", actions[4])
  15.                 val nextAction = Intent()
  16.                 nextAction.putExtra("action", actions[5])
  17.                 return mutableMapOf(
  18.                         Pair(actions[0], NotificationCompat.Action(R.drawable.exo_icon_previous, actions[0],
  19.                                 PendingIntent.getBroadcast(context, 0, Intent(prevAction).setPackage(context?.packageName), PendingIntent.FLAG_CANCEL_CURRENT))),
  20.                         Pair(actions[1], NotificationCompat.Action(R.drawable.exo_icon_rewind, actions[1],
  21.                                 PendingIntent.getBroadcast(context, 0, Intent(backwordAction).setPackage(context?.packageName), PendingIntent.FLAG_CANCEL_CURRENT))),
  22.                         Pair(actions[2], NotificationCompat.Action(R.drawable.exo_icon_play, actions[2],
  23.                                 PendingIntent.getBroadcast(context, 0, Intent(playAction).setPackage(context?.packageName), PendingIntent.FLAG_CANCEL_CURRENT))),
  24.                         Pair(actions[3], NotificationCompat.Action(R.drawable.exo_icon_pause, actions[3],
  25.                                 PendingIntent.getBroadcast(context, 0, Intent(pauseAction).setPackage(context?.packageName), PendingIntent.FLAG_CANCEL_CURRENT))),
  26.                         Pair(actions[4], NotificationCompat.Action(R.drawable.exo_icon_fastforward, actions[4],
  27.                                 PendingIntent.getBroadcast(context, 0, Intent(forwardAction).setPackage(context?.packageName), PendingIntent.FLAG_CANCEL_CURRENT))),
  28.                         Pair(actions[5], NotificationCompat.Action(R.drawable.exo_icon_next, actions[5],
  29.                                 PendingIntent.getBroadcast(context, 0, Intent(nextAction).setPackage(context?.packageName), PendingIntent.FLAG_CANCEL_CURRENT)))
  30.                 )
  31.             }
  32.  
  33.             override fun getCustomActions(player: Player?): MutableList<String> {
  34.                 return actions
  35.             }
  36.  
  37.             override fun onCustomAction(player: Player?, action: String?, intent: Intent?) {
  38.                 LogUtils.e(action ?: "")
  39.             }
  40. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top