Search in sources :

Example 16 with TaskStackBuilder

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

the class SimActivationNotifier method sendSwitchedToRemovableSlotNotification.

/**
 * Sends a push notification for switching to the removable slot.
 */
public void sendSwitchedToRemovableSlotNotification() {
    String carrierName = getActiveCarrierName();
    Intent clickIntent = new Intent(mContext, Settings.MobileNetworkListActivity.class);
    TaskStackBuilder stackBuilder = TaskStackBuilder.create(mContext).addNextIntent(clickIntent);
    PendingIntent contentIntent = stackBuilder.getPendingIntent(0, /* requestCode */
    PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
    String titleText = TextUtils.isEmpty(carrierName) ? mContext.getString(R.string.switch_to_removable_notification_no_carrier_name) : mContext.getString(R.string.switch_to_removable_notification, carrierName);
    Notification.Builder builder = new Notification.Builder(mContext, SWITCH_SLOT_CHANNEL_ID).setContentTitle(titleText).setContentText(mContext.getString(R.string.network_changed_notification_text)).setContentIntent(contentIntent).setSmallIcon(R.drawable.ic_sim_alert).setColor(mContext.getResources().getColor(R.color.homepage_generic_icon_background, null)).setAutoCancel(true);
    mNotificationManager.notify(SWITCH_TO_REMOVABLE_SLOT_NOTIFICATION_ID, builder.build());
}
Also used : TaskStackBuilder(androidx.core.app.TaskStackBuilder) 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