当前位置: 首页>>代码示例>>Java>>正文


Java AudioManager.STREAM_RING属性代码示例

本文整理汇总了Java中android.media.AudioManager.STREAM_RING属性的典型用法代码示例。如果您正苦于以下问题:Java AudioManager.STREAM_RING属性的具体用法?Java AudioManager.STREAM_RING怎么用?Java AudioManager.STREAM_RING使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.media.AudioManager的用法示例。


在下文中一共展示了AudioManager.STREAM_RING属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getVolType

private int getVolType(String type) {
    switch (type) {
        case VOL_VOICE_CALL:
            return AudioManager.STREAM_VOICE_CALL;
        case VOL_SYSTEM:
            return AudioManager.STREAM_SYSTEM;
        case VOL_RING:
            return AudioManager.STREAM_RING;
        case VOL_ALARM:
            return AudioManager.STREAM_ALARM;
        case VOL_NOTIFICATION:
            return AudioManager.STREAM_NOTIFICATION;
        default:
            return AudioManager.STREAM_MUSIC;
    }
}
 
开发者ID:c19354837,项目名称:react-native-system-setting,代码行数:16,代码来源:SystemSetting.java

示例2: SoundEngine

public SoundEngine(Context context) {
		this.context = context;

		sounds = new SoundPool(5, AudioManager.STREAM_RING, 0);

		soundsMap = new HashMap<Integer, Integer>();
		soundsMap.put(EATFOOD, sounds.load(context, R.raw.pacmon_waka_waka, 1));
		soundsMap.put(EATGHOST, sounds.load(context, R.raw.pacmon_eating_ghost, 1));
		soundsMap.put(DIE, sounds.load(context, R.raw.pacmon_dies, 1));
		soundsMap.put(READY, sounds.load(context, R.raw.pacmon_opening_song,1));
		soundsMap.put(GAMEOVER, sounds.load(context, R.raw.pacmon_opening_song, 1));
		//soundsMap.put(EATCHERRY, sounds.load(context, R.raw.pacmon_eating_cherry, 1));
		
		AudioManager mgr = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
		
	    // the music that is played at the beginning
//	    music = MediaPlayer.create(context, R.raw.gameplaymusic);
//	    music.setLooping(true);
	}
 
开发者ID:StringMon,项目名称:homescreenarcade,代码行数:19,代码来源:SoundEngine.java

示例3: adjustStreamVolume

public void adjustStreamVolume(int streamType, int direction, int flags) {
	broadcastVolumeWillBeUpdated(streamType, EXTRA_VALUE_UNKNOWN);
       audioManager.adjustStreamVolume(streamType, direction, flags);
       if(streamType == AudioManager.STREAM_RING) {
       	// Update ringer 
       	ringer.updateRingerMode();
       }
       
       int inCallStream = Compatibility.getInCallStream(userWantBluetooth);
       if(streamType == inCallStream) {
       	int maxLevel = audioManager.getStreamMaxVolume(inCallStream);
       	float modifiedLevel = (audioManager.getStreamVolume(inCallStream)/(float) maxLevel)*10.0f;
       	// Update default stream level
           service.getPrefs().setPreferenceFloatValue(SipConfigManager.SND_STREAM_LEVEL, modifiedLevel);
       	
       }
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:17,代码来源:MediaManager.java

示例4: onReceive

@Override
public void onReceive(Context context, Intent intent) {
   if (intent.getAction().equals(IncreasingRingPreference.ACTION_INCREASING_RING_CHANGED) &&
           intent.getIntExtra(IncreasingRingPreference.EXTRA_STREAM_TYPE, -1) ==
               AudioManager.STREAM_RING) {
       mRingerConfig.enabled = intent.getBooleanExtra(
               IncreasingRingPreference.EXTRA_ENABLED, false);
       mRingerConfig.minVolume = intent.getFloatExtra(
               IncreasingRingPreference.EXTRA_MIN_VOLUME, 0.1f);
       mRingerConfig.rampUpDuration = intent.getIntExtra(
               IncreasingRingPreference.EXTRA_RAMP_UP_DURATION, 10);
       if (DEBUG) log(mRingerConfig.toString());
   }
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:14,代码来源:ModRinger.java

示例5: initSeekBar

private void initSeekBar(SeekBar seekBar, Uri defaultUri) {
    seekBar.setMax(mAudioManager.getStreamMaxVolume(mStreamType));
    mOriginalStreamVolume = mAudioManager.getStreamVolume(mStreamType);
    seekBar.setProgress(mOriginalStreamVolume);
    seekBar.setOnSeekBarChangeListener(this);
    // TODO: removed in MM, find different approach
    mContext.getContentResolver().registerContentObserver(
            System.getUriFor("volume_ring"),
            false, mVolumeObserver);
    if (defaultUri == null) {
        if (mStreamType == AudioManager.STREAM_RING) {
            defaultUri = Settings.System.DEFAULT_RINGTONE_URI;
        } else if (mStreamType == AudioManager.STREAM_NOTIFICATION) {
            defaultUri = Settings.System.DEFAULT_NOTIFICATION_URI;
        } else {
            defaultUri = Settings.System.DEFAULT_ALARM_ALERT_URI;
        }
    }
    mRingtone = RingtoneManager.getRingtone(mContext, defaultUri);
    if (mRingtone != null) {
        mRingtone.setStreamType(mStreamType);
    }
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:23,代码来源:VolumePreference.java

示例6: initSounds

public static void initSounds(Context theContext) {
    Log.v(LOG_TAG, "initSounds");
    mContext = theContext;
    mSoundPool = new SoundPool(32, AudioManager.STREAM_RING, 0);
    mSoundPoolMap = new HashMap<Integer, Integer>();
    mAudioManager = (AudioManager)mContext.getSystemService(Context.AUDIO_SERVICE);
}
 
开发者ID:StringMon,项目名称:homescreenarcade,代码行数:7,代码来源:VPSoundpool.java

示例7: isRingerSliderEnabled

private static boolean isRingerSliderEnabled() {
    try {
        List<?> rows = (List<?>) XposedHelpers.getObjectField(mVolumePanel, "mRows");
        for (Object row : rows) {
            if (XposedHelpers.getIntField(row, "stream") == AudioManager.STREAM_RING) {
                return ((View) XposedHelpers.getObjectField(row, "slider")).isEnabled();
            }
        }
        return true;
    } catch (Throwable t) {
        XposedBridge.log(t);
        return true;
    }
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:14,代码来源:ModVolumePanel.java

示例8: onCreate

@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	if(savedInstanceState != null){
       	finish();
       	return;
       }
	setContentView(R.layout.em_activity_voice_call);
	
	DemoHelper.getInstance().isVoiceCalling = true;
	callType = 0;

       comingBtnContainer = (LinearLayout) findViewById(R.id.ll_coming_call);
	refuseBtn = (Button) findViewById(R.id.btn_refuse_call);
	answerBtn = (Button) findViewById(R.id.btn_answer_call);
	hangupBtn = (Button) findViewById(R.id.btn_hangup_call);
	muteImage = (ImageView) findViewById(R.id.iv_mute);
	handsFreeImage = (ImageView) findViewById(R.id.iv_handsfree);
	callStateTextView = (TextView) findViewById(R.id.tv_call_state);
       TextView nickTextView = (TextView) findViewById(R.id.tv_nick);
       TextView durationTextView = (TextView) findViewById(R.id.tv_calling_duration);
	chronometer = (Chronometer) findViewById(R.id.chronometer);
	voiceContronlLayout = (LinearLayout) findViewById(R.id.ll_voice_control);
	netwrokStatusVeiw = (TextView) findViewById(R.id.tv_network_status);

	refuseBtn.setOnClickListener(this);
	answerBtn.setOnClickListener(this);
	hangupBtn.setOnClickListener(this);
	muteImage.setOnClickListener(this);
	handsFreeImage.setOnClickListener(this);

	getWindow().addFlags(
			WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD
					| WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);

	addCallStateListener();
	msgid = UUID.randomUUID().toString();

	username = getIntent().getStringExtra("username");
	isInComingCall = getIntent().getBooleanExtra("isComingCall", false);
	nickTextView.setText(username);
	if (!isInComingCall) {// outgoing call
		soundPool = new SoundPool(1, AudioManager.STREAM_RING, 0);
		outgoing = soundPool.load(this, R.raw.em_outgoing, 1);

		comingBtnContainer.setVisibility(View.INVISIBLE);
		hangupBtn.setVisibility(View.VISIBLE);
		st1 = getResources().getString(R.string.Are_connected_to_each_other);
		callStateTextView.setText(st1);
		handler.sendEmptyMessage(MSG_CALL_MAKE_VOICE);
           handler.postDelayed(new Runnable() {
               public void run() {
                   streamID = playMakeCallSounds();
               }
           }, 300);
       } else { // incoming call
		voiceContronlLayout.setVisibility(View.INVISIBLE);
		Uri ringUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE);
		audioManager.setMode(AudioManager.MODE_RINGTONE);
		audioManager.setSpeakerphoneOn(true);
		ringtone = RingtoneManager.getRingtone(this, ringUri);
		ringtone.play();
	}
       final int MAKE_CALL_TIMEOUT = 50 * 1000;
       handler.removeCallbacks(timeoutHangup);
       handler.postDelayed(timeoutHangup, MAKE_CALL_TIMEOUT);
}
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:67,代码来源:VoiceCallActivity.java


注:本文中的android.media.AudioManager.STREAM_RING属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。