Java Code Examples for android.graphics.Color.WHITE

The following are Jave code examples for showing how to use WHITE of the android.graphics.Color class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: Fatigue-Detection   File: RotateLoading.java   Source Code and License Vote up 6 votes
private void initView(Context context, AttributeSet attrs) {
    color = Color.WHITE;
    width = dpToPx(context, DEFAULT_WIDTH);
    shadowPosition = dpToPx(getContext(), DEFAULT_SHADOW_POSITION);
    speedOfDegree = DEFAULT_SPEED_OF_DEGREE;

    if (null != attrs) {
        TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.RotateLoading);
        color = typedArray.getColor(R.styleable.RotateLoading_loading_color, Color.WHITE);
        width = typedArray.getDimensionPixelSize(R.styleable.RotateLoading_loading_width, dpToPx(context, DEFAULT_WIDTH));
        shadowPosition = typedArray.getInt(R.styleable.RotateLoading_shadow_position, DEFAULT_SHADOW_POSITION);
        speedOfDegree = typedArray.getInt(R.styleable.RotateLoading_loading_speed, DEFAULT_SPEED_OF_DEGREE);
        typedArray.recycle();
    }
    speedOfArc = speedOfDegree / 4;
    mPaint = new Paint();
    mPaint.setColor(color);
    mPaint.setAntiAlias(true);
    mPaint.setStyle(Paint.Style.STROKE);
    mPaint.setStrokeWidth(width);
    mPaint.setStrokeCap(Paint.Cap.ROUND);
}
 
Example 2
Project: microMathematics   File: SVBar.java   Source Code and License Vote up 6 votes
/**
 * Set the bar color. <br>
 * <br>
 * Its discouraged to use this method.
 * 
 * @param color
 */
public void setColor(int color) {
	int x1, y1;
	if (mOrientation) {
		x1 = (mBarLength + mBarPointerHaloRadius);
		y1 = mBarThickness;
	} else {
		x1 = mBarThickness;
		y1 = (mBarLength + mBarPointerHaloRadius);
	}

	Color.colorToHSV(color, mHSVColor);
	shader = new LinearGradient(mBarPointerHaloRadius, 0, x1, y1,
			new int[] { Color.WHITE, color, Color.BLACK }, null,
			Shader.TileMode.CLAMP);
	mBarPaint.setShader(shader);
	calculateColor(mBarPointerPosition);
	mBarPointerPaint.setColor(mColor);
	if (mPicker != null) {
		mPicker.setNewCenterColor(mColor);
		if (mPicker.hasOpacityBar())
			mPicker.changeOpacityBarColor(mColor);
	}
	invalidate();
}
 
Example 3
Project: BBSSDK-for-Android   File: StatusBarCompat.java   Source Code and License Vote up 5 votes
public static void setStatusBarColor(Activity activity, int statusColor, boolean isLight) {
	if (Color.WHITE == statusColor && Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
		statusColor = calculateStatusBarColor(statusColor, 30);
	}
	if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
		StatusBarCompatLollipop.setStatusBarColor(activity, statusColor, isLight);
	} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
		StatusBarCompatKitKat.setStatusBarColor(activity, statusColor);
	}
}
 
Example 4
Project: SingleSelectBar   File: SingleSelectBar.java   Source Code and License Vote up 5 votes
@ColorInt
private int getPressedStyleColor(int style) {
    switch (style) {
        case DARK: {
            return Color.BLACK;
        }
        case LIGHT: {
            return Color.WHITE;
        }
        case NONE:
        default: {
            return -1;
        }
    }
}
 
Example 5
Project: ledcontrol-androidthings   File: LedControl.java   Source Code and License Vote up 5 votes
/**
 * Draw the given bitmap to the LED matrix.
 *
 * @param addr   the address of the display to control
 * @param bitmap Bitmap to draw
 * @throws IOException
 */
public void draw(int addr, Bitmap bitmap) throws IOException {
    if (addr < 0 || addr >= maxDevices) {
        return;
    }

    Bitmap scaled = Bitmap.createScaledBitmap(bitmap, 8, 8, true);
    for (int row = 0; row < 8; row++) {
        int value = 0;
        for (int col = 0; col < 8; col++) {
            value |= scaled.getPixel(col, row) == Color.WHITE ? (0x80 >> col) : 0;
        }
        setRow(addr, row, (byte) value);
    }
}
 
Example 6
Project: GitHub   File: BiliDanmukuParser.java   Source Code and License Vote up 5 votes
@Override
public void startElement(String uri, String localName, String qName, Attributes attributes)
        throws SAXException {
    String tagName = localName.length() != 0 ? localName : qName;
    tagName = tagName.toLowerCase(Locale.getDefault()).trim();
    if (tagName.equals("d")) {
        // <d p="23.826000213623,1,25,16777215,1422201084,0,057075e9,757076900">我从未见过如此厚颜无耻之猴</d>
        // 0:时间(弹幕出现时间)
        // 1:类型(1从右至左滚动弹幕|6从左至右滚动弹幕|5顶端固定弹幕|4底端固定弹幕|7高级弹幕|8脚本弹幕)
        // 2:字号
        // 3:颜色
        // 4:时间戳 ?
        // 5:弹幕池id
        // 6:用户hash
        // 7:弹幕id
        String pValue = attributes.getValue("p");
        // parse p value to danmaku
        String[] values = pValue.split(",");
        if (values.length > 0) {
            long time = (long) (Float.parseFloat(values[0]) * 1000); // 出现时间
            int type = Integer.parseInt(values[1]); // 弹幕类型
            float textSize = Float.parseFloat(values[2]); // 字体大小
            int color = (int) ((0x00000000ff000000 | Long.parseLong(values[3])) & 0x00000000ffffffff); // 颜色
            // int poolType = Integer.parseInt(values[5]); // 弹幕池类型(忽略
            item = mContext.mDanmakuFactory.createDanmaku(type, mContext);
            if (item != null) {
                item.setTime(time);
                item.textSize = textSize * (mDispDensity - 0.6f);
                item.textColor = color;
                item.textShadowColor = color <= Color.BLACK ? Color.WHITE : Color.BLACK;
            }
        }
    }
}
 
Example 7
Project: Paper-Melody   File: PlayView.java   Source Code and License Vote up 5 votes
private Paint initPaint(int alpha) {
    paint = new Paint();
    paint.setAntiAlias(true);// �����
    //paint.setStyle(Paint.Style.FILL);// ���
    paint.setAlpha(alpha);// ͸����
    //paint.setColor(Color.RED);// ��ɫ
    Shader mShader = new LinearGradient(0, 0, 200, 200,
            new int[]{Color.GREEN, Color.WHITE},
            null, Shader.TileMode.REPEAT);
    paint.setShader(mShader);
    return paint;
}
 
Example 8
Project: Protein   File: ViewUtils.java   Source Code and License Vote up 5 votes
public static RippleDrawable createRipple(@NonNull Palette palette,
        @FloatRange(from = 0f, to = 1f) float darkAlpha,
        @FloatRange(from = 0f, to = 1f) float lightAlpha,
        @ColorInt int fallbackColor,
        boolean bounded) {
    int rippleColor = fallbackColor;
    if (palette != null) {
        // try the named swatches in preference order
        if (palette.getVibrantSwatch() != null) {
            rippleColor =
                    ColorUtils.modifyAlpha(palette.getVibrantSwatch().getRgb(), darkAlpha);

        } else if (palette.getLightVibrantSwatch() != null) {
            rippleColor = ColorUtils.modifyAlpha(palette.getLightVibrantSwatch().getRgb(),
                    lightAlpha);
        } else if (palette.getDarkVibrantSwatch() != null) {
            rippleColor = ColorUtils.modifyAlpha(palette.getDarkVibrantSwatch().getRgb(),
                    darkAlpha);
        } else if (palette.getMutedSwatch() != null) {
            rippleColor = ColorUtils.modifyAlpha(palette.getMutedSwatch().getRgb(), darkAlpha);
        } else if (palette.getLightMutedSwatch() != null) {
            rippleColor = ColorUtils.modifyAlpha(palette.getLightMutedSwatch().getRgb(),
                    lightAlpha);
        } else if (palette.getDarkMutedSwatch() != null) {
            rippleColor =
                    ColorUtils.modifyAlpha(palette.getDarkMutedSwatch().getRgb(), darkAlpha);
        }
    }
    return new RippleDrawable(ColorStateList.valueOf(rippleColor), null,
            bounded ? new ColorDrawable(Color.WHITE) : null);
}
 
Example 9
Project: RLibrary   File: SimpleCircleProgressBar.java   Source Code and License Vote up 5 votes
private void init() {
    mDensity = getResources().getDisplayMetrics().density;

    mProgressColor = Color.WHITE;
    mBackColor = Color.parseColor("#474430");

    mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);

    mPaint.setStrokeCap(Paint.Cap.ROUND);
    mPaint.setAntiAlias(true);
    mPaint.setStyle(Paint.Style.STROKE);

    strokeWidth = mDensity * 2;
    mPaint.setStrokeWidth(strokeWidth);
}
 
Example 10
Project: Bigbang   File: ColorPickerDialogBuilder.java   Source Code and License Vote up 4 votes
private int getStartColor(Integer[] colors) {
	Integer startColor = getStartOffset(colors);
	return startColor == null ? Color.WHITE : colors[startColor];
}
 
Example 11
Project: xlight_android_native   File: SaturationBar.java   Source Code and License Vote up 4 votes
@Override
public boolean onTouchEvent(MotionEvent event) {
	getParent().requestDisallowInterceptTouchEvent(true);

	// Convert coordinates to our internal coordinate system
	float dimen;
	if (mOrientation == ORIENTATION_HORIZONTAL) {
		dimen = event.getX();
	}
	else {
		dimen = event.getY();
	}

	switch (event.getAction()) {
	case MotionEvent.ACTION_DOWN:
	    	mIsMovingPointer = true;
		// Check whether the user pressed on (or near) the pointer
		if (dimen >= (mBarPointerHaloRadius)
				&& dimen <= (mBarPointerHaloRadius + mBarLength)) {
			mBarPointerPosition = Math.round(dimen);
			calculateColor(Math.round(dimen));
			mBarPointerPaint.setColor(mColor);
			invalidate();
		}
		break;
	case MotionEvent.ACTION_MOVE:
		if (mIsMovingPointer) {
			// Move the the pointer on the bar.
			if (dimen >= mBarPointerHaloRadius
					&& dimen <= (mBarPointerHaloRadius + mBarLength)) {
				mBarPointerPosition = Math.round(dimen);
				calculateColor(Math.round(dimen));
				mBarPointerPaint.setColor(mColor);
				if (mPicker != null) {
					mPicker.setNewCenterColor(mColor);
					mPicker.changeValueBarColor(mColor);
					mPicker.changeOpacityBarColor(mColor);
				}
				invalidate();
			} else if (dimen < mBarPointerHaloRadius) {
				mBarPointerPosition = mBarPointerHaloRadius;
				mColor = Color.WHITE;
				mBarPointerPaint.setColor(mColor);
				if (mPicker != null) {
					mPicker.setNewCenterColor(mColor);
					mPicker.changeValueBarColor(mColor);
					mPicker.changeOpacityBarColor(mColor);
				}
				invalidate();
			} else if (dimen > (mBarPointerHaloRadius + mBarLength)) {
				mBarPointerPosition = mBarPointerHaloRadius + mBarLength;
				mColor = Color.HSVToColor(mHSVColor);
				mBarPointerPaint.setColor(mColor);
				if (mPicker != null) {
					mPicker.setNewCenterColor(mColor);
					mPicker.changeValueBarColor(mColor);
					mPicker.changeOpacityBarColor(mColor);
				}
				invalidate();
			}
		}
		if(onSaturationChangedListener != null && oldChangedListenerSaturation != mColor){
            onSaturationChangedListener.onSaturationChanged(mColor);
            oldChangedListenerSaturation = mColor;
		}
		break;
	case MotionEvent.ACTION_UP:
		mIsMovingPointer = false;
		break;
	}
	return true;
}
 
Example 12
Project: GravityBox   File: StatusBarIconManager.java   Source Code and License Vote up 4 votes
public int getDefaultIconColor() {
    return Color.WHITE;
}
 
Example 13
Project: PicKing   File: Apic.java   Source Code and License Vote up 4 votes
@Override
public int getBackgroundColor() {
    return Color.WHITE;
}
 
Example 14
Project: GitHub   File: BottomNavigationBar.java   Source Code and License Vote up 4 votes
/**
 * This method initiates the bottomNavigationBar properties,
 * Tries to get them form XML if not preset sets them to their default values.
 *
 * @param context context of the bottomNavigationBar
 * @param attrs   attributes mentioned in the layout XML by user
 */
private void parseAttrs(Context context, AttributeSet attrs) {
    if (attrs != null) {
        TypedArray typedArray = context.getTheme().obtainStyledAttributes(attrs, R.styleable.BottomNavigationBar, 0, 0);

        mActiveColor = typedArray.getColor(R.styleable.BottomNavigationBar_bnbActiveColor, Utils.fetchContextColor(context, R.attr.colorAccent));
        mInActiveColor = typedArray.getColor(R.styleable.BottomNavigationBar_bnbInactiveColor, Color.LTGRAY);
        mBackgroundColor = typedArray.getColor(R.styleable.BottomNavigationBar_bnbBackgroundColor, Color.WHITE);
        mAutoHideEnabled = typedArray.getBoolean(R.styleable.BottomNavigationBar_bnbAutoHideEnabled, true);
        mElevation = typedArray.getDimension(R.styleable.BottomNavigationBar_bnbElevation, getResources().getDimension(R.dimen.bottom_navigation_elevation));

        setAnimationDuration(typedArray.getInt(R.styleable.BottomNavigationBar_bnbAnimationDuration, DEFAULT_ANIMATION_DURATION));

        switch (typedArray.getInt(R.styleable.BottomNavigationBar_bnbMode, MODE_DEFAULT)) {
            case MODE_FIXED:
                mMode = MODE_FIXED;
                break;

            case MODE_SHIFTING:
                mMode = MODE_SHIFTING;
                break;

            case MODE_FIXED_NO_TITLE:
                mMode = MODE_FIXED_NO_TITLE;
                break;

            case MODE_SHIFTING_NO_TITLE:
                mMode = MODE_SHIFTING_NO_TITLE;
                break;

            case MODE_DEFAULT:
            default:
                mMode = MODE_DEFAULT;
                break;
        }

        switch (typedArray.getInt(R.styleable.BottomNavigationBar_bnbBackgroundStyle, BACKGROUND_STYLE_DEFAULT)) {
            case BACKGROUND_STYLE_STATIC:
                mBackgroundStyle = BACKGROUND_STYLE_STATIC;
                break;

            case BACKGROUND_STYLE_RIPPLE:
                mBackgroundStyle = BACKGROUND_STYLE_RIPPLE;
                break;

            case BACKGROUND_STYLE_DEFAULT:
            default:
                mBackgroundStyle = BACKGROUND_STYLE_DEFAULT;
                break;
        }

        typedArray.recycle();
    } else {
        mActiveColor = Utils.fetchContextColor(context, R.attr.colorAccent);
        mInActiveColor = Color.LTGRAY;
        mBackgroundColor = Color.WHITE;
        mElevation = getResources().getDimension(R.dimen.bottom_navigation_elevation);
    }
}
 
Example 15
Project: gamecollection   File: Bauernkrieg.java   Source Code and License Vote up 4 votes
public Bauernkrieg()
{
    super(Color.rgb(20, 80, 0), Color.WHITE, BoardType.VERT_FULL, windowZoom(600));
}
 
Example 16
Project: android-titanium-imagecropper   File: CropImageOptions.java   Source Code and License Vote up 4 votes
/** Init options with defaults. */
public CropImageOptions() {

  DisplayMetrics dm = Resources.getSystem().getDisplayMetrics();

  cropShape = CropImageView.CropShape.RECTANGLE;
  snapRadius = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 3, dm);
  touchRadius = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 24, dm);
  guidelines = CropImageView.Guidelines.ON_TOUCH;
  scaleType = CropImageView.ScaleType.FIT_CENTER;
  showCropOverlay = true;
  showProgressBar = true;
  autoZoomEnabled = true;
  multiTouchEnabled = false;
  maxZoom = 4;
  initialCropWindowPaddingRatio = 0.1f;

  fixAspectRatio = false;
  aspectRatioX = 1;
  aspectRatioY = 1;

  borderLineThickness = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 3, dm);
  borderLineColor = Color.argb(170, 255, 255, 255);
  borderCornerThickness = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2, dm);
  borderCornerOffset = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 5, dm);
  borderCornerLength = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 14, dm);
  borderCornerColor = Color.WHITE;

  guidelinesThickness = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1, dm);
  guidelinesColor = Color.argb(170, 255, 255, 255);
  backgroundColor = Color.argb(119, 0, 0, 0);

  minCropWindowWidth = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 42, dm);
  minCropWindowHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 42, dm);
  minCropResultWidth = 40;
  minCropResultHeight = 40;
  maxCropResultWidth = 99999;
  maxCropResultHeight = 99999;

  activityTitle = "";
  activityMenuIconColor = 0;

  outputUri = Uri.EMPTY;
  outputCompressFormat = Bitmap.CompressFormat.JPEG;
  outputCompressQuality = 90;
  outputRequestWidth = 0;
  outputRequestHeight = 0;
  outputRequestSizeOptions = CropImageView.RequestSizeOptions.NONE;
  noOutputImage = false;

  initialCropWindowRectangle = null;
  initialRotation = -1;
  allowRotation = true;
  allowFlipping = true;
  allowCounterRotation = false;
  rotationDegrees = 90;
  flipHorizontally = false;
  flipVertically = false;
  cropMenuCropButtonTitle = null;

  cropMenuCropButtonIcon = 0;
}
 
Example 17
Project: gamecollection   File: schafkopf.java   Source Code and License Vote up 4 votes
public schafkopf()
{
    super(Color.rgb(20, 80, 0), Color.WHITE, BoardType.VERT_FULL, windowZoom(600));
}
 
Example 18
Project: SSTVEncoder2   File: ColorFragment.java   Source Code and License Vote up 4 votes
public ColorFragment() {
    mListeners = new ArrayList<>();
    mTitle = R.string.color;
    mColor = Color.WHITE;
}
 
Example 19
Project: android-dev-challenge   File: ColorUtils.java   Source Code and License Vote up 4 votes
/**
 * This method returns the appropriate shade of green to form the gradient
 * seen in the list, based off of the order in which the
 * {@link com.example.android.recyclerview.GreenAdapter.NumberViewHolder}
 * instance was created.
 *
 * This method is used to show how ViewHolders are recycled in a RecyclerView.
 * At first, the colors will form a nice, consistent gradient. As the
 * RecyclerView is scrolled, the
 * {@link com.example.android.recyclerview.GreenAdapter.NumberViewHolder}'s will be
 * recycled and the list will no longer appear as a consistent gradient.
 *
 * @param context     Context for getting colors
 * @param instanceNum Order in which the calling ViewHolder was created
 *
 * @return A shade of green based off of when the calling ViewHolder
 * was created.
 */
public static int getViewHolderBackgroundColorFromInstance(Context context, int instanceNum) {
    switch (instanceNum) {
        case 0:
            return ContextCompat.getColor(context, R.color.material50Green);
        case 1:
            return ContextCompat.getColor(context, R.color.material100Green);
        case 2:
            return ContextCompat.getColor(context, R.color.material150Green);
        case 3:
            return ContextCompat.getColor(context, R.color.material200Green);
        case 4:
            return ContextCompat.getColor(context, R.color.material250Green);
        case 5:
            return ContextCompat.getColor(context, R.color.material300Green);
        case 6:
            return ContextCompat.getColor(context, R.color.material350Green);
        case 7:
            return ContextCompat.getColor(context, R.color.material400Green);
        case 8:
            return ContextCompat.getColor(context, R.color.material450Green);
        case 9:
            return ContextCompat.getColor(context, R.color.material500Green);
        case 10:
            return ContextCompat.getColor(context, R.color.material550Green);
        case 11:
            return ContextCompat.getColor(context, R.color.material600Green);
        case 12:
            return ContextCompat.getColor(context, R.color.material650Green);
        case 13:
            return ContextCompat.getColor(context, R.color.material700Green);
        case 14:
            return ContextCompat.getColor(context, R.color.material750Green);
        case 15:
            return ContextCompat.getColor(context, R.color.material800Green);
        case 16:
            return ContextCompat.getColor(context, R.color.material850Green);
        case 17:
            return ContextCompat.getColor(context, R.color.material900Green);

        default:
            return Color.WHITE;
    }
}
 
Example 20
Project: android-image-classification   File: BorderedText.java   Source Code and License Vote up 2 votes
/**
 * Creates a left-aligned bordered text object with a white interior, and a black exterior with
 * the specified text size.
 *
 * @param textSize text size in pixels
 */
public BorderedText(final float textSize) {
    this(Color.WHITE, Color.BLACK, textSize);
}