1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
|
/*
* Copyright (C) 2012 Christopher Eby <kreed@kreed.org>
* Copyright (C) 2016-2019 Adrian Ulrich <adrian@blinkenlights.ch>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package ch.blinkenlights.android.vanilla;
import ch.blinkenlights.android.medialibrary.MediaMetadataExtractor;
import java.util.ArrayList;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Message;
import android.util.Log;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.SubMenu;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
import android.app.AlertDialog;
import android.content.DialogInterface;
/**
* The primary playback screen with playback controls and large cover display.
*/
public class FullPlaybackActivity extends SlidingPlaybackActivity
implements View.OnLongClickListener
{
public static final int DISPLAY_INFO_OVERLAP = 0;
public static final int DISPLAY_INFO_BELOW = 1;
public static final int DISPLAY_INFO_WIDGETS = 2;
private TextView mOverlayText;
private TableLayout mInfoTable;
private TextView mQueuePosView;
private TextView mTitle;
private TextView mAlbum;
private TextView mArtist;
/**
* True if the controls are visible (play, next, seek bar, etc).
*/
private boolean mControlsVisible;
/**
* True if the extra info is visible.
*/
private boolean mExtraInfoVisible;
/**
* The current display mode, which determines layout and cover render style.
*/
private int mDisplayMode;
private Action mCoverPressAction;
private Action mCoverLongPressAction;
/**
* The currently playing song.
*/
private Song mCurrentSong;
private String mGenre;
private TextView mGenreView;
private String mTrack;
private TextView mTrackView;
private String mYear;
private TextView mYearView;
private String mComposer;
private TextView mComposerView;
private String mPath;
private TextView mPathView;
private String mFormat;
private TextView mFormatView;
private String mReplayGain;
private TextView mReplayGainView;
private MenuItem mFavorites;
@Override
public void onCreate(Bundle icicle)
{
ThemeHelper.setTheme(this, R.style.Playback);
super.onCreate(icicle);
setTitle(R.string.playback_view);
SharedPreferences settings = SharedPrefHelper.getSettings(this);
int displayMode = Integer.parseInt(settings.getString(PrefKeys.DISPLAY_MODE, PrefDefaults.DISPLAY_MODE));
mDisplayMode = displayMode;
int layout = R.layout.full_playback;
int coverStyle;
switch (displayMode) {
default:
Log.w("VanillaMusic", "Invalid display mode given. Defaulting to widget mode.");
// fall through
case DISPLAY_INFO_WIDGETS:
coverStyle = CoverBitmap.STYLE_NO_INFO;
layout = R.layout.full_playback_alt;
break;
case DISPLAY_INFO_OVERLAP:
coverStyle = CoverBitmap.STYLE_OVERLAPPING_BOX;
break;
case DISPLAY_INFO_BELOW:
coverStyle = CoverBitmap.STYLE_INFO_BELOW;
break;
}
setContentView(layout);
CoverView coverView = (CoverView)findViewById(R.id.cover_view);
coverView.setup(mLooper, this, coverStyle);
coverView.setOnClickListener(this);
coverView.setOnLongClickListener(this);
mCoverView = coverView;
TableLayout table = (TableLayout)findViewById(R.id.info_table);
if (table != null) {
table.setOnClickListener(this);
table.setOnLongClickListener(this);
mInfoTable = table;
}
mTitle = (TextView)findViewById(R.id.title);
mAlbum = (TextView)findViewById(R.id.album);
mArtist = (TextView)findViewById(R.id.artist);
mQueuePosView = (TextView)findViewById(R.id.queue_pos);
mGenreView = (TextView)findViewById(R.id.genre);
mTrackView = (TextView)findViewById(R.id.track);
mYearView = (TextView)findViewById(R.id.year);
mComposerView = (TextView)findViewById(R.id.composer);
mPathView = (TextView)findViewById(R.id.path);
mFormatView = (TextView)findViewById(R.id.format);
mReplayGainView = (TextView)findViewById(R.id.replaygain);
bindControlButtons();
setControlsVisible(settings.getBoolean(PrefKeys.VISIBLE_CONTROLS, PrefDefaults.VISIBLE_CONTROLS));
setExtraInfoVisible(settings.getBoolean(PrefKeys.VISIBLE_EXTRA_INFO, PrefDefaults.VISIBLE_EXTRA_INFO));
}
@Override
public void onStart()
{
super.onStart();
SharedPreferences settings = SharedPrefHelper.getSettings(this);
if (mDisplayMode != Integer.parseInt(settings.getString(PrefKeys.DISPLAY_MODE, PrefDefaults.DISPLAY_MODE))) {
finish();
startActivity(new Intent(this, FullPlaybackActivity.class));
}
mCoverPressAction = Action.getAction(settings, PrefKeys.COVER_PRESS_ACTION, PrefDefaults.COVER_PRESS_ACTION);
mCoverLongPressAction = Action.getAction(settings, PrefKeys.COVER_LONGPRESS_ACTION, PrefDefaults.COVER_LONGPRESS_ACTION);
}
/**
* Hide the message overlay, if it exists.
*/
private void hideMessageOverlay()
{
if (mOverlayText != null)
mOverlayText.setVisibility(View.GONE);
}
/**
* Show some text in a message overlay.
*
* @param text Resource id of the text to show.
*/
private void showOverlayMessage(int text)
{
if (mOverlayText == null) {
TextView view = new TextView(this);
// This will be drawn on top of all other controls, so we flood this view
// with a non-alpha color
view.setBackgroundColor(ThemeHelper.fetchThemeColor(this, android.R.attr.colorBackground));
view.setGravity(Gravity.CENTER);
view.setPadding(25, 25, 25, 25);
// Make the view clickable so it eats touch events
view.setClickable(true);
view.setOnClickListener(this);
addContentView(view,
new ViewGroup.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT));
mOverlayText = view;
} else {
mOverlayText.setVisibility(View.VISIBLE);
}
mOverlayText.setText(text);
}
@Override
protected void onStateChange(int state, int toggled)
{
super.onStateChange(state, toggled);
if ((toggled & (PlaybackService.FLAG_NO_MEDIA|PlaybackService.FLAG_EMPTY_QUEUE)) != 0) {
if ((state & PlaybackService.FLAG_NO_MEDIA) != 0) {
showOverlayMessage(R.string.no_songs);
} else if ((state & PlaybackService.FLAG_EMPTY_QUEUE) != 0) {
showOverlayMessage(R.string.empty_queue);
} else {
hideMessageOverlay();
}
}
if (mQueuePosView != null)
updateQueuePosition();
}
@Override
protected void onSongChange(Song song) {
if (mTitle != null) {
if (song == null) {
mTitle.setText(null);
mAlbum.setText(null);
mArtist.setText(null);
} else {
mTitle.setText(song.title);
mAlbum.setText(song.album);
mArtist.setText(song.artist);
}
updateQueuePosition();
}
mCurrentSong = song;
mHandler.sendEmptyMessage(MSG_LOAD_FAVOURITE_INFO);
// All quick UI updates are done: Time to update the cover
// and parse additional info
if (mExtraInfoVisible) {
mHandler.sendEmptyMessage(MSG_LOAD_EXTRA_INFO);
}
super.onSongChange(song);
}
/**
* Update the queue position display. mQueuePos must not be null.
*/
private void updateQueuePosition()
{
if (PlaybackService.finishAction(mState) == SongTimeline.FINISH_RANDOM) {
// Not very useful in random mode; it will always show something
// like 11/13 since the timeline is trimmed to 10 previous songs.
// So just hide it.
mQueuePosView.setText(null);
} else {
PlaybackService service = PlaybackService.get(this);
mQueuePosView.setText((service.getTimelinePosition() + 1) + "/" + service.getTimelineLength());
}
mQueuePosView.requestLayout(); // ensure queue pos column has enough room
}
@Override
public void onPositionInfoChanged()
{
if (mQueuePosView != null)
mUiHandler.sendEmptyMessage(MSG_UPDATE_POSITION);
}
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
super.onCreateOptionsMenu(menu);
menu.add(0, MENU_DELETE, 30, R.string.delete);
SubMenu enqueueMenu = menu.addSubMenu(0, MENU_ENQUEUE, 30, R.string.enqueue_current);
SubMenu moreMenu = menu.addSubMenu(0, MENU_MORE, 30, R.string.more_from_current);
menu.addSubMenu(0, MENU_ADD_TO_PLAYLIST, 30, R.string.add_to_playlist);
menu.add(0, MENU_SHARE, 30, R.string.share);
if (PluginUtils.checkPlugins(this)) {
menu.add(0, MENU_PLUGINS, 30, R.string.plugins)
.setIcon(R.drawable.plugin)
.setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_IF_ROOM);
}
mFavorites = menu.add(0, MENU_SONG_FAVORITE, 0, R.string.add_to_favorites)
.setIcon(R.drawable.btn_rating_star_off_mtrl_alpha)
.setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_IF_ROOM);
// Subitems of 'enqueue...'
enqueueMenu.add(0, MENU_ENQUEUE_ALBUM, 30, R.string.album);
enqueueMenu.add(0, MENU_ENQUEUE_ARTIST, 30, R.string.artist);
enqueueMenu.add(0, MENU_ENQUEUE_GENRE, 30, R.string.genre);
// Subitems of 'more from...'
moreMenu.add(0, MENU_MORE_ALBUM, 30, R.string.album);
moreMenu.add(0, MENU_MORE_ARTIST, 30, R.string.artist);
moreMenu.add(0, MENU_MORE_GENRE, 30, R.string.genre);
moreMenu.add(0, MENU_MORE_FOLDER, 30, R.string.folder);
// ensure that mFavorites is updated
mHandler.sendEmptyMessage(MSG_LOAD_FAVOURITE_INFO);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
final Song song = mCurrentSong;
switch (item.getItemId()) {
case android.R.id.home:
openLibrary(null, -1);
break;
case MENU_MORE_ALBUM:
openLibrary(song, MediaUtils.TYPE_ALBUM);
break;
case MENU_MORE_ARTIST:
openLibrary(song, MediaUtils.TYPE_ARTIST);
break;
case MENU_MORE_GENRE:
openLibrary(song, MediaUtils.TYPE_GENRE);
break;
case MENU_MORE_FOLDER:
openLibrary(song, MediaUtils.TYPE_FILE);
break;
case MENU_ENQUEUE_ALBUM:
PlaybackService.get(this).enqueueFromSong(song, MediaUtils.TYPE_ALBUM);
break;
case MENU_ENQUEUE_ARTIST:
PlaybackService.get(this).enqueueFromSong(song, MediaUtils.TYPE_ARTIST);
break;
case MENU_ENQUEUE_GENRE:
PlaybackService.get(this).enqueueFromSong(song, MediaUtils.TYPE_GENRE);
break;
case MENU_SONG_FAVORITE:
long playlistId = Playlist.getFavoritesId(this, true);
if (song != null) {
PlaylistTask playlistTask = new PlaylistTask(playlistId, getString(R.string.playlist_favorites));
playlistTask.audioIds = new ArrayList<Long>();
playlistTask.audioIds.add(song.id);
int action = Playlist.isInPlaylist(this, playlistId, song) ? MSG_REMOVE_FROM_PLAYLIST : MSG_ADD_TO_PLAYLIST;
mHandler.sendMessage(mHandler.obtainMessage(action, playlistTask));
}
break;
case MENU_ADD_TO_PLAYLIST:
if (song != null) {
Intent intent = new Intent();
intent.putExtra("type", MediaUtils.TYPE_SONG);
intent.putExtra("id", song.id);
PlaylistDialog dialog = PlaylistDialog.newInstance(this, intent, null, song);
dialog.show(getFragmentManager(), "PlaylistDialog");
}
break;
case MENU_SHARE:
if (song != null)
MediaUtils.shareMedia(this, song);
break;
case MENU_DELETE:
final PlaybackService playbackService = PlaybackService.get(this);
final PlaybackActivity activity = this;
if (song != null) {
String delete_message = getString(R.string.delete_file, song.title);
AlertDialog.Builder dialog = new AlertDialog.Builder(this);
dialog.setTitle(R.string.delete);
dialog
.setMessage(delete_message)
.setPositiveButton(R.string.delete, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// MSG_DELETE expects an intent (usually called from listview)
Intent intent = new Intent();
intent.putExtra(LibraryAdapter.DATA_TYPE, MediaUtils.TYPE_SONG);
intent.putExtra(LibraryAdapter.DATA_ID, song.id);
mHandler.sendMessage(mHandler.obtainMessage(MSG_DELETE, intent));
}
})
.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
}
});
dialog.create().show();
}
break;
case MENU_PLUGINS:
if (song != null) {
Intent songIntent = new Intent();
songIntent.putExtra("id", song.id);
showPluginMenu(songIntent);
}
break;
default:
return super.onOptionsItemSelected(item);
}
return true;
}
@Override
public boolean onSearchRequested()
{
openLibrary(null, -1);
return false;
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event)
{
switch (keyCode) {
case KeyEvent.KEYCODE_DPAD_RIGHT:
shiftCurrentSong(SongTimeline.SHIFT_NEXT_SONG);
findViewById(R.id.next).requestFocus();
break;
case KeyEvent.KEYCODE_DPAD_LEFT:
shiftCurrentSong(SongTimeline.SHIFT_PREVIOUS_SONG);
findViewById(R.id.previous).requestFocus();
break;
case KeyEvent.KEYCODE_SEARCH:
Intent librarySearch = new Intent(this, LibraryActivity.class);
librarySearch.putExtra("launch_search", true);
startActivity(librarySearch);
break;
default:
return super.onKeyDown(keyCode, event);
}
return true;
}
@Override
public boolean onKeyUp(int keyCode, KeyEvent event)
{
switch (keyCode) {
case KeyEvent.KEYCODE_DPAD_CENTER:
case KeyEvent.KEYCODE_ENTER:
setControlsVisible(!mControlsVisible);
mHandler.sendEmptyMessage(MSG_SAVE_CONTROLS);
return true;
case KeyEvent.KEYCODE_BACK:
if (mSlidingView.isShrinkable()) {
mSlidingView.hideSlide();
return true;
}
}
return super.onKeyUp(keyCode, event);
}
/**
* Set the visibility of the controls views.
*
* @param visible True to show, false to hide
*/
private void setControlsVisible(boolean visible)
{
int mode = visible ? View.VISIBLE : View.GONE;
mSlidingView.setVisibility(mode);
mControlsVisible = visible;
if (visible) {
mPlayPauseButton.requestFocus();
}
}
/**
* Set the visibility of the extra metadata view.
*
* @param visible True to show, false to hide
*/
private void setExtraInfoVisible(boolean visible)
{
TableLayout table = mInfoTable;
if (table == null)
return;
table.setColumnCollapsed(0, !visible);
// Make title, album, and artist multi-line when extra info is visible
boolean singleLine = !visible;
for (int i = 0; i != 3; ++i) {
TableRow row = (TableRow)table.getChildAt(i);
((TextView)row.getChildAt(1)).setSingleLine(singleLine);
}
// toggle visibility of all but the first three rows (the title/artist/
// album rows)
int visibility = visible ? View.VISIBLE : View.GONE;
for (int i = table.getChildCount() - 1; i > 2 ; i--) {
table.getChildAt(i).setVisibility(visibility);
}
mExtraInfoVisible = visible;
if (visible && !mHandler.hasMessages(MSG_LOAD_EXTRA_INFO)) {
mHandler.sendEmptyMessage(MSG_LOAD_EXTRA_INFO);
}
}
/**
* Retrieve the extra metadata for the current song.
*/
private void loadExtraInfo()
{
Song song = mCurrentSong;
mGenre = null;
mTrack = null;
mYear = null;
mComposer = null;
mPath = null;
mFormat = null;
mReplayGain = null;
if(song != null) {
MediaMetadataExtractor data = new MediaMetadataExtractor(song.path);
mGenre = data.getFirst(MediaMetadataExtractor.GENRE);
mTrack = song.getTrackAndDiscNumber();
mComposer = data.getFirst(MediaMetadataExtractor.COMPOSER);
mYear = data.getFirst(MediaMetadataExtractor.YEAR);
mPath = song.path;
mFormat = data.getFormat();
BastpUtil.GainValues rg = PlaybackService.get(this).getReplayGainValues(song.path);
mReplayGain = String.format("found=%s, track=%.2f, album=%.2f", rg.found, rg.track, rg.album);
}
mUiHandler.sendEmptyMessage(MSG_COMMIT_INFO);
}
/**
* Save the hidden_controls preference to storage.
*/
private static final int MSG_SAVE_CONTROLS = 10;
/**
* Call {@link #loadExtraInfo()}.
*/
private static final int MSG_LOAD_EXTRA_INFO = 11;
/**
* Pass obj to mExtraInfo.setText()
*/
private static final int MSG_COMMIT_INFO = 12;
/**
* Calls {@link #updateQueuePosition()}.
*/
private static final int MSG_UPDATE_POSITION = 13;
/**
* Check if passed song is a favorite
*/
private static final int MSG_LOAD_FAVOURITE_INFO = 14;
/**
* Updates the favorites state
*/
private static final int MSG_COMMIT_FAVOURITE_INFO = 15;
@Override
public boolean handleMessage(Message message)
{
switch (message.what) {
case MSG_SAVE_CONTROLS: {
SharedPreferences.Editor editor = SharedPrefHelper.getSettings(this).edit();
editor.putBoolean(PrefKeys.VISIBLE_CONTROLS, mControlsVisible);
editor.putBoolean(PrefKeys.VISIBLE_EXTRA_INFO, mExtraInfoVisible);
editor.apply();
break;
}
case MSG_LOAD_EXTRA_INFO:
loadExtraInfo();
break;
case MSG_COMMIT_INFO: {
mGenreView.setText(mGenre);
mTrackView.setText(mTrack);
mYearView.setText(mYear);
mComposerView.setText(mComposer);
mPathView.setText(mPath);
mFormatView.setText(mFormat);
mReplayGainView.setText(mReplayGain);
break;
}
case MSG_UPDATE_POSITION:
updateQueuePosition();
break;
case MSG_NOTIFY_PLAYLIST_CHANGED: // triggers a fav-refresh
case MSG_LOAD_FAVOURITE_INFO:
if (mCurrentSong != null) {
boolean found = Playlist.isInPlaylist(this, Playlist.getFavoritesId(this, false), mCurrentSong);
mUiHandler.sendMessage(mUiHandler.obtainMessage(MSG_COMMIT_FAVOURITE_INFO, found));
}
break;
case MSG_COMMIT_FAVOURITE_INFO:
if (mFavorites != null) {
boolean found = (boolean)message.obj;
mFavorites.setIcon(found ? R.drawable.btn_rating_star_on_mtrl_alpha: R.drawable.btn_rating_star_off_mtrl_alpha);
mFavorites.setTitle(found ? R.string.remove_from_favorites : R.string.add_to_favorites);
}
break;
default:
return super.handleMessage(message);
}
return true;
}
@Override
protected void performAction(Action action) {
switch (action) {
case ToggleControls:
setControlsVisible(!mControlsVisible);
mHandler.sendEmptyMessage(MSG_SAVE_CONTROLS);
break;
case ShowQueue:
mSlidingView.expandSlide();
break;
default:
super.performAction(action);
}
}
@Override
public void onClick(View view)
{
if (view == mOverlayText && (mState & PlaybackService.FLAG_EMPTY_QUEUE) != 0) {
setState(PlaybackService.get(this).setFinishAction(SongTimeline.FINISH_RANDOM));
} else if (view == mCoverView) {
performAction(mCoverPressAction);
} else if (view.getId() == R.id.info_table) {
openLibrary(mCurrentSong, MediaUtils.TYPE_ALBUM);
} else {
super.onClick(view);
}
}
@Override
public boolean onLongClick(View view)
{
switch (view.getId()) {
case R.id.cover_view:
performAction(mCoverLongPressAction);
break;
case R.id.info_table:
setExtraInfoVisible(!mExtraInfoVisible);
mHandler.sendEmptyMessage(MSG_SAVE_CONTROLS);
break;
default:
return false;
}
return true;
}
@Override
public void onSlideExpansionChanged(int expansion) {
super.onSlideExpansionChanged(expansion);
setControlsVisible(true);
if (expansion != SlidingView.EXPANSION_PARTIAL) {
setExtraInfoVisible(false);
} else {
SharedPreferences settings = SharedPrefHelper.getSettings(this);
setExtraInfoVisible(settings.getBoolean(PrefKeys.VISIBLE_EXTRA_INFO, PrefDefaults.VISIBLE_EXTRA_INFO));
}
}
}
|