public abstract class AVVolumeHandler extends Object
| 限定符和类型 | 字段 | 说明 |
|---|---|---|
static int |
ADJUST_MODE_ALLOW_ALL |
Indicates that both adjustment based on volume steps and direct volume setting are supported.
|
static int |
ADJUST_MODE_ALLOW_SCROLL |
Indicates that only adjustment based on volume steps is supported.
|
static int |
ADJUST_MODE_FORBID_ALL |
Indicates that volume adjustment is not allowed.
|
| 构造器 | 说明 |
|---|---|
AVVolumeHandler(int adjustMode,
int maxVolume,
int currentVolume) |
A constructor used to create an
AVVolumeHandler instance. |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
int |
getVolume() |
Obtains the current volume.
|
void |
onScrollVolume(int direction) |
Called after volume adjustment request is received.
|
void |
onSetVolume(int volume) |
Called after a volume setting request is received.
|
void |
setVolume(int volume) |
Notifies the system that the current volume has been changed.
|
public static final int ADJUST_MODE_ALLOW_ALL
public static final int ADJUST_MODE_ALLOW_SCROLL
public static final int ADJUST_MODE_FORBID_ALL
public AVVolumeHandler(int adjustMode,
int maxVolume,
int currentVolume)
throws IllegalArgumentException
AVVolumeHandler instance.adjustMode - Indicates the volume adjustment mode. The value can be ADJUST_MODE_FORBID_ALL,
ADJUST_MODE_ALLOW_SCROLL, or ADJUST_MODE_ALLOW_ALL.maxVolume - Indicates the maximum volume allowed.currentVolume - Indicates the current volume, which must be lower than the maximum volume.IllegalArgumentException - Throws this exception if an input parameter is invalid.public final int getVolume()
public final void setVolume(int volume)
onScrollVolume(int) or onSetVolume(int) method.volume - Indicates the changed volume.public void onSetVolume(int volume)
Override this method to process the request and call setVolume(int) to notify the system after the
request is processed.
volume - Indicates the volume to set.public void onScrollVolume(int direction)
Override this method to process the request and call setVolume(int) to notify the system after the
request is processed.
direction - Indicates the volume adjustment direction, which can be AudioManager#VOLUME_OP_DEC,
AudioManager#VOLUME_OP_MAINTAIN, or AudioManager#VOLUME_OP_INC.