Example usage for android.content Intent CATEGORY_LAUNCHER

List of usage examples for android.content Intent CATEGORY_LAUNCHER

Introduction

In this page you can find the example usage for android.content Intent CATEGORY_LAUNCHER.

Prototype

String CATEGORY_LAUNCHER

To view the source code for android.content Intent CATEGORY_LAUNCHER.

Click Source Link

Document

Should be displayed in the top-level launcher.

Usage

From source file:net.ustyugov.jtalk.Notify.java

public static void incomingFileProgress(String filename, Status status) {
    JTalkService service = JTalkService.getInstance();

    Intent i = new Intent(service, RosterActivity.class);
    i.setAction(Intent.ACTION_MAIN);/*www  . java  2s  .  c o  m*/
    i.addCategory(Intent.CATEGORY_LAUNCHER);
    i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

    PendingIntent contentIntent = PendingIntent.getActivity(service, 0, i, 0);

    NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(service);
    mBuilder.setContentTitle(filename);
    mBuilder.setContentIntent(contentIntent);

    if (status == Status.complete) {
        mBuilder.setSmallIcon(android.R.drawable.stat_sys_download_done);
        mBuilder.setTicker(service.getString(R.string.Completed));
        mBuilder.setContentText(service.getString(R.string.Completed));
        mBuilder.setAutoCancel(true);
        mBuilder.setOngoing(false);
    } else if (status == Status.cancelled) {
        mBuilder.setSmallIcon(android.R.drawable.stat_sys_warning);
        mBuilder.setTicker(service.getString(R.string.Canceled));
        mBuilder.setContentText(service.getString(R.string.Canceled));
        mBuilder.setAutoCancel(true);
        mBuilder.setOngoing(false);
    } else if (status == Status.refused) {
        mBuilder.setSmallIcon(android.R.drawable.stat_sys_warning);
        mBuilder.setTicker(service.getString(R.string.Canceled));
        mBuilder.setContentText(service.getString(R.string.Canceled));
        mBuilder.setAutoCancel(true);
        mBuilder.setOngoing(false);
    } else if (status == Status.negotiating_transfer) {
        mBuilder.setOngoing(true);
        mBuilder.setSmallIcon(android.R.drawable.stat_sys_download_done);
        mBuilder.setTicker(service.getString(R.string.Waiting));
        mBuilder.setContentText(service.getString(R.string.Waiting));
    } else if (status == Status.in_progress) {
        mBuilder.setOngoing(true);
        mBuilder.setSmallIcon(android.R.drawable.stat_sys_download);
        mBuilder.setTicker(service.getString(R.string.Downloading));
        mBuilder.setContentText(service.getString(R.string.Downloading));
    } else if (status == Status.error) {
        mBuilder.setSmallIcon(android.R.drawable.stat_sys_warning);
        mBuilder.setTicker(service.getString(R.string.Error));
        mBuilder.setContentText(service.getString(R.string.Error));
        mBuilder.setAutoCancel(true);
        mBuilder.setOngoing(false);
    } else {
        return;
    }

    NotificationManager mng = (NotificationManager) service.getSystemService(Context.NOTIFICATION_SERVICE);
    mng.notify(NOTIFICATION_IN_FILE, mBuilder.build());
}

From source file:com.example.yuen.e_carei.ShowAppointmentList.java

private void open(ApplicationInfo item) {
    // open app/* www. j  a va2s .c om*/
    Intent resolveIntent = new Intent(Intent.ACTION_MAIN, null);
    resolveIntent.addCategory(Intent.CATEGORY_LAUNCHER);
    resolveIntent.setPackage(item.packageName);
    List<ResolveInfo> resolveInfoList = getPackageManager().queryIntentActivities(resolveIntent, 0);
    if (resolveInfoList != null && resolveInfoList.size() > 0) {
        ResolveInfo resolveInfo = resolveInfoList.get(0);
        String activityPackageName = resolveInfo.activityInfo.packageName;
        String className = resolveInfo.activityInfo.name;

        Intent intent = new Intent(Intent.ACTION_MAIN);
        intent.addCategory(Intent.CATEGORY_LAUNCHER);
        ComponentName componentName = new ComponentName(activityPackageName, className);

        intent.setComponent(componentName);
        startActivity(intent);
    }
}

From source file:com.pdmanager.views.patient.TechnicianActivity.java

@Override
public void onMessageReceived(final CNMessage cnMessage) {
    if (application.getUniqueId().equals(cnMessage.getUniqueId())) {
        return;// www .  j  av a  2 s  .  c o m
    }

    if (cnMessage.getMessageType() == CNMessage.CNMessageType.Calling) {

        if (application.isInConference()) {
            application.sendCNMessage(cnMessage.getFrom(), CNMessage.CNMessageType.Busy, null);
            return;
        }

        callDialog = new AlertDialog.Builder(this).create();
        LayoutInflater inflater = getLayoutInflater();
        View incomingCallDialog = inflater.inflate(R.layout.incoming_call_dialog, null);
        incomingCallDialog.setAlpha(0.5f);
        callDialog.setView(incomingCallDialog);

        TextView caller = (TextView) incomingCallDialog.findViewById(R.id.caller);
        caller.setText(cnMessage.getDisplayName());

        Button answerButton = (Button) incomingCallDialog.findViewById(R.id.answer_button);
        answerButton.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                application.setConferenceId(cnMessage.getConferenceId());
                application.sendCNMessage(cnMessage.getFrom(), CNMessage.CNMessageType.AnswerAccept, null);
                callDialog.hide();
                currentRingtone.stop();

                Intent intent = new Intent(application.getContext(), TechnicianActivity.class);
                intent.setAction(Intent.ACTION_MAIN);
                intent.addCategory(Intent.CATEGORY_LAUNCHER);
                startActivity(intent);

                application.join(application.getConferenceId(), true);
            }
        });

        Button declineButton = (Button) incomingCallDialog.findViewById(R.id.decline_button);
        declineButton.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                application.sendCNMessage(cnMessage.getFrom(), CNMessage.CNMessageType.AnswerDecline, null);
                currentRingtone.stop();
                callDialog.hide();
            }
        });

        callDialog.setCancelable(false);
        callDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
        //play current Ringtone
        currentRingtone.play();
        callDialog.show();
    } else if (cnMessage.getMessageType() == CNMessage.CNMessageType.Cancel) {
        currentRingtone.stop();
        callDialog.hide();
    } else if (cnMessage.getMessageType() == CNMessage.CNMessageType.EndCall) {
        if (application.leave()) {
            int count = getFragmentManager().getBackStackEntryCount();
            String name = getFragmentManager().getBackStackEntryAt(count - 2).getName();
            getFragmentManager().popBackStack(name, FragmentManager.POP_BACK_STACK_INCLUSIVE);
        }
    }
}

From source file:org.videolan.vlc.AudioService.java

@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
private void showNotification() {
    try {//  w w  w. jav  a  2 s . c om
        Bitmap cover = AudioUtil.getCover(this, mCurrentMedia, 64);
        String title = mCurrentMedia.getTitle();
        String artist = mCurrentMedia.getArtist();
        String album = mCurrentMedia.getAlbum();
        Notification notification;

        // add notification to status bar
        NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
                .setSmallIcon(R.drawable.ic_stat_vlc).setTicker(title + " - " + artist).setAutoCancel(false)
                .setOngoing(true);

        Intent notificationIntent = new Intent(this, AudioPlayerActivity.class);
        notificationIntent.setAction(Intent.ACTION_MAIN);
        notificationIntent.addCategory(Intent.CATEGORY_LAUNCHER);
        notificationIntent.putExtra(START_FROM_NOTIFICATION, true);
        PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent,
                PendingIntent.FLAG_UPDATE_CURRENT);

        if (Util.isJellyBeanOrLater()) {
            Intent iBackward = new Intent(ACTION_REMOTE_BACKWARD);
            Intent iPlay = new Intent(ACTION_REMOTE_PLAYPAUSE);
            Intent iForward = new Intent(ACTION_REMOTE_FORWARD);
            Intent iStop = new Intent(ACTION_REMOTE_STOP);
            PendingIntent piBackward = PendingIntent.getBroadcast(this, 0, iBackward,
                    PendingIntent.FLAG_UPDATE_CURRENT);
            PendingIntent piPlay = PendingIntent.getBroadcast(this, 0, iPlay,
                    PendingIntent.FLAG_UPDATE_CURRENT);
            PendingIntent piForward = PendingIntent.getBroadcast(this, 0, iForward,
                    PendingIntent.FLAG_UPDATE_CURRENT);
            PendingIntent piStop = PendingIntent.getBroadcast(this, 0, iStop,
                    PendingIntent.FLAG_UPDATE_CURRENT);

            RemoteViews view = new RemoteViews(getPackageName(), R.layout.notification);
            if (cover != null)
                view.setImageViewBitmap(R.id.cover, cover);
            view.setTextViewText(R.id.songName, title);
            view.setTextViewText(R.id.artist, artist);
            view.setImageViewResource(R.id.play_pause,
                    mLibVLC.isPlaying() ? R.drawable.ic_pause : R.drawable.ic_play);
            view.setOnClickPendingIntent(R.id.play_pause, piPlay);
            view.setOnClickPendingIntent(R.id.forward, piForward);
            view.setOnClickPendingIntent(R.id.stop, piStop);
            view.setOnClickPendingIntent(R.id.content, pendingIntent);

            RemoteViews view_expanded = new RemoteViews(getPackageName(), R.layout.notification_expanded);
            if (cover != null)
                view_expanded.setImageViewBitmap(R.id.cover, cover);
            view_expanded.setTextViewText(R.id.songName, title);
            view_expanded.setTextViewText(R.id.artist, artist);
            view_expanded.setTextViewText(R.id.album, album);
            view_expanded.setImageViewResource(R.id.play_pause,
                    mLibVLC.isPlaying() ? R.drawable.ic_pause : R.drawable.ic_play);
            view_expanded.setOnClickPendingIntent(R.id.backward, piBackward);
            view_expanded.setOnClickPendingIntent(R.id.play_pause, piPlay);
            view_expanded.setOnClickPendingIntent(R.id.forward, piForward);
            view_expanded.setOnClickPendingIntent(R.id.stop, piStop);
            view_expanded.setOnClickPendingIntent(R.id.content, pendingIntent);

            notification = builder.build();
            notification.contentView = view;
            notification.bigContentView = view_expanded;
        } else {
            builder.setLargeIcon(cover).setContentTitle(title)
                    .setContentText(Util.isJellyBeanOrLater() ? artist : mCurrentMedia.getSubtitle())
                    .setContentInfo(album).setContentIntent(pendingIntent);
            notification = builder.build();
        }

        startForeground(3, notification);
    } catch (NoSuchMethodError e) {
        // Compat library is wrong on 3.2
        // http://code.google.com/p/android/issues/detail?id=36359
        // http://code.google.com/p/android/issues/detail?id=36502
    }
}

From source file:the.joevlc.AudioService.java

private void showNotification() {
    try {/*from w ww. j  a v  a2s.c o m*/
        // add notification to status bar
        NotificationCompat.Builder builder = new NotificationCompat.Builder(this).setSmallIcon(R.drawable.icon)
                .setLargeIcon(AudioUtil.getCover(this, mCurrentMedia, 64))
                .setContentTitle(mCurrentMedia.getTitle())
                .setTicker(mCurrentMedia.getTitle() + " - " + mCurrentMedia.getArtist())
                .setContentText(
                        Util.isJellyBeanOrLater() ? mCurrentMedia.getArtist() : mCurrentMedia.getSubtitle())
                .setContentInfo(mCurrentMedia.getAlbum()).setAutoCancel(false).setOngoing(true);

        Intent notificationIntent = new Intent(this, AudioPlayerActivity.class);
        notificationIntent.setAction(Intent.ACTION_MAIN);
        notificationIntent.addCategory(Intent.CATEGORY_LAUNCHER);
        notificationIntent.putExtra(START_FROM_NOTIFICATION, true);
        PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);

        builder.setContentIntent(pendingIntent);
        startForeground(3, builder.build());
    } catch (NoSuchMethodError e) {
        // Compat library is wrong on 3.2
        // http://code.google.com/p/android/issues/detail?id=36359
        // http://code.google.com/p/android/issues/detail?id=36502
    }
}

From source file:com.saulcintero.moveon.services.MoveOnService.java

private void showNotification() {
    NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
            .setSmallIcon(R.drawable.ic_silhouette).setContentTitle(getString(R.string.app_complete_name))
            .setContentText(getString(R.string.local_service_started)).setOngoing(true);

    Intent notificationIntent = new Intent(mContext, SplashScreen.class);
    notificationIntent.setFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_NEW_TASK);
    notificationIntent.setAction(Intent.ACTION_MAIN);
    notificationIntent.addCategory(Intent.CATEGORY_LAUNCHER);

    PendingIntent pIntent = PendingIntent.getActivity(mContext, NOTIFICATION_ID, notificationIntent, 0);
    builder.setContentIntent(pIntent);//from   w  ww .j a  va  2s .  c o m

    Notification notif = builder.build();
    mNotificationManager.notify(NOTIFICATION_ID, notif);
}

From source file:com.rainmakerlabs.bleepsample.BleepService.java

private void localNotification(String title, String message, Intent notificationIntent, String failMsg,
        int notifyId) {
    if (!testIntent(notificationIntent)) {
        //if (!BleepActivity.isTesting)
        //   return;
        notificationIntent = null;//from  w ww  .  j  av  a 2  s  .c om
        if (!failMsg.equalsIgnoreCase(""))
            message = failMsg;
    }
    if (notificationIntent == null) {
        notificationIntent = new Intent(this, BleepActivity.rootClass);
        // set intent so it does not start a new activity
        notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        notificationIntent.setAction(Intent.ACTION_MAIN);
        notificationIntent.addCategory(Intent.CATEGORY_LAUNCHER);
    }
    PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent,
            PendingIntent.FLAG_UPDATE_CURRENT);

    if (message == null || message.equalsIgnoreCase(""))
        return;
    if (title == null || title.equalsIgnoreCase(""))
        title = getString(R.string.app_name);

    NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
            .setSmallIcon(R.drawable.ic_launcher).setTicker(message).setWhen(System.currentTimeMillis())
            .setAutoCancel(true).setContentTitle(title).setContentText(message).setContentIntent(contentIntent)
            .setDefaults(Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE);

    NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this);
    notificationManager.notify(notifyId, builder.build());
}

From source file:org.videolan.vlc.MediaService.java

@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
private void showNotification() {
    try {//from  w  ww .j  a  v  a2s .  co m
        Bitmap cover = AudioUtil.getCover(this, mCurrentMedia, 64);
        String title = mCurrentMedia.getTitle();
        String artist = mCurrentMedia.getArtist();
        String album = mCurrentMedia.getAlbum();
        Notification notification;

        // add notification to status bar
        NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
                .setSmallIcon(R.drawable.ic_stat_vlc).setTicker(title + " - " + artist).setAutoCancel(false)
                .setOngoing(true);

        Intent notificationIntent = new Intent(this,
                mIsVout ? MediaPlayerActivity.class : AudioPlayerActivity.class);
        notificationIntent.setAction(Intent.ACTION_MAIN);
        notificationIntent.addCategory(Intent.CATEGORY_LAUNCHER);
        notificationIntent.putExtra(START_FROM_NOTIFICATION, true);
        PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent,
                PendingIntent.FLAG_UPDATE_CURRENT);

        if (Util.isJellyBeanOrLater()) {
            Intent iBackward = new Intent(ACTION_REMOTE_BACKWARD);
            Intent iPlay = new Intent(ACTION_REMOTE_PLAYPAUSE);
            Intent iForward = new Intent(ACTION_REMOTE_FORWARD);
            Intent iStop = new Intent(ACTION_REMOTE_STOP);
            PendingIntent piBackward = PendingIntent.getBroadcast(this, 0, iBackward,
                    PendingIntent.FLAG_UPDATE_CURRENT);
            PendingIntent piPlay = PendingIntent.getBroadcast(this, 0, iPlay,
                    PendingIntent.FLAG_UPDATE_CURRENT);
            PendingIntent piForward = PendingIntent.getBroadcast(this, 0, iForward,
                    PendingIntent.FLAG_UPDATE_CURRENT);
            PendingIntent piStop = PendingIntent.getBroadcast(this, 0, iStop,
                    PendingIntent.FLAG_UPDATE_CURRENT);

            RemoteViews view = new RemoteViews(getPackageName(), R.layout.notification);
            if (cover != null)
                view.setImageViewBitmap(R.id.cover, cover);
            view.setTextViewText(R.id.songName, title);
            view.setTextViewText(R.id.artist, artist);
            view.setImageViewResource(R.id.play_pause,
                    mLibVLC.isPlaying() ? R.drawable.ic_pause : R.drawable.ic_play);
            view.setOnClickPendingIntent(R.id.play_pause, piPlay);
            view.setOnClickPendingIntent(R.id.forward, piForward);
            view.setOnClickPendingIntent(R.id.stop, piStop);
            view.setOnClickPendingIntent(R.id.content, pendingIntent);

            RemoteViews view_expanded = new RemoteViews(getPackageName(), R.layout.notification_expanded);
            if (cover != null)
                view_expanded.setImageViewBitmap(R.id.cover, cover);
            view_expanded.setTextViewText(R.id.songName, title);
            view_expanded.setTextViewText(R.id.artist, artist);
            view_expanded.setTextViewText(R.id.album, album);
            view_expanded.setImageViewResource(R.id.play_pause,
                    mLibVLC.isPlaying() ? R.drawable.ic_pause : R.drawable.ic_play);
            view_expanded.setOnClickPendingIntent(R.id.backward, piBackward);
            view_expanded.setOnClickPendingIntent(R.id.play_pause, piPlay);
            view_expanded.setOnClickPendingIntent(R.id.forward, piForward);
            view_expanded.setOnClickPendingIntent(R.id.stop, piStop);
            view_expanded.setOnClickPendingIntent(R.id.content, pendingIntent);

            notification = builder.build();
            notification.contentView = view;
            notification.bigContentView = view_expanded;
        } else {
            builder.setLargeIcon(cover).setContentTitle(title)
                    .setContentText(Util.isJellyBeanOrLater() ? artist : mCurrentMedia.getSubtitle())
                    .setContentInfo(album).setContentIntent(pendingIntent);
            notification = builder.build();
        }

        startForeground(3, notification);
    } catch (NoSuchMethodError e) {
        // Compat library is wrong on 3.2
        // http://code.google.com/p/android/issues/detail?id=36359
        // http://code.google.com/p/android/issues/detail?id=36502
    }
}

From source file:com.trellmor.berrytubechat.ChatActivity.java

private void initService(BerryTubeBinder service) {
    mBinder = service;//from   w  w w.  j  a v  a  2  s. co  m

    if (mCallback == null) {
        createCallback();
    }
    mBinder.getService().setCallback(mCallback);

    mBinder.getService().setChatMsgBufferSize(mScrollback);

    mBinder.getService().setNotification(mNotification);
    mNotification = null;

    if (mChatAdapter == null) {
        mChatAdapter = new ChatMessageAdapter(ChatActivity.this, R.layout.chat_item,
                mBinder.getService().getChatMsgBuffer());
        mListChat.setAdapter(mChatAdapter);
    }

    mChatAdapter.notifyDataSetChanged();
    setNick(mBinder.getService().getNick());
    mDrinkCount = mBinder.getService().getDrinkCount();
    updateDrinkCount();

    if (!mBinder.getService().isConnected()) {
        try {
            // Only connect if we got Username and Password from
            // MainActivity, otherwise wait until BerryTube reconnect
            // normally
            if (mUsername != null && mPassword != null) {
                NotificationCompat.Builder note = new NotificationCompat.Builder(this);
                note.setSmallIcon(R.drawable.ic_stat_notify_berrytube);
                note.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher));
                note.setContentTitle(getString(R.string.title_activity_chat));

                Intent intent = new Intent(this, ChatActivity.class);
                intent.setAction(Intent.ACTION_MAIN);
                intent.addCategory(Intent.CATEGORY_LAUNCHER);
                intent.putExtra(MainActivity.KEY_USERNAME, mUsername);
                intent.putExtra(MainActivity.KEY_PASSWORD, mPassword);
                intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP
                        | Intent.FLAG_ACTIVITY_PREVIOUS_IS_TOP | Intent.FLAG_ACTIVITY_NO_HISTORY);

                note.setContentIntent(
                        PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT));
                mBinder.getService().connect(mUsername, mPassword, note);
            }
        } catch (MalformedURLException e) {
            Log.w(TAG, e);
        } catch (IllegalStateException e) {
            // already connected, ignore
        }
    }
}

From source file:org.mariotaku.twidere.provider.TwidereDataProvider.java

private void displayMentionsNotification(final Context context, final ContentValues[] values) {
    final Resources res = context.getResources();
    final NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
    final boolean display_screen_name = NAME_DISPLAY_OPTION_SCREEN_NAME
            .equals(mPreferences.getString(PREFERENCE_KEY_NAME_DISPLAY_OPTION, NAME_DISPLAY_OPTION_BOTH));
    final boolean display_hires_profile_image = res.getBoolean(R.bool.hires_profile_image);
    final Intent delete_intent = new Intent(BROADCAST_NOTIFICATION_CLEARED);
    final Bundle delete_extras = new Bundle();
    delete_extras.putInt(INTENT_KEY_NOTIFICATION_ID, NOTIFICATION_ID_MENTIONS);
    delete_intent.putExtras(delete_extras);
    final Intent content_intent;
    int notified_count = 0;
    // Add statuses that not filtered to list for future use.
    for (final ContentValues value : values) {
        final ParcelableStatus status = new ParcelableStatus(value);
        if (!isFiltered(mDatabase, status)) {
            mNewMentions.add(status);/*from w ww  . j a  v  a 2 s.c o m*/
            mNewMentionScreenNames.add(status.screen_name);
            mNewMentionAccounts.add(status.account_id);
            notified_count++;
        }
    }
    Collections.sort(mNewMentions);
    final int mentions_size = mNewMentions.size();
    if (notified_count == 0 || mentions_size == 0 || mNewMentionScreenNames.size() == 0)
        return;
    final String title;
    if (mentions_size > 1) {
        builder.setNumber(mentions_size);
    }
    final int screen_names_size = mNewMentionScreenNames.size();
    final ParcelableStatus status = mNewMentions.get(0);
    if (mentions_size == 1) {
        final Uri.Builder uri_builder = new Uri.Builder();
        uri_builder.scheme(SCHEME_TWIDERE);
        uri_builder.authority(AUTHORITY_STATUS);
        uri_builder.appendQueryParameter(QUERY_PARAM_ACCOUNT_ID, String.valueOf(status.account_id));
        uri_builder.appendQueryParameter(QUERY_PARAM_STATUS_ID, String.valueOf(status.status_id));
        content_intent = new Intent(Intent.ACTION_VIEW, uri_builder.build());
    } else {
        content_intent = new Intent(context, HomeActivity.class);
        content_intent.setAction(Intent.ACTION_MAIN);
        content_intent.addCategory(Intent.CATEGORY_LAUNCHER);
        final Bundle content_extras = new Bundle();
        content_extras.putInt(INTENT_KEY_INITIAL_TAB, HomeActivity.TAB_POSITION_MENTIONS);
        content_intent.putExtras(content_extras);
    }
    if (screen_names_size > 1) {
        title = res.getString(R.string.notification_mention_multiple,
                display_screen_name ? "@" + status.screen_name : status.name, screen_names_size - 1);
    } else {
        title = res.getString(R.string.notification_mention,
                display_screen_name ? "@" + status.screen_name : status.name);
    }
    final String profile_image_url_string = status.profile_image_url_string;
    final File profile_image_file = mProfileImageLoader.getCachedImageFile(
            display_hires_profile_image ? getBiggerTwitterProfileImage(profile_image_url_string)
                    : profile_image_url_string);
    final int w = res.getDimensionPixelSize(R.dimen.notification_large_icon_width);
    final int h = res.getDimensionPixelSize(R.dimen.notification_large_icon_height);
    final Bitmap profile_image = profile_image_file != null && profile_image_file.isFile()
            ? BitmapFactory.decodeFile(profile_image_file.getPath())
            : null;
    final Bitmap profile_image_fallback = BitmapFactory.decodeResource(res,
            R.drawable.ic_profile_image_default);
    builder.setLargeIcon(Bitmap
            .createScaledBitmap(profile_image != null ? profile_image : profile_image_fallback, w, h, true));
    buildNotification(builder, title, title, status.text_plain, R.drawable.ic_stat_mention, null,
            content_intent, delete_intent);
    if (mentions_size > 1) {
        final NotificationCompat.InboxStyle style = new NotificationCompat.InboxStyle(builder);
        final int max = Math.min(4, mentions_size);
        for (int i = 0; i < max; i++) {
            final ParcelableStatus s = mNewMentions.get(i);
            final String name = display_screen_name ? "@" + s.screen_name : s.name;
            style.addLine(Html.fromHtml("<b>" + name + "</b>: "
                    + stripMentionText(s.text_plain, getAccountScreenName(context, s.account_id))));
        }
        if (max == 4 && mentions_size - max > 0) {
            style.addLine(context.getString(R.string.and_more, mentions_size - max));
        }
        final StringBuilder summary = new StringBuilder();
        final int accounts_count = mNewMentionAccounts.size();
        if (accounts_count > 0) {
            for (int i = 0; i < accounts_count; i++) {
                final String name = display_screen_name
                        ? "@" + getAccountScreenName(context, mNewMentionAccounts.get(i))
                        : getAccountName(context, mNewMentionAccounts.get(i));
                summary.append(name);
                if (i != accounts_count - 1) {
                    summary.append(", ");
                }
            }
            style.setSummaryText(summary);
        }
        mNotificationManager.notify(NOTIFICATION_ID_MENTIONS, style.build());
    } else {
        final Intent reply_intent = new Intent(INTENT_ACTION_COMPOSE);
        final Bundle bundle = new Bundle();
        final List<String> mentions = new Extractor().extractMentionedScreennames(status.text_plain);
        mentions.remove(status.screen_name);
        mentions.add(0, status.screen_name);
        bundle.putInt(INTENT_KEY_NOTIFICATION_ID, NOTIFICATION_ID_MENTIONS);
        bundle.putStringArray(INTENT_KEY_MENTIONS, mentions.toArray(new String[mentions.size()]));
        bundle.putLong(INTENT_KEY_ACCOUNT_ID, status.account_id);
        bundle.putLong(INTENT_KEY_IN_REPLY_TO_ID, status.status_id);
        bundle.putString(INTENT_KEY_IN_REPLY_TO_SCREEN_NAME, status.screen_name);
        bundle.putString(INTENT_KEY_IN_REPLY_TO_NAME, status.name);
        reply_intent.putExtras(bundle);
        reply_intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        builder.addAction(R.drawable.ic_menu_reply, context.getString(R.string.reply),
                PendingIntent.getActivity(context, 0, reply_intent, PendingIntent.FLAG_UPDATE_CURRENT));
        final NotificationCompat.BigTextStyle style = new NotificationCompat.BigTextStyle(builder);
        style.bigText(stripMentionText(status.text_plain, getAccountScreenName(context, status.account_id)));
        mNotificationManager.notify(NOTIFICATION_ID_MENTIONS, style.build());
    }
}