Java Code Examples for android.graphics.Color#YELLOW

The following examples show how to use android.graphics.Color#YELLOW . 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 check out the related API usage on the sidebar.
Example 1
Source File: MainActivity.java    From arcgis-runtime-samples-android with Apache License 2.0 6 votes vote down vote up
private void addGraphicsOverlay() {
    // create the polygon
    PolygonBuilder polygonGeometry = new PolygonBuilder(SpatialReferences.getWebMercator());
    polygonGeometry.addPoint(-20e5, 20e5);
    polygonGeometry.addPoint(20e5, 20.e5);
    polygonGeometry.addPoint(20e5, -20e5);
    polygonGeometry.addPoint(-20e5, -20e5);

    // create solid line symbol
    SimpleFillSymbol polygonSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.SOLID, Color.YELLOW, null);
    // create graphic from polygon geometry and symbol
    Graphic graphic = new Graphic(polygonGeometry.toGeometry(), polygonSymbol);

    // create graphics overlay
    grOverlay = new GraphicsOverlay();
    // create list of graphics
    ListenableList<Graphic> graphics = grOverlay.getGraphics();
    // add graphic to graphics overlay
    graphics.add(graphic);
    // add graphics overlay to the MapView
    mMapView.getGraphicsOverlays().add(grOverlay);
}
 
Example 2
Source File: BIGChart.java    From NightWatch with 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 3
Source File: DrivingRouteOverlay.java    From TraceByAmap with MIT License 5 votes vote down vote up
private int getcolor(String status) {

    	if (status.equals("畅通")) {
    		return Color.GREEN;
		} else if (status.equals("缓行")) {
			 return Color.YELLOW;
		} else if (status.equals("拥堵")) {
			return Color.RED;
		} else if (status.equals("严重拥堵")) {
			return Color.parseColor("#990033");
		} else {
			return Color.parseColor("#537edc");
		}	
	}
 
Example 4
Source File: DrawingView.java    From codeexamples-android with Eclipse Public License 1.0 5 votes vote down vote up
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);
	paint.setAntiAlias(true);
	paint.setColor(Color.WHITE);
	paint.setStyle(Paint.Style.STROKE);
	paint.setStrokeJoin(Paint.Join.ROUND);
	paint.setStrokeWidth(STROKE_WIDTH);
}
 
Example 5
Source File: MainActivity.java    From arcgis-runtime-samples-android with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);

  // get reference to map view
  mMapView = findViewById(R.id.mapView);
  // create a map with the topographic basemap
  final ArcGISMap map = new ArcGISMap(Basemap.createTopographic());
  // set the map to the map view
  mMapView.setMap(map);

  // create a service feature table and a feature layer from it
  mServiceFeatureTable = new ServiceFeatureTable(getString(R.string.us_daytime_population_url));
  // create the feature layer using the service feature table
  mFeatureLayer = new FeatureLayer(mServiceFeatureTable);
  mFeatureLayer.setOpacity(0.8f);
  mFeatureLayer.setMaxScale(10000);

  //override the renderer
  SimpleLineSymbol lineSymbol = new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, Color.BLACK, 1);
  SimpleFillSymbol fillSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.SOLID, Color.YELLOW, lineSymbol);
  mFeatureLayer.setRenderer(new SimpleRenderer(fillSymbol));

  // add the layer to the map
  map.getOperationalLayers().add(mFeatureLayer);

  // zoom to a view point of the USA
  mMapView.setViewpointCenterAsync(new Point(-11000000, 5000000, SpatialReferences.getWebMercator()), 100000000);
}
 
Example 6
Source File: BatteryLevelView.java    From ExoVideoView with Apache License 2.0 5 votes vote down vote up
private int getPowerColor() {
    if (mIsCharging) {
        return Color.GREEN;
    }

    if (mPower <= 15) {
        return Color.RED;
    } else if (mPower <= 30) {
        return Color.YELLOW;
    } else {
        return Color.WHITE;
    }
}
 
Example 7
Source File: BIGChart.java    From NightWatch with 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 8
Source File: MainActivity.java    From RippleAnimation with 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 9
Source File: ColorList.java    From ui with 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 10
Source File: QuadrantChart01View.java    From XCL-Charts with Apache License 2.0 5 votes vote down vote up
private void chartDataSetScat()
{

	//线1的数据集
	List<PointD> linePoint1 = new ArrayList<PointD>();
	linePoint1.add(new PointD(15d, 68d));
	
	linePoint1.add(new PointD(32d, 62d));
	linePoint1.add(new PointD(25d, 55d));
	linePoint1.add(new PointD(60d, 80d));
	ScatterData dataSeries1 = new ScatterData("散点1",linePoint1,
			Color.rgb(41, 161, 64),XEnum.DotStyle.DOT );	
	dataSeries1.setLabelVisible(true);	
	dataSeries1.getDotLabelPaint().setColor(Color.rgb(41, 161, 64));
	
	
	//线2的数据集
	List<PointD> linePoint2 = new ArrayList<PointD>();
	linePoint2.add(new PointD(43d,70d));
	linePoint2.add(new PointD(56d, 85d));
	linePoint2.add(new PointD(37d, 65d));
	ScatterData dataSeries2 = new ScatterData("散点2",linePoint2,
			Color.YELLOW,XEnum.DotStyle.PRISMATIC );
					
	//设定数据源		
	chartDataScat.add(dataSeries1);				
	chartDataScat.add(dataSeries2);	
	
}
 
Example 11
Source File: ColorList.java    From ui with 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 12
Source File: DuotoneEffect.java    From VidEffects with Apache License 2.0 4 votes vote down vote up
public DuotoneEffect() {
    this(Color.MAGENTA, Color.YELLOW);
}
 
Example 13
Source File: Home.java    From xDrip-Experimental with GNU General Public License v3.0 4 votes vote down vote up
protected void setColorBright() {

        if (getCurrentWatchMode() == WatchMode.INTERACTIVE) {
            mRelativeLayout.setBackgroundColor(Color.WHITE);
            mLinearLayout.setBackgroundColor(Color.BLACK);
            if (sgvLevel == 1) {
                mSgv.setTextColor(Utils.COLOR_ORANGE);
                mDirection.setTextColor(Utils.COLOR_ORANGE);
                mDelta.setTextColor(Utils.COLOR_ORANGE);
            } else if (sgvLevel == 0) {
                mSgv.setTextColor(Color.BLACK);
                mDirection.setTextColor(Color.BLACK);
                mDelta.setTextColor(Color.BLACK);
            } else if (sgvLevel == -1) {
                mSgv.setTextColor(Color.RED);
                mDirection.setTextColor(Color.RED);
                mDelta.setTextColor(Color.RED);
            }

            if (ageLevel == 1) {
                mTimestamp.setTextColor(Color.WHITE);
            } else {
                mTimestamp.setTextColor(Color.RED);
            }

            if (batteryLevel == 1) {
                mUploaderBattery.setTextColor(Color.WHITE);
            } else {
                mUploaderBattery.setTextColor(Color.RED);
            }
            mRaw.setTextColor(Color.WHITE);
            mStatus.setTextColor(Color.WHITE);

            mTime.setTextColor(Color.BLACK);
            if (chart != null) {
                highColor = Utils.COLOR_ORANGE;
                midColor = Color.BLUE;
                lowColor = Color.RED;
                singleLine = false;
                pointSize = 2;
                setupCharts();
            }
        } else {
            mRelativeLayout.setBackgroundColor(Color.BLACK);
            mLinearLayout.setBackgroundColor(Color.WHITE);
            if (sgvLevel == 1) {
                mSgv.setTextColor(Color.YELLOW);
                mDirection.setTextColor(Color.YELLOW);
                mDelta.setTextColor(Color.YELLOW);
            } else if (sgvLevel == 0) {
                mSgv.setTextColor(Color.WHITE);
                mDirection.setTextColor(Color.WHITE);
                mDelta.setTextColor(Color.WHITE);
            } else if (sgvLevel == -1) {
                mSgv.setTextColor(Color.RED);
                mDirection.setTextColor(Color.RED);
                mDelta.setTextColor(Color.RED);
            }
            mRaw.setTextColor(Color.BLACK);
            mStatus.setTextColor(Color.BLACK);
            mUploaderBattery.setTextColor(Color.BLACK);
            mTimestamp.setTextColor(Color.BLACK);

            mTime.setTextColor(Color.WHITE);
            if (chart != null) {
                highColor = Color.YELLOW;
                midColor = Color.WHITE;
                lowColor = Color.RED;
                singleLine = true;
                pointSize = 2;
                setupCharts();
            }
        }

    }
 
Example 14
Source File: MainActivity.java    From arcgis-runtime-samples-android with Apache License 2.0 4 votes vote down vote up
private void addGraphicsOverlay() {
  // point graphic
  Point pointGeometry = new Point(40e5, 40e5, SpatialReferences.getWebMercator());
  // red diamond point symbol
  SimpleMarkerSymbol pointSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.DIAMOND, Color.RED, 10);
  // create graphic for point
  Graphic pointGraphic = new Graphic(pointGeometry);
  // create a graphic overlay for the point
  GraphicsOverlay pointGraphicOverlay = new GraphicsOverlay();
  // create simple renderer
  SimpleRenderer pointRenderer = new SimpleRenderer(pointSymbol);
  pointGraphicOverlay.setRenderer(pointRenderer);
  // add graphic to overlay
  pointGraphicOverlay.getGraphics().add(pointGraphic);
  // add graphics overlay to the MapView
  mMapView.getGraphicsOverlays().add(pointGraphicOverlay);

  // line graphic
  PolylineBuilder lineGeometry = new PolylineBuilder(SpatialReferences.getWebMercator());
  lineGeometry.addPoint(-10e5, 40e5);
  lineGeometry.addPoint(20e5, 50e5);
  // solid blue line symbol
  SimpleLineSymbol lineSymbol = new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, Color.BLUE, 5);
  // create graphic for polyline
  Graphic lineGraphic = new Graphic(lineGeometry.toGeometry());
  // create graphic overlay for polyline
  GraphicsOverlay lineGraphicOverlay = new GraphicsOverlay();
  // create simple renderer
  SimpleRenderer lineRenderer = new SimpleRenderer(lineSymbol);
  // add graphic to overlay
  lineGraphicOverlay.setRenderer(lineRenderer);
  // add graphic to overlay
  lineGraphicOverlay.getGraphics().add(lineGraphic);
  // add graphics overlay to the MapView
  mMapView.getGraphicsOverlays().add(lineGraphicOverlay);

  //polygon graphic
  PolygonBuilder polygonGeometry = new PolygonBuilder(SpatialReferences.getWebMercator());
  polygonGeometry.addPoint(-20e5, 20e5);
  polygonGeometry.addPoint(20e5, 20e5);
  polygonGeometry.addPoint(20e5, -20e5);
  polygonGeometry.addPoint(-20e5, -20e5);
  // solid yellow polygon symbol
  SimpleFillSymbol polygonSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.SOLID, Color.YELLOW, null);
  // create graphic for polygon
  Graphic polygonGraphic = new Graphic(polygonGeometry.toGeometry());
  // create graphic overlay for polygon
  GraphicsOverlay polygonGraphicOverlay = new GraphicsOverlay();
  // create simple renderer
  SimpleRenderer polygonRenderer = new SimpleRenderer(polygonSymbol);
  // add graphic to overlay
  polygonGraphicOverlay.setRenderer(polygonRenderer);
  // add graphic to overlay
  polygonGraphicOverlay.getGraphics().add(polygonGraphic);
  // add graphics overlay to MapView
  mMapView.getGraphicsOverlays().add(polygonGraphicOverlay);

}
 
Example 15
Source File: DetailFilterActivity.java    From GSYVideoPlayer with Apache License 2.0 4 votes vote down vote up
/**
 * 切换滤镜
 */
private void resolveTypeUI() {
    GSYVideoGLView.ShaderInterface effect = new NoEffect();
    switch (type) {
        case 0:
            effect = new AutoFixEffect(deep);
            break;
        case 1:
            effect = new PixelationEffect();
            break;
        case 2:
            effect = new BlackAndWhiteEffect();
            break;
        case 3:
            effect = new ContrastEffect(deep);
            break;
        case 4:
            effect = new CrossProcessEffect();
            break;
        case 5:
            effect = new DocumentaryEffect();
            break;
        case 6:
            effect = new DuotoneEffect(Color.BLUE, Color.YELLOW);
            break;
        case 7:
            effect = new FillLightEffect(deep);
            break;
        case 8:
            effect = new GammaEffect(deep);
            break;
        case 9:
            effect = new GrainEffect(deep);
            break;
        case 10:
            effect = new GrainEffect(deep);
            break;
        case 11:
            effect = new HueEffect(deep);
            break;
        case 12:
            effect = new InvertColorsEffect();
            break;
        case 13:
            effect = new LamoishEffect();
            break;
        case 14:
            effect = new PosterizeEffect();
            break;
        case 15:
            effect = new BarrelBlurEffect();
            break;
        case 16:
            effect = new SaturationEffect(deep);
            break;
        case 17:
            effect = new SepiaEffect();
            break;
        case 18:
            effect = new SharpnessEffect(deep);
            break;
        case 19:
            effect = new TemperatureEffect(deep);
            break;
        case 20:
            effect = new TintEffect(Color.GREEN);
            break;
        case 21:
            effect = new VignetteEffect(deep);
            break;
        case 22:
            effect = new NoEffect();
            break;
        case 23:
            effect = new OverlayEffect();
            break;
        case 24:
            effect = new SampleBlurEffect(4.0f);
            break;
        case 25:
            effect = new GaussianBlurEffect(6.0f, GaussianBlurEffect.TYPEXY);
            break;
        case 26:
            effect = new BrightnessEffect(deep);
            break;
    }
    detailPlayer.setEffectFilter(effect);
    type++;
    if (type > 25) {
        type = 0;
    }
}
 
Example 16
Source File: CircleWatchface.java    From NightWatch with GNU General Public License v3.0 4 votes vote down vote up
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");

}
 
Example 17
Source File: HomeFragment.java    From batteryhub with Apache License 2.0 4 votes vote down vote up
/**
 * Creates an array to feed data to the recyclerView
 *
 * @param estimator Provider of mobile status
 */
private void loadData(final DataEstimator estimator) {
    mLocalThread = new Thread(new Runnable() {
        public void run() {
            mBatteryCards = new ArrayList<>();
            String value;
            int color = Color.GREEN;

            // Temperature
            float temperature = estimator.getTemperature();
            value = temperature + " ºC";
            if (temperature > 45) {
                color = Color.RED;
            } else if (temperature <= 45 && temperature > 35) {
                color = Color.YELLOW;
            }
            mBatteryCards.add(
                    new BatteryCard(
                            R.drawable.ic_thermometer_black_18dp,
                            getString(R.string.battery_summary_temperature),
                            value,
                            color
                    )
            );

            // Voltage
            value = estimator.getVoltage() + " V";
            mBatteryCards.add(
                    new BatteryCard(
                            R.drawable.ic_flash_black_18dp,
                            getString(R.string.battery_summary_voltage),
                            value
                    )
            );

            // Health
            value = estimator.getHealthStatus(mContext);
            color = value.equals(mContext.getString(R.string.battery_health_good)) ?
                    Color.GREEN : Color.RED;
            mBatteryCards.add(
                    new BatteryCard(
                            R.drawable.ic_heart_black_18dp,
                            getString(R.string.battery_summary_health),
                            value,
                            color
                    )
            );

            // Technology
            if (estimator.getTechnology() == null) {
                color = Color.GRAY;
                value = getString(R.string.not_available);
            } else {
                color = estimator.getTechnology().equals("Li-ion") ? Color.GRAY : Color.GREEN;
                value = estimator.getTechnology();
            }
            mBatteryCards.add(
                    new BatteryCard(
                            R.drawable.ic_wrench_black_18dp,
                            getString(R.string.battery_summary_technology),
                            value,
                            color
                    )
            );
        }
    });

    mLocalThread.start();
    setAdapter();
}
 
Example 18
Source File: CircleWatchface.java    From NightWatch with GNU General Public License v3.0 4 votes vote down vote up
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");

}
 
Example 19
Source File: RemoteControlActivity.java    From next18-ai-in-motion with Apache License 2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_remote_control);

    vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE);

    // Setup Joystick UI to match sphero ball color
    JoyStick joy1 = findViewById(R.id.joy1);
    joy1.setListener(this);
    joy1.setPadBackground(R.drawable.gray_pad);
    if (MainActivity.spheroColor == Color.BLUE) {
        joy1.setButtonDrawable(R.drawable.blue_btn);
    } else if (MainActivity.spheroColor == Color.GREEN) {
        joy1.setButtonDrawable(R.drawable.green_btn);
    } else if (MainActivity.spheroColor == Color.YELLOW) {
        joy1.setButtonDrawable(R.drawable.orange_btn);
    } else if (MainActivity.spheroColor == Color.MAGENTA) {
        joy1.setButtonDrawable(R.drawable.pink_btn);
    } else {
        joy1.setButtonDrawable(R.drawable.btn_1);
    }


    fallBackTimer = new Handler();
    runnable = new Runnable() {
        public void run() {
            UserSetup.joinedGame = false;
            finish();
        }
    };

    fallBackTimer.postDelayed(runnable, 60000);

    countDownTimer = findViewById(R.id.countDownText);

    setEventListeners();


    if (!UserSetup.joinedGame) {
        headingEventListener = new ValueEventListener() {
            @Override
            public void onDataChange(DataSnapshot dataSnapshot) {
                int angle = Integer.valueOf(String.valueOf(dataSnapshot.getValue()));
                if (!UserSetup.joinedGame && angle >= 0) {
                    MainActivity.robot.drive((float) angle, 0.18f);
                    disableJoystick = true;
                }
            }

            @Override
            public void onCancelled(DatabaseError databaseError) {
            }
        };

        MainActivity.databaseReference.child("heading").addValueEventListener(headingEventListener);
    }
}
 
Example 20
Source File: Home.java    From NightWatch with GNU General Public License v3.0 4 votes vote down vote up
protected void setColorBright() {

        if (getCurrentWatchMode() == WatchMode.INTERACTIVE) {
            mRelativeLayout.setBackgroundColor(Color.WHITE);
            mLinearLayout.setBackgroundColor(Color.BLACK);
            if (sgvLevel == 1) {
                mSgv.setTextColor(Utils.COLOR_ORANGE);
                mDirection.setTextColor(Utils.COLOR_ORANGE);
                mDelta.setTextColor(Utils.COLOR_ORANGE);
            } else if (sgvLevel == 0) {
                mSgv.setTextColor(Color.BLACK);
                mDirection.setTextColor(Color.BLACK);
                mDelta.setTextColor(Color.BLACK);
            } else if (sgvLevel == -1) {
                mSgv.setTextColor(Color.RED);
                mDirection.setTextColor(Color.RED);
                mDelta.setTextColor(Color.RED);
            }

            if (ageLevel == 1) {
                mTimestamp.setTextColor(Color.WHITE);
            } else {
                mTimestamp.setTextColor(Color.RED);
            }

            if (batteryLevel == 1) {
                mUploaderBattery.setTextColor(Color.WHITE);
            } else {
                mUploaderBattery.setTextColor(Color.RED);
            }
            mRaw.setTextColor(Color.WHITE);
            mTime.setTextColor(Color.BLACK);
            if (chart != null) {
                highColor = Utils.COLOR_ORANGE;
                midColor = Color.BLUE;
                lowColor = Color.RED;
                singleLine = false;
                pointSize = 2;
                setupCharts();
            }
        } else {
            mRelativeLayout.setBackgroundColor(Color.BLACK);
            mLinearLayout.setBackgroundColor(Color.WHITE);
            if (sgvLevel == 1) {
                mSgv.setTextColor(Color.YELLOW);
                mDirection.setTextColor(Color.YELLOW);
                mDelta.setTextColor(Color.YELLOW);
            } else if (sgvLevel == 0) {
                mSgv.setTextColor(Color.WHITE);
                mDirection.setTextColor(Color.WHITE);
                mDelta.setTextColor(Color.WHITE);
            } else if (sgvLevel == -1) {
                mSgv.setTextColor(Color.RED);
                mDirection.setTextColor(Color.RED);
                mDelta.setTextColor(Color.RED);
            }
            mRaw.setTextColor(Color.BLACK);
            mUploaderBattery.setTextColor(Color.BLACK);
            mTimestamp.setTextColor(Color.BLACK);

            mTime.setTextColor(Color.WHITE);
            if (chart != null) {
                highColor = Color.YELLOW;
                midColor = Color.WHITE;
                lowColor = Color.RED;
                singleLine = true;
                pointSize = 2;
                setupCharts();
            }
        }

    }