Split controls into top and bottom parts
This commit is contained in:
parent
b60404a950
commit
e82838087d
@ -5,55 +5,56 @@
|
|||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
android:layout_width="fill_parent" />
|
android:layout_width="fill_parent" />
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/controls"
|
android:id="@+id/controls_top"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_gravity="bottom|center_horizontal"
|
android:layout_gravity="top"
|
||||||
android:background="#000"
|
android:background="#a000"
|
||||||
android:orientation="vertical">
|
android:orientation="horizontal">
|
||||||
<LinearLayout
|
<SeekBar
|
||||||
|
android:id="@+id/seek_bar"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:orientation="horizontal">
|
android:layout_marginLeft="15px"
|
||||||
<ImageButton
|
android:layout_marginRight="15px"
|
||||||
android:id="@+id/previous"
|
android:layout_weight="1" />
|
||||||
android:layout_height="wrap_content"
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:id="@+id/seek_text"
|
||||||
android:background="@null"
|
|
||||||
android:src="@drawable/previous" />
|
|
||||||
<ImageButton
|
|
||||||
android:id="@+id/play_pause"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_marginLeft="25px"
|
|
||||||
android:background="@null"
|
|
||||||
android:src="@drawable/play" />
|
|
||||||
<ImageButton
|
|
||||||
android:id="@+id/next"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_marginLeft="25px"
|
|
||||||
android:background="@null"
|
|
||||||
android:src="@drawable/next" />
|
|
||||||
</LinearLayout>
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:layout_gravity="center"
|
||||||
<SeekBar
|
android:layout_marginRight="15px"
|
||||||
android:id="@+id/seek_bar"
|
android:text="0:00 / 0:00" />
|
||||||
android:layout_height="wrap_content"
|
</LinearLayout>
|
||||||
android:layout_width="wrap_content"
|
<LinearLayout
|
||||||
android:layout_gravity="center"
|
android:id="@+id/controls_bottom"
|
||||||
android:layout_weight="1" />
|
android:visibility="gone"
|
||||||
<TextView
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/seek_text"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_gravity="bottom|center_horizontal"
|
||||||
android:layout_width="wrap_content"
|
android:background="#a000"
|
||||||
android:layout_gravity="center"
|
android:orientation="horizontal">
|
||||||
android:text="0:00 / 0:00" />
|
<ImageButton
|
||||||
</LinearLayout>
|
android:id="@+id/previous"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:background="@null"
|
||||||
|
android:src="@drawable/previous" />
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/play_pause"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_marginLeft="25px"
|
||||||
|
android:background="@null"
|
||||||
|
android:src="@drawable/play" />
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/next"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_marginLeft="25px"
|
||||||
|
android:background="@null"
|
||||||
|
android:src="@drawable/next" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</merge>
|
</merge>
|
@ -30,7 +30,8 @@ public class NowPlayingActivity extends Activity implements CoverViewWatcher, Se
|
|||||||
private ViewGroup mLayout;
|
private ViewGroup mLayout;
|
||||||
private CoverView mCoverView;
|
private CoverView mCoverView;
|
||||||
private LinearLayout mMessageBox;
|
private LinearLayout mMessageBox;
|
||||||
private View mControls;
|
private View mControlsTop;
|
||||||
|
private View mControlsBottom;
|
||||||
|
|
||||||
private ImageButton mPreviousButton;
|
private ImageButton mPreviousButton;
|
||||||
private ImageButton mPlayPauseButton;
|
private ImageButton mPlayPauseButton;
|
||||||
@ -58,7 +59,8 @@ public class NowPlayingActivity extends Activity implements CoverViewWatcher, Se
|
|||||||
|
|
||||||
mLayout = (ViewGroup)mCoverView.getParent();
|
mLayout = (ViewGroup)mCoverView.getParent();
|
||||||
|
|
||||||
mControls = findViewById(R.id.controls);
|
mControlsTop = findViewById(R.id.controls_top);
|
||||||
|
mControlsBottom = findViewById(R.id.controls_bottom);
|
||||||
|
|
||||||
mPreviousButton = (ImageButton)findViewById(R.id.previous);
|
mPreviousButton = (ImageButton)findViewById(R.id.previous);
|
||||||
mPreviousButton.setOnClickListener(this);
|
mPreviousButton.setOnClickListener(this);
|
||||||
@ -268,7 +270,8 @@ public class NowPlayingActivity extends Activity implements CoverViewWatcher, Se
|
|||||||
|
|
||||||
public void clicked()
|
public void clicked()
|
||||||
{
|
{
|
||||||
mControls.setVisibility(View.VISIBLE);
|
mControlsTop.setVisibility(View.VISIBLE);
|
||||||
|
mControlsBottom.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
if (mStartTime == 0) {
|
if (mStartTime == 0) {
|
||||||
try {
|
try {
|
||||||
@ -300,7 +303,7 @@ public class NowPlayingActivity extends Activity implements CoverViewWatcher, Se
|
|||||||
|
|
||||||
private void updateProgress()
|
private void updateProgress()
|
||||||
{
|
{
|
||||||
if (mState != MusicPlayer.STATE_PLAYING || mControls.getVisibility() != View.VISIBLE)
|
if (mState != MusicPlayer.STATE_PLAYING || mControlsTop.getVisibility() != View.VISIBLE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
long position = System.currentTimeMillis() - mStartTime;
|
long position = System.currentTimeMillis() - mStartTime;
|
||||||
@ -339,7 +342,8 @@ public class NowPlayingActivity extends Activity implements CoverViewWatcher, Se
|
|||||||
public void handleMessage(Message message) {
|
public void handleMessage(Message message) {
|
||||||
switch (message.what) {
|
switch (message.what) {
|
||||||
case HIDE:
|
case HIDE:
|
||||||
mControls.setVisibility(View.GONE);
|
mControlsTop.setVisibility(View.GONE);
|
||||||
|
mControlsBottom.setVisibility(View.GONE);
|
||||||
break;
|
break;
|
||||||
case UPDATE_PROGRESS:
|
case UPDATE_PROGRESS:
|
||||||
updateProgress();
|
updateProgress();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user