本文整理了Java中android.app.Activity.setVolumeControlStream()
方法的一些代码示例,展示了Activity.setVolumeControlStream()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Activity.setVolumeControlStream()
方法的具体详情如下:
包路径:android.app.Activity
类名称:Activity
方法名:setVolumeControlStream
暂无
代码示例来源:origin: journeyapps/zxing-android-embedded
public BeepManager(Activity activity) {
activity.setVolumeControlStream(AudioManager.STREAM_MUSIC);
// We do not keep a reference to the Activity itself, to prevent leaks
this.context = activity.getApplicationContext();
}
代码示例来源:origin: rmtheis/android-ocr
public void updatePrefs() {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
playBeep = shouldBeep(prefs, activity);
if (playBeep && mediaPlayer == null) {
// The volume on STREAM_SYSTEM is not adjustable, and users found it too loud,
// so we now play on the music stream.
activity.setVolumeControlStream(AudioManager.STREAM_MUSIC);
mediaPlayer = buildMediaPlayer(activity);
}
}
代码示例来源:origin: HotBitmapGG/bilibili-android-client
private void initVideoView(Context ctx) {
mContext = ctx;
mVideoWidth = 0;
mVideoHeight = 0;
mVideoSarNum = 0;
mVideoSarDen = 0;
getHolder().addCallback(mSHCallback);
setFocusable(true);
setFocusableInTouchMode(true);
requestFocus();
mCurrentState = STATE_IDLE;
mTargetState = STATE_IDLE;
if (ctx instanceof Activity) {
((Activity) ctx).setVolumeControlStream(AudioManager.STREAM_MUSIC);
}
}
代码示例来源:origin: libgdx/libgdx
public AndroidAudio (Context context, AndroidApplicationConfiguration config) {
if (!config.disableAudio) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
AudioAttributes audioAttrib = new AudioAttributes.Builder()
.setUsage(AudioAttributes.USAGE_GAME)
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
.build();
soundPool = new SoundPool.Builder().setAudioAttributes(audioAttrib).setMaxStreams(config.maxSimultaneousSounds).build();
}else {
soundPool = new SoundPool(config.maxSimultaneousSounds, AudioManager.STREAM_MUSIC, 0);// srcQuality: the sample-rate converter quality. Currently has no effect. Use 0 for the default.
}
manager = (AudioManager)context.getSystemService(Context.AUDIO_SERVICE);
if (context instanceof Activity) {
((Activity)context).setVolumeControlStream(AudioManager.STREAM_MUSIC);
}
} else {
soundPool = null;
manager = null;
}
}
代码示例来源:origin: libgdx/libgdx
public AndroidAudio (Context context, AndroidApplicationConfiguration config) {
if (!config.disableAudio) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
AudioAttributes audioAttrib = new AudioAttributes.Builder()
.setUsage(AudioAttributes.USAGE_GAME)
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
.build();
soundPool = new SoundPool.Builder().setAudioAttributes(audioAttrib).setMaxStreams(config.maxSimultaneousSounds).build();
}else {
soundPool = new SoundPool(config.maxSimultaneousSounds, AudioManager.STREAM_MUSIC, 0);// srcQuality: the sample-rate converter quality. Currently has no effect. Use 0 for the default.
}
manager = (AudioManager)context.getSystemService(Context.AUDIO_SERVICE);
if (context instanceof Activity) {
((Activity)context).setVolumeControlStream(AudioManager.STREAM_MUSIC);
}
} else {
soundPool = null;
manager = null;
}
}
代码示例来源:origin: curtis2/SuperVideoPlayer
@SuppressWarnings("deprecation")
private void initVideoView(Context ctx) {
mContext = ctx;
mVideoWidth = 0;
mVideoHeight = 0;
getHolder().setFormat(PixelFormat.RGBA_8888); // PixelFormat.RGB_565
getHolder().addCallback(mSHCallback);
// this value only use Hardware decoder before Android 2.3
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB && mHardwareDecoder) {
getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
}
setFocusable(true);
setFocusableInTouchMode(true);
requestFocus();
mCurrentState = STATE_IDLE;
mTargetState = STATE_IDLE;
if (ctx instanceof Activity)
((Activity) ctx).setVolumeControlStream(AudioManager.STREAM_MUSIC);
}
代码示例来源:origin: com.uphyca/android-junit4-robolectric
/**
* @param streamType
* @see android.app.Activity#setVolumeControlStream(int)
*/
public final void setVolumeControlStream(int streamType) {
mActivity.setVolumeControlStream(streamType);
}
代码示例来源:origin: mapzen/speakerbox
public void enableVolumeControl(Activity activity) {
if (activity != null) {
activity.setVolumeControlStream(AudioManager.STREAM_MUSIC);
}
}
代码示例来源:origin: mapzen/speakerbox
public void disableVolumeControl(Activity activity) {
if (activity != null) {
activity.setVolumeControlStream(AudioManager.USE_DEFAULT_STREAM_TYPE);
}
}
代码示例来源:origin: stackoverflow.com
public GameView(Context context, Activity activity) {
super(context);
activity.setVolumeControlStream(AudioManager.STREAM_MUSIC);
}
代码示例来源:origin: pilot51/voicenotify
/**
* Sets the volume control stream defined in preferences.
*/
static void setVolumeStream(Activity activity) {
activity.setVolumeControlStream(getSelectedAudioStream(activity));
}
代码示例来源:origin: oVirt/moVirt
synchronized public void updatePrefs() {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
playBeep = shouldBeep(prefs, activity);
vibrate = prefs.getBoolean(PreferencesActivity.KEY_VIBRATE, false);
if (playBeep && mediaPlayer == null) {
// The volume on STREAM_SYSTEM is not adjustable, and users found it too loud,
// so we now play on the music stream.
activity.setVolumeControlStream(AudioManager.STREAM_MUSIC);
mediaPlayer = buildMediaPlayer(activity);
}
}
代码示例来源:origin: huangfangyi/YiChat
private synchronized void updatePrefs() {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
playBeep = shouldBeep(prefs, activity);
vibrate = true;
if (playBeep && mediaPlayer == null) {
// The volume on STREAM_SYSTEM is not adjustable, and users found it
// too loud,
// so we now play on the music stream.
activity.setVolumeControlStream(AudioManager.STREAM_MUSIC);
mediaPlayer = buildMediaPlayer(activity);
}
}
代码示例来源:origin: SuperChenSSS/APPForKEXIE
private synchronized void updatePrefs() {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
playBeep = shouldBeep(prefs, activity);
vibrate = true;
if (playBeep && mediaPlayer == null) {
// The volume on STREAM_SYSTEM is not adjustable, and users found it
// too loud,
// so we now play on the music stream.
activity.setVolumeControlStream(AudioManager.STREAM_MUSIC);
mediaPlayer = buildMediaPlayer(activity);
}
}
代码示例来源:origin: AndroidHensen/YaNi
private synchronized void updatePrefs() {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
playBeep = shouldBeep(prefs, activity);
vibrate = true;
if (playBeep && mediaPlayer == null) {
// The volume on STREAM_SYSTEM is not adjustable, and users found it
// too loud,
// so we now play on the music stream.
activity.setVolumeControlStream(AudioManager.STREAM_MUSIC);
mediaPlayer = buildMediaPlayer(activity);
}
}
代码示例来源:origin: jenly1314/ZXingLite
synchronized void updatePrefs() {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
playBeep = shouldBeep(prefs, activity);
// vibrate = prefs.getBoolean(Preferences.KEY_VIBRATE, false);
if (playBeep && mediaPlayer == null) {
// The volume on STREAM_SYSTEM is not adjustable, and users found it too loud,
// so we now play on the music stream.
activity.setVolumeControlStream(AudioManager.STREAM_MUSIC);
mediaPlayer = buildMediaPlayer(activity);
}
}
代码示例来源:origin: xuyisheng/ZXingLib
private synchronized void updatePrefs() {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
playBeep = shouldBeep(prefs, activity);
vibrate = true;
if (playBeep && mediaPlayer == null) {
// The volume on STREAM_SYSTEM is not adjustable, and users found it
// too loud,
// so we now play on the music stream.
activity.setVolumeControlStream(AudioManager.STREAM_MUSIC);
mediaPlayer = buildMediaPlayer(activity);
}
}
代码示例来源:origin: LiuhangZhang/qrcode_android
private synchronized void updatePrefs() {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
playBeep = shouldBeep(prefs, activity);
vibrate = true;
if (playBeep && mediaPlayer == null) {
// The volume on STREAM_SYSTEM is not adjustable, and users found it
// too loud,
// so we now play on the music stream.
activity.setVolumeControlStream(AudioManager.STREAM_MUSIC);
mediaPlayer = buildMediaPlayer(activity);
}
}
代码示例来源:origin: GuoJinyu/SimpleZXing
public synchronized void updatePrefs() {
playBeep = shouldBeep(activity);
if (playBeep && mediaPlayer == null) {
// The volume on STREAM_SYSTEM is not adjustable, and users found it too loud,
// so we now play on the music stream.
activity.setVolumeControlStream(AudioManager.STREAM_MUSIC);
mediaPlayer = buildMediaPlayer(activity);
}
}
代码示例来源:origin: derry/delion
void hideNotification() {
if (mTab == null) {
return;
}
MediaNotificationManager.hide(mTab.getId(), R.id.media_playback_notification);
Activity activity = getActivityFromTab(mTab);
if (activity != null) {
activity.setVolumeControlStream(mPreviousVolumeControlStream);
}
mNotificationInfoBuilder = null;
}
内容来源于网络,如有侵权,请联系作者删除!