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


Java AudioManager.ADJUST_LOWER属性代码示例

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


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

示例1: changeVolume

@Override
public void changeVolume(VolumeIncrement increment) {
    AudioManager am = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
    int direction = -1;
    switch(increment) {
        case UP:
            direction = AudioManager.ADJUST_RAISE;
            break;
        case DOWN:
            direction = AudioManager.ADJUST_LOWER;
            break;
        default:
            throw new RuntimeException("Unknown VolumeIncrement: " + increment);
    }
    int flags = 0; // ignore
    final int multiplier = 5;
    for (int i=0; i<multiplier; i++) {
        am.adjustVolume(direction, flags);
    }
}
 
开发者ID:Captwalloper,项目名称:NUI_Project,代码行数:20,代码来源:PrototypeAudioPlayer.java

示例2: onResume

@Override
protected void onResume() {
	super.onResume();
	Intent sipServiceIntent = new Intent(SipManager.INTENT_SIP_SERVICE);
       // Optional, but here we bundle so just ensure we are using csipsimple package
	sipServiceIntent.setPackage(getPackageName());
	bindService(sipServiceIntent , sipConnection, BIND_AUTO_CREATE);
	
	
	int direction = getIntent().getIntExtra(Intent.EXTRA_KEY_EVENT, 0);
	if(direction == AudioManager.ADJUST_LOWER  || direction == AudioManager.ADJUST_RAISE) {
		isAutoClose = true;
		okBar.setVisibility(View.GONE);
		delayedQuit(AUTO_QUIT_DELAY);
	}else {
	    okBar.setVisibility(View.VISIBLE);
		isAutoClose = false;
	}
	
	registerReceiver(callStateReceiver, new IntentFilter(SipManager.ACTION_SIP_CALL_CHANGED));
       if (monitorThread == null) {
           monitorThread = new MonitorThread();
           monitorThread.start();
       }
	
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:26,代码来源:InCallMediaControl.java

示例3: onKeyDown

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    Log.d(THIS_FILE, "Key down : " + keyCode);
    switch (keyCode) {
        case KeyEvent.KEYCODE_VOLUME_DOWN:
        case KeyEvent.KEYCODE_VOLUME_UP:
            //
            // Volume has been adjusted by the user.
            //
            Log.d(THIS_FILE, "onKeyDown: Volume button pressed");
            int action = AudioManager.ADJUST_RAISE;
            if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
                action = AudioManager.ADJUST_LOWER;
            }

            // Detect if ringing
            SipCallSession currentCallInfo = getActiveCallInfo();
            // If not any active call active
            if (currentCallInfo == null && serviceConnected) {
                break;
            }

            if (service != null) {
                try {
                    service.adjustVolume(currentCallInfo, action, AudioManager.FLAG_SHOW_UI);
                } catch (RemoteException e) {
                    Log.e(THIS_FILE, "Can't adjust volume", e);
                }
            }

            return true;
        case KeyEvent.KEYCODE_CALL:
        case KeyEvent.KEYCODE_ENDCALL:
            return inCallAnswerControls.onKeyDown(keyCode, event);
        case KeyEvent.KEYCODE_SEARCH:
            // Prevent search
            return true;
        default:
            // Nothing to do
    }
    return super.onKeyDown(keyCode, event);
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:42,代码来源:InCallActivity.java


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