List of usage examples for android.graphics Color WHITE
int WHITE
To view the source code for android.graphics Color WHITE.
Click Source Link
From source file:com.audionote.widget.SlideSwitch.java
@Override protected void onDraw(Canvas canvas) { if (shape == SHAPE_RECT) { paint.setColor(color_back_theme); canvas.drawRect(backRect, paint); paint.setColor(color_theme);/*from w ww. j a v a2 s. c o m*/ paint.setAlpha(alpha); canvas.drawRect(backRect, paint); frontRect.set(frontRect_left, borderWidth, frontRect_left + backRect.height() - 2 * borderWidth, backRect.height() - borderWidth); paint.setColor(Color.WHITE); canvas.drawRect(frontRect, paint); } else { // draw circle int backBorderRadius = backBorderRect.height() / 2; int backRadius = backBorderRadius - borderWidth; // paint.setColor(border_color); backBorderCircleRect.set(backBorderRect); canvas.drawRoundRect(backBorderCircleRect, backBorderRadius, backBorderRadius, paint); // paint.setColor(color_back_theme); backCircleRect.set(backRect); canvas.drawRoundRect(backCircleRect, backRadius, backRadius, paint); // ?? paint.setColor(color_theme); paint.setAlpha(alpha); canvas.drawRoundRect(backBorderCircleRect, backBorderRadius, backBorderRadius, paint); // ? frontBorderRect.set(frontRect_left, 0, frontRect_left + backBorderRect.height(), backBorderRect.height()); frontBorderCircleRect.set(frontBorderRect); paint.setColor(border_color); canvas.drawRoundRect(frontBorderCircleRect, backBorderRadius, backBorderRadius, paint); // ? frontRect.set(frontRect_left + borderWidth, borderWidth, frontRect_left + backBorderRect.height() - borderWidth, backBorderRect.height() - borderWidth); frontCircleRect.set(frontRect); paint.setColor(Color.WHITE); canvas.drawRoundRect(frontCircleRect, backRadius, backRadius, paint); } }
From source file:it.scoppelletti.mobilepower.preference.ColorPreference.java
protected void onRestoreInstanceState(Bundle savedInstanceState) { myValue = savedInstanceState.getInt(ColorPreference.STATE_VALUE, Color.WHITE); }
From source file:com.pablog178.pdfcreator.android.PdfcreatorModule.java
private void generateImageFunction(HashMap args) { if (args.containsKey("fileName")) { Object fileName = args.get("fileName"); if (fileName instanceof String) { this.fileName = (String) fileName; Log.i(PROXY_NAME, "fileName: " + this.fileName); }// ww w.jav a2 s. c o m } else return; if (args.containsKey("view")) { Object viewObject = args.get("view"); if (viewObject instanceof TiViewProxy) { TiViewProxy viewProxy = (TiViewProxy) viewObject; this.view = viewProxy.getOrCreateView(); if (this.view == null) { Log.e(PROXY_NAME, "NO VIEW was created!!"); return; } Log.i(PROXY_NAME, "view: " + this.view.toString()); } } else return; TiBaseFile file = TiFileFactory.createTitaniumFile(this.fileName, true); Log.i(PROXY_NAME, "file full path: " + file.nativePath()); try { final int PDF_WIDTH = 612; final int PDF_HEIGHT = 792; Resources appResources = app.getResources(); OutputStream outputStream = file.getOutputStream(); int viewWidth = 1600; int viewHeight = 1; WebView view = (WebView) this.view.getNativeView(); if (TiApplication.isUIThread()) { viewWidth = view.capturePicture().getWidth(); viewHeight = view.capturePicture().getHeight(); if (viewWidth <= 0) { viewWidth = 1300; } if (viewHeight <= 0) { viewHeight = 2300; } } else { Log.e(PROXY_NAME, "NO UI THREAD"); } Log.i(PROXY_NAME, "viewWidth: " + viewWidth); Log.i(PROXY_NAME, "viewHeight: " + viewHeight); Bitmap viewBitmap = Bitmap.createBitmap(viewWidth, viewHeight, Bitmap.Config.ARGB_8888); float density = appResources.getDisplayMetrics().density; Canvas canvas = new Canvas(viewBitmap); Matrix matrix = new Matrix(); Drawable bgDrawable = view.getBackground(); if (bgDrawable != null) { bgDrawable.draw(canvas); } else { canvas.drawColor(Color.WHITE); } view.draw(canvas); float scaleFactorWidth = 1 / ((float) viewWidth / (float) PDF_WIDTH); float scaleFactorHeight = 1 / ((float) viewHeight / (float) PDF_HEIGHT); Log.i(PROXY_NAME, "scaleFactorWidth: " + scaleFactorWidth); Log.i(PROXY_NAME, "scaleFactorHeight: " + scaleFactorHeight); matrix.setScale(scaleFactorWidth, scaleFactorWidth); Bitmap imageBitmap = Bitmap.createBitmap(PDF_WIDTH, PDF_HEIGHT, Bitmap.Config.ARGB_8888); Canvas imageCanvas = new Canvas(imageBitmap); imageCanvas.drawBitmap(viewBitmap, matrix, null); imageBitmap.compress(Bitmap.CompressFormat.JPEG, 100, outputStream); sendCompleteEvent(); } catch (Exception exception) { Log.e(PROXY_NAME, "Error: " + exception.toString()); sendErrorEvent(exception.toString()); } }
From source file:com.dean.phonesafe.ui.SlideSwitch.java
@Override protected void onDraw(Canvas canvas) { if (shape == SHAPE_RECT) { paint.setColor(Color.GRAY); canvas.drawRect(backRect, paint); paint.setColor(color_theme);/*from w ww . j av a2 s .com*/ paint.setAlpha(alpha); canvas.drawRect(backRect, paint); frontRect.set(frontRect_left, RIM_SIZE, frontRect_left + getMeasuredWidth() / 2 - RIM_SIZE, getMeasuredHeight() - RIM_SIZE); paint.setColor(Color.WHITE); canvas.drawRect(frontRect, paint); } else { // draw circle int radius; radius = backRect.height() / 2 - RIM_SIZE; paint.setColor(Color.GRAY); backCircleRect.set(backRect); canvas.drawRoundRect(backCircleRect, radius, radius, paint); paint.setColor(color_theme); paint.setAlpha(alpha); canvas.drawRoundRect(backCircleRect, radius, radius, paint); frontRect.set(frontRect_left, RIM_SIZE, frontRect_left + backRect.height() - 2 * RIM_SIZE, backRect.height() - RIM_SIZE); frontCircleRect.set(frontRect); paint.setColor(Color.WHITE); canvas.drawRoundRect(frontCircleRect, radius, radius, paint); } //?? //? paint.setStrokeWidth(2); paint.setAlpha(alpha); paint.setStyle(Paint.Style.STROKE); float gap = backRect.width() - frontRect.width(); float left = frontRect.left - gap + frontRect.width() / 2; canvas.drawLine(left, backRect.height() / 4, left, backRect.height() / 4 * 3, paint); //?? paint.setAlpha(255 - alpha); left = frontRect.left + gap + frontRect.width() / 2; canvas.drawCircle(left, backRect.height() / 2, frontRect.width() / 5, paint); // paint.setStyle(Paint.Style.FILL); }
From source file:org.lol.reddit.reddit.prepared.RedditPreparedComment.java
private void rebuildHeader(final Context context) { final BetterSSB sb = new BetterSSB(); final int pointsCol; int score = src.ups - src.downs; if (Boolean.TRUE.equals(src.likes)) score--;/*from w w w . j av a2 s . c om*/ if (Boolean.FALSE.equals(src.likes)) score++; if (isUpvoted()) { pointsCol = rrPostSubtitleUpvoteCol; score++; } else if (isDownvoted()) { pointsCol = rrPostSubtitleDownvoteCol; score--; } else { pointsCol = rrCommentHeaderBoldCol; } if (headerItems.contains(PrefsUtility.AppearanceCommentHeaderItems.AUTHOR)) { if (parentPost != null && src.author.equalsIgnoreCase(parentPost.src.author) && !src.author.equals("[deleted]")) { sb.append(" " + src.author + " ", BetterSSB.BACKGROUND_COLOR | BetterSSB.FOREGROUND_COLOR | BetterSSB.BOLD, Color.WHITE, Color.rgb(0, 126, 168), 1f); // TODO color } else { sb.append(src.author, BetterSSB.FOREGROUND_COLOR | BetterSSB.BOLD, rrCommentHeaderAuthorCol, 0, 1f); } } if (headerItems.contains(PrefsUtility.AppearanceCommentHeaderItems.FLAIR) && flair != null && flair.length() > 0) { if (headerItems.contains(PrefsUtility.AppearanceCommentHeaderItems.AUTHOR)) { sb.append(" ", 0); } sb.append(" " + flair + " ", BetterSSB.FOREGROUND_COLOR | BetterSSB.BACKGROUND_COLOR, rrFlairTextCol, rrFlairBackCol, 1f); } if (headerItems.contains(PrefsUtility.AppearanceCommentHeaderItems.AUTHOR) || headerItems.contains(PrefsUtility.AppearanceCommentHeaderItems.FLAIR)) { sb.append(" ", 0); } if (headerItems.contains(PrefsUtility.AppearanceCommentHeaderItems.SCORE)) { if (!Boolean.TRUE.equals(src.score_hidden)) { sb.append(String.valueOf(score), BetterSSB.FOREGROUND_COLOR | BetterSSB.BOLD, pointsCol, 0, 1f); } else { sb.append("??", BetterSSB.FOREGROUND_COLOR | BetterSSB.BOLD, pointsCol, 0, 1f); } sb.append(" " + context.getString(R.string.subtitle_points) + " ", 0); } if (headerItems.contains(PrefsUtility.AppearanceCommentHeaderItems.GOLD)) { if (src.gilded > 0) { sb.append(" ", 0); sb.append(" " + context.getString(R.string.gold) + " x" + src.gilded + " ", BetterSSB.FOREGROUND_COLOR | BetterSSB.BACKGROUND_COLOR, rrGoldTextCol, rrGoldBackCol, 1f); sb.append(" ", 0); } } if (headerItems.contains(PrefsUtility.AppearanceCommentHeaderItems.AGE)) { sb.append(RRTime.formatDurationFrom(context, src.created_utc * 1000L), BetterSSB.FOREGROUND_COLOR | BetterSSB.BOLD, rrCommentHeaderBoldCol, 0, 1f); if (src.edited != null && src.edited instanceof Long) { sb.append("*", BetterSSB.FOREGROUND_COLOR | BetterSSB.BOLD, rrCommentHeaderBoldCol, 0, 1f); } } header = sb.get(); }
From source file:com.antonioleiva.materializeyourapp.DetailActivity.java
private void setComponentsStatus(View scrollView, ImageView image) { int scrollY = scrollView.getScrollY(); image.setTranslationY(-scrollY / 2); ColorDrawable background = (ColorDrawable) toolbar.getBackground(); int padding = scrollView.getPaddingTop(); double alpha = (1 - (((double) padding - (double) scrollY) / (double) padding)) * 255.0; alpha = alpha < 0 ? 0 : alpha;//w w w . ja v a 2 s. co m alpha = alpha > 255 ? 255 : alpha; background.setAlpha((int) alpha); float scrollRatio = (float) (alpha / 255f); int titleColor = getAlphaColor(Color.WHITE, scrollRatio); toolbar.setTitleTextColor(titleColor); }
From source file:com.eyekabob.EventInfo.java
protected void loadEvent(JSONObject response) { try {//from www . j av a 2 s . c o m JSONObject jsonEvent = response.getJSONObject("event"); artists = new ArrayList<String>(); title = jsonEvent.getString("title"); JSONObject jsonAllArtists = jsonEvent.getJSONObject("artists"); headliner = jsonAllArtists.getString("headliner"); Object artistObj = jsonAllArtists.get("artist"); JSONArray jsonOpeners = new JSONArray(); if (artistObj instanceof JSONArray) { jsonOpeners = (JSONArray) artistObj; } for (int i = 0; i < jsonOpeners.length(); i++) { String artistName = jsonOpeners.getString(i); if (!headliner.equals(artistName)) { artists.add(artistName); } } JSONObject jsonVenue = jsonEvent.getJSONObject("venue"); venue = jsonVenue.optString("name"); venueCity = jsonVenue.optString("city"); venueStreet = jsonVenue.optString("street"); venueUrl = jsonVenue.optString("url"); startDate = EyekabobHelper.LastFM.toReadableDate(jsonEvent.getString("startDate")); JSONObject image = EyekabobHelper.LastFM.getLargestJSONImage(jsonEvent.getJSONArray("image")); imageUrl = image.getString("#text"); } catch (JSONException e) { Log.e(getClass().getName(), "", e); } try { new EventImageTask().execute(new URL(imageUrl)); } catch (MalformedURLException e) { Log.e(getClass().getName(), "Bad image URL [" + imageUrl + "]", e); } TextView titleView = (TextView) findViewById(R.id.infoMainHeader); titleView.setText(title); TextView headlinerView = (TextView) findViewById(R.id.infoSubHeaderOne); // TODO: I18N headlinerView.setText("Headlining: " + headliner); TextView dateTimeView = (TextView) findViewById(R.id.infoSubHeaderTwo); dateTimeView.setText(startDate); if (!startDate.equals("")) { Button tixButton = (Button) findViewById(R.id.infoTicketsButton); tixButton.setVisibility(View.VISIBLE); } LinearLayout artistsView = (LinearLayout) findViewById(R.id.infoFutureEventsContent); TextView alsoPerformingView = (TextView) findViewById(R.id.infoFutureEventsHeader); if (!artists.isEmpty()) { // TODO: I18N alsoPerformingView.setText("Also Performing:"); for (String artist : artists) { TextView row = new TextView(this); row.setTextColor(Color.WHITE); row.setText(artist); row.setPadding(20, 0, 0, 20); // Left and bottom padding artistsView.addView(row); } } String venueDesc = ""; TextView venueView = (TextView) findViewById(R.id.infoEventVenue); // TODO: Padding instead of whitespace venueDesc += " " + venue; if (!venueCity.equals("") && !venueStreet.equals("")) { // TODO: I18N venueDesc += "\n Address: " + venueStreet + "\n" + venueCity; } // TODO: Padding instead of whitespace venueDesc += "\n " + startDate; TextView venueTitleView = (TextView) findViewById(R.id.infoBioHeader); if (!venue.equals("") || !venueCity.equals("") || !venueStreet.equals("")) { // TODO: I18N venueTitleView.setText("Venue Details:"); View vView = findViewById(R.id.infoVenueDetails); vView.setVisibility(View.VISIBLE); } else { // TODO: I18N venueTitleView.setText("No Venue Details Available"); } venueView.setVisibility(View.VISIBLE); venueView.setText(venueDesc); TextView websiteView = (TextView) findViewById(R.id.infoVenueWebsite); if (!venueUrl.equals("")) { // TODO: I18N websiteView.setVisibility(View.VISIBLE); websiteView.setText(Html.fromHtml("<a href=\"" + venueUrl + "\">More Information</a>")); websiteView.setMovementMethod(LinkMovementMethod.getInstance()); } }
From source file:edu.rowan.app.carousel.CarouselFeature.java
private void setupView() { imageView.setId(1);/* www .j av a2 s . co m*/ RelativeLayout.LayoutParams imageParams = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT); imageParams.addRule(RelativeLayout.CENTER_HORIZONTAL); imageView.setLayoutParams(imageParams); // imageView.setAdjustViewBounds(true); Resources r = context.getResources(); int padding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 5, r.getDisplayMetrics()); TextView descriptionView = new TextView(context); descriptionView.setId(2); descriptionView.setPadding(padding, 0, padding, padding); descriptionView.setText(description); descriptionView.setBackgroundColor(Color.argb(220, 63, 26, 10)); descriptionView.setTextColor(Color.WHITE); RelativeLayout.LayoutParams descParams = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT); descParams.addRule(RelativeLayout.ALIGN_BOTTOM, imageView.getId()); carouselView.addView(descriptionView, descParams); TextView titleView = new TextView(context); titleView.setText(title); titleView.setPadding(padding, 0, padding, 0); RelativeLayout.LayoutParams titleParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); titleParams.addRule(RelativeLayout.ABOVE, descriptionView.getId()); titleView.setLayoutParams(titleParams); titleView.setTextColor(Color.WHITE); titleView.setShadowLayer(2, 3, 3, Color.argb(230, 0, 0, 0)); titleView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 22); carouselView.addView(titleView); }
From source file:com.anjlu.weighttracker.chart.LineFragment.java
private void compose(View v) { // init example series data Cursor cursor = getActivity().getContentResolver().query(WeightProvider.CONTENT_URI_WEIGHT, null, WeightProvider.WeightTracker.DATE_TRACK + " <= ?", new String[] { Utils.formatDate(Calendar.getInstance().getTime()) }, WeightProvider.WeightTracker._ID); int i = 0;/*from www .j a va 2 s . c o m*/ Vector<GraphViewData> values = new Vector<GraphViewData>(); while (cursor.moveToNext()) { String dateTrack = cursor.getString(cursor.getColumnIndex(WeightProvider.WeightTracker.DATE_TRACK)); String weight = cursor.getString(cursor.getColumnIndex(WeightProvider.WeightTracker.WEIGHT)); Log.i(LineFragment.class.getCanonicalName(), "Date: " + dateTrack + "Weight: " + weight); values.add(new GraphViewData(i++, Double.parseDouble(weight))); } GraphViewData[] graphs = {}; graphs = values.toArray((GraphViewData[]) graphs); GraphViewSeries exampleSeries = new GraphViewSeries(graphs); GraphView graphView = new LineGraphView(getActivity() // context , "GraphViewDemo" // heading ); graphView.getGraphViewStyle().setNumHorizontalLabels(graphs.length); graphView.getGraphViewStyle().setGridColor(Color.WHITE); graphView.addSeries(exampleSeries); // data LinearLayout layout = (LinearLayout) v.findViewById(R.id.graph1); layout.addView(graphView); }
From source file:it.iziozi.iziozi.gui.IOBoardFragment.java
private View buildView(boolean editMode) { this.homeRows.clear(); final List<IOSpeakableImageButton> mButtons = new ArrayList<IOSpeakableImageButton>(); List<IOSpeakableImageButton> configButtons = this.mBoard.getButtons(); ViewGroup mainView = (ViewGroup) getActivity().getLayoutInflater().inflate(R.layout.table_main_layout, null);//www. ja va 2 s .com LinearLayout tableContainer = new LinearLayout(getActivity()); LinearLayout.LayoutParams mainParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT); tableContainer.setLayoutParams(mainParams); tableContainer.setOrientation(LinearLayout.VERTICAL); for (int i = 0; i < this.mBoard.getRows(); i++) { LinearLayout rowLayout = new LinearLayout(getActivity()); LinearLayout.LayoutParams rowParams = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, 0, 1.f); rowLayout.setLayoutParams(rowParams); rowLayout.setOrientation(LinearLayout.HORIZONTAL); Random color = new Random(); rowLayout.setBackgroundColor(Color.WHITE); tableContainer.addView(rowLayout); this.homeRows.add(rowLayout); } for (int j = 0; j < this.homeRows.size(); j++) { LinearLayout homeRow = this.homeRows.get(j); for (int i = 0; i < this.mBoard.getCols(); i++) { LinearLayout btnContainer = new LinearLayout(getActivity()); LinearLayout.LayoutParams btnContainerParams = new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MATCH_PARENT, 1.f); btnContainer.setLayoutParams(btnContainerParams); btnContainer.setOrientation(LinearLayout.VERTICAL); btnContainer.setGravity(Gravity.CENTER); homeRow.addView(btnContainer); final IOSpeakableImageButton imgButton = (configButtons.size() > 0 && configButtons.size() > mButtons.size()) ? configButtons.get(mButtons.size()) : new IOSpeakableImageButton(getActivity()); imgButton.setmContext(getActivity()); imgButton.setShowBorder(IOConfiguration.getShowBorders()); if (IOGlobalConfiguration.isEditing) imgButton.setImageDrawable(getResources().getDrawable(R.drawable.logo_org)); else imgButton.setImageDrawable(null); imgButton.setScaleType(ImageView.ScaleType.CENTER_INSIDE); imgButton.setBackgroundColor(Color.TRANSPARENT); if (imgButton.getmImageFile() != null && imgButton.getmImageFile().length() > 0) { if (!new File(imgButton.getmImageFile()).exists()) { if (mAlertDialog == null || !mAlertDialog.isShowing()) { mAlertDialog = new AlertDialog.Builder(getActivity()).setCancelable(true) .setTitle(getString(R.string.image_missing)) .setMessage(getString(R.string.image_missing_text)) .setNegativeButton(getString(R.string.continue_string), null).create(); mAlertDialog.show(); } //download image if (isExternalStorageReadable()) { File baseFolder = new File(Environment.getExternalStorageDirectory() + "/" + IOApplication.APPLICATION_FOLDER + "/pictograms"); Character pictoChar = imgButton.getmImageFile() .charAt(imgButton.getmImageFile().lastIndexOf("/") + 1); File pictoFolder = new File(baseFolder + "/" + pictoChar + "/"); if (isExternalStorageWritable()) { pictoFolder.mkdirs(); //download it AsyncHttpClient client = new AsyncHttpClient(); client.get(imgButton.getmUrl(), new FileAsyncHttpResponseHandler(new File(imgButton.getmImageFile())) { @Override public void onFailure(int statusCode, Header[] headers, Throwable throwable, File file) { Toast.makeText(getActivity(), getString(R.string.download_error) + file.toString(), Toast.LENGTH_LONG).show(); } @Override public void onSuccess(int statusCode, Header[] headers, File downloadedFile) { if (new File(imgButton.getmImageFile()).exists()) { imgButton.setImageBitmap( BitmapFactory.decodeFile(imgButton.getmImageFile())); } else { Toast.makeText(getActivity(), getString(R.string.image_save_error), Toast.LENGTH_SHORT).show(); } } }); } else { Toast.makeText(getActivity(), getString(R.string.image_save_error), Toast.LENGTH_SHORT).show(); } } else { Toast.makeText(getActivity(), getString(R.string.image_save_error), Toast.LENGTH_SHORT) .show(); } } else imgButton.setImageBitmap(BitmapFactory.decodeFile(imgButton.getmImageFile())); } ViewGroup parent = (ViewGroup) imgButton.getParent(); if (parent != null) parent.removeAllViews(); btnContainer.addView(imgButton); mButtons.add(imgButton); imgButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { int index = mButtons.indexOf(v); if (mListener != null) mListener.tapOnSpeakableButton(mButtons.get(index), mBoardLevel); } }); } } this.mBoard.setButtons(mButtons.size() > configButtons.size() ? mButtons : configButtons); return tableContainer; }