Example usage for android.graphics Color WHITE

List of usage examples for android.graphics Color WHITE

Introduction

In this page you can find the example usage for android.graphics Color WHITE.

Prototype

int WHITE

To view the source code for android.graphics Color WHITE.

Click Source Link

Usage

From source file:Main.java

public static void customActionBarSearchViewTextColor(SearchView searchView) {
    int id = searchView.getContext().getResources().getIdentifier("android:id/search_src_text", null, null);
    TextView textView = (TextView) searchView.findViewById(id);
    textView.setTextColor(Color.WHITE);
}

From source file:Main.java

public static int getDurationColor(long duration) {
    if (duration < 3 * 3600 * 1000) {
        return Color.RED;
    }/*from  w ww.  j  a v a2s . c o m*/
    if (duration < 12 * 3600 * 1000) {
        return Color.YELLOW;
    }
    if (duration < 24 * 3600 * 1000) {
        return Color.GREEN;
    }
    return Color.WHITE;
}

From source file:Main.java

public static int getLongDurationColor(long duration) {
    if (duration < 24 * 3600 * 1000) {
        return Color.RED;
    }//  www  .  j a  v  a2  s . c o m
    if (duration < 2 * 24 * 3600 * 1000) {
        return Color.YELLOW;
    }
    if (duration < 7 * 24 * 3600 * 1000) {
        return Color.GREEN;
    }
    return Color.WHITE;
}

From source file:Main.java

public static Bitmap addPadding(@NonNull Bitmap bmp) {

    int biggerParam = Math.max(bmp.getWidth(), bmp.getHeight());
    Bitmap bitmap = Bitmap.createBitmap(biggerParam, biggerParam, bmp.getConfig());
    Canvas canvas = new Canvas(bitmap);
    canvas.drawColor(Color.WHITE);

    int top = bmp.getHeight() > bmp.getWidth() ? 0 : (bmp.getWidth() - bmp.getHeight()) / 2;
    int left = bmp.getWidth() > bmp.getHeight() ? 0 : (bmp.getHeight() - bmp.getWidth()) / 2;

    canvas.drawBitmap(bmp, left, top, null);
    return bitmap;
}

From source file:Main.java

/**
 * Gets the background color for light theme progress bar.
 * @param toolbarColor The color of the toolbar.
 * @return The color of the progress bar in light theme, given the toolbar color.
 *//*from   w w w . ja  v a 2s.co  m*/
public static int getLightProgressbarBackground(int toolbarColor) {
    return getColorWithOverlay(Color.WHITE, toolbarColor, LIGHT_PROGRESSBAR_BACKGROUND_ALPHA);
}

From source file:Main.java

public final static int getCategoryDefaultBG(String category) {
    switch (category) {
    case "boardingPass":
        return 0xFF3d73e9;

    case "eventTicket":
        return 0xFF9f3dd0;

    case "coupon":
        return 0xFF9ccb05;

    case "storeCard":
        return 0xFFf29b21;

    case "generic":
        return 0xFFea3c48;

    default:/*from ww  w .  j  av  a2s  . c om*/
        return Color.WHITE;
    }

}

From source file:Main.java

/**
 * @return The base color for the textbox given a toolbar background color.
 *//*from w w w.  j  a  va2s . c om*/
public static int getTextBoxColorForToolbarBackground(int color) {
    if (shouldUseOpaqueTextboxBackground(color))
        return Color.WHITE;
    return getColorWithOverlay(Color.WHITE, color, LOCATION_BAR_TRANSPARENT_BACKGROUND_ALPHA);
}

From source file:Main.java

public static int lighten(int color) {
    double r = Color.red(color);
    double g = Color.green(color);
    double b = Color.blue(color);

    r *= 1.1;/*w w  w.j a  v  a  2s. c  o  m*/
    g *= 1.1;
    b *= 1.1;

    double threshold = 255.999;
    double max = Math.max(r, Math.max(g, b));

    if (max > threshold) {
        double total = r + g + b;
        if (total >= 3 * threshold)
            return Color.WHITE;

        double x = (3 * threshold - total) / (3 * max - total);
        double gray = threshold - x * max;

        r = gray + x * r;
        g = gray + x * g;
        b = gray + x * b;
    }

    return Color.argb(255, (int) r, (int) g, (int) b);
}

From source file:Main.java

public static Bitmap circleBitmap(final Bitmap source) {
    int width = source.getWidth();
    int height = source.getHeight();

    Paint paint = new Paint();
    paint.setAntiAlias(true);//from  w w  w  .j  a  v  a  2s.  co m
    paint.setColor(Color.WHITE);

    Bitmap clipped = Bitmap.createBitmap(width, height, Config.ARGB_8888);
    Canvas canvas = new Canvas(clipped);
    final float radius = width > height ? height / 2 : width / 2;
    canvas.drawCircle(width / 2, height / 2, radius, paint);
    paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));

    Bitmap rounded = Bitmap.createBitmap(width, height, Config.ARGB_8888);
    canvas = new Canvas(rounded);
    canvas.drawBitmap(source, 0, 0, null);
    canvas.drawBitmap(clipped, 0, 0, paint);

    source.recycle();
    clipped.recycle();

    return rounded;
}

From source file:Main.java

public static int getIntPref(Context context, String key) {
    int i = 0;/*  w  w w .j a  va  2 s . c  o  m*/
    if (key.contains("picker")) {
        int intColor = context.getSharedPreferences(THEME_PREFS, 0).getInt(key, Color.WHITE);
        i = intColor;
    }
    return i;
}