use of android.media.AudioManager in project carat by amplab.
the class SettingsSuggestionAdapter method acceptDisableVibration.
private void acceptDisableVibration(ArrayList<SimpleHogBug> result) {
AudioManager myAudioManager = (AudioManager) a.getApplicationContext().getSystemService(Context.AUDIO_SERVICE);
if (myAudioManager.getVibrateSetting(1) == 1 || myAudioManager.getVibrateSetting(0) == 1) {
SimpleHogBug item = new SimpleHogBug(a.getString(R.string.disablevibration), Constants.Type.OS);
// TODO Get expected benefit
result.add(item);
}
}
use of android.media.AudioManager in project Signal-Android by WhisperSystems.
the class WebRtcCallControls method updateAudioState.
public void updateAudioState(boolean isBluetoothAvailable) {
AudioManager audioManager = ServiceUtil.getAudioManager(getContext());
if (!isBluetoothAvailable) {
bluetoothButton.setVisibility(View.GONE);
} else {
bluetoothButton.setVisibility(View.VISIBLE);
}
if (audioManager.isBluetoothScoOn()) {
bluetoothButton.setChecked(true);
speakerButton.setChecked(false);
} else if (audioManager.isSpeakerphoneOn()) {
speakerButton.setChecked(true);
bluetoothButton.setChecked(false);
} else {
speakerButton.setChecked(false);
bluetoothButton.setChecked(false);
}
}
use of android.media.AudioManager in project Signal-Android by WhisperSystems.
the class SignalAudioManager method stop.
public void stop(boolean playDisconnected) {
AudioManager audioManager = ServiceUtil.getAudioManager(context);
incomingRinger.stop();
outgoingRinger.stop();
if (playDisconnected) {
soundPool.play(disconnectedSoundId, 1.0f, 1.0f, 0, 0, 1.0f);
}
if (audioManager.isBluetoothScoOn()) {
audioManager.setBluetoothScoOn(false);
audioManager.stopBluetoothSco();
}
audioManager.setSpeakerphoneOn(false);
audioManager.setMicrophoneMute(false);
audioManager.setMode(AudioManager.MODE_NORMAL);
audioManager.abandonAudioFocus(null);
}
use of android.media.AudioManager in project Signal-Android by WhisperSystems.
the class SignalAudioManager method startCommunication.
public void startCommunication(boolean preserveSpeakerphone) {
AudioManager audioManager = ServiceUtil.getAudioManager(context);
incomingRinger.stop();
outgoingRinger.stop();
if (!preserveSpeakerphone) {
audioManager.setSpeakerphoneOn(false);
}
soundPool.play(connectedSoundId, 1.0f, 1.0f, 0, 0, 1.0f);
}
use of android.media.AudioManager in project remusic by aa112901.
the class PlayingActivity method initLrcView.
private void initLrcView() {
mLrcView.setOnSeekToListener(onSeekToListener);
mLrcView.setOnLrcClickListener(onLrcClickListener);
mViewPager.setOnSingleTouchListener(new AlbumViewPager.OnSingleTouchListener() {
@Override
public void onSingleTouch(View v) {
if (mAlbumLayout.getVisibility() == View.VISIBLE) {
mAlbumLayout.setVisibility(View.INVISIBLE);
mLrcViewContainer.setVisibility(View.VISIBLE);
mMusicTool.setVisibility(View.INVISIBLE);
}
}
});
mLrcViewContainer.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (mLrcViewContainer.getVisibility() == View.VISIBLE) {
mLrcViewContainer.setVisibility(View.INVISIBLE);
mAlbumLayout.setVisibility(View.VISIBLE);
mMusicTool.setVisibility(View.VISIBLE);
}
}
});
mTryGetLrc.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent();
intent.setAction(MediaService.TRY_GET_TRACKINFO);
sendBroadcast(intent);
Toast.makeText(getApplicationContext(), "正在获取信息", Toast.LENGTH_SHORT).show();
}
});
final AudioManager audioManager = (AudioManager) getSystemService(AUDIO_SERVICE);
int v = audioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
int mMaxVol = audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
mVolumeSeek.setMax(mMaxVol);
mVolumeSeek.setProgress(v);
mVolumeSeek.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, progress, AudioManager.ADJUST_SAME);
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
}
Aggregations