Java Code Examples for androidx.core.app.RemoteInput#getResultsFromIntent()

The following examples show how to use androidx.core.app.RemoteInput#getResultsFromIntent() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VoiceNotiActivity.java    From wearable with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_voice_noti);

    //note android developer page, shows this in a separate method, but not necessary.

    Bundle remoteInput = RemoteInput.getResultsFromIntent(getIntent());
    if (remoteInput != null) {
        info = remoteInput.getCharSequence(EXTRA_VOICE_REPLY).toString();
    } else {
        info = "No voice response.";
    }
    logger = findViewById(R.id.logger);
    logger.setText(info);
}
 
Example 2
Source File: AutoMessageReplyReceiver.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void onReceive(Context context, Intent intent) {
    ApplicationLoader.postInitApplication();
    Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
    if (remoteInput == null) {
        return;
    }
    CharSequence text = remoteInput.getCharSequence(NotificationsController.EXTRA_VOICE_REPLY);
    if (text == null || text.length() == 0) {
        return;
    }
    long dialog_id = intent.getLongExtra("dialog_id", 0);
    int max_id = intent.getIntExtra("max_id", 0);
    int currentAccount = intent.getIntExtra("currentAccount", 0);
    if (dialog_id == 0 || max_id == 0) {
        return;
    }
    SendMessagesHelper.getInstance(currentAccount).sendMessage(text.toString(), dialog_id, null, null, true, null, null, null, true, 0);
    MessagesController.getInstance(currentAccount).markDialogAsRead(dialog_id, max_id, max_id, 0, false, 0, true, 0);
}
 
Example 3
Source File: QiscusPushNotificationClickReceiver.java    From qiscus-sdk-android with Apache License 2.0 6 votes vote down vote up
@Override
public void onReceive(Context context, Intent intent) {
    QiscusComment comment = intent.getParcelableExtra("data");
    Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
    if (remoteInput != null) {
        CharSequence message = remoteInput.getCharSequence(QiscusPushNotificationUtil.KEY_NOTIFICATION_REPLY);
        NotificationManager notificationManager = (NotificationManager) context.getSystemService(
                Context.NOTIFICATION_SERVICE);
        if (notificationManager != null) {
            notificationManager.cancel((int) comment.getRoomId());
        }
        QiscusComment qiscusComment = QiscusComment.generateMessage(comment.getRoomId(), (String) message);
        Qiscus.getChatConfig().getReplyNotificationHandler().onSend(context, qiscusComment);
    } else {
        Qiscus.getChatConfig().getNotificationClickListener().onClick(context, comment);
    }
}
 
Example 4
Source File: AutoMessageReplyReceiver.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void onReceive(Context context, Intent intent) {
    ApplicationLoader.postInitApplication();
    Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
    if (remoteInput == null) {
        return;
    }
    CharSequence text = remoteInput.getCharSequence(NotificationsController.EXTRA_VOICE_REPLY);
    if (text == null || text.length() == 0) {
        return;
    }
    long dialog_id = intent.getLongExtra("dialog_id", 0);
    int max_id = intent.getIntExtra("max_id", 0);
    int currentAccount = intent.getIntExtra("currentAccount", 0);
    if (dialog_id == 0 || max_id == 0) {
        return;
    }
    SendMessagesHelper.getInstance(currentAccount).sendMessage(text.toString(), dialog_id, null, null, true, null, null, null, true, 0);
    MessagesController.getInstance(currentAccount).markDialogAsRead(dialog_id, max_id, max_id, 0, false, 0, true, 0);
}
 
Example 5
Source File: MessagingIntentService.java    From android-Notifications with Apache License 2.0 5 votes vote down vote up
private CharSequence getMessage(Intent intent) {
    Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
    if (remoteInput != null) {
        return remoteInput.getCharSequence(EXTRA_REPLY);
    }
    return null;
}
 
Example 6
Source File: NotificationBroadcastReceiver.java    From Applozic-Android-SDK with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private CharSequence getMessageText(Intent intent) {
    Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
    if (remoteInput != null) {
        return remoteInput.getCharSequence(WearableNotificationWithVoice.EXTRA_VOICE_REPLY);
    }
    return null;
}
 
Example 7
Source File: MessageReplyReceiver.java    From MycroftCore-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Get the message text from the intent.
 * Note that you should call {@code RemoteInput#getResultsFromIntent(intent)} to process
 * the RemoteInput.
 */
private CharSequence getMessageText(Intent intent) {
    Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
    if (remoteInput != null) {
        return remoteInput.getCharSequence(MycroftMessagingService.EXTRA_VOICE_REPLY);
    }
    return null;
}
 
Example 8
Source File: MessagingIntentService.java    From android-Notifications with Apache License 2.0 5 votes vote down vote up
private CharSequence getMessage(Intent intent) {
    Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
    if (remoteInput != null) {
        return remoteInput.getCharSequence(EXTRA_REPLY);
    }
    return null;
}
 
Example 9
Source File: BigPictureSocialIntentService.java    From android-Notifications with Apache License 2.0 5 votes vote down vote up
private CharSequence getMessage(Intent intent) {
    Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
    if (remoteInput != null) {
        return remoteInput.getCharSequence(EXTRA_COMMENT);
    }
    return null;
}
 
Example 10
Source File: AndroidAutoReplyReceiver.java    From mollyim-android with GNU General Public License v3.0 5 votes vote down vote up
private CharSequence getMessageText(Intent intent) {
  Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
  if (remoteInput != null) {
    return remoteInput.getCharSequence(VOICE_REPLY_KEY);
  }
  return null;
}
 
Example 11
Source File: BigPictureSocialIntentService.java    From android-Notifications with Apache License 2.0 5 votes vote down vote up
private CharSequence getMessage(Intent intent) {
    Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
    if (remoteInput != null) {
        return remoteInput.getCharSequence(EXTRA_COMMENT);
    }
    return null;
}
 
Example 12
Source File: FFMBroadcastReceiver.java    From FCM-for-Mojo with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onReceive(final Context context, Intent intent) {
    if (intent == null || intent.getAction() == null) {
        return;
    }

    Chat chat = intent.getParcelableExtra(EXTRA_CHAT);
    switch (intent.getAction()) {
        case ACTION_REPLY:
            Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
            handleReply(context, remoteInput, chat);
            break;
        case ACTION_CONTENT:
            handleContent(context, chat);
            break;
        case ACTION_DELETE:
            handleDelete(context, chat);
            break;
        case ACTION_OPEN_SCAN:
            handleOpenScan(context);
            break;
        case ACTION_DISMISS_SYSTEM_NOTIFICATION:
            handleDismissSystemNotification(context);
            break;
        case ACTION_COPY_TO_CLIPBOARD:
            String text = intent.getStringExtra(Intent.EXTRA_TEXT);
            handleCopyToClipBoard(context, text);
            break;
    }
}
 
Example 13
Source File: MyFirebaseMessagingService.java    From NaviBee with GNU General Public License v3.0 5 votes vote down vote up
public static CharSequence getReplyMessage(Intent intent) {
    Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
    if (remoteInput != null) {
        return remoteInput.getCharSequence(KEY_TEXT_REPLY);
    }
    return null;
}
 
Example 14
Source File: MessagingIntentService.java    From user-interface-samples with Apache License 2.0 5 votes vote down vote up
private CharSequence getMessage(Intent intent) {
    Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
    if (remoteInput != null) {
        return remoteInput.getCharSequence(EXTRA_REPLY);
    }
    return null;
}
 
Example 15
Source File: BigPictureSocialIntentService.java    From user-interface-samples with Apache License 2.0 5 votes vote down vote up
private CharSequence getMessage(Intent intent) {
    Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
    if (remoteInput != null) {
        return remoteInput.getCharSequence(EXTRA_COMMENT);
    }
    return null;
}
 
Example 16
Source File: MessagingIntentService.java    From user-interface-samples with Apache License 2.0 5 votes vote down vote up
private CharSequence getMessage(Intent intent) {
    Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
    if (remoteInput != null) {
        return remoteInput.getCharSequence(EXTRA_REPLY);
    }
    return null;
}
 
Example 17
Source File: BigPictureSocialIntentService.java    From user-interface-samples with Apache License 2.0 5 votes vote down vote up
private CharSequence getMessage(Intent intent) {
    Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
    if (remoteInput != null) {
        return remoteInput.getCharSequence(EXTRA_COMMENT);
    }
    return null;
}
 
Example 18
Source File: MessagingIntentService.java    From wear-os-samples with Apache License 2.0 5 votes vote down vote up
private CharSequence getMessage(Intent intent) {
    Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
    if (remoteInput != null) {
        return remoteInput.getCharSequence(EXTRA_REPLY);
    }
    return null;
}
 
Example 19
Source File: WearReplyReceiver.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void onReceive(Context context, Intent intent) {
    ApplicationLoader.postInitApplication();
    Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
    if (remoteInput == null) {
        return;
    }
    CharSequence text = remoteInput.getCharSequence(NotificationsController.EXTRA_VOICE_REPLY);
    if (TextUtils.isEmpty(text)) {
        return;
    }
    long dialog_id = intent.getLongExtra("dialog_id", 0);
    int max_id = intent.getIntExtra("max_id", 0);
    int currentAccount = intent.getIntExtra("currentAccount", 0);
    if (dialog_id == 0 || max_id == 0) {
        return;
    }
    int lowerId = (int) dialog_id;
    int highId = (int) (dialog_id >> 32);
    AccountInstance accountInstance = AccountInstance.getInstance(currentAccount);
    if (lowerId > 0) {
        TLRPC.User user = accountInstance.getMessagesController().getUser(lowerId);
        if (user == null) {
            Utilities.globalQueue.postRunnable(() -> {
                TLRPC.User user1 = accountInstance.getMessagesStorage().getUserSync(lowerId);
                AndroidUtilities.runOnUIThread(() -> {
                    accountInstance.getMessagesController().putUser(user1, true);
                    sendMessage(accountInstance, text, dialog_id, max_id);
                });
            });
            return;
        }
    } else if (lowerId < 0) {
        TLRPC.Chat chat = accountInstance.getMessagesController().getChat(-lowerId);
        if (chat == null) {
            Utilities.globalQueue.postRunnable(() -> {
                TLRPC.Chat chat1 = accountInstance.getMessagesStorage().getChatSync(-lowerId);
                AndroidUtilities.runOnUIThread(() -> {
                    accountInstance.getMessagesController().putChat(chat1, true);
                    sendMessage(accountInstance, text, dialog_id, max_id);
                });
            });
            return;
        }
    }
    sendMessage(accountInstance, text, dialog_id, max_id);
}
 
Example 20
Source File: WearReplyReceiver.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void onReceive(Context context, Intent intent) {
    ApplicationLoader.postInitApplication();
    Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
    if (remoteInput == null) {
        return;
    }
    CharSequence text = remoteInput.getCharSequence(NotificationsController.EXTRA_VOICE_REPLY);
    if (TextUtils.isEmpty(text)) {
        return;
    }
    long dialog_id = intent.getLongExtra("dialog_id", 0);
    int max_id = intent.getIntExtra("max_id", 0);
    int currentAccount = intent.getIntExtra("currentAccount", 0);
    if (dialog_id == 0 || max_id == 0) {
        return;
    }
    int lowerId = (int) dialog_id;
    int highId = (int) (dialog_id >> 32);
    AccountInstance accountInstance = AccountInstance.getInstance(currentAccount);
    if (lowerId > 0) {
        TLRPC.User user = accountInstance.getMessagesController().getUser(lowerId);
        if (user == null) {
            Utilities.globalQueue.postRunnable(() -> {
                TLRPC.User user1 = accountInstance.getMessagesStorage().getUserSync(lowerId);
                AndroidUtilities.runOnUIThread(() -> {
                    accountInstance.getMessagesController().putUser(user1, true);
                    sendMessage(accountInstance, text, dialog_id, max_id);
                });
            });
            return;
        }
    } else if (lowerId < 0) {
        TLRPC.Chat chat = accountInstance.getMessagesController().getChat(-lowerId);
        if (chat == null) {
            Utilities.globalQueue.postRunnable(() -> {
                TLRPC.Chat chat1 = accountInstance.getMessagesStorage().getChatSync(-lowerId);
                AndroidUtilities.runOnUIThread(() -> {
                    accountInstance.getMessagesController().putChat(chat1, true);
                    sendMessage(accountInstance, text, dialog_id, max_id);
                });
            });
            return;
        }
    }
    sendMessage(accountInstance, text, dialog_id, max_id);
}