Small fixes
This commit is contained in:
parent
cb11044999
commit
d3d37ccab3
12 changed files with 26 additions and 17 deletions
|
|
@ -23,8 +23,8 @@ android {
|
|||
applicationId "com.kabouzeid.gramophone"
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 22
|
||||
versionCode 4
|
||||
versionName "0.9.2b"
|
||||
versionCode 5
|
||||
versionName "0.9.3b"
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
|
|
|
|||
|
|
@ -83,7 +83,8 @@ public class SongAdapter extends RecyclerView.Adapter<SongAdapter.ViewHolder> {
|
|||
holder.songTitle.setTextColor(accentColor);
|
||||
holder.songInfo.setVisibility(View.GONE);
|
||||
holder.overflowButton.setVisibility(View.GONE);
|
||||
holder.albumArt.setPadding(48, 48, 48, 48);
|
||||
final int padding = activity.getResources().getDimensionPixelSize(R.dimen.default_item_margin);
|
||||
holder.albumArt.setPadding(padding, padding, padding, padding);
|
||||
holder.albumArt.setColorFilter(accentColor);
|
||||
holder.albumArt.setImageResource(R.drawable.ic_shuffle_white_48dp);
|
||||
holder.separator.setVisibility(View.VISIBLE);
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ public class PlayingNotificationHelper {
|
|||
R.layout.notification_playing_expanded);
|
||||
|
||||
notification = new NotificationCompat.Builder(service)
|
||||
.setSmallIcon(R.drawable.notification_icon)
|
||||
.setSmallIcon(R.drawable.ic_audiotrack_white_24dp)
|
||||
.setContentIntent(getOpenMusicControllerPendingIntent())
|
||||
.setCategory(NotificationCompat.CATEGORY_PROGRESS)
|
||||
.setPriority(NotificationCompat.PRIORITY_MAX)
|
||||
|
|
|
|||
|
|
@ -28,9 +28,11 @@ public class MediaButtonIntentReceiver extends BroadcastReceiver {
|
|||
break;
|
||||
case KeyEvent.KEYCODE_HEADSETHOOK:
|
||||
case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
|
||||
case KeyEvent.KEYCODE_MEDIA_PLAY:
|
||||
command = MusicService.ACTION_TOGGLE_PLAYBACK;
|
||||
break;
|
||||
case KeyEvent.KEYCODE_MEDIA_PLAY:
|
||||
command = MusicService.ACTION_RESUME;
|
||||
break;
|
||||
case KeyEvent.KEYCODE_MEDIA_NEXT:
|
||||
command = MusicService.ACTION_SKIP;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ import java.util.List;
|
|||
public class MusicService extends Service implements MediaPlayer.OnPreparedListener, MediaPlayer.OnErrorListener, MediaPlayer.OnCompletionListener, AudioManager.OnAudioFocusChangeListener {
|
||||
public static final String ACTION_TOGGLE_PLAYBACK = "com.kabouzeid.gramophone.action.TOGGLE_PLAYBACK";
|
||||
public static final String ACTION_PLAY = "com.kabouzeid.gramophone.action.PLAY";
|
||||
public static final String ACTION_RESUME = "com.kabouzeid.gramophone.action.RESUME";
|
||||
public static final String ACTION_PAUSE = "com.kabouzeid.gramophone.action.PAUSE";
|
||||
public static final String ACTION_STOP = "com.kabouzeid.gramophone.action.STOP";
|
||||
public static final String ACTION_SKIP = "com.kabouzeid.gramophone.action.SKIP";
|
||||
|
|
@ -56,7 +57,7 @@ public class MusicService extends Service implements MediaPlayer.OnPreparedListe
|
|||
private final BroadcastReceiver receiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (intent.getAction().equals(AudioManager.ACTION_AUDIO_BECOMING_NOISY)) {
|
||||
if (intent.getAction().compareTo(AudioManager.ACTION_AUDIO_BECOMING_NOISY) == 0) {
|
||||
pausePlaying();
|
||||
}
|
||||
}
|
||||
|
|
@ -145,6 +146,9 @@ public class MusicService extends Service implements MediaPlayer.OnPreparedListe
|
|||
case ACTION_PLAY:
|
||||
playSong();
|
||||
break;
|
||||
case ACTION_RESUME:
|
||||
resumePlaying();
|
||||
break;
|
||||
case ACTION_REWIND:
|
||||
back();
|
||||
break;
|
||||
|
|
@ -594,17 +598,19 @@ public class MusicService extends Service implements MediaPlayer.OnPreparedListe
|
|||
}
|
||||
|
||||
public void resumePlaying() {
|
||||
if (requestFocus()) {
|
||||
if (isPlayerPrepared) {
|
||||
player.start();
|
||||
playingNotificationHelper.updatePlayState(isPlaying());
|
||||
remoteControlClient.setPlaybackState(RemoteControlClient.PLAYSTATE_PLAYING);
|
||||
notifyOnMusicRemoteEventListeners(MusicRemoteEvent.RESUME);
|
||||
if(!isPlaying()) {
|
||||
if (requestFocus()) {
|
||||
if (isPlayerPrepared) {
|
||||
player.start();
|
||||
playingNotificationHelper.updatePlayState(isPlaying());
|
||||
remoteControlClient.setPlaybackState(RemoteControlClient.PLAYSTATE_PLAYING);
|
||||
notifyOnMusicRemoteEventListeners(MusicRemoteEvent.RESUME);
|
||||
} else {
|
||||
playSong();
|
||||
}
|
||||
} else {
|
||||
playSong();
|
||||
Toast.makeText(this, getResources().getString(R.string.audio_focus_denied), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(this, getResources().getString(R.string.audio_focus_denied), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
BIN
app/src/main/res/drawable-hdpi/ic_audiotrack_white_24dp.png
Normal file
BIN
app/src/main/res/drawable-hdpi/ic_audiotrack_white_24dp.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 333 B |
BIN
app/src/main/res/drawable-mdpi/ic_audiotrack_white_24dp.png
Normal file
BIN
app/src/main/res/drawable-mdpi/ic_audiotrack_white_24dp.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 236 B |
BIN
app/src/main/res/drawable-xhdpi/ic_audiotrack_white_24dp.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/ic_audiotrack_white_24dp.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 328 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_audiotrack_white_24dp.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/ic_audiotrack_white_24dp.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 509 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_audiotrack_white_24dp.png
Normal file
BIN
app/src/main/res/drawable-xxxhdpi/ic_audiotrack_white_24dp.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 625 B |
Binary file not shown.
|
Before Width: | Height: | Size: 1.5 KiB |
|
|
@ -26,7 +26,7 @@
|
|||
<string name="unknown_album">Unknown Album</string>
|
||||
<string name="untitled_song">Untitled Song</string>
|
||||
<string name="nothing_playing">Nothing is playing</string>
|
||||
<string name="hint_fling_to_open">fling to open current playing</string>
|
||||
<string name="hint_fling_to_open">Fling to toggle the now playing screen</string>
|
||||
<string name="hint_fling_to_go_back">fling to return</string>
|
||||
<string name="hint_press_again_to_exit">Press once again to exit!</string>
|
||||
<string name="unplayable_file">Sorry - an error occurred while attempting to play this song</string>
|
||||
|
|
@ -63,7 +63,7 @@
|
|||
<string name="label_current_playing_queue">Playing queue</string>
|
||||
<string name="close">Close</string>
|
||||
<string name="save_as_playlist">Save as playlist</string>
|
||||
<string name="credits">Gramophone is a completely free material designed music player by <b>Karim Abou Zeid</b>.\n\nIcon by <a href="http://cookicons.co/">Cookicons</a>\n\n<a href="https://plus.google.com/+KarimAbouZeid23697">Google+</a>   <a href="https://twitter.com/karim23697">Twitter</a></string>
|
||||
<string name="credits">Gramophone is a completely free material designed music player by <b>Karim Abou Zeid</b>.\n\n<a href="https://plus.google.com/+KarimAbouZeid23697">Google+</a>   <a href="https://twitter.com/karim23697">Twitter</a>\n\nIcon by <a href="http://cookicons.co/">Cookicons</a></string>
|
||||
<string name="title_activity_search">SearchActivity</string>
|
||||
<string name="more">more</string>
|
||||
<string name="no_results">No results</string>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue