Search in sources :

Example 11 with ShortcutManager

use of android.content.pm.ShortcutManager in project platform_frameworks_base by android.

the class RemoteInputView method sendRemoteInput.

private void sendRemoteInput() {
    Bundle results = new Bundle();
    results.putString(mRemoteInput.getResultKey(), mEditText.getText().toString());
    Intent fillInIntent = new Intent().addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
    RemoteInput.addResultsToIntent(mRemoteInputs, fillInIntent, results);
    mEditText.setEnabled(false);
    mSendButton.setVisibility(INVISIBLE);
    mProgressBar.setVisibility(VISIBLE);
    mEntry.remoteInputText = mEditText.getText();
    mController.addSpinning(mEntry.key, mToken);
    mController.removeRemoteInput(mEntry, mToken);
    mEditText.mShowImeOnInputConnection = false;
    mController.remoteInputSent(mEntry);
    // Tell ShortcutManager that this package has been "activated".  ShortcutManager
    // will reset the throttling for this package.
    // Strictly speaking, the intent receiver may be different from the notification publisher,
    // but that's an edge case, and also because we can't always know which package will receive
    // an intent, so we just reset for the publisher.
    getContext().getSystemService(ShortcutManager.class).onApplicationActive(mEntry.notification.getPackageName(), mEntry.notification.getUser().getIdentifier());
    MetricsLogger.action(mContext, MetricsProto.MetricsEvent.ACTION_REMOTE_INPUT_SEND, mEntry.notification.getPackageName());
    try {
        mPendingIntent.send(mContext, 0, fillInIntent);
    } catch (PendingIntent.CanceledException e) {
        Log.i(TAG, "Unable to send remote input result", e);
        MetricsLogger.action(mContext, MetricsProto.MetricsEvent.ACTION_REMOTE_INPUT_FAIL, mEntry.notification.getPackageName());
    }
}
Also used : Bundle(android.os.Bundle) ShortcutManager(android.content.pm.ShortcutManager) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) PendingIntent(android.app.PendingIntent)

Example 12 with ShortcutManager

use of android.content.pm.ShortcutManager in project android_frameworks_base by ResurrectionRemix.

the class RemoteInputView method sendRemoteInput.

private void sendRemoteInput() {
    Bundle results = new Bundle();
    results.putString(mRemoteInput.getResultKey(), mEditText.getText().toString());
    Intent fillInIntent = new Intent().addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
    RemoteInput.addResultsToIntent(mRemoteInputs, fillInIntent, results);
    mEditText.setEnabled(false);
    mSendButton.setVisibility(INVISIBLE);
    mProgressBar.setVisibility(VISIBLE);
    mEntry.remoteInputText = mEditText.getText();
    mController.addSpinning(mEntry.key, mToken);
    mController.removeRemoteInput(mEntry, mToken);
    mEditText.mShowImeOnInputConnection = false;
    mController.remoteInputSent(mEntry);
    // Tell ShortcutManager that this package has been "activated".  ShortcutManager
    // will reset the throttling for this package.
    // Strictly speaking, the intent receiver may be different from the notification publisher,
    // but that's an edge case, and also because we can't always know which package will receive
    // an intent, so we just reset for the publisher.
    getContext().getSystemService(ShortcutManager.class).onApplicationActive(mEntry.notification.getPackageName(), mEntry.notification.getUser().getIdentifier());
    MetricsLogger.action(mContext, MetricsProto.MetricsEvent.ACTION_REMOTE_INPUT_SEND, mEntry.notification.getPackageName());
    try {
        mPendingIntent.send(mContext, 0, fillInIntent);
    } catch (PendingIntent.CanceledException e) {
        Log.i(TAG, "Unable to send remote input result", e);
        MetricsLogger.action(mContext, MetricsProto.MetricsEvent.ACTION_REMOTE_INPUT_FAIL, mEntry.notification.getPackageName());
    }
}
Also used : Bundle(android.os.Bundle) ShortcutManager(android.content.pm.ShortcutManager) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) PendingIntent(android.app.PendingIntent)

Aggregations

ShortcutManager (android.content.pm.ShortcutManager)12 Intent (android.content.Intent)9 TargetApi (android.annotation.TargetApi)5 PendingIntent (android.app.PendingIntent)5 Bundle (android.os.Bundle)5 ShortcutInfo (android.content.pm.ShortcutInfo)4 ArrayList (java.util.ArrayList)2 Cursor (android.database.Cursor)1 Paint (android.graphics.Paint)1 RecognizerIntent (android.speech.RecognizerIntent)1 SpannableString (android.text.SpannableString)1 View (android.view.View)1 ExecutableString (ee.ioc.phon.android.speak.ExecutableString)1 Combo (ee.ioc.phon.android.speak.model.Combo)1 URISyntaxException (java.net.URISyntaxException)1 List (java.util.List)1