Example usage for android.app Notification COLOR_DEFAULT

List of usage examples for android.app Notification COLOR_DEFAULT

Introduction

In this page you can find the example usage for android.app Notification COLOR_DEFAULT.

Prototype

int COLOR_DEFAULT

To view the source code for android.app Notification COLOR_DEFAULT.

Click Source Link

Document

Special value of #color telling the system not to decorate this notification with any special color but instead use default colors when presenting this notification.

Usage

From source file:android.support.car.ui.CarNavExtender.java

/**
 * Reconstruct a CarNavExtender from an existing notification. Can be used to retrieve values.
 *
 * @param notification The notification to retrieve the values from.
 *//*from w ww. j av  a 2s.  c o  m*/
public CarNavExtender(@NonNull Notification notification) {
    Bundle extras = NotificationCompat.getExtras(notification);
    if (extras == null) {
        return;
    }
    Bundle b = extras.getBundle(EXTRA_CAR_EXTENDER);
    if (b == null) {
        return;
    }

    mIsExtended = b.getBoolean(EXTRA_IS_EXTENDED);
    mContentId = (Long) b.getSerializable(EXTRA_CONTENT_ID);
    // The ternary guarantees that we return either TYPE_HERO or TYPE_NORMAL.
    mType = (b.getInt(EXTRA_TYPE, TYPE_NORMAL) == TYPE_HERO) ? TYPE_HERO : TYPE_NORMAL;
    mContentTitle = b.getCharSequence(Notification.EXTRA_TITLE);
    mContentText = b.getCharSequence(Notification.EXTRA_TEXT);
    mSubText = b.getCharSequence(EXTRA_SUB_TEXT);
    mLargeIcon = b.getParcelable(Notification.EXTRA_LARGE_ICON);
    mActionIcon = b.getInt(EXTRA_ACTION_ICON);
    mContentIntent = b.getParcelable(EXTRA_CONTENT_INTENT);
    mColor = b.getInt(EXTRA_COLOR, Notification.COLOR_DEFAULT);
    mNightColor = b.getInt(EXTRA_NIGHT_COLOR, Notification.COLOR_DEFAULT);
    mShowInStream = b.getBoolean(EXTRA_STREAM_VISIBILITY, true);
    mShowAsHeadsUp = b.getBoolean(EXTRA_HEADS_UP_VISIBILITY);
    mIgnoreInStream = b.getBoolean(EXTRA_IGNORE_IN_STREAM);
}

From source file:com.simplecity.amp_library.utils.color.ColorHelper.java

private static boolean shouldUseDark(int backgroundColor) {
    boolean useDark = backgroundColor == Notification.COLOR_DEFAULT;
    if (!useDark) {
        useDark = ColorUtilsFromCompat.calculateLuminance(backgroundColor) > 0.5;
    }/*from w  w  w. j ava 2 s .co m*/
    return useDark;
}

From source file:tk.wasdennnoch.androidn_ify.utils.NotificationColorUtil.java

/**
 * Resolves {@param color} to an actual color if it is {@link Notification#COLOR_DEFAULT}
 *///from  w  ww  .  j  av  a 2 s  .  c  om
public static int resolveColor(int color) {
    if (color == Notification.COLOR_DEFAULT) {
        return mContext.getResources().getColor(R.color.notification_default_color);
    }
    return color;
}