Skip to content

Commit

Permalink
Merge pull request #21 from brianwernick/version_prep
Browse files Browse the repository at this point in the history
Miscellaneous Updates
  • Loading branch information
brianwernick committed Oct 5, 2015
2 parents fd40874 + 42c4998 commit d9de152
Show file tree
Hide file tree
Showing 16 changed files with 279 additions and 170 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {
jcenter();
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.1'
classpath 'com.android.tools.build:gradle:1.4.0-beta3'
classpath 'com.novoda:bintray-release:0.2.7'
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.devbrackets.android.exomediademo.data;


import com.devbrackets.android.exomedia.manager.EMPlaylistManager;
import com.devbrackets.android.exomediademo.helper.AudioItems;

Expand All @@ -26,13 +25,8 @@ public long getPlaylistId() {
}

@Override
public boolean isAudio() {
return true;
}

@Override
public boolean isVideo() {
return false;
public EMPlaylistManager.MediaType getMediaType() {
return EMPlaylistManager.MediaType.AUDIO;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ public void onDestroy() {
super.onDestroy();
}

@Override
protected String getAppName() {
return getResources().getString(R.string.app_name);
}

@Override
protected int getNotificationId() {
return NOTIFICATION_ID;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ protected void onResume() {
}

@Override
public boolean onPlaylistItemChanged(EMPlaylistManager.PlaylistItem currentItem, EMPlaylistManager.MediaType mediaType, boolean hasNext, boolean hasPrevious) {
public boolean onPlaylistItemChanged(EMPlaylistManager.PlaylistItem currentItem, boolean hasNext, boolean hasPrevious) {
shouldSetDuration = true;

//Updates the button states
Expand Down Expand Up @@ -147,7 +147,7 @@ public boolean onProgressUpdated(EMMediaProgressEvent event) {
private void updateCurrentPlaybackInformation() {
EMPlaylistItemChangedEvent itemChangedEvent = playlistManager.getCurrentItemChangedEvent();
if (itemChangedEvent != null) {
onPlaylistItemChanged(itemChangedEvent.getCurrentItem(), itemChangedEvent.getMediaType(), itemChangedEvent.hasNext(), itemChangedEvent.hasPrevious());
onPlaylistItemChanged(itemChangedEvent.getCurrentItem(), itemChangedEvent.hasNext(), itemChangedEvent.hasPrevious());
}

EMPlaylistService.MediaState currentMediaState = playlistManager.getCurrentMediaState();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void dismiss() {
* Sets weather notifications are shown when audio is playing or
* ready for playback (e.g. paused). The notification information
* will need to be updated by calling {@link #setNotificationBaseInformation(int, int)}
* and {@link #updateNotificationInformation(String, String, Bitmap, Bitmap)} and can be retrieved
* and {@link #updateNotificationInformation(String, String, String, Bitmap, Bitmap)} and can be retrieved
* with {@link #getNotification(android.app.PendingIntent)}
*
* @param enabled True if notifications should be shown
Expand Down Expand Up @@ -117,13 +117,15 @@ public void setNotificationBaseInformation(int notificationId, @DrawableRes int
* Sets the volatile information for the notification. This information is expected to
* change frequently.
*
* @param title The title to display for the notification (e.g. A song name)
* @param content A short description or additional information for the notification (e.g. An artists name)
* @param title The title to display on the notification (e.g. A song name)
* @param album The album to display on the notification. This is the second row of text displayed
* @param artist The artist to display on the notification. This is the third row of text displayed
* @param notificationImage An image to display on the notification (e.g. Album artwork)
* @param secondaryNotificationImage An image to display on the notification should be used to indicate playback type (e.g. Chromecast)
*/
public void updateNotificationInformation(String title, String content, @Nullable Bitmap notificationImage, @Nullable Bitmap secondaryNotificationImage) {
updateNotificationInformation(title, content, notificationImage, secondaryNotificationImage, null);
public void updateNotificationInformation(@Nullable String title, @Nullable String album, @Nullable String artist, @Nullable Bitmap notificationImage,
@Nullable Bitmap secondaryNotificationImage) {
updateNotificationInformation(title, album, artist, notificationImage, secondaryNotificationImage, null);
}

/**
Expand All @@ -139,16 +141,18 @@ public void setClickPendingIntent(@Nullable PendingIntent pendingIntent) {
* Sets the volatile information for the notification. This information is expected to
* change frequently.
*
* @param title The title to display for the notification (e.g. A song name)
* @param content A short description or additional information for the notification (e.g. An artists name)
* @param title The title to display on the notification (e.g. A song name)
* @param album The album to display on the notification. This is the second row of text displayed
* @param artist The artist to display on the notification. This is the third row of text displayed
* @param notificationImage An image to display on the notification (e.g. Album artwork)
* @param secondaryNotificationImage An image to display on the notification should be used to indicate playback type (e.g. Chromecast)
* @param notificationMediaState The current media state for the expanded (big) notification
*/
public void updateNotificationInformation(String title, String content, @Nullable Bitmap notificationImage, @Nullable Bitmap secondaryNotificationImage,
@Nullable NotificationMediaState notificationMediaState) {
public void updateNotificationInformation(@Nullable String title, @Nullable String album, @Nullable String artist, @Nullable Bitmap notificationImage,
@Nullable Bitmap secondaryNotificationImage, @Nullable NotificationMediaState notificationMediaState) {
notificationInfo.setTitle(title);
notificationInfo.setContent(content);
notificationInfo.setAlbum(album);
notificationInfo.setArtist(artist);
notificationInfo.setLargeImage(notificationImage);
notificationInfo.setSecondaryImage(secondaryNotificationImage);
notificationInfo.setMediaState(notificationMediaState);
Expand All @@ -161,7 +165,7 @@ public void updateNotificationInformation(String title, String content, @Nullabl
/**
* Returns a fully constructed notification to use when moving a service to the
* foreground. This should be called after the notification information is set with
* {@link #setNotificationBaseInformation(int, int)} and {@link #updateNotificationInformation(String, String, Bitmap, Bitmap)}.
* {@link #setNotificationBaseInformation(int, int)} and {@link #updateNotificationInformation(String, String, String, Bitmap, Bitmap)}.
*
* @param pendingIntent The pending intent to use when the notification itself is clicked
* @return The constructed notification
Expand Down Expand Up @@ -216,7 +220,8 @@ private RemoteViews getCustomNotification() {
}

customNotification.setTextViewText(R.id.exomedia_notification_title, notificationInfo.getTitle());
customNotification.setTextViewText(R.id.exomedia_notification_content_text, notificationInfo.getContent());
customNotification.setTextViewText(R.id.exomedia_notification_album, notificationInfo.getAlbum());
customNotification.setTextViewText(R.id.exomedia_notification_artist, notificationInfo.getArtist());
customNotification.setBitmap(R.id.exomedia_notification_large_image, "setImageBitmap", notificationInfo.getLargeImage());

if (notificationInfo.getMediaState() != null) {
Expand All @@ -242,7 +247,8 @@ private RemoteViews getBigNotification() {
}

bigContent.setTextViewText(R.id.exomedia_big_notification_title, notificationInfo.getTitle());
bigContent.setTextViewText(R.id.exomedia_big_notification_content_text, notificationInfo.getContent());
bigContent.setTextViewText(R.id.exomedia_big_notification_album, notificationInfo.getAlbum());
bigContent.setTextViewText(R.id.exomedia_big_notification_artist, notificationInfo.getArtist());
bigContent.setBitmap(R.id.exomedia_big_notification_large_image, "setImageBitmap", notificationInfo.getLargeImage());
bigContent.setBitmap(R.id.exomedia_big_notification_secondary_image, "setImageBitmap", notificationInfo.getSecondaryImage());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
*/
class NotificationInfo {
private String title;
private String content;
private String album;
private String artist;

private Bitmap largeImage;
private Bitmap secondaryImage;
Expand All @@ -42,12 +43,16 @@ class NotificationInfo {

private EMNotification.NotificationMediaState mediaState;

public void setTitle(String title) {
public void setTitle(@Nullable String title) {
this.title = title;
}

public void setContent(String content) {
this.content = content;
public void setAlbum(@Nullable String album) {
this.album = album;
}

public void setArtist(@Nullable String artist) {
this.artist = artist;
}

public void setLargeImage(@Nullable Bitmap largeImage) {
Expand Down Expand Up @@ -84,8 +89,13 @@ public String getTitle() {
}

@NonNull
public String getContent() {
return content != null ? content : "";
public String getAlbum() {
return album != null ? album : "";
}

@NonNull
public String getArtist() {
return artist != null ? artist : "";
}

@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,11 @@

public class EMPlaylistItemChangedEvent<T extends EMPlaylistManager.PlaylistItem> {
private final T currentItem;
private final EMPlaylistManager.MediaType mediaType;
private final boolean hasNext;
private final boolean hasPrevious;

public EMPlaylistItemChangedEvent(T currentItem, EMPlaylistManager.MediaType mediaType, boolean hasPrevious, boolean hasNext) {
public EMPlaylistItemChangedEvent(T currentItem, boolean hasPrevious, boolean hasNext) {
this.currentItem = currentItem;
this.mediaType = mediaType;
this.hasPrevious = hasPrevious;
this.hasNext = hasNext;
}
Expand All @@ -35,10 +33,6 @@ public T getCurrentItem() {
return currentItem;
}

public EMPlaylistManager.MediaType getMediaType() {
return mediaType;
}

public boolean hasNext() {
return hasNext;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public interface EMPlaylistServiceCallback {
*
* @return True if the event has been handled
*/
boolean onPlaylistItemChanged(EMPlaylistManager.PlaylistItem currentItem, EMPlaylistManager.MediaType mediaType, boolean hasNext, boolean hasPrevious);
boolean onPlaylistItemChanged(EMPlaylistManager.PlaylistItem currentItem, boolean hasNext, boolean hasPrevious);

/**
* Occurs when the current media state changes.
Expand Down
Loading

0 comments on commit d9de152

Please sign in to comment.