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