Add progress bar to expanded notification
This commit is contained in:
parent
8021848b03
commit
9494f3a299
|
@ -349,6 +349,11 @@ public class BackgroundPlayer extends Service /*implements MediaPlayer.OnPrepare
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the title of the stream
|
||||||
|
* @param title the title of the stream
|
||||||
|
* @return this builder for chaining
|
||||||
|
*/
|
||||||
NoteBuilder setTitle(String title) {
|
NoteBuilder setTitle(String title) {
|
||||||
setContentTitle(title);
|
setContentTitle(title);
|
||||||
getContentView().setTextViewText(R.id.notificationSongName, title);
|
getContentView().setTextViewText(R.id.notificationSongName, title);
|
||||||
|
@ -358,6 +363,11 @@ public class BackgroundPlayer extends Service /*implements MediaPlayer.OnPrepare
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the artist of the stream
|
||||||
|
* @param artist the artist of the stream
|
||||||
|
* @return this builder for chaining
|
||||||
|
*/
|
||||||
NoteBuilder setArtist(String artist) {
|
NoteBuilder setArtist(String artist) {
|
||||||
setSubText(artist);
|
setSubText(artist);
|
||||||
getContentView().setTextViewText(R.id.notificationArtist, artist);
|
getContentView().setTextViewText(R.id.notificationArtist, artist);
|
||||||
|
@ -367,16 +377,15 @@ public class BackgroundPlayer extends Service /*implements MediaPlayer.OnPrepare
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public android.support.v4.app.NotificationCompat.Builder setProgress(int max, int progress, boolean indeterminate) {
|
public android.support.v4.app.NotificationCompat.Builder setProgress(int max, int progress, boolean indeterminate) {
|
||||||
// TODO: implement
|
super.setProgress(max, progress, indeterminate);
|
||||||
return super.setProgress(max, progress, indeterminate);
|
getBigContentView().setProgressBar(R.id.playbackProgress, max, progress, indeterminate);
|
||||||
}
|
return this;
|
||||||
|
|
||||||
@Override
|
|
||||||
public Notification build() {
|
|
||||||
|
|
||||||
return super.build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the isPlaying state
|
||||||
|
* @param isPlaying the is playing state
|
||||||
|
*/
|
||||||
public void setIsPlaying(boolean isPlaying) {
|
public void setIsPlaying(boolean isPlaying) {
|
||||||
RemoteViews views = getContentView(), bigViews = getBigContentView();
|
RemoteViews views = getContentView(), bigViews = getBigContentView();
|
||||||
int imageSrc;
|
int imageSrc;
|
||||||
|
|
|
@ -40,6 +40,12 @@
|
||||||
android:ellipsize="marquee"
|
android:ellipsize="marquee"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:text="artist" />
|
android:text="artist" />
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/playbackProgress"
|
||||||
|
style="@style/Widget.AppCompat.ProgressBar.Horizontal" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
|
|
Loading…
Reference in New Issue