List of usage examples for android.graphics Color WHITE
int WHITE
To view the source code for android.graphics Color WHITE.
Click Source Link
From source file:Main.java
/** * Creates the Paint object for drawing the crop window guidelines. * /*from w w w .j av a 2 s .co m*/ * @return the new Paint object */ public static Paint newRotateBottomImagePaint() { final Paint paint = new Paint(); paint.setColor(Color.WHITE); paint.setStrokeWidth(3); return paint; }
From source file:Main.java
public static int getHeaderBackgroundColor(View convertView, String header) { if (colorMap == null) { colorMap = new HashMap<>(); // colorMap.put("grocery_or_supermarket", convertView.getResources().getColor(R.color.grocery_or_supermarket)); // colorMap.put("hardware_store",convertView.getResources().getColor(R.color.hardware_store)); // colorMap.put("clothing_store",convertView.getResources().getColor(R.color.clothing_store)); // colorMap.put(Constants.UNCATEGORIZED,convertView.getResources().getColor(R.color.uncategorized)); // colorMap.put(Constants.GOOGLE_CALENDAR_CATEGORY,convertView.getResources().getColor(R.color.google_calendar)); }//from w w w . j a va2s.c om if (colorMap.get(header) == null) return Color.WHITE; return colorMap.get(header); }
From source file:Main.java
public static void applyDialogStyle(ViewGroup viewGroup) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { return;//from w w w. j a v a 2s. c o m } viewGroup.setBackgroundColor(Color.BLACK); // Theme.AppCompat.Light makes all text and background black final int childCount = viewGroup.getChildCount(); for (int i = 0; i < childCount; i++) { View childView = viewGroup.getChildAt(i); if (childView instanceof ListView) { childView.setBackgroundColor(Color.LTGRAY); } else if (childView instanceof ViewGroup) { applyDialogStyle((ViewGroup) childView); } else if (childView instanceof TextView) { ((TextView) childView).setTextColor(Color.WHITE); } } }
From source file:Main.java
public static Bitmap drawTextCenterToBitmap(Bitmap bitmap, String text, int textSize, int textColor) { android.graphics.Bitmap.Config bitmapConfig = bitmap.getConfig(); // set default bitmap config if none if (bitmapConfig == null) { bitmapConfig = android.graphics.Bitmap.Config.ARGB_8888; }/* w w w.j a v a 2 s .c o m*/ // resource bitmaps are imutable, // so we need to convert it to mutable one bitmap = bitmap.copy(bitmapConfig, true); Canvas canvas = new Canvas(bitmap); // new antialised Paint Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); // text color - #3D3D3D paint.setColor(textColor); // text size in pixels paint.setTextSize(textSize); // text shadow paint.setShadowLayer(1f, 0f, 1f, Color.WHITE); // draw text to the Canvas center Rect bounds = new Rect(); paint.getTextBounds(text, 0, text.length(), bounds); //int x = (bitmap.getWidth() - bounds.width()) / 2; //int y = (bitmap.getHeight() + bounds.height()) / 2; //draw text to the bottom int x = (bitmap.getWidth() - bounds.width()) / 10 * 5; int y = (bitmap.getHeight() + bounds.height()) / 10 * 5; canvas.drawText(text, x, y, paint); return bitmap; }
From source file:Main.java
public static BitmapDrawable writeOnDrawable(Activity actv, Resources res, int drawableId, String text, int textSize) { Bitmap bm = BitmapFactory.decodeResource(res, drawableId).copy(Bitmap.Config.ARGB_8888, true); DisplayMetrics dm = new DisplayMetrics(); actv.getWindowManager().getDefaultDisplay().getMetrics(dm); int pixelSize = (int) ((textSize * dm.scaledDensity)); if (text.length() > 2) { pixelSize = (int) ((textSize * dm.scaledDensity) * (0.5 - (text.length() / 10))); }//w ww. j a va 2 s . c om Paint paint = new Paint(); paint.setStyle(Style.FILL); paint.setColor(Color.WHITE); paint.setTextSize(pixelSize); paint.setTextAlign(Paint.Align.CENTER); // float adjust = paint.measureText(text); Canvas canvas = new Canvas(bm); int xPos = (int) ((bm.getWidth() / 2)); int yPos = (int) ((bm.getHeight() / 2) - ((paint.descent() + paint.ascent()) / 2)); canvas.drawText(text, xPos, yPos, paint); return new BitmapDrawable(res, bm); }
From source file:Main.java
public static PopupWindow showPopWindow(Context context, View targetView, View contentView, Integer width) { PopupWindow popupWindow = null;/*w w w . j a va 2 s.c o m*/ popupWindow = new PopupWindow(contentView, -2, -2); popupWindow.setBackgroundDrawable(new ColorDrawable(Color.WHITE)); if (width != null) { popupWindow.setWidth(width); } popupWindow.setOutsideTouchable(true); popupWindow.showAsDropDown(targetView); return popupWindow; }
From source file:Main.java
public static PopupWindow showPopWindow2(Context context, View targetView, View contentView, Integer width) { PopupWindow popupWindow = null;//from www .j ava2 s . com popupWindow = new PopupWindow(contentView, -2, -2); popupWindow.setBackgroundDrawable(new ColorDrawable(Color.WHITE)); if (width != null) { popupWindow.setWidth(width); } popupWindow.setOutsideTouchable(true); popupWindow.showAtLocation(targetView, Gravity.BOTTOM, 0, 0); return popupWindow; }
From source file:Main.java
public static PopupWindow showPopWindow3(Context context, View targetView, View contentView, Integer width) { PopupWindow popupWindow = null;//www. j a v a2s . c o m popupWindow = new PopupWindow(contentView, -2, -2); popupWindow.setBackgroundDrawable(new ColorDrawable(Color.WHITE)); if (width != null) { popupWindow.setWidth(width); } popupWindow.setOutsideTouchable(true); popupWindow.showAtLocation(targetView, Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL, 0, 0); return popupWindow; }
From source file:Main.java
public static int calculateCtaTextColor(final int ctaBackgroundColor) { if (isLightColor(ctaBackgroundColor)) { return calculateDarkerColor(ctaBackgroundColor, CTA_TEXT_LIGHTNESS_FACTOR); } else {//from ww w .j a v a 2s .co m return Color.WHITE; } }
From source file:Main.java
public static Bitmap drawTextToBitmap(Bitmap bitmap, String gText) { OutputStream outStream = null; Bitmap.Config bitmapConfig = bitmap.getConfig(); // set default bitmap config if none if (bitmapConfig == null) { bitmapConfig = Bitmap.Config.ARGB_8888; }//w w w . j a v a 2s. c om String dataPath = Environment.getExternalStorageDirectory().toString() + "/SignChat/Temp/temp" + "0" + pictureNum + ".jpg"; try { FileOutputStream out = new FileOutputStream(dataPath); // NEWLY ADDED CODE STARTS HERE [ Canvas canvas = new Canvas(bitmap); Paint paint = new Paint(); paint.setColor(Color.WHITE); // Text Color paint.setStrokeWidth(12); // Text Size paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OVER)); // Text // Overlapping // Pattern // some more settings... canvas.drawBitmap(bitmap, 0, 0, paint); canvas.drawText("Testing...", 10, 10, paint); // NEWLY ADDED CODE ENDS HERE ] bitmap.compress(CompressFormat.JPEG, 90, out); out.flush(); out.close(); } catch (Exception e) { e.printStackTrace(); } return bitmap; }