Java Code Examples for android.graphics.Color#CYAN

The following examples show how to use android.graphics.Color#CYAN . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: Telegram   File: SvgHelper.java    License: GNU General Public License v2.0 6 votes vote down vote up
private static Integer getColorByName(String name) {
    switch (name.toLowerCase()) {
        case "black":
            return Color.BLACK;
        case "gray":
            return Color.GRAY;
        case "red":
            return Color.RED;
        case "green":
            return Color.GREEN;
        case "blue":
            return Color.BLUE;
        case "yellow":
            return Color.YELLOW;
        case "cyan":
            return Color.CYAN;
        case "magenta":
            return Color.MAGENTA;
        case "white":
            return Color.WHITE;
    }
    return null;
}
 
Example 2
Source Project: relight   File: ListDemoWidget.java    License: Apache License 2.0 6 votes vote down vote up
private Integer getColor(int index) {
    int position = index % 7;
    switch (position) {
        case 0:
            return Color.RED;
        case 1:
            return Color.YELLOW;
        case 2:
            return Color.BLUE;
        case 3:
            return Color.GREEN;
        case 4:
            return Color.CYAN;
        case 5:
            return Color.LTGRAY;
        default:
            return Color.MAGENTA;
    }
}
 
Example 3
@Override
public void onDroidSpeechFinalResult(String finalSpeechResult)
{
    // Setting the final speech result
    this.finalSpeechResult.setText(finalSpeechResult);

    if(droidSpeech.getContinuousSpeechRecognition())
    {
        int[] colorPallets1 = new int[] {Color.RED, Color.GREEN, Color.BLUE, Color.CYAN, Color.MAGENTA};
        int[] colorPallets2 = new int[] {Color.YELLOW, Color.RED, Color.CYAN, Color.BLUE, Color.GREEN};

        // Setting random color pallets to the recognition progress view
        droidSpeech.setRecognitionProgressViewColors(new Random().nextInt(2) == 0 ? colorPallets1 : colorPallets2);
    }
    else
    {
        stop.setVisibility(View.GONE);
        start.setVisibility(View.VISIBLE);
    }
}
 
Example 4
public DrawingView(Context context, AttributeSet attrs) {
	super(context, attrs);

	colors = new int[] { Color.BLUE, Color.CYAN, Color.GREEN,
			Color.MAGENTA, Color.YELLOW, Color.RED, Color.WHITE };

	random = new Random();
	nextColor = random.nextInt(colors.length);
	for (int i = 0; i < colors.length; i++) {
		Paint paint = new Paint();
		paint.setAntiAlias(true);
		paint.setColor(colors[i]);
		paint.setStyle(Paint.Style.STROKE);
		paint.setStrokeJoin(Paint.Join.ROUND);
		paint.setStrokeWidth(STROKE_WIDTH);
		paints.add(paint);
	}

}
 
Example 5
Source Project: RippleAnimation   File: MainActivity.java    License: Apache License 2.0 5 votes vote down vote up
public void onClick(View view) {

        RippleAnimation.create().setDuration().start().setOnAnimationEndListener();

        //关键代码
        RippleAnimation.create(view).setDuration(250).start();


        int color;
        switch (view.getId()) {
            case R.id.red:
                color = Color.RED;
                break;
            case R.id.green:
                color = Color.GREEN;
                break;
            case R.id.blue:
                color = Color.BLUE;
                break;
            case R.id.yellow:
                color = Color.YELLOW;
                break;
            case R.id.black:
                color = Color.DKGRAY;
                break;
            case R.id.cyan:
                color = Color.CYAN;
                break;
            default:
                color = Color.TRANSPARENT;
                break;
        }
        updateColor(color);
    }
 
Example 6
Source Project: fresco   File: RoundedCornersDrawableTest.java    License: MIT License 5 votes vote down vote up
@Test
public void testSetBorder() {
  float borderWidth = 0.7f;
  int borderColor = Color.CYAN;
  mRoundedCornersDrawable.setBorder(borderColor, borderWidth);
  verify(mCallback).invalidateDrawable(mRoundedCornersDrawable);
  assertEquals(borderColor, mRoundedCornersDrawable.getBorderColor());
  assertEquals(borderWidth, mRoundedCornersDrawable.getBorderWidth(), 0);
}
 
Example 7
@Override
public int getColor() {
    if (isSMB)
        return MainApp.gc(R.color.tempbasal);
    else if (isValid)
        return Color.CYAN;
    else
        return MainApp.instance().getResources().getColor(android.R.color.holo_red_light);
}
 
Example 8
Source Project: xDrip   File: BIGChart.java    License: GNU General Public License v3.0 5 votes vote down vote up
protected void updateRainbow() {
    animationAngle = (animationAngle + 1) % 360;
    //Animation matrix:
    int[] rainbow = {Color.RED, Color.YELLOW, Color.GREEN, Color.BLUE
            , Color.CYAN};
    Shader shader = new LinearGradient(0, 0, 0, 20, rainbow,
            null, Shader.TileMode.MIRROR);
    Matrix matrix = new Matrix();
    matrix.setRotate(animationAngle);
    shader.setLocalMatrix(matrix);
    mSgv.getPaint().setShader(shader);
    invalidate();
}
 
Example 9
protected void updateRainbow() {
    animationAngle = (animationAngle + 1) % 360;
    //Animation matrix:
    int[] rainbow = {Color.RED, Color.YELLOW, Color.GREEN, Color.BLUE
            , Color.CYAN};
    Shader shader = new LinearGradient(0, 0, 0, 20, rainbow,
            null, Shader.TileMode.MIRROR);
    Matrix matrix = new Matrix();
    matrix.setRotate(animationAngle);
    shader.setLocalMatrix(matrix);
    mSgv.getPaint().setShader(shader);
    invalidate();
}
 
Example 10
protected void updateRainbow() {
    animationAngle = (animationAngle + 1) % 360;
    //Animation matrix:
    int[] rainbow = {Color.RED, Color.YELLOW, Color.GREEN, Color.BLUE
            , Color.CYAN};
    Shader shader = new LinearGradient(0, 0, 0, 20, rainbow,
            null, Shader.TileMode.MIRROR);
    Matrix matrix = new Matrix();
    matrix.setRotate(animationAngle);
    shader.setLocalMatrix(matrix);
    mSgv.getPaint().setShader(shader);
    invalidate();
}
 
Example 11
private Bitmap createColorWheelBitmap(int width, int height) {
    Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);

    LinearGradient gradientShader = new LinearGradient(0, 0, width, 0, new int[]{Color.RED, Color.YELLOW, Color.GREEN, Color.CYAN, Color.BLUE, Color.MAGENTA, Color.RED}, null, Shader.TileMode.CLAMP);
    LinearGradient alphaShader = new LinearGradient(0, (height / 3), 0, height, new int[]{Color.WHITE, Color.TRANSPARENT}, null, Shader.TileMode.CLAMP);
    ComposeShader composeShader = new ComposeShader(alphaShader, gradientShader, PorterDuff.Mode.MULTIPLY);

    colorWheelPaint.setShader(composeShader);

    Canvas canvas = new Canvas(bitmap);
    canvas.drawRect(0, 0, width, height, colorWheelPaint);

    return bitmap;
}
 
Example 12
Source Project: Chart   File: PieActivity.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.piechart);
    update();
    final PieChart pieChart = (PieChart) findViewById(R.id.piechart);
    final int[] colors = new int[]{Color.RED,Color.BLACK,Color.BLUE,Color.GREEN,Color.GRAY,
            Color.YELLOW,Color.LTGRAY,Color.CYAN,Color.MAGENTA};
    final PieChartData pieChartData = PieChartData.builder()
            .setDatas(datas)
            //.setColors(colors)
            //.setTextColor(Color.RED)
            //.setTextSize(36)
            //.setSeparationDegree(3)
            .setPieItemClickListener(new OnPieItemClickListener() {
                @Override
                public void onPieItemClick(int position) {
                    Toast.makeText(PieActivity.this,"click->"+position,Toast.LENGTH_SHORT).show();
                }
            }).build();
    pieChart.setChartData(pieChartData);
    findViewById(R.id.update).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            update();
            pieChartData.setDatas(datas);
            pieChart.update(pieChartData);
        }
    });
}
 
Example 13
private void updateShader(){
    int[] gradient = new int[]{Color.RED, Color.YELLOW, Color.GREEN,
            Color.CYAN, Color.BLUE, Color.MAGENTA, Color.RED};
    SweepGradient rainbow = new SweepGradient(center.x, center.y, gradient, null);

    paint.setShader(rainbow);
}
 
Example 14
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);

  // get a reference to the scene view
  mSceneView = findViewById(R.id.sceneView);
  // create a scene and add it to the scene view
  ArcGISScene scene = new ArcGISScene(Basemap.createImagery());
  mSceneView.setScene(scene);

  // add base surface for elevation data
  final Surface surface = new Surface();
  ArcGISTiledElevationSource elevationSource = new ArcGISTiledElevationSource(
      getString(R.string.elevation_image_service_url));
  surface.getElevationSources().add(elevationSource);
  scene.setBaseSurface(surface);

  // add a camera and initial camera position
  Camera camera = new Camera(28.9, 45, 12000, 0, 45, 0);
  mSceneView.setViewpointCamera(camera);

  // add graphics overlay(s)
  GraphicsOverlay graphicsOverlay = new GraphicsOverlay();
  graphicsOverlay.getSceneProperties().setSurfacePlacement(LayerSceneProperties.SurfacePlacement.ABSOLUTE);
  mSceneView.getGraphicsOverlays().add(graphicsOverlay);

  int[] colors = { Color.RED, Color.GREEN, Color.BLUE, Color.MAGENTA, Color.CYAN, Color.WHITE };
  SimpleMarkerSceneSymbol.Style[] symbolStyles = SimpleMarkerSceneSymbol.Style.values();

  // for each symbol style (cube, cone, cylinder, diamond, sphere, tetrahedron)
  for (int i = 0; i < symbolStyles.length; i++) {
    SimpleMarkerSceneSymbol simpleMarkerSceneSymbol = new SimpleMarkerSceneSymbol(symbolStyles[i], colors[i], 200,
        200, 200, SceneSymbol.AnchorPosition.CENTER);
    Graphic graphic = new Graphic(new Point(44.975 + .01 * i, 29, 500, SpatialReferences.getWgs84()),
        simpleMarkerSceneSymbol);
    graphicsOverlay.getGraphics().add(graphic);
  }
}
 
Example 15
protected void updateRainbow() {
    animationAngle = (animationAngle + 1) % 360;
    //Animation matrix:
    int[] rainbow = {Color.RED, Color.YELLOW, Color.GREEN, Color.BLUE
            , Color.CYAN};
    Shader shader = new LinearGradient(0, 0, 0, 20, rainbow,
            null, Shader.TileMode.MIRROR);
    Matrix matrix = new Matrix();
    matrix.setRotate(animationAngle);
    shader.setLocalMatrix(matrix);
    mSgv.getPaint().setShader(shader);
    invalidate();
}
 
Example 16
Source Project: ui   File: ColorList.java    License: Apache License 2.0 5 votes vote down vote up
ColorList() {
    num = 0; //set to first color in list
    colors = new ColorData[]{
        new ColorData("Red", Color.RED),
        new ColorData("Blue", Color.BLUE),
        new ColorData("Cyan", Color.CYAN),
        new ColorData("Orange", Color.rgb(255, 165, 0)),
        //Android's green is lime.
        //new ColorData("Green", Color.GREEN),
        new ColorData("Green", Color.rgb(0, 128, 0)),
        new ColorData("Magenta", Color.MAGENTA),
        new ColorData("Pink", Color.rgb(255, 192, 203)),
        new ColorData("Yellow", Color.YELLOW),
        new ColorData("Gray", Color.GRAY),
        new ColorData("Light Gray", Color.LTGRAY),
        new ColorData("Dark Gray", Color.DKGRAY),
        new ColorData("Lime", Color.rgb(0, 255, 0)),
        new ColorData("Olive", Color.rgb(128, 128, 0)),
        new ColorData("Purple", Color.rgb(128, 0, 128)),
        new ColorData("Teal", Color.rgb(0, 128, 128)),
        new ColorData("Navy", Color.rgb(0, 0, 128)),
        new ColorData("Golden Rod", Color.rgb(218, 165, 32)),
        new ColorData("Dark Olive Green", Color.rgb(85, 107, 47)),
        new ColorData("Khaki", Color.rgb(240, 230, 140)),
        new ColorData("Steel Blue", Color.rgb(70, 130, 180)),
        new ColorData("Dark Orchid", Color.rgb(153, 50, 204)),
        new ColorData("White", Color.WHITE),
        new ColorData()  //black.
    };

}
 
Example 17
public AnimationHelper() {
    interpolator = new LinearOutSlowInInterpolator();
    colorAnimationArray = new int[]{Color.CYAN};
}
 
Example 18
private void setupExamples() {
    // Plain example
    mListExamples.add(new AdvancedPolylineExample("Sailing", "Plain colored polyline showing a sailing track from Sicily to Sardinia.",
            new ColorMappingPlain(Color.WHITE),
            false, Color.BLACK, false,
            getPoints("sailing"), null));

    // Cycle example
    mListExamples.add(new AdvancedPolylineExample("Coast", "Cycle polyline showing border of Italy coast line.\n\nColor cycle: GREEN, WHITE, RED.",
            new ColorMappingCycle(new int[] {Color.GREEN, Color.WHITE, Color.RED}),
            true, Color.BLACK, false,
            getPoints("border_coast_italy"), null));

    // Ranges example
    SortedMap<Float, Integer> mColorRanges = new TreeMap<>();
    mColorRanges.put(5.0f, Color.RED);
    mColorRanges.put(7.5f, Color.YELLOW);
    mColorRanges.put(10.0f, Color.GREEN);
    mListExamples.add(new AdvancedPolylineExample("Tram", "Ranges polyline with border showing a tram ride between airport and main train station.\n\nBorders: 5 m/s RED, 7.5 m/s YELLOW, 10.0 m/s GREEN.",
            new ColorMappingRanges(mColorRanges, true),
            false, Color.BLACK, false,
            getPoints("tram"), getScalars("tram")));

    // Hue example
    mListExamples.add(new AdvancedPolylineExample("Flight", "Hue variation polyline for speed of plane from Paris to Philadelphia.\n\nHue from 0.0f to 120.0f for speed range 0 km/h to 1000 km/h.",
            new ColorMappingVariationHue(0.0f, 1000.0f, 0.0f, 120.0f, 1.0f, 0.5f),
            false, Color.BLACK, false,
            getPoints("flight_paris_phil"), getScalars("flight_paris_phil")));

    // Saturation example
    mListExamples.add(new AdvancedPolylineExample("Flight", "Saturation variation polyline for speed of plane from Frankfurt to Bangkok.\n\nSaturation from 0.0f to 1.0f for speed range 0 km/h to 1100 km/h.",
            new ColorMappingVariationSaturation(0.0f, 1100.0f, 0.0f, 1.0f, 160.0f, 0.5f),
            false, Color.BLACK, false,
            getPoints("flight_fra_bkk"), getScalars("flight_fra_bkk")));

    // Luminance example
    mListExamples.add(new AdvancedPolylineExample("Hiking", "Luminance variation polyline for height of hiking track in Nepal Himalayas.\n\nLuminance from 0.0f to 1.0f for height range 1800 m to 6000 m.",
            new ColorMappingVariationLuminance(1800.0f, 6000.0f, 0.0f, 1.0f, 0.0f, 0.0f),
            false, Color.BLACK, false,
            getPoints("nepal_himalayas"), getScalars("nepal_himalayas")));

    // Loop example
    final List<GeoPoint> hexagon = new ArrayList<>();
    hexagon.add(new GeoPoint(51.038333, 2.377500)); // Dunkerque
    hexagon.add(new GeoPoint(48.573333, 7.752200)); // Strasbourg
    hexagon.add(new GeoPoint(43.695833, 7.271389)); // Nice
    hexagon.add(new GeoPoint(42.698611, 2.895556)); // Perpignan
    hexagon.add(new GeoPoint(43.481617, -1.556111)); // Biarritz
    hexagon.add(new GeoPoint(48.390833, -4.468889)); // Brest
    final ColorMappingCycle colorMappingCycle = new ColorMappingCycle(new int[] { // rainbow
            Color.RED,
            Color.rgb(0xFF, 0x7f, 0), // orange
            Color.YELLOW,
            Color.GREEN,
            Color.CYAN,
            Color.BLUE,
            Color.rgb(0x7F, 0, 0xFF) // violet
    });
    colorMappingCycle.setGeoPointNumber(hexagon.size());
    mListExamples.add(new AdvancedPolylineExample("Loop", "Test about closed Polylines",
            colorMappingCycle,
            true, Color.BLACK, true,
            hexagon, null));
}
 
Example 19
Source Project: zone-sdk   File: TextViewLinkActivity.java    License: MIT License 4 votes vote down vote up
@Override
public void updateDrawState(TextPaint tp) {
    tp.setColor(Color.RED);
    tp.bgColor = Color.CYAN;
    //模糊啥的 完全可以用tp set去设置;
}
 
Example 20
private synchronized void prepareDrawTime() {
    Log.d("CircleWatchface", "start prepareDrawTime");

    hour = Calendar.getInstance().get(Calendar.HOUR_OF_DAY) % 12;
    minute = Calendar.getInstance().get(Calendar.MINUTE);
    angleBig = (((hour + minute / 60f) / 12f * 360) - 90 - BIG_HAND_WIDTH / 2f + 360) % 360;
    angleSMALL = ((minute / 60f * 360) - 90 - SMALL_HAND_WIDTH / 2f + 360) % 360;


    color = 0;
    switch (getSgvLevel()) {
        case -1:
            color = getLowColor();
            break;
        case 0:
            color = getInRangeColor();
            break;
        case 1:
            color = getHighColor();
            break;
    }


    if (isAnimated()) {
        //Animation matrix:
        int[] rainbow = {Color.RED, Color.YELLOW, Color.GREEN, Color.BLUE
                , Color.CYAN};
        Shader shader = new LinearGradient(0, 0, 0, 20, rainbow,
                null, Shader.TileMode.MIRROR);
        Matrix matrix = new Matrix();
        matrix.setRotate(animationAngle);
        shader.setLocalMatrix(matrix);
        circlePaint.setShader(shader);
    } else {
        circlePaint.setShader(null);
    }


    circlePaint.setStyle(Paint.Style.STROKE);
    circlePaint.setStrokeWidth(CIRCLE_WIDTH);
    circlePaint.setAntiAlias(true);
    circlePaint.setColor(color);

    removePaint.setStyle(Paint.Style.STROKE);
    removePaint.setStrokeWidth(CIRCLE_WIDTH);
    removePaint.setAntiAlias(true);
    removePaint.setColor(getBackgroundColor());

    ;

    rect = new RectF(PADDING, PADDING, (float) (displaySize.x - PADDING), (float) (displaySize.y - PADDING));
    rectDelete = new RectF(PADDING - CIRCLE_WIDTH / 2, PADDING - CIRCLE_WIDTH / 2, (float) (displaySize.x - PADDING + CIRCLE_WIDTH / 2), (float) (displaySize.y - PADDING + CIRCLE_WIDTH / 2));
    overlapping = ALWAYS_HIGHLIGT_SMALL || areOverlapping(angleSMALL, angleSMALL + SMALL_HAND_WIDTH + NEAR, angleBig, angleBig + BIG_HAND_WIDTH + NEAR);
    Log.d("CircleWatchface", "end prepareDrawTime");

}