Java Code Examples for android.media.session.MediaSession#QueueItem
The following examples show how to use
android.media.session.MediaSession#QueueItem .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MusicBrowserService.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
@Override public void onPlayFromMediaId(String mediaId, Bundle extras) { String args[] = mediaId.split("_"); if (args.length != 2) { return; } try { int did = Integer.parseInt(args[0]); int id = Integer.parseInt(args[1]); ArrayList<MessageObject> arrayList = musicObjects.get(did); ArrayList<MediaSession.QueueItem> arrayList1 = musicQueues.get(did); if (arrayList == null || id < 0 || id >= arrayList.size()) { return; } lastSelectedDialog = did; MessagesController.getNotificationsSettings(currentAccount).edit().putInt("auto_lastSelectedDialog", did).commit(); MediaController.getInstance().setPlaylist(arrayList, arrayList.get(id), false); mediaSession.setQueue(arrayList1); if (did > 0) { TLRPC.User user = users.get(did); if (user != null) { mediaSession.setQueueTitle(ContactsController.formatName(user.first_name, user.last_name)); } else { mediaSession.setQueueTitle("DELETED USER"); } } else { TLRPC.Chat chat = chats.get(-did); if (chat != null) { mediaSession.setQueueTitle(chat.title); } else { mediaSession.setQueueTitle("DELETED CHAT"); } } } catch (Exception e) { FileLog.e(e); } handlePlayRequest(); }
Example 2
Source File: MusicBrowserService.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
@Override public void onPlayFromMediaId(String mediaId, Bundle extras) { String args[] = mediaId.split("_"); if (args.length != 2) { return; } try { int did = Integer.parseInt(args[0]); int id = Integer.parseInt(args[1]); ArrayList<MessageObject> arrayList = musicObjects.get(did); ArrayList<MediaSession.QueueItem> arrayList1 = musicQueues.get(did); if (arrayList == null || id < 0 || id >= arrayList.size()) { return; } lastSelectedDialog = did; MessagesController.getNotificationsSettings(currentAccount).edit().putInt("auto_lastSelectedDialog", did).commit(); MediaController.getInstance().setPlaylist(arrayList, arrayList.get(id), false); mediaSession.setQueue(arrayList1); if (did > 0) { TLRPC.User user = users.get(did); if (user != null) { mediaSession.setQueueTitle(ContactsController.formatName(user.first_name, user.last_name)); } else { mediaSession.setQueueTitle("DELETED USER"); } } else { TLRPC.Chat chat = chats.get(-did); if (chat != null) { mediaSession.setQueueTitle(chat.title); } else { mediaSession.setQueueTitle("DELETED CHAT"); } } } catch (Exception e) { FileLog.e(e); } handlePlayRequest(); }
Example 3
Source File: MusicBrowserService.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
@Override public void onPlayFromMediaId(String mediaId, Bundle extras) { String args[] = mediaId.split("_"); if (args.length != 2) { return; } try { int did = Integer.parseInt(args[0]); int id = Integer.parseInt(args[1]); ArrayList<MessageObject> arrayList = musicObjects.get(did); ArrayList<MediaSession.QueueItem> arrayList1 = musicQueues.get(did); if (arrayList == null || id < 0 || id >= arrayList.size()) { return; } lastSelectedDialog = did; MessagesController.getNotificationsSettings(currentAccount).edit().putInt("auto_lastSelectedDialog", did).commit(); MediaController.getInstance().setPlaylist(arrayList, arrayList.get(id), false); mediaSession.setQueue(arrayList1); if (did > 0) { TLRPC.User user = users.get(did); if (user != null) { mediaSession.setQueueTitle(ContactsController.formatName(user.first_name, user.last_name)); } else { mediaSession.setQueueTitle("DELETED USER"); } } else { TLRPC.Chat chat = chats.get(-did); if (chat != null) { mediaSession.setQueueTitle(chat.title); } else { mediaSession.setQueueTitle("DELETED CHAT"); } } } catch (Exception e) { FileLog.e(e); } handlePlayRequest(); }
Example 4
Source File: MusicBrowserService.java From Telegram with GNU General Public License v2.0 | 5 votes |
@Override public void onPlayFromMediaId(String mediaId, Bundle extras) { String args[] = mediaId.split("_"); if (args.length != 2) { return; } try { int did = Integer.parseInt(args[0]); int id = Integer.parseInt(args[1]); ArrayList<MessageObject> arrayList = musicObjects.get(did); ArrayList<MediaSession.QueueItem> arrayList1 = musicQueues.get(did); if (arrayList == null || id < 0 || id >= arrayList.size()) { return; } lastSelectedDialog = did; MessagesController.getNotificationsSettings(currentAccount).edit().putInt("auto_lastSelectedDialog", did).commit(); MediaController.getInstance().setPlaylist(arrayList, arrayList.get(id), false); mediaSession.setQueue(arrayList1); if (did > 0) { TLRPC.User user = users.get(did); if (user != null) { mediaSession.setQueueTitle(ContactsController.formatName(user.first_name, user.last_name)); } else { mediaSession.setQueueTitle("DELETED USER"); } } else { TLRPC.Chat chat = chats.get(-did); if (chat != null) { mediaSession.setQueueTitle(chat.title); } else { mediaSession.setQueueTitle("DELETED CHAT"); } } } catch (Exception e) { FileLog.e(e); } handlePlayRequest(); }
Example 5
Source File: MediaService.java From AsteroidOSSync with GNU General Public License v3.0 | 4 votes |
@Override public void onQueueChanged(List<MediaSession.QueueItem> queue) { super.onQueueChanged(queue); }