当前位置: 首页>>代码示例>>Java>>正文


Java TaskStackBuilder.addNextIntent方法代码示例

本文整理汇总了Java中android.support.v4.app.TaskStackBuilder.addNextIntent方法的典型用法代码示例。如果您正苦于以下问题:Java TaskStackBuilder.addNextIntent方法的具体用法?Java TaskStackBuilder.addNextIntent怎么用?Java TaskStackBuilder.addNextIntent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.v4.app.TaskStackBuilder的用法示例。


在下文中一共展示了TaskStackBuilder.addNextIntent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreate

import android.support.v4.app.TaskStackBuilder; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    TaskStackBuilder builder = TaskStackBuilder.create(this);
    Intent proxyIntent = getIntent();
    if (!proxyIntent.hasExtra(EXTRA_INTENTS)) {
        finish();
        return;
    }

    for (Parcelable parcelable : proxyIntent.getParcelableArrayExtra(EXTRA_INTENTS)) {
        builder.addNextIntent((Intent) parcelable);
    }

    builder.startActivities();
    finish();
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:19,代码来源:TaskStackBuilderProxyActivity.java

示例2: getCommentPendingIntent

import android.support.v4.app.TaskStackBuilder; //导入方法依赖的package包/类
private PendingIntent getCommentPendingIntent(Bundle b) {
    // Intent to open Comments Activity
    TaskStackBuilder stackBuilder = TaskStackBuilder.create(context);
    stackBuilder.addParentStack(CommentsActivity.class);

    Intent commentsIntent = IntentUtils.getIntent(context, CommentsActivity.class);
    commentsIntent.putExtras(b);
    stackBuilder.addNextIntent(commentsIntent);

    // Set the pendingIntent on Notification.Builder
    //PendingIntent pendingIntent = PendingIntent.getActivity(context, id, commentsIntent, PendingIntent.FLAG_UPDATE_CURRENT);
    return stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
}
 
开发者ID:pedromassango,项目名称:Programmers,代码行数:14,代码来源:CustomNotification.java

示例3: showNotification

import android.support.v4.app.TaskStackBuilder; //导入方法依赖的package包/类
/**
 * Show notification
 *
 * @param mId Notification Id
 */
private void showNotification(int mId) {
    if (Logger.DEBUG) { Log.d(TAG, "[showNotification " + mId + "]"); }

    NotificationCompat.Builder mBuilder =
            new NotificationCompat.Builder(this)
                    .setSmallIcon(R.drawable.ic_stat_notify_24dp)
                    .setContentTitle(getString(R.string.app_name))
                    .setContentText(String.format(getString(R.string.is_running), getString(R.string.app_name)));
    Intent resultIntent = new Intent(this, MainActivity.class);

    TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
    stackBuilder.addParentStack(MainActivity.class);
    stackBuilder.addNextIntent(resultIntent);
    PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
    mBuilder.setContentIntent(resultPendingIntent);
    mNotificationManager.notify(mId, mBuilder.build());
}
 
开发者ID:bfabiszewski,项目名称:ulogger-android,代码行数:23,代码来源:LoggerService.java

示例4: showNotification

import android.support.v4.app.TaskStackBuilder; //导入方法依赖的package包/类
/**
 * Displays a notification with the location results.
 */
void showNotification() {
    Intent notificationIntent = new Intent(mContext, MainActivity.class);

    // Construct a task stack.
    TaskStackBuilder stackBuilder = TaskStackBuilder.create(mContext);

    // Add the main Activity to the task stack as the parent.
    stackBuilder.addParentStack(MainActivity.class);

    // Push the content Intent onto the stack.
    stackBuilder.addNextIntent(notificationIntent);

    // Get a PendingIntent containing the entire back stack.
    PendingIntent notificationPendingIntent =
            stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);

    Notification.Builder notificationBuilder = new Notification.Builder(mContext)
            .setContentTitle(getLocationResultTitle())
            .setContentText(getLocationResultText())
            .setSmallIcon(R.mipmap.ic_launcher)
            .setAutoCancel(true)
            .setContentIntent(notificationPendingIntent);

    getNotificationManager().notify(0, notificationBuilder.build());
}
 
开发者ID:googlecodelabs,项目名称:background-location-updates-android-o,代码行数:29,代码来源:LocationResultHelper.java

示例5: sendEvaluationNotification

import android.support.v4.app.TaskStackBuilder; //导入方法依赖的package包/类
private void sendEvaluationNotification(){
    NotificationCompat.Builder mBuilder =
            (NotificationCompat.Builder) new NotificationCompat.Builder(this)
                    .setSmallIcon(R.drawable.trezentos_icon)
                    .setContentTitle("Avaliação")
                    .setContentText("Você tem avaliações à serem feitas!")
                    .setLargeIcon(BitmapFactory.decodeResource(getResources()
                            , R.drawable.trezentos_icon));

    Intent resultIntent = new Intent(this, MainActivity.class);

    TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
    stackBuilder.addParentStack(MainActivity.class);
    stackBuilder.addNextIntent(resultIntent);

    PendingIntent resultPendingIntent =
            stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);

    mBuilder.setContentIntent(resultPendingIntent);

    NotificationManager mNotificationManager =
            (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    mNotificationManager.notify(0, mBuilder.build());
}
 
开发者ID:fga-gpp-mds,项目名称:2017.1-Trezentos,代码行数:25,代码来源:ExamActivity.java

示例6: showStartNotification

import android.support.v4.app.TaskStackBuilder; //导入方法依赖的package包/类
private void showStartNotification() {
    NotificationCompat.Builder mBuilder =
            new NotificationCompat.Builder(this)
                    .setSmallIcon(R.mipmap.ic_launcher)
                    .setContentTitle(getString(R.string.file_scanner))
                    .setContentText(getString(R.string.scan_started))
                    .setTicker(getString(R.string.file_scan_started))
                    .setVisibility(NotificationCompat.VISIBILITY_PUBLIC);
    Intent resultIntent = new Intent(this, MainActivity.class);
    TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
    stackBuilder.addParentStack(MainActivity.class);
    stackBuilder.addNextIntent(resultIntent);
    PendingIntent resultPendingIntent =
            stackBuilder.getPendingIntent(
                    0,
                    PendingIntent.FLAG_UPDATE_CURRENT
            );
    mBuilder.setContentIntent(resultPendingIntent);
    NotificationManager mNotificationManager =
            (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    mNotificationManager.notify(0, mBuilder.build());
}
 
开发者ID:steveyangmoto,项目名称:file_scanner,代码行数:23,代码来源:MainActivity.java

示例7: sendNotification

import android.support.v4.app.TaskStackBuilder; //导入方法依赖的package包/类
/**
 * Create and show a simple notification containing the received FCM message.
 *
 * @param messageBody FCM message body received.
 */
private void sendNotification( String messageBody) {

    Intent intent = new Intent(this, HomeActivity.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    intent.putExtra("menuFragment",""+ messageBody);
    TaskStackBuilder taskStackBuilder = TaskStackBuilder.create(getApplicationContext());
    taskStackBuilder.addNextIntent(intent);
    PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent,
            PendingIntent.FLAG_ONE_SHOT);

    Uri defaultSoundUri= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
    NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
            .setSmallIcon(R.drawable.ic_launcher)
            .setContentTitle("MSF Communique")
            .setContentText(""+messageBody.split("=")[1].replace("}", ""))
            .setAutoCancel(true)
            .setSound(defaultSoundUri)
            .setContentIntent(pendingIntent);

    NotificationManager notificationManager =
            (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

    notificationManager.notify(0 /* ID of notification */, notificationBuilder.build());

}
 
开发者ID:thandile,项目名称:msf_communique,代码行数:31,代码来源:MyFirebaseMessagingService.java

示例8: processDeepLink

import android.support.v4.app.TaskStackBuilder; //导入方法依赖的package包/类
private void processDeepLink() {
    Intent intent = getIntent();
    if (intent == null || intent.getData() == null) {
        return;
    }

    TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
    List<String> segments = intent.getData().getPathSegments();
    if (segments.isEmpty()) {
        Intent launcherIntent = getPackageManager().getLaunchIntentForPackage(getPackageName());
        if (launcherIntent != null) {
            startActivity(launcherIntent.putExtras(intent));
        }
        return;
    }

    for (String segment : intent.getData().getPathSegments()) {
        if (activityMap.containsKey(segment)) {
            Intent nextIntent = new Intent(this, activityMap.get(segment)).putExtras(intent);
            stackBuilder.addNextIntent(nextIntent);
        }
    }
    stackBuilder.startActivities();
}
 
开发者ID:infobip,项目名称:mobile-messaging-sdk-android,代码行数:25,代码来源:DeepLinkLandingActivity.java

示例9: buildMessageListBackStack

import android.support.v4.app.TaskStackBuilder; //导入方法依赖的package包/类
private TaskStackBuilder buildMessageListBackStack(Account account, String folderId) {
    TaskStackBuilder stack = skipFolderListInBackStack(account, folderId) ?
            buildAccountsBackStack() : buildFolderListBackStack(account);

    LocalSearch search = new LocalSearch(folderId);
    search.addAllowedFolder(folderId);
    search.addAccountUuid(account.getUuid());
    Intent intent = MessageList.intentDisplaySearch(context, search, false, true, true);

    stack.addNextIntent(intent);

    return stack;
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:14,代码来源:NotificationActionCreator.java

示例10: buildMessageViewBackStack

import android.support.v4.app.TaskStackBuilder; //导入方法依赖的package包/类
private TaskStackBuilder buildMessageViewBackStack(MessageReference message) {
    Account account = Preferences.getPreferences(context).getAccount(message.getAccountUuid());
    String folderId = message.getFolderId();
    TaskStackBuilder stack = buildMessageListBackStack(account, folderId);

    Intent intent = MessageList.actionDisplayMessageIntent(context, message);

    stack.addNextIntent(intent);

    return stack;
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:12,代码来源:NotificationActionCreator.java

示例11: createNotification

import android.support.v4.app.TaskStackBuilder; //导入方法依赖的package包/类
private void createNotification(int new_poems_count)
{
    String notification_title;
    if (new_poems_count>10){
        notification_title = "More than 10 new poems available!";
    } else {
        notification_title = String.format("%d new poem%s available!",
                new_poems_count, new_poems_count > 1 ? "s" : "");
    }
    NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this)
            .setSmallIcon(R.drawable.ic_stat_fleuronwhite)
            .setContentTitle(notification_title)
            .setContentText("Tap to view.")
            .setColor(ContextCompat.getColor(this, R.color.colorLauncherIcon))
            .setAutoCancel(false)
            .setLights(Color.GREEN, 400, 3000);
    Intent mainIntent = new Intent(this, MainActivity.class);
    mainIntent.putExtra("UPDATE", true);
    NotificationManager mNotificationManager =
            (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
    // Adds the back stack for the Intent (but not the Intent itself)
    stackBuilder.addParentStack(MainActivity.class);
    // Adds the Intent that starts the Activity to the top of the stack
    stackBuilder.addNextIntent(mainIntent);
    PendingIntent resultPendingIntent =
            stackBuilder.getPendingIntent(
                    0,
                    PendingIntent.FLAG_UPDATE_CURRENT
            );
    mBuilder.setContentIntent(resultPendingIntent);
    // If a previous notification is still visible it is updated automatically
    mNotificationManager.notify(NEW_POEMS_NOTIFICATION_ID, mBuilder.build());

}
 
开发者ID:PaulKlinger,项目名称:Sprog-App,代码行数:36,代码来源:MessagingService.java

示例12: showNotification

import android.support.v4.app.TaskStackBuilder; //导入方法依赖的package包/类
public static void showNotification(Context ctx) {
	NotificationCompat.Builder mBuilder =
			new NotificationCompat.Builder(ctx)
					.setSmallIcon(android.R.color.transparent)
					.setContentTitle(ctx.getString(R.string.app_name))
					.setContentText(ctx.getString(R.string.notification_desc))
					.setCategory(NotificationCompat.CATEGORY_SERVICE)
					.setOngoing(true);
	// Creates an explicit intent for an Activity in your app
	Intent resultIntent = new Intent(ctx, MainActivity.class);
	// The stack builder object will contain an artificial back stack for the
	// started Activity.
	// This ensures that navigating backward from the Activity leads out of
	// your application to the Home screen.
	TaskStackBuilder stackBuilder = TaskStackBuilder.create(ctx);
	// Adds the back stack for the Intent (but not the Intent itself)
	stackBuilder.addParentStack(MainActivity.class);
	// Adds the Intent that starts the Activity to the top of the stack
	stackBuilder.addNextIntent(resultIntent);
	PendingIntent resultPendingIntent =
			stackBuilder.getPendingIntent(
					0,
					PendingIntent.FLAG_UPDATE_CURRENT
			);
	mBuilder.setContentIntent(resultPendingIntent);
	NotificationManager mNotificationManager =
			(NotificationManager) ctx.getSystemService(Context.NOTIFICATION_SERVICE);
	mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
}
 
开发者ID:comp500,项目名称:SSLSocks,代码行数:30,代码来源:ServiceUtils.java

示例13: buildPendingIntent

import android.support.v4.app.TaskStackBuilder; //导入方法依赖的package包/类
private PendingIntent buildPendingIntent(Uri video) {
	Intent detailsIntent = new Intent(Intent.ACTION_VIEW);
	detailsIntent.setData(video);
	detailsIntent.putExtra(PlayerActivity.RESUME, PlayerActivity.RESUME_FROM_LAST_POS);
	detailsIntent.setClass(this, PlayerActivity.class);
	TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
	stackBuilder.addParentStack(PlayerActivity.class);
	stackBuilder.addNextIntent(detailsIntent);
	// Ensure a unique PendingIntents, otherwise all
	// recommendations end up with the same PendingIntent
	PendingIntent intent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);

	return intent;
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:15,代码来源:UpdateRecommendationsService.java

示例14: updateBlogPostNotification

import android.support.v4.app.TaskStackBuilder; //导入方法依赖的package包/类
@UiThread
private void updateBlogPostNotification() {
	if (blogTotal == 0) {
		clearBlogPostNotification();
	} else if (settings.getBoolean(PREF_NOTIFY_BLOG, true)) {
		NotificationCompat.Builder b =
				new NotificationCompat.Builder(appContext);
		b.setSmallIcon(R.drawable.notification_blog);
		b.setColor(ContextCompat.getColor(appContext,
				R.color.briar_primary));
		b.setContentTitle(appContext.getText(R.string.app_name));
		b.setContentText(appContext.getResources().getQuantityString(
				R.plurals.blog_post_notification_text, blogTotal,
				blogTotal));
		String ringtoneUri = settings.get(PREF_NOTIFY_RINGTONE_URI);
		if (!StringUtils.isNullOrEmpty(ringtoneUri))
			b.setSound(Uri.parse(ringtoneUri));
		b.setDefaults(getDefaults());
		b.setOnlyAlertOnce(true);
		b.setAutoCancel(true);
		// Touching the notification shows the combined blog feed
		Intent i = new Intent(appContext, NavDrawerActivity.class);
		i.putExtra(INTENT_BLOGS, true);
		i.setFlags(FLAG_ACTIVITY_CLEAR_TOP);
		i.setData(Uri.parse(BLOG_URI));
		TaskStackBuilder t = TaskStackBuilder.create(appContext);
		t.addParentStack(NavDrawerActivity.class);
		t.addNextIntent(i);
		b.setContentIntent(t.getPendingIntent(nextRequestId++, 0));
		if (Build.VERSION.SDK_INT >= 21) {
			b.setCategory(CATEGORY_SOCIAL);
			b.setVisibility(VISIBILITY_SECRET);
		}
		Object o = appContext.getSystemService(NOTIFICATION_SERVICE);
		NotificationManager nm = (NotificationManager) o;
		nm.notify(BLOG_POST_NOTIFICATION_ID, b.build());
	}
}
 
开发者ID:rafjordao,项目名称:Nird2,代码行数:39,代码来源:AndroidNotificationManagerImpl.java

示例15: showSyncNotification

import android.support.v4.app.TaskStackBuilder; //导入方法依赖的package包/类
private void showSyncNotification() {
    DebugLog.logMethod();
    NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
            .setContentTitle(contentTitle)
            .setContentText(contentText)
            .setWhen(System.currentTimeMillis())
            .setLargeIcon(Utilities.getBitmap(context, largeIconId))
            .setSmallIcon(smallIconId)
            .setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION))
            .setAutoCancel(true);

    TaskStackBuilder stackBuilder = TaskStackBuilder.create(context);
    stackBuilder.addNextIntent(new Intent(context, CouponListActivity.class));
    PendingIntent contentPendingIntent = stackBuilder.getPendingIntent(
            0,
            PendingIntent.FLAG_UPDATE_CURRENT
    );
    builder.setContentIntent(contentPendingIntent);

    // Cancel any previously shown notification
    NotificationManagerCompat.from(context).cancel(TAG, SYNC_NOTIFICATION_ID);
    // Show notification
    NotificationManagerCompat.from(context).notify(
            TAG,
            SYNC_NOTIFICATION_ID,
            builder.build()
    );
}
 
开发者ID:darsh2,项目名称:CouponsTracker,代码行数:29,代码来源:CouponsTrackerNotification.java


注:本文中的android.support.v4.app.TaskStackBuilder.addNextIntent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。