Search in sources :

Example 86 with AudioManager

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);
    }
}
Also used : AudioManager(android.media.AudioManager) SimpleHogBug(edu.berkeley.cs.amplab.carat.android.storage.SimpleHogBug)

Example 87 with AudioManager

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);
    }
}
Also used : AudioManager(android.media.AudioManager)

Example 88 with AudioManager

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);
}
Also used : AudioManager(android.media.AudioManager)

Example 89 with AudioManager

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);
}
Also used : AudioManager(android.media.AudioManager)

Example 90 with AudioManager

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) {
        }
    });
}
Also used : AudioManager(android.media.AudioManager) SeekBar(android.widget.SeekBar) PlayerSeekBar(com.wm.remusic.widget.PlayerSeekBar) AlbumViewPager(com.wm.remusic.widget.AlbumViewPager) Intent(android.content.Intent) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) LrcView(com.wm.remusic.lrc.LrcView)

Aggregations

AudioManager (android.media.AudioManager)159 MediaPlayer (android.media.MediaPlayer)50 AudioEffect (android.media.audiofx.AudioEffect)42 LargeTest (android.test.suitebuilder.annotation.LargeTest)42 EnergyProbe (com.android.mediaframeworktest.functional.EnergyProbe)24 Context (android.content.Context)9 Intent (android.content.Intent)7 IOException (java.io.IOException)7 Cea708CaptionRenderer (android.media.Cea708CaptionRenderer)5 ClosedCaptionRenderer (android.media.ClosedCaptionRenderer)5 MediaFormat (android.media.MediaFormat)5 Ringtone (android.media.Ringtone)5 SubtitleController (android.media.SubtitleController)5 TtmlRenderer (android.media.TtmlRenderer)5 WebVttRenderer (android.media.WebVttRenderer)5 PowerManager (android.os.PowerManager)5 InputStream (java.io.InputStream)5 View (android.view.View)4 NotificationManager (android.app.NotificationManager)3 PendingIntent (android.app.PendingIntent)3