Persist the visibility of the controls
This commit is contained in:
parent
33374c2ebd
commit
83cdef201f
@ -73,6 +73,7 @@ public class FullPlaybackActivity extends PlaybackActivity implements SeekBar.On
|
|||||||
|
|
||||||
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);
|
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
int displayMode = Integer.parseInt(settings.getString("display_mode", "0"));
|
int displayMode = Integer.parseInt(settings.getString("display_mode", "0"));
|
||||||
|
boolean hiddenControls = settings.getBoolean("hidden_controls", false);
|
||||||
|
|
||||||
int layout = R.layout.full_playback;
|
int layout = R.layout.full_playback;
|
||||||
int coverStyle = -1;
|
int coverStyle = -1;
|
||||||
@ -105,6 +106,10 @@ public class FullPlaybackActivity extends PlaybackActivity implements SeekBar.On
|
|||||||
|
|
||||||
mControlsTop = findViewById(R.id.controls_top);
|
mControlsTop = findViewById(R.id.controls_top);
|
||||||
mControlsBottom = findViewById(R.id.controls_bottom);
|
mControlsBottom = findViewById(R.id.controls_bottom);
|
||||||
|
if (hiddenControls) {
|
||||||
|
mControlsTop.setVisibility(View.GONE);
|
||||||
|
mControlsBottom.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
View previousButton = findViewById(R.id.previous);
|
View previousButton = findViewById(R.id.previous);
|
||||||
previousButton.setOnClickListener(this);
|
previousButton.setOnClickListener(this);
|
||||||
@ -313,6 +318,9 @@ public class FullPlaybackActivity extends PlaybackActivity implements SeekBar.On
|
|||||||
|
|
||||||
updateProgress();
|
updateProgress();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int hidden = mControlsTop.getVisibility() == View.VISIBLE ? 0 : 1;
|
||||||
|
mHandler.sendMessage(mHandler.obtainMessage(MSG_SAVE_CONTROLS, hidden, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -354,11 +362,22 @@ public class FullPlaybackActivity extends PlaybackActivity implements SeekBar.On
|
|||||||
* Hide any overlay messages. This must be called on the UI Handler.
|
* Hide any overlay messages. This must be called on the UI Handler.
|
||||||
*/
|
*/
|
||||||
private static final int MSG_HIDE_MESSAGE_OVERLAY = 13;
|
private static final int MSG_HIDE_MESSAGE_OVERLAY = 13;
|
||||||
|
/**
|
||||||
|
* Save the hidden_controls preference to storage.
|
||||||
|
*/
|
||||||
|
private static final int MSG_SAVE_CONTROLS = 14;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handleMessage(Message message)
|
public boolean handleMessage(Message message)
|
||||||
{
|
{
|
||||||
switch (message.what) {
|
switch (message.what) {
|
||||||
|
case MSG_SAVE_CONTROLS: {
|
||||||
|
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
|
SharedPreferences.Editor editor = settings.edit();
|
||||||
|
editor.putBoolean("hidden_controls", message.arg1 == 1);
|
||||||
|
editor.commit();
|
||||||
|
break;
|
||||||
|
}
|
||||||
case MSG_UPDATE_PROGRESS:
|
case MSG_UPDATE_PROGRESS:
|
||||||
updateProgress();
|
updateProgress();
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user