Search in sources :

Example 11 with TaskStackBuilder

use of androidx.core.app.TaskStackBuilder in project android-oss by kickstarter.

the class PushNotifications method projectUpdateContentIntent.

@NonNull
private PendingIntent projectUpdateContentIntent(@NonNull final PushNotificationEnvelope envelope, @NonNull final Update update, @NonNull final String projectParam) {
    final Intent projectIntent = IntentExtKt.getProjectIntent(new Intent(), this.context).putExtra(IntentKey.PROJECT_PARAM, projectParam).putExtra(IntentKey.REF_TAG, RefTag.push());
    final Intent updateIntent = new Intent(this.context, UpdateActivity.class).putExtra(IntentKey.PROJECT_PARAM, projectParam).putExtra(IntentKey.UPDATE, update).putExtra(IntentKey.PUSH_NOTIFICATION_ENVELOPE, envelope);
    final TaskStackBuilder taskStackBuilder = TaskStackBuilder.create(this.context).addNextIntentWithParentStack(projectIntent).addNextIntent(updateIntent);
    return taskStackBuilder.getPendingIntent(envelope.signature(), PendingIntent.FLAG_IMMUTABLE);
}
Also used : UpdateActivity(com.kickstarter.ui.activities.UpdateActivity) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) TaskStackBuilder(androidx.core.app.TaskStackBuilder) NonNull(androidx.annotation.NonNull)

Example 12 with TaskStackBuilder

use of androidx.core.app.TaskStackBuilder in project android-oss by kickstarter.

the class PushNotifications method messageThreadIntent.

@VisibleForTesting
@NonNull
public PendingIntent messageThreadIntent(@NonNull final PushNotificationEnvelope envelope, @NonNull final MessageThread messageThread) {
    this.messageThreadIntent = new Intent(this.context, MessagesActivity.class).putExtra(IntentKey.MESSAGE_THREAD, messageThread).putExtra(IntentKey.MESSAGE_SCREEN_SOURCE_CONTEXT, MessagePreviousScreenType.PUSH);
    final TaskStackBuilder taskStackBuilder = TaskStackBuilder.create(this.context).addNextIntentWithParentStack(this.messageThreadIntent);
    return taskStackBuilder.getPendingIntent(envelope.signature(), PendingIntent.FLAG_IMMUTABLE);
}
Also used : MessagesActivity(com.kickstarter.ui.activities.MessagesActivity) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) TaskStackBuilder(androidx.core.app.TaskStackBuilder) VisibleForTesting(androidx.annotation.VisibleForTesting) NonNull(androidx.annotation.NonNull)

Example 13 with TaskStackBuilder

use of androidx.core.app.TaskStackBuilder in project android-oss by kickstarter.

the class PushNotifications method friendFollowActivityIntent.

@NonNull
private PendingIntent friendFollowActivityIntent(@NonNull final PushNotificationEnvelope envelope) {
    final Intent messageThreadIntent = new Intent(this.context, ActivityFeedActivity.class);
    final TaskStackBuilder taskStackBuilder = TaskStackBuilder.create(this.context).addNextIntentWithParentStack(messageThreadIntent);
    return taskStackBuilder.getPendingIntent(envelope.signature(), PendingIntent.FLAG_IMMUTABLE);
}
Also used : Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) TaskStackBuilder(androidx.core.app.TaskStackBuilder) NonNull(androidx.annotation.NonNull)

Example 14 with TaskStackBuilder

use of androidx.core.app.TaskStackBuilder in project Signal-Android by signalapp.

the class ShortcutLauncherActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    String rawId = getIntent().getStringExtra(KEY_RECIPIENT);
    if (rawId == null) {
        Toast.makeText(this, R.string.ShortcutLauncherActivity_invalid_shortcut, Toast.LENGTH_SHORT).show();
        // TODO [greyson] Navigation
        startActivity(MainActivity.clearTop(this));
        finish();
        return;
    }
    Recipient recipient = Recipient.live(RecipientId.from(rawId)).get();
    // TODO [greyson] Navigation
    TaskStackBuilder backStack = TaskStackBuilder.create(this).addNextIntent(MainActivity.clearTop(this));
    CommunicationActions.startConversation(this, recipient, null, backStack);
    finish();
}
Also used : Recipient(org.thoughtcrime.securesms.recipients.Recipient) TaskStackBuilder(androidx.core.app.TaskStackBuilder)

Example 15 with TaskStackBuilder

use of androidx.core.app.TaskStackBuilder in project android_packages_apps_Settings by omnirom.

the class SimActivationNotifier method sendEnableDsdsNotification.

/**
 * Sends a push notification for enabling DSDS.
 */
public void sendEnableDsdsNotification() {
    Intent parentIntent = new Intent(mContext, Settings.MobileNetworkListActivity.class);
    Intent clickIntent = new Intent(mContext, DsdsDialogActivity.class);
    TaskStackBuilder stackBuilder = TaskStackBuilder.create(mContext).addNextIntentWithParentStack(parentIntent).addNextIntent(clickIntent);
    PendingIntent contentIntent = stackBuilder.getPendingIntent(0, /* requestCode */
    PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
    Notification.Builder builder = new Notification.Builder(mContext, SIM_SETUP_CHANNEL_ID).setContentTitle(mContext.getString(R.string.dsds_notification_after_suw_title)).setContentText(mContext.getString(R.string.dsds_notification_after_suw_text)).setContentIntent(contentIntent).setSmallIcon(R.drawable.ic_sim_alert).setAutoCancel(true);
    mNotificationManager.notify(SIM_ACTIVATION_NOTIFICATION_ID, builder.build());
}
Also used : Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) PendingIntent(android.app.PendingIntent) TaskStackBuilder(androidx.core.app.TaskStackBuilder) Settings(com.android.settings.Settings) Notification(android.app.Notification)

Aggregations

TaskStackBuilder (androidx.core.app.TaskStackBuilder)16 Intent (android.content.Intent)12 PendingIntent (android.app.PendingIntent)10 NonNull (androidx.annotation.NonNull)4 Notification (android.app.Notification)3 NotificationCompat (androidx.core.app.NotificationCompat)3 Settings (com.android.settings.Settings)3 Recipient (org.thoughtcrime.securesms.recipients.Recipient)2 Bundle (android.os.Bundle)1 SubscriptionInfo (android.telephony.SubscriptionInfo)1 VisibleForTesting (androidx.annotation.VisibleForTesting)1 DeepLink (com.airbnb.deeplinkdispatch.DeepLink)1 MediaMetadata (com.google.android.gms.cast.MediaMetadata)1 MessagesActivity (com.kickstarter.ui.activities.MessagesActivity)1 SurveyResponseActivity (com.kickstarter.ui.activities.SurveyResponseActivity)1 UpdateActivity (com.kickstarter.ui.activities.UpdateActivity)1 AppIntent (com.orgzly.android.AppIntent)1 NotNull (org.jetbrains.annotations.NotNull)1