Don't automatically hide the controls in the main view
Let's just try it out. It's more like the iPod/iPhone..?
This commit is contained in:
parent
f1142c894f
commit
05e4abed9c
@ -6,7 +6,6 @@
|
|||||||
android:layout_width="fill_parent" />
|
android:layout_width="fill_parent" />
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/controls_top"
|
android:id="@+id/controls_top"
|
||||||
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="top"
|
android:layout_gravity="top"
|
||||||
@ -32,7 +31,6 @@
|
|||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/controls_bottom"
|
android:id="@+id/controls_bottom"
|
||||||
android:visibility="gone"
|
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_gravity="bottom|center_horizontal"
|
android:layout_gravity="bottom|center_horizontal"
|
||||||
@ -40,4 +38,4 @@
|
|||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
<include layout="@layout/playback_buttons" />
|
<include layout="@layout/playback_buttons" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</merge>
|
</merge>
|
||||||
|
@ -42,7 +42,7 @@ import android.widget.SeekBar;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
public class FullPlaybackActivity extends PlaybackActivity implements View.OnClickListener, SeekBar.OnSeekBarChangeListener, View.OnFocusChangeListener, Handler.Callback, CoverView.Callback {
|
public class FullPlaybackActivity extends PlaybackActivity implements View.OnClickListener, SeekBar.OnSeekBarChangeListener, Handler.Callback, CoverView.Callback {
|
||||||
private IPlaybackService mService;
|
private IPlaybackService mService;
|
||||||
private Handler mHandler = new Handler(this);
|
private Handler mHandler = new Handler(this);
|
||||||
|
|
||||||
@ -89,19 +89,15 @@ public class FullPlaybackActivity extends PlaybackActivity implements View.OnCli
|
|||||||
|
|
||||||
View previousButton = findViewById(R.id.previous);
|
View previousButton = findViewById(R.id.previous);
|
||||||
previousButton.setOnClickListener(this);
|
previousButton.setOnClickListener(this);
|
||||||
previousButton.setOnFocusChangeListener(this);
|
|
||||||
mPlayPauseButton = (ImageView)findViewById(R.id.play_pause);
|
mPlayPauseButton = (ImageView)findViewById(R.id.play_pause);
|
||||||
mPlayPauseButton.setOnClickListener(this);
|
mPlayPauseButton.setOnClickListener(this);
|
||||||
mPlayPauseButton.setOnFocusChangeListener(this);
|
|
||||||
View nextButton = findViewById(R.id.next);
|
View nextButton = findViewById(R.id.next);
|
||||||
nextButton.setOnClickListener(this);
|
nextButton.setOnClickListener(this);
|
||||||
nextButton.setOnFocusChangeListener(this);
|
|
||||||
|
|
||||||
mSeekText = (TextView)findViewById(R.id.seek_text);
|
mSeekText = (TextView)findViewById(R.id.seek_text);
|
||||||
mSeekBar = (SeekBar)findViewById(R.id.seek_bar);
|
mSeekBar = (SeekBar)findViewById(R.id.seek_bar);
|
||||||
mSeekBar.setMax(1000);
|
mSeekBar.setMax(1000);
|
||||||
mSeekBar.setOnSeekBarChangeListener(this);
|
mSeekBar.setOnSeekBarChangeListener(this);
|
||||||
mSeekBar.setOnFocusChangeListener(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -138,14 +134,10 @@ public class FullPlaybackActivity extends PlaybackActivity implements View.OnCli
|
|||||||
mMessageOverlay.addView(text);
|
mMessageOverlay.addView(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((mState & PlaybackService.FLAG_PLAYING) != 0) {
|
if ((mState & PlaybackService.FLAG_PLAYING) != 0)
|
||||||
if (!mHandler.hasMessages(HIDE))
|
|
||||||
mControlsBottom.setVisibility(View.GONE);
|
|
||||||
mPlayPauseButton.setImageResource(R.drawable.pause);
|
mPlayPauseButton.setImageResource(R.drawable.pause);
|
||||||
} else {
|
else
|
||||||
mControlsBottom.setVisibility(View.VISIBLE);
|
|
||||||
mPlayPauseButton.setImageResource(R.drawable.play);
|
mPlayPauseButton.setImageResource(R.drawable.play);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -310,21 +302,12 @@ public class FullPlaybackActivity extends PlaybackActivity implements View.OnCli
|
|||||||
mHandler.sendEmptyMessageDelayed(UPDATE_PROGRESS, next);
|
mHandler.sendEmptyMessageDelayed(UPDATE_PROGRESS, next);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendHideMessage()
|
|
||||||
{
|
|
||||||
mHandler.removeMessages(HIDE);
|
|
||||||
mHandler.sendEmptyMessageDelayed(HIDE, 3000);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onClick(View view)
|
public void onClick(View view)
|
||||||
{
|
{
|
||||||
sendHideMessage();
|
|
||||||
|
|
||||||
if (view == mCoverView) {
|
if (view == mCoverView) {
|
||||||
if (mControlsTop.getVisibility() == View.VISIBLE) {
|
if (mControlsTop.getVisibility() == View.VISIBLE) {
|
||||||
mControlsTop.setVisibility(View.GONE);
|
mControlsTop.setVisibility(View.GONE);
|
||||||
if ((mState & PlaybackService.FLAG_PLAYING) != 0)
|
mControlsBottom.setVisibility(View.GONE);
|
||||||
mControlsBottom.setVisibility(View.GONE);
|
|
||||||
} else {
|
} else {
|
||||||
mControlsTop.setVisibility(View.VISIBLE);
|
mControlsTop.setVisibility(View.VISIBLE);
|
||||||
mControlsBottom.setVisibility(View.VISIBLE);
|
mControlsBottom.setVisibility(View.VISIBLE);
|
||||||
@ -338,7 +321,6 @@ public class FullPlaybackActivity extends PlaybackActivity implements View.OnCli
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final int HIDE = 0;
|
|
||||||
private static final int UPDATE_PROGRESS = 1;
|
private static final int UPDATE_PROGRESS = 1;
|
||||||
private static final int SAVE_DISPLAY_MODE = 2;
|
private static final int SAVE_DISPLAY_MODE = 2;
|
||||||
private static final int TOGGLE_FLAG = 3;
|
private static final int TOGGLE_FLAG = 3;
|
||||||
@ -346,11 +328,6 @@ public class FullPlaybackActivity extends PlaybackActivity implements View.OnCli
|
|||||||
public boolean handleMessage(Message message)
|
public boolean handleMessage(Message message)
|
||||||
{
|
{
|
||||||
switch (message.what) {
|
switch (message.what) {
|
||||||
case HIDE:
|
|
||||||
mControlsTop.setVisibility(View.GONE);
|
|
||||||
if ((mState & PlaybackService.FLAG_PLAYING) != 0)
|
|
||||||
mControlsBottom.setVisibility(View.GONE);
|
|
||||||
break;
|
|
||||||
case UPDATE_PROGRESS:
|
case UPDATE_PROGRESS:
|
||||||
updateProgress();
|
updateProgress();
|
||||||
break;
|
break;
|
||||||
@ -398,22 +375,14 @@ public class FullPlaybackActivity extends PlaybackActivity implements View.OnCli
|
|||||||
|
|
||||||
public void onStartTrackingTouch(SeekBar seekBar)
|
public void onStartTrackingTouch(SeekBar seekBar)
|
||||||
{
|
{
|
||||||
mHandler.removeMessages(HIDE);
|
|
||||||
mSeekBarTracking = true;
|
mSeekBarTracking = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onStopTrackingTouch(SeekBar seekBar)
|
public void onStopTrackingTouch(SeekBar seekBar)
|
||||||
{
|
{
|
||||||
sendHideMessage();
|
|
||||||
mSeekBarTracking = false;
|
mSeekBarTracking = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onFocusChange(View v, boolean hasFocus)
|
|
||||||
{
|
|
||||||
if (hasFocus)
|
|
||||||
sendHideMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void songChanged(Song song)
|
public void songChanged(Song song)
|
||||||
{
|
{
|
||||||
if (mSongSelector != null)
|
if (mSongSelector != null)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user