Example usage for android.content.res Resources getBoolean

List of usage examples for android.content.res Resources getBoolean

Introduction

In this page you can find the example usage for android.content.res Resources getBoolean.

Prototype

public boolean getBoolean(@BoolRes int id) throws NotFoundException 

Source Link

Document

Return a boolean associated with a particular resource ID.

Usage

From source file:uk.co.senab.photup.model.PhotoUpload.java

public Bitmap getThumbnailImage(Context context) {
    if (ContentResolver.SCHEME_CONTENT.equals(getOriginalPhotoUri().getScheme())) {
        return getThumbnailImageFromMediaStore(context);
    }/*from   w w  w .  j a v a2s . c  o  m*/

    final Resources res = context.getResources();
    int size = res.getBoolean(R.bool.load_mini_thumbnails) ? MINI_THUMBNAIL_SIZE : MICRO_THUMBNAIL_SIZE;
    if (size == MINI_THUMBNAIL_SIZE && res.getBoolean(R.bool.sample_mini_thumbnails)) {
        size /= 2;
    }

    try {
        Bitmap bitmap = Utils.decodeImage(context.getContentResolver(), getOriginalPhotoUri(), size);
        bitmap = Utils.rotate(bitmap, getExifRotation(context));
        return bitmap;
    } catch (FileNotFoundException e) {
        e.printStackTrace();
        return null;
    }
}

From source file:uk.co.senab.photup.model.PhotoUpload.java

private Bitmap getThumbnailImageFromMediaStore(Context context) {
    Resources res = context.getResources();

    final int kind = res.getBoolean(R.bool.load_mini_thumbnails) ? Thumbnails.MINI_KIND : Thumbnails.MICRO_KIND;

    BitmapFactory.Options opts = null;/* w  w w. j  ava 2 s .  c  o  m*/
    if (kind == Thumbnails.MINI_KIND && res.getBoolean(R.bool.sample_mini_thumbnails)) {
        opts = new BitmapFactory.Options();
        opts.inSampleSize = 2;
    }

    try {
        final long id = Long.parseLong(getOriginalPhotoUri().getLastPathSegment());

        Bitmap bitmap = Thumbnails.getThumbnail(context.getContentResolver(), id, kind, opts);
        bitmap = Utils.rotate(bitmap, getExifRotation(context));
        return bitmap;
    } catch (Exception e) {
        if (Flags.DEBUG) {
            e.printStackTrace();
        }
        return null;
    }
}

From source file:com.chen.mail.ui.NestedFolderTeaserView.java

public NestedFolderTeaserView(final Context context, final AttributeSet attrs, final int defStyle) {
    super(context, attrs, defStyle);

    final Resources resources = context.getResources();

    if (sCollapsedFolderThreshold < 0) {
        sCollapsedFolderThreshold = resources.getInteger(R.integer.nested_folders_collapse_threshold);
    }/* w ww.jav a2 s .  com*/

    mFolderItemUpdateDelayMs = resources.getInteger(R.integer.folder_item_refresh_delay_ms);

    mTabletDevice = Utils.useTabletUI(resources);
    mListCollapsible = resources.getBoolean(R.bool.list_collapsible);
}

From source file:com.example.ray.firstapp.bottombar.BottomBar.java

private static void navBarMagic(Activity activity, final BottomBar bottomBar) {
    Resources res = activity.getResources();
    int softMenuIdentifier = res.getIdentifier("config_showNavigationBar", "bool", "android");
    int navBarIdentifier = res.getIdentifier("navigation_bar_height", "dimen", "android");
    int navBarHeight = 0;

    if (navBarIdentifier > 0) {
        navBarHeight = res.getDimensionPixelSize(navBarIdentifier);
    }// ww  w  .  j  a v  a2s. co  m

    if (!bottomBar.drawBehindNavBar() || navBarHeight == 0
            || (!(softMenuIdentifier > 0 && res.getBoolean(softMenuIdentifier)))) {
        return;
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH
            && ViewConfiguration.get(activity).hasPermanentMenuKey()) {
        return;
    }

    /**
     * Copy-paste coding made possible by:
     * http://stackoverflow.com/a/14871974/940036
     */
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        Display d = activity.getWindowManager().getDefaultDisplay();

        DisplayMetrics realDisplayMetrics = new DisplayMetrics();
        d.getRealMetrics(realDisplayMetrics);

        int realHeight = realDisplayMetrics.heightPixels;
        int realWidth = realDisplayMetrics.widthPixels;

        DisplayMetrics displayMetrics = new DisplayMetrics();
        d.getMetrics(displayMetrics);

        int displayHeight = displayMetrics.heightPixels;
        int displayWidth = displayMetrics.widthPixels;

        boolean hasSoftwareKeys = (realWidth - displayWidth) > 0 || (realHeight - displayHeight) > 0;

        if (!hasSoftwareKeys) {
            return;
        }
    }
    /**
     * End of delicious copy-paste code
     */

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT
            && res.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
        activity.getWindow().getAttributes().flags |= WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION;

        if (bottomBar.useTopOffset()) {
            int offset;
            int statusBarResource = res.getIdentifier("status_bar_height", "dimen", "android");

            if (statusBarResource > 0) {
                offset = res.getDimensionPixelSize(statusBarResource);
            } else {
                offset = MiscUtils.dpToPixel(activity, 25);
            }

            if (!bottomBar.useOnlyStatusbarOffset()) {
                TypedValue tv = new TypedValue();
                if (activity.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) {
                    offset += TypedValue.complexToDimensionPixelSize(tv.data, res.getDisplayMetrics());
                } else {
                    offset += MiscUtils.dpToPixel(activity, 56);
                }
            }

            bottomBar.getUserContainer().setPadding(0, offset, 0, 0);
        }

        final View outerContainer = bottomBar.getOuterContainer();
        final int navBarHeightCopy = navBarHeight;
        bottomBar.getViewTreeObserver()
                .addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
                    @SuppressWarnings("deprecation")
                    @Override
                    public void onGlobalLayout() {
                        bottomBar.shyHeightAlreadyCalculated();

                        int newHeight = outerContainer.getHeight() + navBarHeightCopy;
                        outerContainer.getLayoutParams().height = newHeight;

                        if (bottomBar.isShy()) {
                            int defaultOffset = bottomBar.useExtraOffset() ? navBarHeightCopy : 0;
                            bottomBar.setTranslationY(defaultOffset);
                            ((CoordinatorLayout.LayoutParams) bottomBar.getLayoutParams())
                                    .setBehavior(new BottomNavigationBehavior(newHeight, defaultOffset));
                        }

                        ViewTreeObserver obs = outerContainer.getViewTreeObserver();

                        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
                            obs.removeOnGlobalLayoutListener(this);
                        } else {
                            obs.removeGlobalOnLayoutListener(this);
                        }
                    }
                });
    }
}

From source file:com.androtex.viewpagerindicator.CirclePageIndicator.java

public CirclePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    //Load defaults from resources
    final Resources res = getResources();
    final int defaultFillColor = res.getColor(R.color.default_circle_indicator_fill_color);
    final int defaultOrientation = res.getInteger(R.integer.default_circle_indicator_orientation);
    final int defaultStrokeColor = res.getColor(R.color.default_circle_indicator_stroke_color);
    final float defaultStrokeWidth = res.getDimension(R.dimen.default_circle_indicator_stroke_width);
    final float defaultRadius = res.getDimension(R.dimen.default_circle_indicator_radius);
    final boolean defaultCentered = res.getBoolean(R.bool.default_circle_indicator_centered);
    final boolean defaultSnap = res.getBoolean(R.bool.default_circle_indicator_snap);

    //Retrieve styles attributes
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CirclePageIndicator, defStyle,
            R.style.Widget_CirclePageIndicator);

    mCentered = a.getBoolean(R.styleable.CirclePageIndicator_centered, defaultCentered);
    mOrientation = a.getInt(R.styleable.CirclePageIndicator_orientation, defaultOrientation);
    mPaintStroke = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPaintStroke.setStyle(Style.STROKE);
    mPaintStroke.setColor(a.getColor(R.styleable.CirclePageIndicator_strokeColor, defaultStrokeColor));
    mPaintStroke/*  w  w w . ja v  a  2s  . c om*/
            .setStrokeWidth(a.getDimension(R.styleable.CirclePageIndicator_strokeWidth, defaultStrokeWidth));
    mPaintFill = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPaintFill.setStyle(Style.FILL);
    mPaintFill.setColor(a.getColor(R.styleable.CirclePageIndicator_fillColor, defaultFillColor));
    mRadius = a.getDimension(R.styleable.CirclePageIndicator_radius, defaultRadius);
    mSnap = a.getBoolean(R.styleable.CirclePageIndicator_snap, defaultSnap);

    a.recycle();
}

From source file:com.moblin.cellcomsms.utils.CirclePageIndicator.java

public CirclePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    // Load defaults from resources
    final Resources res = getResources();
    final int defaultFillColor = res.getColor(R.color.default_circle_indicator_fill_color);
    final int defaultOrientation = res.getInteger(R.integer.default_circle_indicator_orientation);
    final int defaultStrokeColor = res.getColor(R.color.default_circle_indicator_stroke_color);
    final float defaultStrokeWidth = res.getDimension(R.dimen.default_circle_indicator_stroke_width);
    final float defaultRadius = res.getDimension(R.dimen.default_circle_indicator_radius);
    final boolean defaultCentered = res.getBoolean(R.bool.default_circle_indicator_centered);
    final boolean defaultSnap = res.getBoolean(R.bool.default_circle_indicator_snap);

    // Retrieve styles attributes
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CirclePageIndicator, defStyle,
            R.style.Widget_CirclePageIndicator);

    mCentered = a.getBoolean(R.styleable.CirclePageIndicator_centered, defaultCentered);
    mOrientation = a.getInt(R.styleable.CirclePageIndicator_orientation, defaultOrientation);
    mPaintStroke = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPaintStroke.setStyle(Style.FILL_AND_STROKE);
    mPaintStroke.setColor(a.getColor(R.styleable.CirclePageIndicator_strokeColor, defaultStrokeColor));
    mPaintStroke// w ww  . j a va  2 s .c  o  m
            .setStrokeWidth(a.getDimension(R.styleable.CirclePageIndicator_strokeWidth, defaultStrokeWidth));
    mPaintFill = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPaintFill.setStyle(Style.FILL);
    mPaintFill.setColor(a.getColor(R.styleable.CirclePageIndicator_fillColor, defaultFillColor));
    mRadius = a.getDimension(R.styleable.CirclePageIndicator_radius, defaultRadius);
    mSnap = a.getBoolean(R.styleable.CirclePageIndicator_snap, defaultSnap);

    a.recycle();
}

From source file:com.joy.ui.view.banner.indicator.CircleIndicator.java

public CircleIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode()) {
        return;// w  w  w .j  a va 2 s .  co  m
    }
    // Load defaults from resources
    final Resources res = getResources();
    final int defaultPageColor = res.getColor(R.color.default_circle_indicator_page_color);
    final int defaultFillColor = res.getColor(R.color.default_circle_indicator_fill_color);
    final int defaultStrokeColor = res.getColor(R.color.default_circle_indicator_stroke_color);
    final float defaultStrokeWidth = res.getDimension(R.dimen.default_circle_indicator_stroke_width);
    final float defaultRadius = res.getDimension(R.dimen.default_circle_indicator_radius);
    final boolean defaultSnap = res.getBoolean(R.bool.default_circle_indicator_snap);

    // Retrieve styles attributes
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CircleIndicator, defStyle, 0);

    mPaintPageFill.setStyle(Style.FILL);
    mPaintPageFill.setColor(a.getColor(R.styleable.CircleIndicator_pageColor, defaultPageColor));
    mPaintStroke.setStyle(Style.STROKE);
    mPaintStroke.setColor(a.getColor(R.styleable.CircleIndicator_strokeColor, defaultStrokeColor));
    mPaintStroke.setStrokeWidth(a.getDimension(R.styleable.CircleIndicator_strokeWidth, defaultStrokeWidth));
    mPaintFill.setStyle(Style.FILL);
    mPaintFill.setColor(a.getColor(R.styleable.CircleIndicator_fillColor, defaultFillColor));
    mRadius = a.getDimension(R.styleable.CircleIndicator_radius, defaultRadius);
    mSnap = a.getBoolean(R.styleable.CircleIndicator_snap, defaultSnap);
    a.recycle();

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
}

From source file:com.lovebridge.library.view.viewpagerindicator.LinePageIndicator.java

public LinePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode())
        return;/*from  w  w  w.  ja v  a  2  s.c  o m*/
    final Resources res = getResources();
    // Load defaults from resources
    final int defaultSelectedColor = res.getColor(R.color.default_line_indicator_selected_color);
    final int defaultUnselectedColor = res.getColor(R.color.default_line_indicator_unselected_color);
    final float defaultLineWidth = res.getDimension(R.dimen.default_line_indicator_line_width);
    final float defaultGapWidth = res.getDimension(R.dimen.default_line_indicator_gap_width);
    final float defaultStrokeWidth = res.getDimension(R.dimen.default_line_indicator_stroke_width);
    final boolean defaultCentered = res.getBoolean(R.bool.default_line_indicator_centered);
    // Retrieve styles attributes
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.LinePageIndicator, defStyle, 0);
    mCentered = a.getBoolean(R.styleable.LinePageIndicator_centered, defaultCentered);
    mLineWidth = a.getDimension(R.styleable.LinePageIndicator_lineWidth, defaultLineWidth);
    mGapWidth = a.getDimension(R.styleable.LinePageIndicator_gapWidth, defaultGapWidth);
    setStrokeWidth(a.getDimension(R.styleable.LinePageIndicator_strokeWidth, defaultStrokeWidth));
    mPaintUnselected
            .setColor(a.getColor(R.styleable.LinePageIndicator_unselectedColor, defaultUnselectedColor));
    mPaintSelected.setColor(a.getColor(R.styleable.LinePageIndicator_selectedColor, defaultSelectedColor));
    Drawable background = a.getDrawable(R.styleable.LinePageIndicator_android_background);
    if (background != null) {
        setBackgroundDrawable(background);
    }
    a.recycle();
    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
}

From source file:com.zxl.easyapp.ui.viewpagerindicator.CirclePageIndicator.java

public CirclePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode())
        return;//from   w  ww .j  a  va2 s . co m
    //Load defaults from resources
    final Resources res = getResources();
    final int defaultPageColor = Color.TRANSPARENT;
    final int defaultFillColor = res.getColor(R.color.red_ff4848);
    final int defaultOrientation = res.getInteger(R.integer.default_circle_indicator_orientation);
    final int defaultStrokeColor = res.getColor(R.color.gray_ddd);
    final float defaultStrokeWidth = res.getDimension(R.dimen.dp1);
    final float defaultRadius = res.getDimension(R.dimen.dp3);
    final boolean defaultCentered = res.getBoolean(R.bool.default_circle_indicator_centered);
    final boolean defaultSnap = res.getBoolean(R.bool.default_circle_indicator_snap);
    //Retrieve styles attributes
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CirclePageIndicator, defStyle, 0);
    mCentered = a.getBoolean(R.styleable.CirclePageIndicator_centered, defaultCentered);
    mOrientation = a.getInt(R.styleable.CirclePageIndicator_android_orientation, defaultOrientation);
    mPaintPageFill.setStyle(Style.FILL);
    mPaintPageFill.setColor(a.getColor(R.styleable.CirclePageIndicator_pageColor, defaultPageColor));
    mPaintStroke.setStyle(Style.STROKE);
    mPaintStroke.setColor(a.getColor(R.styleable.CirclePageIndicator_strokeColor, defaultStrokeColor));
    mPaintStroke
            .setStrokeWidth(a.getDimension(R.styleable.CirclePageIndicator_strokeWidth, defaultStrokeWidth));
    mPaintFill.setStyle(Style.FILL);
    mPaintFill.setColor(a.getColor(R.styleable.CirclePageIndicator_fillColor, defaultFillColor));
    mRadius = a.getDimension(R.styleable.CirclePageIndicator_radius, defaultRadius);
    mSnap = a.getBoolean(R.styleable.CirclePageIndicator_snap, defaultSnap);
    Drawable background = a.getDrawable(R.styleable.CirclePageIndicator_android_background);
    if (background != null) {
        setBackgroundDrawable(background);
    }
    a.recycle();
    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
}

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

private void onNewItemsInserted(final Uri uri, final int count, final ContentValues... values) {
    if (uri == null || values == null || values.length == 0 || count == 0)
        return;//from  w w w  .j av a2s  .  c  om
    if ("false".equals(uri.getQueryParameter(QUERY_PARAM_NOTIFY)))
        return;
    final Context context = getContext();
    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);
    switch (getTableId(uri)) {
    case URI_STATUSES: {
        if (!mPreferences.getBoolean(PREFERENCE_KEY_NOTIFICATION_ENABLE_HOME_TIMELINE, false))
            return;
        final String message = res.getQuantityString(R.plurals.Ntweets, mNewStatusesCount, mNewStatusesCount);
        final Intent delete_intent = new Intent(BROADCAST_NOTIFICATION_CLEARED);
        final Bundle delete_extras = new Bundle();
        delete_extras.putInt(INTENT_KEY_NOTIFICATION_ID, NOTIFICATION_ID_HOME_TIMELINE);
        delete_intent.putExtras(delete_extras);
        final Intent 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_HOME);
        content_intent.putExtras(content_extras);
        builder.setOnlyAlertOnce(true);
        final Notification notification = buildNotification(builder, res.getString(R.string.new_notifications),
                message, message, R.drawable.ic_stat_tweet, null, content_intent, delete_intent);
        mNotificationManager.notify(NOTIFICATION_ID_HOME_TIMELINE, notification);
        break;
    }
    case URI_MENTIONS: {
        if (!mPreferences.getBoolean(PREFERENCE_KEY_NOTIFICATION_ENABLE_MENTIONS, false))
            return;
        if (mNewMentionsCount > 1) {
            builder.setNumber(mNewMentionsCount);
        }
        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;
        final List<String> screen_names = new NoDuplicatesArrayList<String>();
        ContentValues notification_value = null;
        int notified_count = 0;
        for (final ContentValues value : values) {
            final String screen_name = value.getAsString(Statuses.SCREEN_NAME);
            if (!isFiltered(mDatabase, screen_name, value.getAsString(Statuses.SOURCE),
                    value.getAsString(Statuses.TEXT_PLAIN))) {
                if (notification_value == null) {
                    notification_value = value;
                }
                screen_names.add(screen_name);
                notified_count++;
            }
        }
        if (notified_count == 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,
                    notification_value.getAsString(Statuses.ACCOUNT_ID));
            uri_builder.appendQueryParameter(QUERY_PARAM_STATUS_ID,
                    notification_value.getAsString(Statuses.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 (notification_value == null)
            return;
        final String title;
        if (screen_names.size() > 1) {
            title = res.getString(R.string.notification_mention_multiple,
                    display_screen_name ? notification_value.getAsString(Statuses.SCREEN_NAME)
                            : notification_value.getAsString(Statuses.NAME),
                    screen_names.size() - 1);
        } else {
            title = res.getString(R.string.notification_mention,
                    display_screen_name ? notification_value.getAsString(Statuses.SCREEN_NAME)
                            : notification_value.getAsString(Statuses.NAME));
        }
        final String message = notification_value.getAsString(Statuses.TEXT_PLAIN);
        final String profile_image_url_string = notification_value.getAsString(Statuses.PROFILE_IMAGE_URL);
        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);
        builder.setLargeIcon(Bitmap.createScaledBitmap(profile_image_file != null && profile_image_file.isFile()
                ? BitmapFactory.decodeFile(profile_image_file.getPath())
                : BitmapFactory.decodeResource(res, R.drawable.ic_profile_image_default), w, h, true));
        final Notification notification = buildNotification(builder, title, title, message,
                R.drawable.ic_stat_mention, null, content_intent, delete_intent);
        mNotificationManager.notify(NOTIFICATION_ID_MENTIONS, notification);
        break;
    }
    case URI_DIRECT_MESSAGES_INBOX: {
        if (!mPreferences.getBoolean(PREFERENCE_KEY_NOTIFICATION_ENABLE_DIRECT_MESSAGES, false))
            return;
        if (mNewMessagesCount > 1) {
            builder.setNumber(mNewMessagesCount);
        }
        final List<String> screen_names = new NoDuplicatesArrayList<String>();
        final ContentValues notification_value = values[0];
        for (final ContentValues value : values) {
            screen_names.add(value.getAsString(DirectMessages.SENDER_SCREEN_NAME));
        }
        if (notification_value == null)
            return;
        final String title;
        if (screen_names.size() > 1) {
            title = res.getString(R.string.notification_direct_message_multiple,
                    display_screen_name ? notification_value.getAsString(DirectMessages.SENDER_SCREEN_NAME)
                            : notification_value.getAsString(DirectMessages.SENDER_NAME),
                    screen_names.size() - 1);
        } else {
            title = res.getString(R.string.notification_direct_message,
                    display_screen_name ? notification_value.getAsString(DirectMessages.SENDER_SCREEN_NAME)
                            : notification_value.getAsString(DirectMessages.SENDER_NAME));
        }
        final String message = notification_value.getAsString(DirectMessages.TEXT_PLAIN);
        final String profile_image_url_string = notification_value
                .getAsString(DirectMessages.SENDER_PROFILE_IMAGE_URL);
        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);
        builder.setLargeIcon(Bitmap.createScaledBitmap(profile_image_file != null && profile_image_file.isFile()
                ? BitmapFactory.decodeFile(profile_image_file.getPath())
                : BitmapFactory.decodeResource(res, R.drawable.ic_profile_image_default), w, h, true));
        final Intent delete_intent = new Intent(BROADCAST_NOTIFICATION_CLEARED);
        final Bundle delete_extras = new Bundle();
        delete_extras.putInt(INTENT_KEY_NOTIFICATION_ID, NOTIFICATION_ID_DIRECT_MESSAGES);
        delete_intent.putExtras(delete_extras);
        final Intent content_intent;
        if (values.length == 1) {
            final Uri.Builder uri_builder = new Uri.Builder();
            final long account_id = notification_value.getAsLong(DirectMessages.ACCOUNT_ID);
            final long conversation_id = notification_value.getAsLong(DirectMessages.SENDER_ID);
            uri_builder.scheme(SCHEME_TWIDERE);
            uri_builder.authority(AUTHORITY_DIRECT_MESSAGES_CONVERSATION);
            uri_builder.appendQueryParameter(QUERY_PARAM_ACCOUNT_ID, String.valueOf(account_id));
            uri_builder.appendQueryParameter(QUERY_PARAM_CONVERSATION_ID, String.valueOf(conversation_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_MESSAGES);
            content_intent.putExtras(content_extras);
        }
        final Notification notification = buildNotification(builder, title, title, message,
                R.drawable.ic_stat_direct_message, null, content_intent, delete_intent);
        mNotificationManager.notify(NOTIFICATION_ID_DIRECT_MESSAGES, notification);
        break;
    }
    }
}