initial handling of slide callbacks
This commit is contained in:
parent
4578cee645
commit
9dd046298e
@ -295,6 +295,7 @@ THE SOFTWARE.
|
|||||||
<string name="clear_queue">Clear queue</string>
|
<string name="clear_queue">Clear queue</string>
|
||||||
<string name="empty_the_queue">Empty queue</string>
|
<string name="empty_the_queue">Empty queue</string>
|
||||||
<string name="show_queue">Show queue</string>
|
<string name="show_queue">Show queue</string>
|
||||||
|
<string name="hide_queue">Hide queue</string>
|
||||||
<string name="dequeue_rest">Dequeue rest</string>
|
<string name="dequeue_rest">Dequeue rest</string>
|
||||||
<string name="queue">Queue</string>
|
<string name="queue">Queue</string>
|
||||||
<string name="toggle_controls">Toggle controls</string>
|
<string name="toggle_controls">Toggle controls</string>
|
||||||
|
@ -64,7 +64,6 @@ public class FullPlaybackActivity extends PlaybackActivity
|
|||||||
|
|
||||||
private TextView mOverlayText;
|
private TextView mOverlayText;
|
||||||
private View mControlsTop;
|
private View mControlsTop;
|
||||||
private View mSlidingView;
|
|
||||||
|
|
||||||
private SeekBar mSeekBar;
|
private SeekBar mSeekBar;
|
||||||
private TableLayout mInfoTable;
|
private TableLayout mInfoTable;
|
||||||
@ -161,8 +160,6 @@ public class FullPlaybackActivity extends PlaybackActivity
|
|||||||
coverView.setOnLongClickListener(this);
|
coverView.setOnLongClickListener(this);
|
||||||
mCoverView = coverView;
|
mCoverView = coverView;
|
||||||
|
|
||||||
mSlidingView = findViewById(R.id.sliding_view);
|
|
||||||
|
|
||||||
TableLayout table = (TableLayout)findViewById(R.id.info_table);
|
TableLayout table = (TableLayout)findViewById(R.id.info_table);
|
||||||
if (table != null) {
|
if (table != null) {
|
||||||
table.setOnClickListener(this);
|
table.setOnClickListener(this);
|
||||||
@ -362,7 +359,6 @@ public class FullPlaybackActivity extends PlaybackActivity
|
|||||||
menu.add(0, MENU_ENQUEUE_ARTIST, 0, R.string.enqueue_current_artist).setIcon(R.drawable.ic_menu_add);
|
menu.add(0, MENU_ENQUEUE_ARTIST, 0, R.string.enqueue_current_artist).setIcon(R.drawable.ic_menu_add);
|
||||||
menu.add(0, MENU_ENQUEUE_GENRE, 0, R.string.enqueue_current_genre).setIcon(R.drawable.ic_menu_add);
|
menu.add(0, MENU_ENQUEUE_GENRE, 0, R.string.enqueue_current_genre).setIcon(R.drawable.ic_menu_add);
|
||||||
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);
|
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);
|
||||||
menu.add(0, MENU_SHOW_QUEUE, 0, R.string.show_queue);
|
|
||||||
|
|
||||||
// ensure that mFavorites is updated
|
// ensure that mFavorites is updated
|
||||||
mHandler.sendEmptyMessage(MSG_LOAD_FAVOURITE_INFO);
|
mHandler.sendEmptyMessage(MSG_LOAD_FAVOURITE_INFO);
|
||||||
|
@ -796,12 +796,8 @@ public class LibraryActivity
|
|||||||
menu.add(0, MENU_PLAYBACK, 0, R.string.playback_view);
|
menu.add(0, MENU_PLAYBACK, 0, R.string.playback_view);
|
||||||
super.onCreateOptionsMenu(menu);
|
super.onCreateOptionsMenu(menu);
|
||||||
|
|
||||||
MenuItem search = menu.add(0, MENU_SEARCH, 0, R.string.search).setIcon(R.drawable.ic_menu_search);
|
menu.add(0, MENU_SEARCH, 0, R.string.search).setIcon(R.drawable.ic_menu_search).setVisible(false);
|
||||||
search.setVisible(false);
|
|
||||||
|
|
||||||
menu.add(0, MENU_SORT, 0, R.string.sort_by).setIcon(R.drawable.ic_menu_sort_alphabetically);
|
menu.add(0, MENU_SORT, 0, R.string.sort_by).setIcon(R.drawable.ic_menu_sort_alphabetically);
|
||||||
menu.add(0, MENU_SHOW_QUEUE, 0, R.string.show_queue);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,10 +54,12 @@ public abstract class PlaybackActivity extends Activity
|
|||||||
implements TimelineCallback,
|
implements TimelineCallback,
|
||||||
Handler.Callback,
|
Handler.Callback,
|
||||||
View.OnClickListener,
|
View.OnClickListener,
|
||||||
CoverView.Callback
|
CoverView.Callback,
|
||||||
|
SlidingView.Callback
|
||||||
{
|
{
|
||||||
private Action mUpAction;
|
private Action mUpAction;
|
||||||
private Action mDownAction;
|
private Action mDownAction;
|
||||||
|
private Menu mMenu;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Handler running on the UI thread, in contrast with mHandler which runs
|
* A Handler running on the UI thread, in contrast with mHandler which runs
|
||||||
@ -77,6 +79,7 @@ public abstract class PlaybackActivity extends Activity
|
|||||||
protected ImageButton mPlayPauseButton;
|
protected ImageButton mPlayPauseButton;
|
||||||
protected ImageButton mShuffleButton;
|
protected ImageButton mShuffleButton;
|
||||||
protected ImageButton mEndButton;
|
protected ImageButton mEndButton;
|
||||||
|
protected SlidingView mSlidingView;
|
||||||
|
|
||||||
protected int mState;
|
protected int mState;
|
||||||
private long mLastStateEvent;
|
private long mLastStateEvent;
|
||||||
@ -310,6 +313,10 @@ public abstract class PlaybackActivity extends Activity
|
|||||||
mEndButton = (ImageButton)findViewById(R.id.end_action);
|
mEndButton = (ImageButton)findViewById(R.id.end_action);
|
||||||
mEndButton.setOnClickListener(this);
|
mEndButton.setOnClickListener(this);
|
||||||
registerForContextMenu(mEndButton);
|
registerForContextMenu(mEndButton);
|
||||||
|
|
||||||
|
mSlidingView = (SlidingView)findViewById(R.id.sliding_view);
|
||||||
|
if (mSlidingView != null)
|
||||||
|
mSlidingView.setCallback(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -363,14 +370,18 @@ public abstract class PlaybackActivity extends Activity
|
|||||||
static final int MENU_CLEAR_QUEUE = 11;
|
static final int MENU_CLEAR_QUEUE = 11;
|
||||||
static final int MENU_SONG_FAVORITE = 12;
|
static final int MENU_SONG_FAVORITE = 12;
|
||||||
static final int MENU_SHOW_QUEUE = 13;
|
static final int MENU_SHOW_QUEUE = 13;
|
||||||
static final int MENU_SAVE_AS_PLAYLIST = 14;
|
static final int MENU_HIDE_QUEUE = 14;
|
||||||
static final int MENU_DELETE = 15;
|
static final int MENU_SAVE_AS_PLAYLIST = 15;
|
||||||
static final int MENU_EMPTY_QUEUE = 16;
|
static final int MENU_DELETE = 16;
|
||||||
|
static final int MENU_EMPTY_QUEUE = 17;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu)
|
public boolean onCreateOptionsMenu(Menu menu)
|
||||||
{
|
{
|
||||||
|
mMenu = menu;
|
||||||
menu.add(0, MENU_PREFS, 0, R.string.settings).setIcon(R.drawable.ic_menu_preferences);
|
menu.add(0, MENU_PREFS, 0, R.string.settings).setIcon(R.drawable.ic_menu_preferences);
|
||||||
|
menu.add(0, MENU_SHOW_QUEUE, 0, R.string.show_queue);
|
||||||
|
menu.add(0, MENU_HIDE_QUEUE, 0, R.string.hide_queue);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -385,14 +396,28 @@ public abstract class PlaybackActivity extends Activity
|
|||||||
PlaybackService.get(this).clearQueue();
|
PlaybackService.get(this).clearQueue();
|
||||||
break;
|
break;
|
||||||
case MENU_SHOW_QUEUE:
|
case MENU_SHOW_QUEUE:
|
||||||
startActivity(new Intent(this, ShowQueueActivity.class));
|
mSlidingView.expandSlide();
|
||||||
break;
|
break;
|
||||||
|
case MENU_HIDE_QUEUE:
|
||||||
|
mSlidingView.hideSlide();
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called by SlidingView to signal a visibility change
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onSlideFullyExpanded(boolean visible) {
|
||||||
|
if (mMenu == null)
|
||||||
|
return; // not initialized yet
|
||||||
|
mMenu.findItem(MENU_HIDE_QUEUE).setVisible(visible);
|
||||||
|
mMenu.findItem(MENU_SHOW_QUEUE).setVisible(!visible);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call addToPlaylist with the results from a NewPlaylistDialog stored in
|
* Call addToPlaylist with the results from a NewPlaylistDialog stored in
|
||||||
* obj.
|
* obj.
|
||||||
|
@ -85,8 +85,7 @@ public class SlidingView extends FrameLayout
|
|||||||
*/
|
*/
|
||||||
private Callback mCallback;
|
private Callback mCallback;
|
||||||
public interface Callback {
|
public interface Callback {
|
||||||
public abstract void onSlideHidden();
|
public abstract void onSlideFullyExpanded(boolean visible);
|
||||||
public abstract void onSlideExpanded();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -324,10 +323,7 @@ public class SlidingView extends FrameLayout
|
|||||||
public void onAnimationEnd(Animator animation) {
|
public void onAnimationEnd(Animator animation) {
|
||||||
setSlaveViewStage(mCurrentStage);
|
setSlaveViewStage(mCurrentStage);
|
||||||
if (mCallback != null) {
|
if (mCallback != null) {
|
||||||
if (mCurrentStage == 0)
|
mCallback.onSlideFullyExpanded( mCurrentStage == mStages.size()-1 );
|
||||||
mCallback.onSlideHidden();
|
|
||||||
if (mCurrentStage == mStages.size()-1)
|
|
||||||
mCallback.onSlideExpanded();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user