本文整理汇总了Java中org.appspot.apprtc.util.AppRTCUtils.assertIsTrue方法的典型用法代码示例。如果您正苦于以下问题:Java AppRTCUtils.assertIsTrue方法的具体用法?Java AppRTCUtils.assertIsTrue怎么用?Java AppRTCUtils.assertIsTrue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.appspot.apprtc.util.AppRTCUtils
的用法示例。
在下文中一共展示了AppRTCUtils.assertIsTrue方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onAccuracyChanged
import org.appspot.apprtc.util.AppRTCUtils; //导入方法依赖的package包/类
@Override
public final void onAccuracyChanged(Sensor sensor, int accuracy) {
threadChecker.checkIsOnValidThread();
AppRTCUtils.assertIsTrue(sensor.getType() == Sensor.TYPE_PROXIMITY);
if (accuracy == SensorManager.SENSOR_STATUS_UNRELIABLE) {
Log.e(TAG, "The values returned by this sensor cannot be trusted");
}
}
示例2: onSensorChanged
import org.appspot.apprtc.util.AppRTCUtils; //导入方法依赖的package包/类
@Override
public final void onSensorChanged(SensorEvent event) {
threadChecker.checkIsOnValidThread();
AppRTCUtils.assertIsTrue(event.sensor.getType() == Sensor.TYPE_PROXIMITY);
// As a best practice; do as little as possible within this method and
// avoid blocking.
float distanceInCentimeters = event.values[0];
if (distanceInCentimeters < proximitySensor.getMaximumRange()) {
Log.d(TAG, "Proximity sensor => NEAR state");
lastStateReportIsNear = true;
} else {
Log.d(TAG, "Proximity sensor => FAR state");
lastStateReportIsNear = false;
}
// Report about new state to listening client. Client can then call
// sensorReportsNearState() to query the current state (NEAR or FAR).
if (onSensorStateListener != null) {
onSensorStateListener.run();
}
Log.d(TAG, "onSensorChanged" + AppRTCUtils.getThreadInfo() + ": "
+ "accuracy=" + event.accuracy + ", timestamp=" + event.timestamp + ", distance="
+ event.values[0]);
}
示例3: setAudioDeviceInternal
import org.appspot.apprtc.util.AppRTCUtils; //导入方法依赖的package包/类
/** Changes selection of the currently active audio device. */
private void setAudioDeviceInternal(AudioDevice device) {
Log.d(TAG, "setAudioDeviceInternal(device=" + device + ")");
AppRTCUtils.assertIsTrue(audioDevices.contains(device));
switch (device) {
case SPEAKER_PHONE:
setSpeakerphoneOn(true);
break;
case EARPIECE:
setSpeakerphoneOn(false);
break;
case WIRED_HEADSET:
setSpeakerphoneOn(false);
break;
case BLUETOOTH:
setSpeakerphoneOn(false);
break;
default:
Log.e(TAG, "Invalid audio device selection");
break;
}
selectedAudioDevice = device;
}
示例4: onSensorChanged
import org.appspot.apprtc.util.AppRTCUtils; //导入方法依赖的package包/类
@Override
public final void onSensorChanged(SensorEvent event) {
threadChecker.checkIsOnValidThread();
AppRTCUtils.assertIsTrue(event.sensor.getType() == Sensor.TYPE_PROXIMITY);
// As a best practice; do as little as possible within this method and
// avoid blocking.
float distanceInCentimeters = event.values[0];
if (distanceInCentimeters < proximitySensor.getMaximumRange()) {
Log.d(TAG, "Proximity sensor => NEAR state");
lastStateReportIsNear = true;
} else {
Log.d(TAG, "Proximity sensor => FAR state");
lastStateReportIsNear = false;
}
// Report about new state to listening client. Client can then call
// sensorReportsNearState() to query the current state (NEAR or FAR).
if (onSensorStateListener != null) {
onSensorStateListener.run();
}
Log.d(TAG, "onSensorChanged" + AppRTCUtils.getThreadInfo() + ": "
+ "accuracy=" + event.accuracy + ", timestamp=" + event.timestamp + ", distance="
+ event.values[0]);
}
示例5: setAudioDeviceInternal
import org.appspot.apprtc.util.AppRTCUtils; //导入方法依赖的package包/类
/**
* Changes selection of the currently active audio device.
*/
private void setAudioDeviceInternal(AudioDevice device) {
Log.d(TAG, "setAudioDeviceInternal(device=" + device + ")");
AppRTCUtils.assertIsTrue(audioDevices.contains(device));
switch (device) {
case SPEAKER_PHONE:
setSpeakerphoneOn(true);
break;
case EARPIECE:
setSpeakerphoneOn(false);
break;
case WIRED_HEADSET:
setSpeakerphoneOn(false);
break;
case BLUETOOTH:
setSpeakerphoneOn(false);
break;
default:
Log.e(TAG, "Invalid audio device selection");
break;
}
selectedAudioDevice = device;
}
示例6: setAudioDevice
import org.appspot.apprtc.util.AppRTCUtils; //导入方法依赖的package包/类
/**
* Changes selection of the currently active audio device.
*/
public void setAudioDevice(AudioDevice device)
{
RCLogger.d(TAG, "setAudioDevice(device=" + device + ")");
AppRTCUtils.assertIsTrue(audioDevices.contains(device));
switch (device) {
case SPEAKER_PHONE:
setSpeakerphoneOn(true);
selectedAudioDevice = AudioDevice.SPEAKER_PHONE;
break;
case EARPIECE:
setSpeakerphoneOn(false);
selectedAudioDevice = AudioDevice.EARPIECE;
break;
case WIRED_HEADSET:
setSpeakerphoneOn(false);
selectedAudioDevice = AudioDevice.WIRED_HEADSET;
break;
default:
RCLogger.e(TAG, "Invalid audio device selection");
break;
}
onAudioManagerChangedState();
}
示例7: onAccuracyChanged
import org.appspot.apprtc.util.AppRTCUtils; //导入方法依赖的package包/类
@Override
public final void onAccuracyChanged(Sensor sensor, int accuracy) {
threadChecker.checkIsOnValidThread();
AppRTCUtils.assertIsTrue(sensor.getType() == Sensor.TYPE_PROXIMITY);
if (accuracy == SensorManager.SENSOR_STATUS_UNRELIABLE) {
Log.e(TAG, "The values returned by this sensor cannot be trusted");
}
}
示例8: onAudioManagerChangedState
import org.appspot.apprtc.util.AppRTCUtils; //导入方法依赖的package包/类
/**
* Called each time a new audio device has been added or removed.
*/
private void onAudioManagerChangedState()
{
RCLogger.d(TAG, "onAudioManagerChangedState: devices=" + audioDevices
+ ", selected=" + selectedAudioDevice);
// Enable the proximity sensor if there are two available audio devices
// in the list. Given the current implementation, we know that the choice
// will then be between EARPIECE and SPEAKER_PHONE.
if (audioDevices.size() == 2) {
AppRTCUtils.assertIsTrue(audioDevices.contains(AudioDevice.EARPIECE)
&& audioDevices.contains(AudioDevice.SPEAKER_PHONE));
// Start the proximity sensor.
proximitySensor.start();
}
else if (audioDevices.size() == 1) {
// Stop the proximity sensor since it is no longer needed.
proximitySensor.stop();
}
else {
RCLogger.e(TAG, "Invalid device list");
}
if (onStateChangeListener != null) {
// Run callback to notify a listening client. The client can then
// use public getters to query the new state.
onStateChangeListener.run();
}
}