List of usage examples for android.graphics Color argb
@ColorInt public static int argb(float alpha, float red, float green, float blue)
From source file:com.iride.ayride.HomePageActivity.java
private void centerInLocation(Location location) { if (currentLocationMarker != null) { currentLocationMarker.remove();/* ww w .ja v a 2 s . c o m*/ } if (location == null) { Log.d(loggerTag, "LOCATION IS NULL IN CENTER IN LOCATION METHOD"); return; } this.latitude = location.getLatitude(); this.longitude = location.getLongitude(); LatLng myLaLn = new LatLng(this.latitude, this.longitude); this.searchCircle = this.googleMap.addCircle(new CircleOptions().center(myLaLn).radius(1000)); this.searchCircle.setFillColor(Color.argb(66, 255, 0, 255)); this.searchCircle.setStrokeColor(Color.argb(66, 0, 0, 0)); CameraPosition camPos = new CameraPosition.Builder().target(myLaLn).zoom(15).bearing(45).tilt(70).build(); CameraUpdate camUpd3 = CameraUpdateFactory.newCameraPosition(camPos); googleMap.animateCamera(camUpd3); BitmapDescriptor icon; if (userLocalStorage.isDriverMode()) { icon = BitmapDescriptorFactory.fromResource(R.drawable.car); } else { icon = BitmapDescriptorFactory.fromResource(R.drawable.person); } MarkerOptions markerOpts = new MarkerOptions().position(myLaLn).title("You're Here!").icon(icon); currentLocationMarker = googleMap.addMarker(markerOpts); }
From source file:devlight.io.library.ArcProgressStackView.java
private int adjustColorAlpha(final int color, final float factor) { return Color.argb(Math.round(Color.alpha(color) * factor), Color.red(color), Color.green(color), Color.blue(color));//from w ww .ja v a 2 s . c o m }
From source file:com.iride.ayride.HomePageActivity.java
private void centerInLocation(LatLng latLng) { if (currentLocationMarker != null) { currentLocationMarker.remove();//from ww w. j a v a 2 s . co m } this.searchCircle = this.googleMap.addCircle(new CircleOptions().center(latLng).radius(1000)); this.searchCircle.setFillColor(Color.argb(66, 255, 0, 255)); this.searchCircle.setStrokeColor(Color.argb(66, 0, 0, 0)); CameraPosition camPos = new CameraPosition.Builder().target(latLng).zoom(15).bearing(45).tilt(70).build(); CameraUpdate camUpd3 = CameraUpdateFactory.newCameraPosition(camPos); googleMap.animateCamera(camUpd3); BitmapDescriptor icon; if (userLocalStorage.isDriverMode()) { icon = BitmapDescriptorFactory.fromResource(R.drawable.car); } else { icon = BitmapDescriptorFactory.fromResource(R.drawable.person); } MarkerOptions markerOpts = new MarkerOptions().position(latLng).title("You're Here!").icon(icon); currentLocationMarker = googleMap.addMarker(markerOpts); }
From source file:com.cypress.cysmart.BLEServiceFragments.CSCService.java
/** * Setting up the aChart Third party library * * @param parent//from w ww . j a v a2 s .co m */ private void setupChart(View parent) { /** * Setting graph titles */ String graphTitle = getResources().getString(R.string.csc_fragment); String graphXAxis = getResources().getString(R.string.health_temperature_time); String graphYAxis = getResources().getString(R.string.csc_cadence_graph); // Creating an XYSeries for running speed mDataSeries = new XYSeries(graphTitle); // Creating a dataset to hold each series XYMultipleSeriesDataset mDataset = new XYMultipleSeriesDataset(); // Adding temperature Series to the dataset mDataset.addSeries(mDataSeries); // Creating XYSeriesRenderer to customize XYSeriesRenderer mRenderer = new XYSeriesRenderer(); mRenderer.setColor(getResources().getColor(R.color.main_bg_color)); mRenderer.setPointStyle(PointStyle.CIRCLE); mRenderer.setFillPoints(true); mRenderer.setLineWidth(5); // Creating a XYMultipleSeriesRenderer to customize the whole chart XYMultipleSeriesRenderer mMultiRenderer = new XYMultipleSeriesRenderer(); int deviceDPi = getResources().getDisplayMetrics().densityDpi; switch (getResources().getDisplayMetrics().densityDpi) { case DisplayMetrics.DENSITY_XHIGH: mMultiRenderer.setMargins(new int[] { 40, 90, 25, 10 }); mMultiRenderer.setAxisTitleTextSize(Constants.TEXT_SIZE_XHDPI); mMultiRenderer.setChartTitleTextSize(Constants.TEXT_SIZE_XHDPI); mMultiRenderer.setLabelsTextSize(Constants.TEXT_SIZE_XHDPI); mMultiRenderer.setLegendTextSize(Constants.TEXT_SIZE_XHDPI); break; case DisplayMetrics.DENSITY_HIGH: mMultiRenderer.setMargins(new int[] { 30, 50, 25, 10 }); mMultiRenderer.setAxisTitleTextSize(Constants.TEXT_SIZE_HDPI); mMultiRenderer.setChartTitleTextSize(Constants.TEXT_SIZE_HDPI); mMultiRenderer.setLabelsTextSize(Constants.TEXT_SIZE_HDPI); mMultiRenderer.setLegendTextSize(Constants.TEXT_SIZE_HDPI); break; case DisplayMetrics.DENSITY_XXHIGH: mMultiRenderer.setMargins(new int[] { 50, 100, 35, 20 }); mMultiRenderer.setAxisTitleTextSize(Constants.TEXT_SIZE_XXHDPI); mMultiRenderer.setChartTitleTextSize(Constants.TEXT_SIZE_XXHDPI); mMultiRenderer.setLabelsTextSize(Constants.TEXT_SIZE_XXHDPI); mMultiRenderer.setLegendTextSize(Constants.TEXT_SIZE_XXHDPI); break; default: if (deviceDPi > DisplayMetrics.DENSITY_XXHIGH && deviceDPi < DisplayMetrics.DENSITY_XXXHIGH) { mMultiRenderer.setMargins(new int[] { 50, 100, 35, 20 }); mMultiRenderer.setAxisTitleTextSize(Constants.TEXT_SIZE_XXHDPI); mMultiRenderer.setChartTitleTextSize(Constants.TEXT_SIZE_XXHDPI); mMultiRenderer.setLabelsTextSize(Constants.TEXT_SIZE_XXHDPI); mMultiRenderer.setLegendTextSize(Constants.TEXT_SIZE_XXHDPI); } else { mMultiRenderer.setMargins(new int[] { 30, 50, 25, 10 }); mMultiRenderer.setAxisTitleTextSize(Constants.TEXT_SIZE_LDPI); mMultiRenderer.setChartTitleTextSize(Constants.TEXT_SIZE_LDPI); mMultiRenderer.setLabelsTextSize(Constants.TEXT_SIZE_LDPI); mMultiRenderer.setLegendTextSize(Constants.TEXT_SIZE_LDPI); } break; } mMultiRenderer.setXTitle(graphXAxis); mMultiRenderer.setLabelsColor(Color.BLACK); mMultiRenderer.setYTitle(graphYAxis); mMultiRenderer.setYAxisMin(0); mMultiRenderer.setXAxisMin(0); mMultiRenderer.setMarginsColor(Color.argb(0x00, 0xff, 0x00, 0x00)); mMultiRenderer.setPanEnabled(true, true); mMultiRenderer.setZoomEnabled(false, false); mMultiRenderer.setYLabelsColor(0, Color.BLACK); mMultiRenderer.setXLabelsColor(Color.BLACK); mMultiRenderer.setApplyBackgroundColor(true); mMultiRenderer.setBackgroundColor(Color.WHITE); mMultiRenderer.setGridColor(Color.BLACK); mMultiRenderer.setShowGrid(true); mMultiRenderer.setShowLegend(false); // Adding mRenderer to multipleRenderer mMultiRenderer.addSeriesRenderer(mRenderer); // Getting a reference to LinearLayout of the MainActivity Layout mGraphLayoutParent = (LinearLayout) parent.findViewById(R.id.chart_container); mChart = ChartFactory.getLineChartView(getActivity(), mDataset, mMultiRenderer); // Adding the Line Chart to the LinearLayout mGraphLayoutParent.addView(mChart); }
From source file:com.granita.tasks.EditTaskFragment.java
private int getBlendColor(int baseColor, int targetColor, float alpha) { int r1, g1, b1, r3, g3, b3; if (alpha <= 0) { return targetColor; } else if (alpha > 254) { return targetColor; }//w w w .j ava 2 s . c om r1 = Color.red(baseColor); g1 = Color.green(baseColor); b1 = Color.blue(baseColor); r3 = Color.red(targetColor); g3 = Color.green(targetColor); b3 = Color.blue(targetColor); int r2 = (int) Math.ceil((Math.max(0, r3 * 255 - r1 * (255 - alpha))) / alpha); int g2 = (int) Math.ceil((Math.max(0, g3 * 255 - g1 * (255 - alpha))) / alpha); int b2 = (int) Math.ceil((Math.max(0, b3 * 255 - b1 * (255 - alpha))) / alpha); return Color.argb((int) alpha, r2, g2, b2); }
From source file:com.cypress.cysmart.BLEServiceFragments.RSCService.java
/** * Setting up the aChart Third party library * * @param parent//from w w w . ja v a 2 s. com */ private void setupChart(View parent) { /** * Setting graph titles */ String graphTitle = getResources().getString(R.string.rsc_fragment); String graphXAxis = getResources().getString(R.string.health_temperature_time); String graphYAxis = getResources().getString(R.string.rsc_avg_speed); // Creating an XYSeries for running speed mDataSeries = new XYSeries(graphTitle); // Creating a dataset to hold each series XYMultipleSeriesDataset mDataset = new XYMultipleSeriesDataset(); // Adding temperature Series to the dataset mDataset.addSeries(mDataSeries); // Creating XYSeriesRenderer to customize XYSeriesRenderer mRenderer = new XYSeriesRenderer(); mRenderer.setColor(getResources().getColor(R.color.main_bg_color)); mRenderer.setPointStyle(PointStyle.CIRCLE); mRenderer.setFillPoints(true); mRenderer.setLineWidth(5); // Creating a XYMultipleSeriesRenderer to customize the whole chart XYMultipleSeriesRenderer mMultiRenderer = new XYMultipleSeriesRenderer(); int deviceDPi = getResources().getDisplayMetrics().densityDpi; switch (getResources().getDisplayMetrics().densityDpi) { case DisplayMetrics.DENSITY_XHIGH: mMultiRenderer.setMargins(new int[] { 40, 90, 25, 10 }); mMultiRenderer.setAxisTitleTextSize(Constants.TEXT_SIZE_XHDPI); mMultiRenderer.setChartTitleTextSize(Constants.TEXT_SIZE_XHDPI); mMultiRenderer.setLabelsTextSize(Constants.TEXT_SIZE_XHDPI); mMultiRenderer.setLegendTextSize(Constants.TEXT_SIZE_XHDPI); break; case DisplayMetrics.DENSITY_HIGH: mMultiRenderer.setMargins(new int[] { 30, 50, 25, 10 }); mMultiRenderer.setAxisTitleTextSize(Constants.TEXT_SIZE_HDPI); mMultiRenderer.setChartTitleTextSize(Constants.TEXT_SIZE_HDPI); mMultiRenderer.setLabelsTextSize(Constants.TEXT_SIZE_HDPI); mMultiRenderer.setLegendTextSize(Constants.TEXT_SIZE_HDPI); break; case DisplayMetrics.DENSITY_XXHIGH: mMultiRenderer.setMargins(new int[] { 50, 100, 35, 20 }); mMultiRenderer.setAxisTitleTextSize(Constants.TEXT_SIZE_XXHDPI); mMultiRenderer.setChartTitleTextSize(Constants.TEXT_SIZE_XXHDPI); mMultiRenderer.setLabelsTextSize(Constants.TEXT_SIZE_XXHDPI); mMultiRenderer.setLegendTextSize(Constants.TEXT_SIZE_XXHDPI); break; default: if (deviceDPi > DisplayMetrics.DENSITY_XXHIGH && deviceDPi < DisplayMetrics.DENSITY_XXXHIGH) { mMultiRenderer.setMargins(new int[] { 50, 100, 35, 20 }); mMultiRenderer.setAxisTitleTextSize(Constants.TEXT_SIZE_XXHDPI); mMultiRenderer.setChartTitleTextSize(Constants.TEXT_SIZE_XXHDPI); mMultiRenderer.setLabelsTextSize(Constants.TEXT_SIZE_XXHDPI); mMultiRenderer.setLegendTextSize(Constants.TEXT_SIZE_XXHDPI); } else { mMultiRenderer.setMargins(new int[] { 30, 50, 25, 10 }); mMultiRenderer.setAxisTitleTextSize(Constants.TEXT_SIZE_LDPI); mMultiRenderer.setChartTitleTextSize(Constants.TEXT_SIZE_LDPI); mMultiRenderer.setLabelsTextSize(Constants.TEXT_SIZE_LDPI); mMultiRenderer.setLegendTextSize(Constants.TEXT_SIZE_LDPI); } break; } mMultiRenderer.setXTitle(graphXAxis); mMultiRenderer.setLabelsColor(Color.BLACK); mMultiRenderer.setYTitle(graphYAxis); mMultiRenderer.setYAxisMin(0); mMultiRenderer.setXAxisMin(0); mMultiRenderer.setMarginsColor(Color.argb(0x00, 0xff, 0x00, 0x00)); mMultiRenderer.setPanEnabled(true, true); mMultiRenderer.setZoomEnabled(false, false); mMultiRenderer.setYLabelsColor(0, Color.BLACK); mMultiRenderer.setXLabelsColor(Color.BLACK); mMultiRenderer.setApplyBackgroundColor(true); mMultiRenderer.setBackgroundColor(Color.WHITE); mMultiRenderer.setGridColor(Color.BLACK); mMultiRenderer.setShowGrid(true); mMultiRenderer.setShowLegend(false); // Adding mRenderer to multipleRenderer mMultiRenderer.addSeriesRenderer(mRenderer); // Getting a reference to LinearLayout of the MainActivity Layout mGraphLayoutParent = (LinearLayout) parent.findViewById(R.id.chart_container); mChart = ChartFactory.getLineChartView(getActivity(), mDataset, mMultiRenderer); // Adding the Line Chart to the LinearLayout mGraphLayoutParent.addView(mChart); }
From source file:com.olearyp.gusto.Expsetup.java
protected void sendCommand(final String command, final String description, final String state) { final Intent runCmd = new Intent("com.olearyp.gusto.SUEXEC"); runCmd.setData(//from ww w. j a v a 2 s .com Uri.fromParts("command", ". /system/bin/exp_script.sh.lib && read_in_ep_config && " + command, "")) .putExtra("com.olearyp.gusto.STATE", state); final Notification note = new Notification(R.drawable.icon, description.substring(0, 1).toUpperCase() + description.substring(1) + "...", System.currentTimeMillis()); note.setLatestEventInfo(Expsetup.this, getString(R.string.app_name), getString(R.string.app_name) + " is " + description + "...", PendingIntent.getBroadcast(Expsetup.this, 0, null, 0)); runCmd.putExtra("com.olearyp.gusto.RUN_NOTIFICATION", note); startService(runCmd); setServerState(state); if (getServerState().equals(getString(R.string.reboot_manual_flash_required))) { final Intent intent = new Intent("com.olearyp.gusto.SUEXEC") .setData(Uri.fromParts("commandid", Integer.toString(R.string.reboot_recovery), "")); final PendingIntent contentIntent = PendingIntent.getService(this, 0, intent, 0); final Notification rebootNote = new Notification(R.drawable.status_reboot, getString(R.string.reboot_recovery_required_msg), System.currentTimeMillis()); rebootNote.setLatestEventInfo(this, "GUSTO reboot request", getString(R.string.reboot_recovery_doit_msg), contentIntent); rebootNote.deleteIntent = PendingIntent.getBroadcast(this, 0, new Intent("com.olearyp.gusto.RESET_SERVER_STATE"), 0); rebootNote.flags |= Notification.FLAG_SHOW_LIGHTS; rebootNote.ledOnMS = 200; rebootNote.ledOffMS = 400; rebootNote.ledARGB = Color.argb(255, 255, 0, 0); nm.notify(REBOOT_NOTIFICATION, rebootNote); } else if (getServerState().equals(getString(R.string.reboot_recovery_required))) { final Intent intent = new Intent("com.olearyp.gusto.SUEXEC") .setData(Uri.fromParts("commandid", Integer.toString(R.string.reboot), "")); final PendingIntent contentIntent = PendingIntent.getService(this, 0, intent, 0); final Notification rebootNote = new Notification(R.drawable.status_reboot, getString(R.string.reboot_autoflash_required_msg), System.currentTimeMillis()); rebootNote.setLatestEventInfo(this, "GUSTO reboot request", getString(R.string.reboot_autoflash_doit_msg), contentIntent); rebootNote.deleteIntent = PendingIntent.getBroadcast(this, 0, new Intent("com.olearyp.gusto.RESET_SERVER_STATE"), 0); rebootNote.flags |= Notification.FLAG_SHOW_LIGHTS; rebootNote.ledOnMS = 200; rebootNote.ledOffMS = 600; rebootNote.ledARGB = Color.argb(255, 255, 255, 0); nm.notify(REBOOT_NOTIFICATION, rebootNote); } else if (getServerState().equals(getString(R.string.reboot_required))) { final Intent intent = new Intent("com.olearyp.gusto.SUEXEC") .setData(Uri.fromParts("commandid", Integer.toString(R.string.reboot), "")); final PendingIntent contentIntent = PendingIntent.getService(this, 0, intent, 0); final Notification rebootNote = new Notification(R.drawable.status_reboot, getString(R.string.reboot_required_msg), System.currentTimeMillis()); rebootNote.setLatestEventInfo(this, "GUSTO reboot request", getString(R.string.reboot_doit_msg), contentIntent); rebootNote.deleteIntent = PendingIntent.getBroadcast(this, 0, new Intent("com.olearyp.gusto.RESET_SERVER_STATE"), 0); rebootNote.flags |= Notification.FLAG_SHOW_LIGHTS; rebootNote.ledOnMS = 200; rebootNote.ledOffMS = 600; rebootNote.ledARGB = Color.argb(255, 255, 255, 0); nm.notify(REBOOT_NOTIFICATION, rebootNote); } }
From source file:com.bili.diushoujuaner.widget.waveswipe.WaveSwipeRefreshLayout.java
/** * WaveView is colored by given rgb color + 0xFF000000 * * @param r int [0, 0xFF]//ww w . j av a 2 s. c o m * @param g int [0, 0xFF] * @param b int [0, 0xFF] */ public void setWaveRGBColor(int r, int g, int b) { mWaveView.setWaveColor(Color.argb(0xFF, r, g, b)); }
From source file:com.guipenedo.pokeradar.activities.MapsActivity.java
private void update() { if (mMap == null || location == null) return;// w w w . j a va2s. c o m if (center != null) removeMarker(center); if (scanArea != null) scanArea.remove(); if (showScanArea) scanArea = mMap.addPolygon(new PolygonOptions().addAll(createRectangle(location, steps * gpsOffset)) .fillColor(Color.argb(20, 50, 0, 255))); center = addMarker(getString(R.string.center_marker_title), location, new PMarker(PMarker.MarkerType.CENTER), true); mMap.setOnMarkerDragListener(new GoogleMap.OnMarkerDragListener() { @Override public void onMarkerDragStart(Marker marker) { } @Override public void onMarkerDrag(Marker marker) { } @Override public void onMarkerDragEnd(Marker marker) { location = marker.getPosition(); update(); } }); centerCamera(); }
From source file:com.jaredrummler.android.colorpicker.ColorPickerDialog.java
private int shadeColor(@ColorInt int color, double percent) { String hex = String.format("#%06X", (0xFFFFFF & color)); long f = Long.parseLong(hex.substring(1), 16); double t = percent < 0 ? 0 : 255; double p = percent < 0 ? percent * -1 : percent; long R = f >> 16; long G = f >> 8 & 0x00FF; long B = f & 0x0000FF; int alpha = Color.alpha(color); int red = (int) (Math.round((t - R) * p) + R); int green = (int) (Math.round((t - G) * p) + G); int blue = (int) (Math.round((t - B) * p) + B); return Color.argb(alpha, red, green, blue); }