Add another space to the playlist duration. Clean up the code.
This commit is contained in:
parent
e553a64c80
commit
d3c3fe8f08
4 changed files with 10 additions and 10 deletions
|
|
@ -239,7 +239,7 @@ public class MusicPlayerRemote {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getQueueDurationMillis(int position) {
|
public static long getQueueDurationMillis(int position) {
|
||||||
if (musicService != null) {
|
if (musicService != null) {
|
||||||
return musicService.getQueueDurationMillis(position);
|
return musicService.getQueueDurationMillis(position);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -946,11 +946,11 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP
|
||||||
return playback.duration();
|
return playback.duration();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getQueueDurationMillis(int position) {
|
public long getQueueDurationMillis(int position) {
|
||||||
int ret=0;
|
long duration = 0;
|
||||||
for(int i=position+1;i<playingQueue.size();i++)
|
for (int i = position + 1; i < playingQueue.size(); i++)
|
||||||
ret+=playingQueue.get(i).duration;
|
duration += playingQueue.get(i).duration;
|
||||||
return ret;
|
return duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int seek(int millis) {
|
public int seek(int millis) {
|
||||||
|
|
|
||||||
|
|
@ -198,7 +198,7 @@ public class CardPlayerFragment extends AbsPlayerFragment implements PlayerAlbum
|
||||||
|
|
||||||
private void updateQueue() {
|
private void updateQueue() {
|
||||||
playingQueueAdapter.swapDataSet(MusicPlayerRemote.getPlayingQueue(), MusicPlayerRemote.getPosition());
|
playingQueueAdapter.swapDataSet(MusicPlayerRemote.getPlayingQueue(), MusicPlayerRemote.getPosition());
|
||||||
playerQueueSubHeader.setText(getResources().getString(R.string.up_next)+" • "+ MusicUtil.getReadableDurationString(MusicPlayerRemote.getQueueDurationMillis( MusicPlayerRemote.getPosition())));
|
playerQueueSubHeader.setText(getResources().getString(R.string.up_next) + " • " + MusicUtil.getReadableDurationString(MusicPlayerRemote.getQueueDurationMillis(MusicPlayerRemote.getPosition())));
|
||||||
if (slidingUpPanelLayout.getPanelState() == SlidingUpPanelLayout.PanelState.COLLAPSED) {
|
if (slidingUpPanelLayout.getPanelState() == SlidingUpPanelLayout.PanelState.COLLAPSED) {
|
||||||
resetToCurrentPosition();
|
resetToCurrentPosition();
|
||||||
}
|
}
|
||||||
|
|
@ -206,7 +206,7 @@ public class CardPlayerFragment extends AbsPlayerFragment implements PlayerAlbum
|
||||||
|
|
||||||
private void updateQueuePosition() {
|
private void updateQueuePosition() {
|
||||||
playingQueueAdapter.setCurrent(MusicPlayerRemote.getPosition());
|
playingQueueAdapter.setCurrent(MusicPlayerRemote.getPosition());
|
||||||
playerQueueSubHeader.setText(getResources().getString(R.string.up_next)+" • "+ MusicUtil.getReadableDurationString(MusicPlayerRemote.getQueueDurationMillis( MusicPlayerRemote.getPosition())));
|
playerQueueSubHeader.setText(getResources().getString(R.string.up_next) + " • " + MusicUtil.getReadableDurationString(MusicPlayerRemote.getQueueDurationMillis(MusicPlayerRemote.getPosition())));
|
||||||
if (slidingUpPanelLayout.getPanelState() == SlidingUpPanelLayout.PanelState.COLLAPSED) {
|
if (slidingUpPanelLayout.getPanelState() == SlidingUpPanelLayout.PanelState.COLLAPSED) {
|
||||||
resetToCurrentPosition();
|
resetToCurrentPosition();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -194,7 +194,7 @@ public class FlatPlayerFragment extends AbsPlayerFragment implements PlayerAlbum
|
||||||
|
|
||||||
private void updateQueue() {
|
private void updateQueue() {
|
||||||
playingQueueAdapter.swapDataSet(MusicPlayerRemote.getPlayingQueue(), MusicPlayerRemote.getPosition());
|
playingQueueAdapter.swapDataSet(MusicPlayerRemote.getPlayingQueue(), MusicPlayerRemote.getPosition());
|
||||||
playerQueueSubHeader.setText(getResources().getString(R.string.up_next)+" • "+ MusicUtil.getReadableDurationString(MusicPlayerRemote.getQueueDurationMillis( MusicPlayerRemote.getPosition())));
|
playerQueueSubHeader.setText(getResources().getString(R.string.up_next) + " • " + MusicUtil.getReadableDurationString(MusicPlayerRemote.getQueueDurationMillis(MusicPlayerRemote.getPosition())));
|
||||||
if (slidingUpPanelLayout == null || slidingUpPanelLayout.getPanelState() == SlidingUpPanelLayout.PanelState.COLLAPSED) {
|
if (slidingUpPanelLayout == null || slidingUpPanelLayout.getPanelState() == SlidingUpPanelLayout.PanelState.COLLAPSED) {
|
||||||
resetToCurrentPosition();
|
resetToCurrentPosition();
|
||||||
}
|
}
|
||||||
|
|
@ -202,7 +202,7 @@ public class FlatPlayerFragment extends AbsPlayerFragment implements PlayerAlbum
|
||||||
|
|
||||||
private void updateQueuePosition() {
|
private void updateQueuePosition() {
|
||||||
playingQueueAdapter.setCurrent(MusicPlayerRemote.getPosition());
|
playingQueueAdapter.setCurrent(MusicPlayerRemote.getPosition());
|
||||||
playerQueueSubHeader.setText(getResources().getString(R.string.up_next)+" • "+ MusicUtil.getReadableDurationString(MusicPlayerRemote.getQueueDurationMillis( MusicPlayerRemote.getPosition())));
|
playerQueueSubHeader.setText(getResources().getString(R.string.up_next) + " • " + MusicUtil.getReadableDurationString(MusicPlayerRemote.getQueueDurationMillis(MusicPlayerRemote.getPosition())));
|
||||||
if (slidingUpPanelLayout == null || slidingUpPanelLayout.getPanelState() == SlidingUpPanelLayout.PanelState.COLLAPSED) {
|
if (slidingUpPanelLayout == null || slidingUpPanelLayout.getPanelState() == SlidingUpPanelLayout.PanelState.COLLAPSED) {
|
||||||
resetToCurrentPosition();
|
resetToCurrentPosition();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue