Java Code Examples for android.graphics.Color.BLUE

The following are Jave code examples for showing how to use BLUE 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.
+ Save this method
Example 1
Project: ChenYan   File: Main2Activity.java   View Source Code Vote up 7 votes
private void spanTest() {
        SpannableString spannableString = new SpannableString("欢迎光临我的博客");
//        字体颜色span
        ForegroundColorSpan colorSpan = new ForegroundColorSpan(Color.BLUE);
//        背景颜色span
        BackgroundColorSpan backgroundColorSpan = new BackgroundColorSpan(Color.RED);

//        1,3其实是两个位置,末尾不包括
//        Flag 为 span如果新增了文字 的前面不包括样式,后面包括样式
        spannableString.setSpan(colorSpan, 1, 3, Spanned.SPAN_EXCLUSIVE_INCLUSIVE);
        spannableString.setSpan(backgroundColorSpan, 5, 7, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);

        SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder();
        spannableStringBuilder.append(spannableString);

        editText.setText(spannableString);

    }
 
Example 2
Project: GitHub   File: CircularProgressDrawable.java   View Source Code Vote up 6 votes
private void initValues(@NonNull Context context, boolean editMode) {
  mBorderWidth = context.getResources().getDimension(R.dimen.cpb_default_stroke_width);
  mSweepSpeed = 1f;
  mRotationSpeed = 1f;
  if (editMode) {
    mColors = new int[]{Color.BLUE};
    mMinSweepAngle = 20;
    mMaxSweepAngle = 300;
  } else {
    mColors = new int[]{context.getResources().getColor(R.color.cpb_default_color)};
    mMinSweepAngle = context.getResources().getInteger(R.integer.cpb_default_min_sweep_angle);
    mMaxSweepAngle = context.getResources().getInteger(R.integer.cpb_default_max_sweep_angle);
  }
  mStyle = CircularProgressDrawable.STYLE_ROUNDED;
  mPowerManager = Utils.powerManager(context);
}
 
Example 3
Project: GitHub   File: SingleRequestTest.java   View Source Code Vote up 6 votes
@Test
public void testFallbackDrawableSetOnNullModelWithErrorAndFallbackDrawables() {
  Drawable placeholder = new ColorDrawable(Color.RED);
  Drawable errorPlaceholder = new ColorDrawable(Color.GREEN);
  Drawable fallback = new ColorDrawable(Color.BLUE);

  MockTarget target = new MockTarget();
  harness.placeholderDrawable = placeholder;
  harness.errorDrawable = errorPlaceholder;
  harness.fallbackDrawable = fallback;
  harness.target = target;
  harness.model = null;
  SingleRequest<List> request = harness.getRequest();
  request.begin();
  assertEquals(fallback, target.currentPlaceholder);
}
 
Example 4
Project: GitHub   File: GenericDraweeHierarchyTest.java   View Source Code Vote up 6 votes
@Before
public void setUp() {
  mBuilder = new GenericDraweeHierarchyBuilder(null);

  mBackground = DrawableTestUtils.mockDrawable();
  mOverlay1 = DrawableTestUtils.mockDrawable();
  mOverlay2 = DrawableTestUtils.mockDrawable();
  mPlaceholderImage = DrawableTestUtils.mockBitmapDrawable();
  mFailureImage = DrawableTestUtils.mockBitmapDrawable();
  mRetryImage = DrawableTestUtils.mockBitmapDrawable();
  mProgressBarImage = DrawableTestUtils.mockBitmapDrawable();
  mActualImage1 = DrawableTestUtils.mockBitmapDrawable();
  mActualImage2 = DrawableTestUtils.mockBitmapDrawable();
  mWrappedLeaf = new ColorDrawable(Color.BLUE);
  mWrappedImage = new ForwardingDrawable(new ForwardingDrawable(mWrappedLeaf));
  mFocusPoint = new PointF(0.1f, 0.4f);
}
 
Example 5
Project: UIWidget   File: UIProgressView.java   View Source Code Vote up 6 votes
public UIProgressView(Context context, int style) {
    super(context, R.style.ProgressViewDialogStyle);
    this.mStyle = style;
    this.mContext = context;
    this.textColor = context.getResources().getColor(R.color.colorLoadingText);
    this.loadingColor = Color.BLUE;
    this.window = getWindow();
    this.lp = window.getAttributes();
    if (mStyle == STYLE_WEI_BO) {//微博样式
        mIndeterminateDrawable = mContext.getResources().getDrawable(R.drawable.dialog_loading_wei_bo);
        textColor = mContext.getResources().getColor(R.color.colorLoadingTextWeiBo);
    } else if (mStyle == STYLE_WEI_XIN) {//微信样式
        mIndeterminateDrawable = mContext.getResources().getDrawable(R.drawable.dialog_loading_wei_xin);
        textColor = Color.WHITE;
    } else if (mStyle == STYLE_MATERIAL_DESIGN) {
        textColor = loadingColor;
    }
    window.setWindowAnimations(R.style.PopWindowAnimStyle);
    setContentView(R.layout.layout_progress_view);
    initView();
}
 
Example 6
Project: LucaHome-MediaServer   File: GameSurfaceView.java   View Source Code Vote up 6 votes
private int getColor(@NonNull Piece piece) {
    switch (piece) {
        case T:
            return Color.GREEN;
        case L:
            return Color.RED;
        case Z:
            return Color.YELLOW;
        case S:
            return Color.BLUE;
        case LL:
            return Color.MAGENTA;
        default:
            return Color.CYAN;
    }
}
 
Example 7
Project: StatusBarManager   File: ColorUtil.java   View Source Code Vote up 6 votes
public static @ColorInt int getColor(int index) {
    int color = Color.TRANSPARENT;
    switch (index) {
        case 0:
            color = R.color.color0;
            break;
        case 1:
            color = Color.BLUE;
            break;

        case 2:
            color = Color.GRAY;
            break;
    }

    return color;
}
 
Example 8
Project: mongol-library   File: MongolTextView.java   View Source Code Vote up 6 votes
private void init() {
    mTextPaint = new TextPaint();
    mTextPaint.setAntiAlias(true);
    mTextPaint.setColor(mTextColor);
    if (mTextSizePx <= 0) {
        mTextSizePx = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP,
                DEFAULT_FONT_SIZE_SP, getResources().getDisplayMetrics());
    }
    mTextPaint.setTextSize(mTextSizePx);
    mTypeface = MongolFont.get(MongolFont.QAGAN, mContext);
    mTextPaint.setTypeface(mTypeface);
    mTextPaint.linkColor = Color.BLUE;

    // initialize the layout, but the height still needs to be set
    final CharSequence text = mTextStorage.getGlyphText();
    mLayout = new MongolLayout(text, 0, text.length(), mTextPaint, 0, Gravity.TOP, 1, 0, false, Integer.MAX_VALUE);

}
 
Example 9
Project: pm-home-station   File: ChartFragment.java   View Source Code Vote up 6 votes
private LineDataSet createSet(String label) {
    LineDataSet set = new LineDataSet(null, label);
    set.setAxisDependency(YAxis.AxisDependency.LEFT);
    int color;
    if (label.equals(pm1Label)) {
        color = Color.BLUE;
    } else if (label.equals(pm25Label)) {
        color = Color.RED;
    } else {
        color = Color.BLACK;
    }
    set.setColor(color);
    set.setLineWidth(2f);
    set.setDrawValues(false);
    set.setDrawCircles(false);
    set.setMode(LineDataSet.Mode.LINEAR);
    return set;
}
 
Example 10
Project: timelineview   File: TimeLineView.java   View Source Code Vote up 6 votes
private void init() {
    this.mPaint = new Paint();
    this.mPaint.setAntiAlias(true);
    this.mStartedLineColor = Color.BLUE;
    this.mPreLineColor = Color.GRAY;
    this.mStartedCircleColor = mStartedLineColor;
    this.mUnderwayCircleColor = mStartedCircleColor;
    this.mPreCircleColor = mPreLineColor;
    this.mStartedStringColor = mStartedLineColor;
    this.mUnderwayStringColor = mStartedStringColor;
    this.mPreStringColor = mPreLineColor;
    this.mPointTxt = new ArrayList();
    this.mPointTxt.add("step 1");
    this.mPointTxt.add("step 2");
    this.mPointTxt.add("step 3");
    this.mBuilder = new Builder();
}
 
Example 11
Project: ShangHanLun   File: Helper.java   View Source Code Vote up 5 votes
public static void renderItemNumber(SpannableStringBuilder builder) {
    String string = builder.toString();
    if (!string.contains("、")
            || !isNumeric(string.substring(0, string.indexOf("、")))) {
        return;
    }
    ForegroundColorSpan numSpan = new ForegroundColorSpan(Color.BLUE);
    builder.setSpan(numSpan, 0, string.indexOf("、"),
            Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}
 
Example 12
Project: GitHub   File: GlideTest.java   View Source Code Vote up 5 votes
@Test
public void testNullModelPrefersFallbackDrawable() {
  Drawable placeholder = new ColorDrawable(Color.GREEN);
  Drawable error = new ColorDrawable(Color.RED);
  Drawable fallback = new ColorDrawable(Color.BLUE);

  requestManager
      .load(null)
      .apply(placeholderOf(placeholder)
          .error(error)
          .fallback(fallback))
      .into(target);

  verify(target).onLoadFailed(eq(fallback));
}
 
Example 13
Project: GitHub   File: GlideTest.java   View Source Code Vote up 5 votes
@Test
public void testNullModelPrefersFallbackDrawable() {
  Drawable placeholder = new ColorDrawable(Color.GREEN);
  Drawable error = new ColorDrawable(Color.RED);
  Drawable fallback = new ColorDrawable(Color.BLUE);

  requestManager
      .load(null)
      .apply(placeholderOf(placeholder)
          .error(error)
          .fallback(fallback))
      .into(target);

  verify(target).onLoadFailed(eq(fallback));
}
 
Example 14
Project: KB2   File: Painter.java   View Source Code Vote up 5 votes
public void drawTrainingCircle(int stepX, int stepY) {
    int dx = (width - xOffset * 2) / 6;
    int dy = (height - yOffset * 2) / 5;
    int x = xOffset + stepX *dx + dx / 2;
    int y = yOffset + stepY *dy + dy / 2;

    RadialGradient gradient = new RadialGradient(x, y, 200,
            Color.TRANSPARENT, Color.BLUE, Shader.TileMode.CLAMP);
    Paint p = new Paint();
    p.setDither(true);
    p.setShader(gradient);

    canvas.drawCircle(x, y, 200, p);
}
 
Example 15
Project: mongol-library   File: MongolLabelActivity.java   View Source Code Vote up 5 votes
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
        // An item was selected. You can retrieve the selected item using
        // parent.getItemAtPosition(pos)

        int viewid = parent.getId();
        if (viewid == R.id.fontcolor_spinner) {
            int color = Color.BLACK;
            String item = String.valueOf(parent.getItemAtPosition(pos));
            switch (item) {
                case "BLUE":
                    color = Color.BLUE;
                    break;
                case "RED":
                    color = Color.RED;
                    break;
                case "YELLOW":
                    color = Color.YELLOW;
                    break;
            }
            mMongolLabelMatchParent.setTextColor(color);
            mMongolLabelWrapContent.setTextColor(color);
        } else if (viewid == R.id.fontsize_spinner) {
            int size = Integer.parseInt(parent.getSelectedItem().toString());
            mMongolLabelMatchParent.setTextSize(size);
            mMongolLabelWrapContent.setTextSize(size);
//        } else if (viewid == R.id.alignment_spinner) {
//            int gravity = Gravity.TOP;
//            String item = String.valueOf(parent.getItemAtPosition(pos));
//            switch (item) {
//                case "CENTER":
//                    gravity = Gravity.CENTER;
//                    break;
//                case "BOTTOM":
//                    gravity = Gravity.BOTTOM;
//                    break;
//            }
//            mMongolLabelMatchParent.setGravity(gravity);
//            mMongolLabelWrapContent.setGravity(gravity);
        }
    }
 
Example 16
Project: CityView   File: BuildingView.java   View Source Code Vote up 5 votes
private void init(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
  if (!isInEditMode()) {

  }

  rect = new Rect();
  paint = new Paint();

  doorRect = new Rect();
  doorPaint = new Paint();
  doorPaint.setColor(Color.WHITE);

  int buildingsColor = Color.BLUE;
  if (attrs != null) {
    boolean containsBuildColor = containsBuildColor(attrs);

    if (containsBuildColor) {
      buildingsColor = loadColorAttribute(context, attrs, defStyleAttr, buildingsColor, R.styleable.BuildingView, defStyleRes,
          R.styleable.BuildingView_building_color);
    } else {
      buildingsColor = loadColorAttribute(context, attrs, defStyleAttr, buildingsColor, R.styleable.CityView, R.style.CityViewTheme,
          R.styleable.CityView_buildings_color);
    }
  }
  paint.setColor(buildingsColor);

  loadDimensions(context, attrs, defStyleAttr, defStyleRes);
}
 
Example 17
Project: android-audio-visualizer   File: LineBarVisualizer.java   View Source Code Vote up 5 votes
@Override
protected void onDraw(Canvas canvas) {
    if (middleLine.getColor() != Color.BLUE) {
        middleLine.setColor(color);
    }
    if (bytes != null) {
        float barWidth = getWidth() / density;
        float div = bytes.length / density;
        canvas.drawLine(0, getHeight() / 2, getWidth(), getHeight() / 2, middleLine);
        paint.setStrokeWidth(barWidth - gap);

        for (int i = 0; i < density; i++) {
            int x = (int) Math.ceil(i * div);
            int top = canvas.getHeight() / 2
                    + (128 - Math.abs(bytes[x]))
                    * (canvas.getHeight() / 2) / 128;

            int bottom = canvas.getHeight() / 2
                    - (128 - Math.abs(bytes[x]))
                    * (canvas.getHeight() / 2) / 128;

            canvas.drawLine(i * barWidth, bottom, i * barWidth, getHeight() / 2, paint);
            canvas.drawLine(i * barWidth, top, i * barWidth, getHeight() / 2, paint);
        }
        super.onDraw(canvas);
    }
}
 
Example 18
Project: android-audio-visualizer   File: BlazingColorVisualizer.java   View Source Code Vote up 5 votes
@Override
protected void init() {
    shader = new LinearGradient(0,
            0,
            0,
            getHeight(),
            Color.BLUE,
            Color.GREEN,
            Shader.TileMode.MIRROR /*or REPEAT*/);
}
 
Example 19
Project: phonk   File: PSlider_.java   View Source Code Vote up 5 votes
public PSlider_(AppRunner appRunner) {
    super(appRunner.getAppContext());
    super.setMax(MAX_VALUE);
    // setProgressDrawable(getResources().getDrawable(R.drawable.ui_seekbar_progress));

    mSlider = this;
    // getStyles = new Styler(appRunner, this);

    //Custom background drawable allows you to draw how you want it to look if needed
    // SeekBarBackgroundDrawable backgroundDrawable = new SeekBarBackgroundDrawable(appRunner.getAppContext());
    ColorDrawable progressDrawable = new ColorDrawable(Color.BLUE);
    SeekBarProgressDrawable clipProgressDrawable = new SeekBarProgressDrawable(progressDrawable, Gravity.LEFT, ClipDrawable.HORIZONTAL, appRunner.getAppContext());

    ColorDrawable progressDrawable2 = new ColorDrawable(Color.GREEN);
    //Custom seek bar slider drawable. Also allows you to modify appearance.
    InsetDrawable insetDrawable = new InsetDrawable(progressDrawable2, 0, 0, 0, 0);

    Drawable[] drawables = new Drawable[]{ insetDrawable, clipProgressDrawable };

    //Create layer drawables with android pre-defined ids
    LayerDrawable layerDrawable = new LayerDrawable(drawables);
    // layerDrawable.setId(0,android.R.id.background);
    // layerDrawable.setId(1,android.R.id.slider);

    //Set to seek bar
    setThumb(null);
    setProgressDrawable(layerDrawable);
}
 
Example 20
Project: SSTVEncoder2   File: GridColorPalette.java   View Source Code Vote up 5 votes
static int[] getStandardColors() {
    return new int[]{
            Color.BLACK,
            Color.GRAY,
            Color.LTGRAY,
            Color.WHITE,
            Color.YELLOW,
            Color.CYAN,
            Color.GREEN,
            Color.MAGENTA,
            Color.RED,
            Color.BLUE
    };
}