Example usage for android.media.audiofx AudioEffect EXTRA_CONTENT_TYPE

List of usage examples for android.media.audiofx AudioEffect EXTRA_CONTENT_TYPE

Introduction

In this page you can find the example usage for android.media.audiofx AudioEffect EXTRA_CONTENT_TYPE.

Prototype

String EXTRA_CONTENT_TYPE

To view the source code for android.media.audiofx AudioEffect EXTRA_CONTENT_TYPE.

Click Source Link

Document

Indicates which type of content is played by the application.

Usage

From source file:org.mariotaku.harmony.activity.MusicPlaybackActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (mService == null)
        return true;
    switch (item.getItemId()) {
    case MENU_ADD_TO_PLAYLIST: {
        final Intent intent = new Intent(INTENT_ADD_TO_PLAYLIST);
        long[] list_to_be_added = new long[1];
        //list_to_be_added[0] = MusicUtils.getCurrentAudioId();
        intent.putExtra(INTENT_KEY_LIST, list_to_be_added);
        startActivity(intent);/*from w  ww . jav  a2  s . co  m*/
        break;
    }
    case EQUALIZER: {
        final Intent intent = new Intent(AudioEffect.ACTION_DISPLAY_AUDIO_EFFECT_CONTROL_PANEL);
        intent.putExtra(AudioEffect.EXTRA_PACKAGE_NAME, getPackageName());
        intent.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, mService.getAudioSessionId());
        intent.putExtra(AudioEffect.EXTRA_CONTENT_TYPE, AudioEffect.CONTENT_TYPE_MUSIC);
        startActivityForResult(intent, REQUEST_EQUALIZER);
        break;
    }
    case MENU_SLEEP_TIMER: {
        final Intent intent = new Intent(INTENT_SLEEP_TIMER);
        startActivity(intent);
        break;
    }
    case DELETE_ITEMS: {
        final Intent intent = new Intent(INTENT_DELETE_ITEMS);
        Bundle bundle = new Bundle();
        //            bundle.putString(
        //                  INTENT_KEY_PATH,
        //                  Uri.withAppendedPath(Audio.Media.EXTERNAL_CONTENT_URI,
        //                        Uri.encode(String.valueOf(MusicUtils.getCurrentAudioId())))
        //                        .toString());
        intent.putExtras(bundle);
        startActivity(intent);
        break;
    }
    case SETTINGS: {
        final Intent intent = new Intent(INTENT_APPEARANCE_SETTINGS);
        startActivity(intent);
        break;
    }
    case MENU_HOME: {
        overridePendingTransition(R.anim.music_playback_activity_enter, R.anim.music_playback_activity_exit);
        NavUtils.navigateUpTo(this, new Intent(this, MusicBrowserActivity.class));
        break;
    }
    case ADD_TO_FAVORITES: {
        toggleFavorite();
        break;
    }
    case MENU_SHUFFLE_MODE_NONE: {
        mService.setShuffleMode(SHUFFLE_MODE_NONE);
        break;
    }
    case MENU_SHUFFLE_MODE_ALL: {
        mService.setShuffleMode(SHUFFLE_MODE_ALL);
        break;
    }
    case MENU_REPEAT_MODE_NONE: {
        mService.setRepeatMode(REPEAT_MODE_NONE);
        break;
    }
    case MENU_REPEAT_MODE_ALL: {
        mService.setRepeatMode(REPEAT_MODE_ALL);
        break;
    }
    case MENU_REPEAT_MODE_CURRENT: {
        mService.setRepeatMode(REPEAT_MODE_CURRENT);
        break;
    }
    }
    return true;
}

From source file:com.rks.musicx.ui.activities.MainActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == OVERLAY_REQ) {
        if (Build.VERSION.SDK_INT >= M) {
            if (Settings.canDrawOverlays(this)) {
                Log.d("MainActivity", "Granted");
            } else {
                Extras.getInstance().setWidgetTrack(true);
                Log.d("MainActivity", "Denied or Grant permission Manually");
            }/*w  w  w  . j  a  v  a 2  s.c  o  m*/
        }
    }
    if (requestCode == WRITESETTINGS) {
        if (Build.VERSION.SDK_INT >= M) {
            if (!Settings.System.canWrite(this)) {
                Log.d("MainActivity", "Granted");
            } else {
                Extras.getInstance().setSettings(true);
                Log.d("MainActivity", "Denied or Grant permission Manually");
            }
        }
    }
    if (requestCode == EQ) {
        Intent intent = new Intent(AudioEffect.ACTION_OPEN_AUDIO_EFFECT_CONTROL_SESSION);
        if (intent.getAction() != null && Helper.isActivityPresent(MainActivity.this, intent)) {
            if (musicXService == null) {
                return;
            }
            intent.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, musicXService.audioSession());
            intent.putExtra(AudioEffect.EXTRA_PACKAGE_NAME, this.getPackageName());
            intent.putExtra(AudioEffect.EXTRA_CONTENT_TYPE, AudioEffect.CONTENT_TYPE_MUSIC);
            sendBroadcast(intent);
        } else {
            Log.d("MainActivity", "Error");
        }
    }
    if (requestCode == NAV && resultCode == RESULT_OK) {
        intent = data;
    }
}