Fixed the none repeat mode not working when at the end of the playing queue. Reverted new color and elevation of songs and artists.

This commit is contained in:
Karim Abou Zeid 2015-06-22 13:08:05 +02:00
commit a86afe6111
9 changed files with 31 additions and 21 deletions

View file

@ -447,7 +447,7 @@ public class MusicService extends Service {
public int getNextPosition(boolean force) { public int getNextPosition(boolean force) {
int position = getPosition() + 1; int position = getPosition() + 1;
switch (repeatMode) { switch (getRepeatMode()) {
case REPEAT_MODE_ALL: case REPEAT_MODE_ALL:
if (isLastTrack()) { if (isLastTrack()) {
position = 0; position = 0;
@ -459,7 +459,7 @@ public class MusicService extends Service {
position = 0; position = 0;
} }
} else { } else {
position = getPosition(); position -= 1;
} }
break; break;
default: default:
@ -658,11 +658,11 @@ public class MusicService extends Service {
playerHandler.removeMessages(FADE_DOWN_AND_PAUSE); playerHandler.removeMessages(FADE_DOWN_AND_PAUSE);
playerHandler.sendEmptyMessage(FADE_UP_AND_RESUME); playerHandler.sendEmptyMessage(FADE_UP_AND_RESUME);
} else { } else {
playImpl();
try { try {
player.setVolume(1f); player.setVolume(1f);
} catch (IllegalStateException ignored) { } catch (IllegalStateException ignored) {
} }
playImpl();
} }
} }
@ -923,13 +923,23 @@ public class MusicService extends Service {
break; break;
case TRACK_WENT_TO_NEXT: case TRACK_WENT_TO_NEXT:
service.setPosition(service.nextPosition); if (service.getRepeatMode() == REPEAT_MODE_NONE && service.isLastTrack()) {
service.prepareNext(); service.pause(true);
service.notifyChange(META_CHANGED); service.seek(0);
} else {
service.setPosition(service.nextPosition);
service.prepareNext();
service.notifyChange(META_CHANGED);
}
break; break;
case TRACK_ENDED: case TRACK_ENDED:
service.playNextSong(false); if (service.getRepeatMode() == REPEAT_MODE_NONE && service.isLastTrack()) {
service.notifyChange(PLAYSTATE_CHANGED);
service.seek(0);
} else {
service.playNextSong(false);
}
break; break;
case RELEASE_WAKELOCK: case RELEASE_WAKELOCK:

View file

@ -20,7 +20,7 @@
android:layout_height="104dp" android:layout_height="104dp"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:transitionName="@string/transition_album_cover" android:transitionName="@string/transition_album_cover"
tools:ignore="UnusedAttribute" /> tools:ignore="ContentDescription,UnusedAttribute" />
<LinearLayout <LinearLayout
android:id="@+id/footer" android:id="@+id/footer"

View file

@ -3,8 +3,6 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="72dp" android:layout_height="72dp"
android:background="?card_color"
android:elevation="2dp"
android:foreground="?rect_selector" android:foreground="?rect_selector"
tools:ignore="UnusedAttribute"> tools:ignore="UnusedAttribute">
@ -13,9 +11,10 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:descendantFocusability="blocksDescendants" android:descendantFocusability="blocksDescendants"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingEnd="0dp"
android:paddingLeft="16dp" android:paddingLeft="16dp"
android:paddingStart="16dp" android:paddingRight="0dp"
tools:ignore="RtlSymmetry"> android:paddingStart="16dp">
<TextView <TextView
android:id="@+id/track_number" android:id="@+id/track_number"

View file

@ -3,8 +3,6 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="72dp" android:layout_height="72dp"
android:background="?card_color"
android:elevation="2dp"
android:foreground="?rect_selector" android:foreground="?rect_selector"
tools:ignore="UnusedAttribute"> tools:ignore="UnusedAttribute">

View file

@ -3,8 +3,6 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="72dp" android:layout_height="72dp"
android:background="?card_color"
android:elevation="2dp"
android:foreground="?rect_selector" android:foreground="?rect_selector"
tools:ignore="UnusedAttribute"> tools:ignore="UnusedAttribute">
@ -13,7 +11,9 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:descendantFocusability="blocksDescendants" android:descendantFocusability="blocksDescendants"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingEnd="0dp"
android:paddingLeft="16dp" android:paddingLeft="16dp"
android:paddingRight="0dp"
android:paddingStart="16dp"> android:paddingStart="16dp">
<com.kabouzeid.gramophone.views.WidthFitSquareImageView <com.kabouzeid.gramophone.views.WidthFitSquareImageView

View file

@ -10,7 +10,9 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingEnd="0dp"
android:paddingLeft="16dp" android:paddingLeft="16dp"
android:paddingRight="0dp"
android:paddingStart="16dp"> android:paddingStart="16dp">
<ImageView <ImageView

View file

@ -3,9 +3,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="64dp" android:layout_height="64dp"
android:background="?card_color"
android:descendantFocusability="blocksDescendants" android:descendantFocusability="blocksDescendants"
android:elevation="2dp"
android:orientation="horizontal" android:orientation="horizontal"
tools:ignore="UnusedAttribute"> tools:ignore="UnusedAttribute">
@ -31,6 +29,7 @@
<ImageView <ImageView
android:id="@+id/menu" android:id="@+id/menu"
style="@style/OverFlowButton" style="@style/OverFlowButton"
android:layout_gravity="center_vertical" /> android:layout_gravity="center_vertical"
tools:ignore="ContentDescription" />
</LinearLayout> </LinearLayout>

View file

@ -12,7 +12,9 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingEnd="0dp"
android:paddingLeft="16dp" android:paddingLeft="16dp"
android:paddingRight="0dp"
android:paddingStart="16dp"> android:paddingStart="16dp">
<ImageView <ImageView

View file

@ -3,8 +3,6 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="72dp" android:layout_height="72dp"
android:background="?card_color"
android:elevation="2dp"
android:foreground="?rect_selector" android:foreground="?rect_selector"
tools:ignore="UnusedAttribute"> tools:ignore="UnusedAttribute">
@ -13,7 +11,9 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:descendantFocusability="blocksDescendants" android:descendantFocusability="blocksDescendants"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingEnd="0dp"
android:paddingLeft="16dp" android:paddingLeft="16dp"
android:paddingRight="0dp"
android:paddingStart="16dp"> android:paddingStart="16dp">
<com.kabouzeid.gramophone.views.WidthFitSquareImageView <com.kabouzeid.gramophone.views.WidthFitSquareImageView