Search in sources :

Example 1 with PictureInPictureArgs

use of android.app.PictureInPictureArgs in project K6nele by Kaljurand.

the class AbstractRecognizerIntentActivity method getPictureInPictureArgs.

@TargetApi(26)
private PictureInPictureArgs getPictureInPictureArgs() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
        Intent thisIntent = getIntent();
        ArrayList<RemoteAction> actions = new ArrayList<>();
        // Action to start recognition
        actions.add(new RemoteAction(Icon.createWithResource(this, R.drawable.ic_voice_search_api_material), "Recognize", "Tap & Speak", PendingIntent.getActivity(this, 10, thisIntent, 0)));
        // Action to go to the settings
        actions.add(new RemoteAction(Icon.createWithResource(this, R.drawable.ic_settings_24dp), "Settings", "Settings", PendingIntent.getActivity(this, 11, new Intent(getApplicationContext(), Preferences.class), 0)));
        PictureInPictureArgs mPictureInPictureArgs = new PictureInPictureArgs();
        mPictureInPictureArgs.setActions(actions);
        return mPictureInPictureArgs;
    }
    return null;
}
Also used : ArrayList(java.util.ArrayList) RemoteAction(android.app.RemoteAction) PictureInPictureArgs(android.app.PictureInPictureArgs) PendingIntent(android.app.PendingIntent) Intent(android.content.Intent) RecognizerIntent(android.speech.RecognizerIntent) SharedPreferences(android.content.SharedPreferences) TargetApi(android.annotation.TargetApi)

Aggregations

TargetApi (android.annotation.TargetApi)1 PendingIntent (android.app.PendingIntent)1 PictureInPictureArgs (android.app.PictureInPictureArgs)1 RemoteAction (android.app.RemoteAction)1 Intent (android.content.Intent)1 SharedPreferences (android.content.SharedPreferences)1 RecognizerIntent (android.speech.RecognizerIntent)1 ArrayList (java.util.ArrayList)1