public class VolumePanel extends Handler implements SeekBar.OnSeekBarChangeListener, View.OnClickListener
Handler.Callback
Modifier and Type | Field and Description |
---|---|
protected AudioService |
mAudioService |
protected Context |
mContext |
static int |
PLAY_SOUND_DELAY
The delay before playing a sound.
|
static int |
VIBRATE_DELAY
The delay before vibrating.
|
Constructor and Description |
---|
VolumePanel(Context context,
AudioService volumeService) |
Modifier and Type | Method and Description |
---|---|
void |
handleMessage(Message msg)
Subclasses must implement this to receive messages.
|
void |
onClick(View v)
Called when a view has been clicked.
|
protected void |
onDisplaySafeVolumeWarning() |
protected void |
onFreeResources() |
protected void |
onMuteChanged(int streamType,
int flags) |
protected void |
onPlaySound(int streamType,
int flags) |
void |
onProgressChanged(SeekBar seekBar,
int progress,
boolean fromUser)
Notification that the progress level has changed.
|
protected void |
onRemoteVolumeChanged(int streamType,
int flags) |
protected void |
onRemoteVolumeUpdateIfShown() |
protected void |
onShowVolumeChanged(int streamType,
int flags) |
protected void |
onSliderVisibilityChanged(int streamType,
int visible)
Handler for MSG_SLIDER_VISIBILITY_CHANGED
Hide or show a slider
|
void |
onStartTrackingTouch(SeekBar seekBar)
Notification that the user has started a touch gesture.
|
protected void |
onStopSounds() |
void |
onStopTrackingTouch(SeekBar seekBar)
Notification that the user has finished a touch gesture.
|
protected void |
onVibrate() |
protected void |
onVolumeChanged(int streamType,
int flags)
Override this if you have other work to do when the volume changes (for
example, vibrating, playing a sound, etc.).
|
void |
postDisplaySafeVolumeWarning() |
void |
postHasNewRemotePlaybackInfo()
Called by AudioService when it has received new remote playback information that
would affect the VolumePanel display (mainly volumes).
|
void |
postMasterMuteChanged(int flags) |
void |
postMasterVolumeChanged(int flags) |
void |
postMuteChanged(int streamType,
int flags) |
void |
postRemoteSliderVisibility(boolean visible) |
void |
postRemoteVolumeChanged(int streamType,
int flags) |
void |
postVolumeChanged(int streamType,
int flags) |
dispatchMessage, dump, getLooper, getMessageName, hasCallbacks, hasMessages, hasMessages, obtainMessage, obtainMessage, obtainMessage, obtainMessage, obtainMessage, post, postAtFrontOfQueue, postAtTime, postAtTime, postDelayed, removeCallbacks, removeCallbacks, removeCallbacksAndMessages, removeMessages, removeMessages, runWithScissors, sendEmptyMessage, sendEmptyMessageAtTime, sendEmptyMessageDelayed, sendMessage, sendMessageAtFrontOfQueue, sendMessageAtTime, sendMessageDelayed, toString
public static final int PLAY_SOUND_DELAY
PhoneWindow will implement this part.
public static final int VIBRATE_DELAY
protected Context mContext
protected AudioService mAudioService
public VolumePanel(Context context, AudioService volumeService)
public void postVolumeChanged(int streamType, int flags)
public void postRemoteVolumeChanged(int streamType, int flags)
public void postRemoteSliderVisibility(boolean visible)
public void postHasNewRemotePlaybackInfo()
postRemoteVolumeChanged(int, int)
is that the handling of the posted message
(MSG_REMOTE_VOLUME_UPDATE_IF_SHOWN) will only update the volume slider if it is being
displayed.
This special code path is due to the fact that remote volume updates arrive to AudioService
asynchronously. So after AudioService has sent the volume update (which should be treated
as a request to update the volume), the application will likely set a new volume. If the UI
is still up, we need to refresh the display to show this new value.public void postMasterVolumeChanged(int flags)
public void postMuteChanged(int streamType, int flags)
public void postMasterMuteChanged(int flags)
public void postDisplaySafeVolumeWarning()
protected void onVolumeChanged(int streamType, int flags)
protected void onMuteChanged(int streamType, int flags)
protected void onShowVolumeChanged(int streamType, int flags)
protected void onPlaySound(int streamType, int flags)
protected void onStopSounds()
protected void onVibrate()
protected void onRemoteVolumeChanged(int streamType, int flags)
protected void onRemoteVolumeUpdateIfShown()
protected void onSliderVisibilityChanged(int streamType, int visible)
streamType
- can be a valid stream type value, or VolumePanel.STREAM_MASTER,
or AudioService.STREAM_REMOTE_MUSICvisible
- protected void onDisplaySafeVolumeWarning()
protected void onFreeResources()
public void handleMessage(Message msg)
Handler
handleMessage
in class Handler
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser)
SeekBar.OnSeekBarChangeListener
onProgressChanged
in interface SeekBar.OnSeekBarChangeListener
seekBar
- The SeekBar whose progress has changedprogress
- The current progress level. This will be in the range 0..max where max
was set by ProgressBar.setMax(int)
. (The default value for max is 100.)fromUser
- True if the progress change was initiated by the user.public void onStartTrackingTouch(SeekBar seekBar)
SeekBar.OnSeekBarChangeListener
onStartTrackingTouch
in interface SeekBar.OnSeekBarChangeListener
seekBar
- The SeekBar in which the touch gesture beganpublic void onStopTrackingTouch(SeekBar seekBar)
SeekBar.OnSeekBarChangeListener
onStopTrackingTouch
in interface SeekBar.OnSeekBarChangeListener
seekBar
- The SeekBar in which the touch gesture beganpublic void onClick(View v)
View.OnClickListener
onClick
in interface View.OnClickListener
v
- The view that was clicked.