Commit 6ddb52db authored by Adrien Maglo's avatar Adrien Maglo
Browse files

Audio player: slide up and down the audio player when its header is clicked

parent 70a60f36
......@@ -842,6 +842,16 @@ public class MainActivity extends SherlockFragmentActivity {
return false;
}
/**
* Slide up and down the audio player depending on its current state.
*/
public void slideUpOrDownAudioPlayer() {
if (mSlidingPane.getState() == mSlidingPane.STATE_CLOSED)
mSlidingPane.openPane();
else if (mSlidingPane.getState() == mSlidingPane.STATE_OPENED)
mSlidingPane.closePane();
}
/**
* Hide the audio player.
*/
......
......@@ -526,6 +526,12 @@ public class AudioPlayer extends Fragment implements IAudioPlayer {
public void onTouchUp() {
restoreHedaderButtonVisibilities();
}
@Override
public void onTouchClick() {
MainActivity activity = (MainActivity)getActivity();
activity.slideUpOrDownAudioPlayer();
}
};
private final AudioMediaSwitcherListener mCoverMediaSwitcherListener = new AudioMediaSwitcherListener() {
......@@ -546,6 +552,9 @@ public class AudioPlayer extends Fragment implements IAudioPlayer {
@Override
public void onTouchUp() {}
@Override
public void onTouchClick() {}
};
}
......@@ -120,6 +120,8 @@ public abstract class AudioMediaSwitcher extends FlingViewGroup {
@Override
public void onTouchClick() {
if (mAudioMediaSwitcherListener != null)
mAudioMediaSwitcherListener.onTouchClick();
}
};
......@@ -139,5 +141,7 @@ public abstract class AudioMediaSwitcher extends FlingViewGroup {
void onTouchDown();
void onTouchUp();
void onTouchClick();
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment