List of usage examples for android.graphics Color GRAY
int GRAY
To view the source code for android.graphics Color GRAY.
Click Source Link
From source file:com.adrguides.ReadGuideFragment.java
private Drawable getDrawableDisabled(int res) { Drawable resIcon = getResources().getDrawable(res); resIcon.mutate().setColorFilter(Color.GRAY, PorterDuff.Mode.SRC_IN); return resIcon; }
From source file:com.example.parkhere.seeker.SeekerProfileVehicleFragment.java
public void getCurrInfo() { tag = 1;/*from ww w . j a va 2s. co m*/ Retrofit retrofit = new Retrofit.Builder().baseUrl(Constants.BASE_URL) .addConverterFactory(GsonConverterFactory.create()).build(); RequestInterface requestInterface = retrofit.create(RequestInterface.class); ServerRequest request = new ServerRequest(); request.setOperation(Constants.GET_SEEKER_PROFILE_OPERATION); request.setUser(user); Call<ServerResponse> response = requestInterface.operation(request); response.enqueue(new Callback<ServerResponse>() { @Override public void onResponse(Call<ServerResponse> call, retrofit2.Response<ServerResponse> response) { ServerResponse resp = response.body(); if (resp.getResult().equals(Constants.SUCCESS)) { vehicles = resp.getVehicles(); TableRow tr_head = new TableRow(myContext); tr_head.setBackgroundColor(Color.GRAY); tr_head.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.FILL_PARENT, TableRow.LayoutParams.WRAP_CONTENT)); TextView make = new TextView(myContext); make.setText("MAKE"); make.setTextColor(Color.WHITE); make.setPadding(5, 5, 5, 5); tr_head.addView(make); TextView model = new TextView(myContext); model.setText("MODEL"); model.setTextColor(Color.WHITE); model.setPadding(5, 5, 5, 5); tr_head.addView(model); final TextView license = new TextView(myContext); license.setText("LICENSE PLATE"); license.setTextColor(Color.WHITE); license.setPadding(5, 5, 5, 5); tr_head.addView(license); tl.addView(tr_head, new TableLayout.LayoutParams(TableLayout.LayoutParams.FILL_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)); for (int i = 0; i < vehicles.length; i++) { if (vehicles[i].getDeletedWithHistory() == 1) { continue; } TableRow tr = new TableRow(myContext); tr.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.FILL_PARENT, TableRow.LayoutParams.WRAP_CONTENT)); tr.setTag(tag); tag++; tr.setClickable(true); tr.setOnClickListener(clickListener); TextView v_make = new TextView(myContext); v_make.setText(vehicles[i].getMake()); v_make.setLayoutParams(new TableRow.LayoutParams(300, 150)); tr.addView(v_make); TextView v_model = new TextView(myContext); v_model.setText(vehicles[i].getModel()); v_model.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT)); tr.addView(v_model); TextView v_license = new TextView(myContext); v_license.setText(vehicles[i].getLicensePlate()); v_license.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT)); tr.addView(v_license); tl.addView(tr, new TableLayout.LayoutParams(TableLayout.LayoutParams.FILL_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)); } } } @Override public void onFailure(Call<ServerResponse> call, Throwable t) { Snackbar.make(rootView, t.getLocalizedMessage(), Snackbar.LENGTH_LONG).show(); } }); }
From source file:edu.cmu.cylab.starslinger.view.ComposeFragment.java
public void updateValues(Bundle extras) { String contactLookupKey = SafeSlingerPrefs.getContactLookupKey(); DraftData d = DraftData.INSTANCE;/*from ww w . j a v a 2s .c om*/ if (d.existsRecip()) { mRowIdRecipient = d.getRecipRowId(); } else { mRowIdRecipient = -1; } mFilePath = d.getFileName(); mFileSize = d.getFileSize(); mText = d.getText(); if (!TextUtils.isEmpty(d.getFileType()) && d.getFileType().contains("image")) { mThumb = SSUtil.makeThumbnail(SafeSlinger.getApplication().getApplicationContext(), d.getFileData()); } else { mThumb = null; } // make sure view is already inflated... if (mTextViewSenderName == null) { return; } RecipientDbAdapter dbRecipient = RecipientDbAdapter.openInstance(this.getActivity()); mRecip = null; Cursor c = dbRecipient.fetchRecipient(mRowIdRecipient); if (c != null) { try { if (c.moveToFirst()) { mRecip = new RecipientRow(c); } } finally { c.close(); } } // load key here! String myKeyId = SafeSlingerPrefs.getKeyIdString(); long myKeyDate = SafeSlingerPrefs.getKeyDate(); // sender mImageViewSenderPhoto.setImageResource(0); String name = SafeSlingerPrefs.getContactName(); if (!TextUtils.isEmpty(name)) { byte[] photo = ((BaseActivity) this.getActivity()).getContactPhoto(contactLookupKey); drawUserData(R.string.label_SendFrom, name, photo, mTextViewSenderName, mTextViewSenderKey, mImageViewSenderPhoto, myKeyId, myKeyDate); } else { mTextViewRecipName.setTextColor(Color.GRAY); mTextViewSenderName.setText(R.string.label_UserName); mTextViewSenderKey.setText(""); mImageViewSenderPhoto.setImageResource(R.drawable.ic_silhouette); } // recipient mImageViewRecipPhoto.setImageResource(0); if (mRecip != null) { drawUserData(R.string.label_SendTo, mRecip.getName(), mRecip.getPhoto(), mTextViewRecipName, mTextViewRecipKey, mImageViewRecipPhoto, mRecip.getKeyid(), mRecip.getKeydate()); mTextViewRecipName.setTextColor(Color.BLACK); } else { mTextViewRecipName.setTextColor(Color.GRAY); mTextViewRecipName.setText(R.string.label_SelectRecip); mTextViewRecipKey.setText(""); mImageViewRecipPhoto.setImageResource(R.drawable.ic_silhouette_select); } // file if (!(TextUtils.isEmpty(mFilePath))) { drawFileImage(); drawFileData(); mTextViewFile.setTextColor(Color.BLACK); } else { mTextViewFile.setTextColor(Color.GRAY); mTextViewFile.setText(R.string.btn_SelectFile); mImageViewFile.setImageResource(R.drawable.ic_attachment_select); mTextViewFileSize.setText(""); } // message if (!TextUtils.isEmpty(mText)) { mEditTextMessage.setTextKeepState(mText); mEditTextMessage.forceLayout(); } else { mEditTextMessage.setTextKeepState(""); } }
From source file:com.progym.custom.fragments.CalloriesProgressYearlyLineFragment.java
public void setYearProgressData(final Date date, final boolean isLeftIn) { final ProgressDialog ringProgressDialog = ProgressDialog.show(getActivity(), getResources().getString(R.string.please_wait), getResources().getString(R.string.populating_data), true);//from w w w. j av a2 s . co m ringProgressDialog.setCancelable(true); new Thread(new Runnable() { @Override public void run() { try { int yMaxAxisValue = 0; getActivity().runOnUiThread(new Runnable() { @Override public void run() { try { rlRootGraphLayout.removeView(viewChart); } catch (Exception edsx) { edsx.printStackTrace(); } } }); DATE = date; // Get amount of days in a month to find out average int daysInMonth = Utils.getDaysInMonth(date.getMonth(), Integer.valueOf(Utils.formatDate(date, DataBaseUtils.DATE_PATTERN_YYYY))); // set January as first month date.setMonth(0); date.setDate(1); int[] x = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; final XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset(); CategorySeries seriesCallories = new CategorySeries("Callories"); List<Ingridient> list; Date dt = date; // * for (int element : x) { list = DataBaseUtils.getAllFoodConsumedInMonth( Utils.formatDate(dt, DataBaseUtils.DATE_PATTERN_YYYY_MM)); // init "average" data int totalCallories = 0; for (Ingridient ingridient : list) { totalCallories += ingridient.kkal; } // add value to series seriesCallories.add(totalCallories / daysInMonth); // calculate maximum Y axis values yMaxAxisValue = Math.max(yMaxAxisValue, totalCallories / daysInMonth); // increment month dt = DateUtils.addMonths(dt, 1); } int[] colors = new int[] { getActivity().getResources().getColor(R.color.purple) }; final XYMultipleSeriesRenderer renderer = buildBarRenderer(colors); setChartSettings(renderer, String.format("Callories statistic for %s year", Utils.getSpecificDateValue(DATE, "yyyy")), "Months", "Calories consumption", 0.7, 12.3, 0, yMaxAxisValue + 30, Color.GRAY, Color.LTGRAY); renderer.getSeriesRendererAt(0).setDisplayChartValues(true); renderer.getSeriesRendererAt(0).setChartValuesTextSize(15f); renderer.setXLabels(0); renderer.setClickEnabled(false); renderer.setZoomEnabled(false); renderer.setPanEnabled(false, false); renderer.setZoomButtonsVisible(false); renderer.setPanLimits(new double[] { 1, 11 }); renderer.setShowGrid(true); renderer.setShowLegend(true); renderer.setFitLegend(true); for (int i = 0; i < ActivityWaterProgress.months_short.length; i++) { renderer.addXTextLabel(i + 1, ActivityWaterProgress.months_short[i]); } dataset.addSeries(seriesCallories.toXYSeries()); getActivity().runOnUiThread(new Runnable() { @Override public void run() { viewChart = ChartFactory.getBarChartView(getActivity(), dataset, renderer, Type.DEFAULT); rlRootGraphLayout.addView(viewChart, 0); if (isLeftIn) { rightIn.setDuration(1000); viewChart.startAnimation(rightIn); } else { leftIn.setDuration(1000); viewChart.startAnimation(leftIn); } } }); } catch (Exception e) { } ringProgressDialog.dismiss(); } }).start(); }
From source file:com.luan.thermospy.android.fragments.temperaturelog.TemperatureGraph.java
private void setupLineChart() { //mChart.setOnChartValueSelectedListener(this); mChart.setValueTextColor(Color.WHITE); mChart.setUnit(" C"); mChart.setDrawUnitsInChart(true);/*from w ww . ja v a 2 s. c o m*/ // if enabled, the chart will always start at zero on the y-axis mChart.setStartAtZero(false); // disable the drawing of values into the chart mChart.setDrawYValues(false); mChart.setDrawBorder(true); mChart.setBorderPositions(new BarLineChartBase.BorderPosition[] { BarLineChartBase.BorderPosition.BOTTOM }); // no description text mChart.setDescription(""); mChart.setNoDataTextDescription("You need to provide data for the chart."); // enable value highlighting mChart.setHighlightEnabled(true); // enable touch gestures mChart.setTouchEnabled(true); // enable scaling and dragging mChart.setDragEnabled(true); mChart.setScaleEnabled(true); mChart.setDrawGridBackground(false); mChart.setDrawVerticalGrid(false); mChart.setDrawHorizontalGrid(false); // if disabled, scaling can be done on x- and y-axis separately mChart.setPinchZoom(true); // set an alternative background color mChart.setBackgroundColor(Color.GRAY); }
From source file:com.doomy.library.DiscreteSeekBar.java
public DiscreteSeekBar(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); setFocusable(true);/*from w ww. j a v a 2 s.c om*/ setWillNotDraw(false); mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop(); float density = context.getResources().getDisplayMetrics().density; mTrackHeight = (int) (1 * density); mScrubberHeight = (int) (4 * density); int thumbSize = (int) (density * ThumbDrawable.DEFAULT_SIZE_DP); //Extra pixels for a touch area of 48dp int touchBounds = (int) (density * 32); mAddedTouchBounds = (touchBounds - thumbSize) / 2; TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.DiscreteSeekBar, R.attr.discreteSeekBarStyle, defStyle); int max = 100; int min = 0; int value = 0; mMirrorForRtl = a.getBoolean(R.styleable.DiscreteSeekBar_dsb_mirrorForRtl, mMirrorForRtl); mAllowTrackClick = a.getBoolean(R.styleable.DiscreteSeekBar_dsb_allowTrackClickToDrag, mAllowTrackClick); int indexMax = R.styleable.DiscreteSeekBar_dsb_max; int indexMin = R.styleable.DiscreteSeekBar_dsb_min; int indexValue = R.styleable.DiscreteSeekBar_dsb_value; final TypedValue out = new TypedValue(); //Not sure why, but we wanted to be able to use dimensions here... if (a.getValue(indexMax, out)) { if (out.type == TypedValue.TYPE_DIMENSION) { max = a.getDimensionPixelSize(indexMax, max); } else { max = a.getInteger(indexMax, max); } } if (a.getValue(indexMin, out)) { if (out.type == TypedValue.TYPE_DIMENSION) { min = a.getDimensionPixelSize(indexMin, min); } else { min = a.getInteger(indexMin, min); } } if (a.getValue(indexValue, out)) { if (out.type == TypedValue.TYPE_DIMENSION) { value = a.getDimensionPixelSize(indexValue, value); } else { value = a.getInteger(indexValue, value); } } mMin = min; mMax = Math.max(min + 1, max); mValue = Math.max(min, Math.min(max, value)); updateKeyboardRange(); mIndicatorFormatter = a.getString(R.styleable.DiscreteSeekBar_dsb_indicatorFormatter); ColorStateList trackColor = a.getColorStateList(R.styleable.DiscreteSeekBar_dsb_trackColor); ColorStateList progressColor = a.getColorStateList(R.styleable.DiscreteSeekBar_dsb_progressColor); ColorStateList rippleColor = a.getColorStateList(R.styleable.DiscreteSeekBar_dsb_rippleColor); boolean editMode = isInEditMode(); if (editMode && rippleColor == null) { rippleColor = new ColorStateList(new int[][] { new int[] {} }, new int[] { Color.DKGRAY }); } if (editMode && trackColor == null) { trackColor = new ColorStateList(new int[][] { new int[] {} }, new int[] { Color.GRAY }); } if (editMode && progressColor == null) { progressColor = new ColorStateList(new int[][] { new int[] {} }, new int[] { 0xff009688 }); } mRipple = SeekBarCompat.getRipple(rippleColor); if (isLollipopOrGreater) { SeekBarCompat.setBackground(this, mRipple); } else { mRipple.setCallback(this); } TrackRectDrawable shapeDrawable = new TrackRectDrawable(trackColor); mTrack = shapeDrawable; mTrack.setCallback(this); shapeDrawable = new TrackRectDrawable(progressColor); mScrubber = shapeDrawable; mScrubber.setCallback(this); ThumbDrawable thumbDrawable = new ThumbDrawable(progressColor, thumbSize); mThumb = thumbDrawable; mThumb.setCallback(this); mThumb.setBounds(0, 0, mThumb.getIntrinsicWidth(), mThumb.getIntrinsicHeight()); if (!editMode) { mIndicator = new PopupIndicator(context, attrs, defStyle, convertValueToMessage(mMax)); mIndicator.setListener(mFloaterListener); } a.recycle(); setNumericTransformer(new DefaultNumericTransformer()); }
From source file:com.TwentyCodes.android.IOIOTruck.NavigationActivity.java
/** * called when the directions overlay is generated * (non-Javadoc)//from ww w .j av a 2 s. co m * @see com.TwentyCodes.android.overlays.DirectionsOverlay.OnDirectionsCompleteListener#onDirectionsComplete(com.TwentyCodes.android.overlays.DirectionsOverlay) */ @Override public void onDirectionsComplete(DirectionsOverlay directionsOverlay) { ArrayList<PathOverlay> path = directionsOverlay.getPath(); if (path.size() > 0) { mWayPoints = new ArrayList<PathOverlay>(); ArrayList<GeoPoint> points = new ArrayList<GeoPoint>(); points.add(path.get(0).getStartPoint()); for (PathOverlay item : path) if (item.getEndPoint() != null) { points.add(item.getEndPoint()); mWayPoints.add(new PathOverlay(item.getEndPoint(), 5, Color.GRAY)); } mPoints = points; mMap.setDestination(points.get(0)); mWayPoints.add(new PathOverlay(points.get(0), 5, Color.MAGENTA)); mMap.getMap().getOverlays().addAll(mWayPoints); mWayPoints.addAll(path); } }
From source file:shetye.prathamesh.notifyme.Utilities.java
private void updateBtnText(Time time, boolean setTime, Context context) { if (setTime) { if (mTimeBtn != null) { SimpleDateFormat sdf = new SimpleDateFormat("hh:mm a", getLocale(context)); mTimeBtn.setText(sdf.format(new Date(time.toMillis(false)))); if (mPastDateSelected) { mTimeBtn.setTextColor(Color.RED); } else { mTimeBtn.setTextColor(Color.GRAY); mDateBtn.setTextColor(Color.GRAY); }//from w w w . j a v a 2 s . c om } } else { if (mDateBtn != null) { SimpleDateFormat sdf = new SimpleDateFormat("cccc, MMMM dd", getLocale(context)); mDateBtn.setText(sdf.format(new Date(time.toMillis(false)))); if (mPastDateSelected) { mDateBtn.setTextColor(Color.RED); } else { mDateBtn.setTextColor(Color.GRAY); mTimeBtn.setTextColor(Color.GRAY); } } } if (!mPastDateSelected) { mDialogOKBtn.setEnabled(true); } else { mDialogOKBtn.setEnabled(false); } }
From source file:com.byagowi.persiancalendar.view.QiblaCompassView.java
public void drawMoon(Canvas canvas) { moonPaint.reset();// w ww. ja va2s. c o m moonPaint.setColor(Color.WHITE); moonPaint.setStyle(Paint.Style.FILL_AND_STROKE); moonPaintB.reset();// moon Paint Black moonPaintB.setColor(Color.BLACK); moonPaintB.setStyle(Paint.Style.FILL_AND_STROKE); moonPaintO.reset();// moon Paint for Oval moonPaintO.setColor(Color.WHITE); moonPaintO.setStyle(Paint.Style.FILL_AND_STROKE); moonPaintD.reset();// moon Paint for Diameter // draw moonPaintD.setColor(Color.GRAY); moonPaintD.setStyle(Paint.Style.STROKE); double moonPhase = sunMoonPosition.getMoonPhase(); if (moonPosition.getElevation() > -5) { canvas.rotate((float) moonPosition.getAzimuth() - 360, px, py); int eOffset = (int) ((moonPosition.getElevation() / 90) * Radius); // elevation Offset 0 for 0 degree; r for 90 degree moonRect.set(px - r, py + eOffset - Radius - r, px + r, py + eOffset - Radius + r); canvas.drawArc(moonRect, 90, 180, false, moonPaint); canvas.drawArc(moonRect, 270, 180, false, moonPaintB); int arcWidth = (int) ((moonPhase - 0.5) * (4 * r)); moonPaintO.setColor(arcWidth < 0 ? Color.BLACK : Color.WHITE); moonOval.set(px - Math.abs(arcWidth) / 2, py + eOffset - Radius - r, px + Math.abs(arcWidth) / 2, py + eOffset - Radius + r); canvas.drawArc(moonOval, 0, 360, false, moonPaintO); canvas.drawArc(moonRect, 0, 360, false, moonPaintD); moonPaintD.setPathEffect(dashPath); canvas.drawLine(px, py - Radius, px, py + Radius, moonPaintD); moonPaintD.setPathEffect(null); canvas.restore(); } }
From source file:com.jjoe64.graphview.GridLabelRenderer.java
/** * resets the styles. This loads the style * from reading the values of the current * theme./*from w w w . j av a2 s . c o m*/ */ public void resetStyles() { // get matching styles from theme TypedValue typedValue = new TypedValue(); mGraphView.getContext().getTheme().resolveAttribute(android.R.attr.textAppearanceSmall, typedValue, true); int color1; int color2; int size; int size2; TypedArray array = null; try { array = mGraphView.getContext().obtainStyledAttributes(typedValue.data, new int[] { android.R.attr.textColorPrimary, android.R.attr.textColorSecondary, android.R.attr.textSize, android.R.attr.horizontalGap }); color1 = array.getColor(0, Color.BLACK); color2 = array.getColor(1, Color.GRAY); size = array.getDimensionPixelSize(2, 20); size2 = array.getDimensionPixelSize(3, 20); array.recycle(); } catch (Exception e) { color1 = Color.BLACK; color2 = Color.GRAY; size = 20; size2 = 20; } mStyles.verticalLabelsColor = color1; mStyles.verticalLabelsSecondScaleColor = color1; mStyles.horizontalLabelsColor = color1; mStyles.gridColor = color2; mStyles.textSize = size; mStyles.padding = size2; mStyles.labelsSpace = (int) mStyles.textSize / 5; mStyles.verticalLabelsAlign = Paint.Align.RIGHT; mStyles.verticalLabelsSecondScaleAlign = Paint.Align.LEFT; mStyles.highlightZeroLines = true; mStyles.verticalAxisTitleColor = mStyles.verticalLabelsColor; mStyles.horizontalAxisTitleColor = mStyles.horizontalLabelsColor; mStyles.verticalAxisTitleTextSize = mStyles.textSize; mStyles.horizontalAxisTitleTextSize = mStyles.textSize; mStyles.horizontalLabelsVisible = true; mStyles.verticalLabelsVisible = true; mStyles.horizontalLabelsAngle = 0f; mStyles.gridStyle = GridStyle.BOTH; reloadStyles(); }