Make library controls react to no media and empty queue states better
This commit is contained in:
parent
a6c4c6c90f
commit
fcad52ef5d
@ -26,6 +26,13 @@ THE SOFTWARE.
|
|||||||
android:background="@drawable/music_bottom_playback_bg"
|
android:background="@drawable/music_bottom_playback_bg"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="80dip">
|
android:layout_height="80dip">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/empty_queue"
|
||||||
|
android:gravity="center"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:text="@string/empty_queue"
|
||||||
|
android:visibility="gone" />
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/cover"
|
android:id="@+id/cover"
|
||||||
android:scaleType="fitCenter"
|
android:scaleType="fitCenter"
|
||||||
|
@ -25,7 +25,7 @@ THE SOFTWARE.
|
|||||||
|
|
||||||
<!-- Playback Activity (main screen) -->
|
<!-- Playback Activity (main screen) -->
|
||||||
<string name="no_songs">No songs found on your device.</string>
|
<string name="no_songs">No songs found on your device.</string>
|
||||||
<string name="empty_queue">No songs selected. Pick some from the library (search key) or enter random mode by tapping this message.</string>
|
<string name="empty_queue">No songs selected. Pick some from the library or enter random mode by tapping this message.</string>
|
||||||
<string name="settings">Settings</string>
|
<string name="settings">Settings</string>
|
||||||
<string name="library">Library</string>
|
<string name="library">Library</string>
|
||||||
<string name="no_shuffle">No shuffle</string>
|
<string name="no_shuffle">No shuffle</string>
|
||||||
|
@ -86,6 +86,7 @@ public class LibraryActivity
|
|||||||
private TextView mTitle;
|
private TextView mTitle;
|
||||||
private TextView mArtist;
|
private TextView mArtist;
|
||||||
private ImageView mCover;
|
private ImageView mCover;
|
||||||
|
private View mEmptyQueue;
|
||||||
|
|
||||||
private ViewGroup mLimiterViews;
|
private ViewGroup mLimiterViews;
|
||||||
|
|
||||||
@ -143,6 +144,9 @@ public class LibraryActivity
|
|||||||
mEndButton = (ImageButton)findViewById(R.id.end_action);
|
mEndButton = (ImageButton)findViewById(R.id.end_action);
|
||||||
mEndButton.setOnClickListener(this);
|
mEndButton.setOnClickListener(this);
|
||||||
registerForContextMenu(mEndButton);
|
registerForContextMenu(mEndButton);
|
||||||
|
|
||||||
|
mEmptyQueue = findViewById(R.id.empty_queue);
|
||||||
|
mEmptyQueue.setOnClickListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
mSearchBox = findViewById(R.id.search_box);
|
mSearchBox = findViewById(R.id.search_box);
|
||||||
@ -445,6 +449,8 @@ public class LibraryActivity
|
|||||||
mTextFilter.setText("");
|
mTextFilter.setText("");
|
||||||
} else if (view == mCover) {
|
} else if (view == mCover) {
|
||||||
startActivity(new Intent(this, FullPlaybackActivity.class));
|
startActivity(new Intent(this, FullPlaybackActivity.class));
|
||||||
|
} else if (view == mEmptyQueue) {
|
||||||
|
setState(PlaybackService.get(this).setFinishAction(SongTimeline.FINISH_RANDOM));
|
||||||
} else if (view.getTag() != null) {
|
} else if (view.getTag() != null) {
|
||||||
// a limiter view was clicked
|
// a limiter view was clicked
|
||||||
int i = (Integer)view.getTag();
|
int i = (Integer)view.getTag();
|
||||||
@ -865,11 +871,25 @@ public class LibraryActivity
|
|||||||
mSearchBoxVisible = visible;
|
mSearchBoxVisible = visible;
|
||||||
mSearchBox.setVisibility(visible ? View.VISIBLE : View.GONE);
|
mSearchBox.setVisibility(visible ? View.VISIBLE : View.GONE);
|
||||||
if (mControls != null)
|
if (mControls != null)
|
||||||
mControls.setVisibility(visible ? View.GONE : View.VISIBLE);
|
mControls.setVisibility(visible || (mState & PlaybackService.FLAG_NO_MEDIA) != 0 ? View.GONE : View.VISIBLE);
|
||||||
if (visible)
|
if (visible)
|
||||||
mSearchBox.requestFocus();
|
mSearchBox.requestFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStateChange(int state, int toggled)
|
||||||
|
{
|
||||||
|
super.onStateChange(state, toggled);
|
||||||
|
|
||||||
|
if ((toggled & PlaybackService.FLAG_NO_MEDIA) != 0) {
|
||||||
|
// update visibility of controls
|
||||||
|
setSearchBoxVisible(mSearchBoxVisible);
|
||||||
|
}
|
||||||
|
if ((toggled & PlaybackService.FLAG_EMPTY_QUEUE) != 0 && mEmptyQueue != null) {
|
||||||
|
mEmptyQueue.setVisibility((state & PlaybackService.FLAG_EMPTY_QUEUE) == 0 ? View.GONE : View.VISIBLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onSongChange(final Song song)
|
protected void onSongChange(final Song song)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user