-Fixed activity padding.

-Fixed expanded notification artist name.
-Fixed playpause on complete setting wrong index.
This commit is contained in:
John Zhen Mo 2017-10-30 08:04:14 -07:00
parent 68695bbf92
commit 86c16fa5d8
4 changed files with 10 additions and 14 deletions

View File

@ -191,8 +191,8 @@ public final class BackgroundPlayer extends Service {
} }
private void setupNotification(RemoteViews remoteViews) { private void setupNotification(RemoteViews remoteViews) {
bigNotRemoteView.setTextViewText(R.id.notificationSongName, basePlayerImpl.getVideoTitle()); remoteViews.setTextViewText(R.id.notificationSongName, basePlayerImpl.getVideoTitle());
bigNotRemoteView.setTextViewText(R.id.notificationArtist, basePlayerImpl.getVideoTitle()); remoteViews.setTextViewText(R.id.notificationArtist, basePlayerImpl.getUploaderName());
remoteViews.setOnClickPendingIntent(R.id.notificationPlayPause, remoteViews.setOnClickPendingIntent(R.id.notificationPlayPause,
PendingIntent.getBroadcast(this, NOTIFICATION_ID, new Intent(ACTION_PLAY_PAUSE), PendingIntent.FLAG_UPDATE_CURRENT)); PendingIntent.getBroadcast(this, NOTIFICATION_ID, new Intent(ACTION_PLAY_PAUSE), PendingIntent.FLAG_UPDATE_CURRENT));
@ -268,10 +268,9 @@ public final class BackgroundPlayer extends Service {
super.handleIntent(intent); super.handleIntent(intent);
resetNotification(); resetNotification();
startForeground(NOTIFICATION_ID, notBuilder.build());
if (bigNotRemoteView != null) bigNotRemoteView.setProgressBar(R.id.notificationProgressBar, 100, 0, false); if (bigNotRemoteView != null) bigNotRemoteView.setProgressBar(R.id.notificationProgressBar, 100, 0, false);
if (notRemoteView != null) notRemoteView.setProgressBar(R.id.notificationProgressBar, 100, 0, false); if (notRemoteView != null) notRemoteView.setProgressBar(R.id.notificationProgressBar, 100, 0, false);
startForeground(NOTIFICATION_ID, notBuilder.build());
} }
@Override @Override
@ -363,8 +362,6 @@ public final class BackgroundPlayer extends Service {
@Override @Override
public void onRepeatModeChanged(int i) { public void onRepeatModeChanged(int i) {
resetNotification(); resetNotification();
setRepeatModeIcon(notRemoteView, i);
setRepeatModeIcon(bigNotRemoteView, i);
updateNotification(-1); updateNotification(-1);
updatePlayback(); updatePlayback();
} }
@ -378,10 +375,6 @@ public final class BackgroundPlayer extends Service {
super.sync(item, info); super.sync(item, info);
resetNotification(); resetNotification();
notRemoteView.setTextViewText(R.id.notificationSongName, getVideoTitle());
notRemoteView.setTextViewText(R.id.notificationArtist, getUploaderName());
bigNotRemoteView.setTextViewText(R.id.notificationSongName, getVideoTitle());
bigNotRemoteView.setTextViewText(R.id.notificationArtist, getUploaderName());
updateNotification(-1); updateNotification(-1);
updateMetadata(); updateMetadata();
} }
@ -539,6 +532,8 @@ public final class BackgroundPlayer extends Service {
super.onCompleted(); super.onCompleted();
setControlsOpacity(255); setControlsOpacity(255);
resetNotification();
if (bigNotRemoteView != null) bigNotRemoteView.setProgressBar(R.id.notificationProgressBar, 100, 100, false); if (bigNotRemoteView != null) bigNotRemoteView.setProgressBar(R.id.notificationProgressBar, 100, 100, false);
if (notRemoteView != null) notRemoteView.setProgressBar(R.id.notificationProgressBar, 100, 100, false); if (notRemoteView != null) notRemoteView.setProgressBar(R.id.notificationProgressBar, 100, 100, false);
updateNotification(R.drawable.ic_replay_white); updateNotification(R.drawable.ic_replay_white);

View File

@ -706,8 +706,11 @@ public abstract class BasePlayer implements Player.EventListener, PlaybackListen
} }
if (getCurrentState() == STATE_COMPLETED) { if (getCurrentState() == STATE_COMPLETED) {
playQueue.setIndex(0); if (playQueue.getIndex() == 0) {
simpleExoPlayer.seekToDefaultPosition(); simpleExoPlayer.seekToDefaultPosition();
} else {
playQueue.setIndex(0);
}
} }
simpleExoPlayer.setPlayWhenReady(!isPlaying()); simpleExoPlayer.setPlayWhenReady(!isPlaying());

View File

@ -12,7 +12,6 @@
android:id="@+id/appbar" android:id="@+id/appbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="@dimen/appbar_padding_top"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar" android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.ActionBar"> app:popupTheme="@style/ThemeOverlay.AppCompat.ActionBar">

View File

@ -12,7 +12,6 @@
android:id="@+id/appbar" android:id="@+id/appbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="@dimen/appbar_padding_top"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar" android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.ActionBar"> app:popupTheme="@style/ThemeOverlay.AppCompat.ActionBar">