1
0
mirror of https://github.com/TeamNewPipe/NewPipe.git synced 2024-11-23 11:32:32 +01:00

Add progress bar to expanded notification

This commit is contained in:
Coffeemakr 2016-12-27 14:49:59 +01:00
parent 8021848b03
commit 9494f3a299
2 changed files with 23 additions and 8 deletions

View File

@ -349,6 +349,11 @@ public class BackgroundPlayer extends Service /*implements MediaPlayer.OnPrepare
return view;
}
/**
* Set the title of the stream
* @param title the title of the stream
* @return this builder for chaining
*/
NoteBuilder setTitle(String title) {
setContentTitle(title);
getContentView().setTextViewText(R.id.notificationSongName, title);
@ -358,6 +363,11 @@ public class BackgroundPlayer extends Service /*implements MediaPlayer.OnPrepare
return this;
}
/**
* Set the artist of the stream
* @param artist the artist of the stream
* @return this builder for chaining
*/
NoteBuilder setArtist(String artist) {
setSubText(artist);
getContentView().setTextViewText(R.id.notificationArtist, artist);
@ -367,16 +377,15 @@ public class BackgroundPlayer extends Service /*implements MediaPlayer.OnPrepare
@Override
public android.support.v4.app.NotificationCompat.Builder setProgress(int max, int progress, boolean indeterminate) {
// TODO: implement
return super.setProgress(max, progress, indeterminate);
}
@Override
public Notification build() {
return super.build();
super.setProgress(max, progress, indeterminate);
getBigContentView().setProgressBar(R.id.playbackProgress, max, progress, indeterminate);
return this;
}
/**
* Set the isPlaying state
* @param isPlaying the is playing state
*/
public void setIsPlaying(boolean isPlaying) {
RemoteViews views = getContentView(), bigViews = getBigContentView();
int imageSrc;

View File

@ -40,6 +40,12 @@
android:ellipsize="marquee"
android:singleLine="true"
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>
<ImageButton