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:de.treichels.hott.ui.android.html.AndroidCurveImageGenerator.java
private Bitmap getBitmap(final Curve curve, final float scale, final boolean description) { final boolean pitchCurve = curve.getPoint()[0].getPosition() == 0; final float scale1 = scale * 0.75f; // smaller images on the android // platform/*from ww w.j a va2 s. com*/ final Bitmap image = Bitmap.createBitmap((int) (10 + 200 * scale1), (int) (10 + 250 * scale1), Bitmap.Config.ARGB_8888); final Canvas canvas = new Canvas(image); final Paint backgroundPaint = new Paint(); backgroundPaint.setColor(Color.WHITE); backgroundPaint.setStyle(Style.FILL); final Paint forgroundPaint = new Paint(); forgroundPaint.setColor(Color.BLACK); forgroundPaint.setStyle(Style.STROKE); forgroundPaint.setStrokeWidth(1.0f); forgroundPaint.setStrokeCap(Cap.BUTT); forgroundPaint.setStrokeJoin(Join.ROUND); forgroundPaint.setStrokeMiter(0.0f); final Paint curvePaint = new Paint(forgroundPaint); curvePaint.setFlags(Paint.ANTI_ALIAS_FLAG); curvePaint.setStrokeWidth(2.0f); final Paint pointPaint = new Paint(curvePaint); pointPaint.setStrokeWidth(5.0f); pointPaint.setStyle(Style.FILL_AND_STROKE); final Paint helpLinePaint = new Paint(forgroundPaint); helpLinePaint.setColor(Color.GRAY); helpLinePaint.setPathEffect(new DashPathEffect(new float[] { 5.0f, 5.0f }, 2.5f)); final Paint textPaint = new Paint(forgroundPaint); textPaint.setTypeface(Typeface.create(Typeface.SANS_SERIF, Typeface.BOLD)); textPaint.setTextSize(12.0f); textPaint.setTextAlign(Align.CENTER); textPaint.setStyle(Style.FILL); canvas.drawRect(0, 0, 10 + 200 * scale1, 10 + 250 * scale1, backgroundPaint); canvas.drawRect(5, 5, 5 + 200 * scale1, 5 + 250 * scale1, forgroundPaint); canvas.drawLine(5, 5 + 25 * scale1, 5 + 200 * scale1, 5 + 25 * scale1, helpLinePaint); canvas.drawLine(5, 5 + 225 * scale1, 5 + 200 * scale1, 5 + 225 * scale1, helpLinePaint); if (!pitchCurve) { canvas.drawLine(5, 5 + 125 * scale1, 5 + 200 * scale1, 5 + 125 * scale1, helpLinePaint); canvas.drawLine(5 + 100 * scale1, 5, 5 + 100 * scale1, 5 + 250 * scale1, helpLinePaint); } if (curve.getPoint() != null) { int numPoints = 0; for (final CurvePoint p : curve.getPoint()) { if (p.isEnabled()) { numPoints++; } } final double[] xVals = new double[numPoints]; final double[] yVals = new double[numPoints]; int i = 0; for (final CurvePoint p : curve.getPoint()) { if (p.isEnabled()) { if (i == 0) { xVals[i] = pitchCurve ? 0 : -100; } else if (i == numPoints - 1) { xVals[i] = 100; } else { xVals[i] = p.getPosition(); } yVals[i] = p.getValue(); if (description) { float x0; float y0; if (pitchCurve) { x0 = (float) (5 + xVals[i] * 2 * scale1); y0 = (float) (5 + (225 - yVals[i] * 2) * scale1); } else { x0 = (float) (5 + (100 + xVals[i]) * scale1); y0 = (float) (5 + (125 - yVals[i]) * scale1); } canvas.drawPoint(x0, y0, pointPaint); if (y0 < 5 + 125 * scale1) { canvas.drawRect(x0 - 4, y0 + 5, x0 + 3, y0 + 18, backgroundPaint); canvas.drawText(Integer.toString(p.getNumber() + 1), x0 - 1, y0 + 16, textPaint); } else { canvas.drawRect(x0 - 4, y0 - 5, x0 + 3, y0 - 18, backgroundPaint); canvas.drawText(Integer.toString(p.getNumber() + 1), x0 - 1, y0 - 7, textPaint); } } i++; } } if (numPoints > 2 && curve.isSmoothing()) { final SplineInterpolator s = new SplineInterpolator(); final PolynomialSplineFunction function = s.interpolate(xVals, yVals); float x0 = 5; float y0; if (pitchCurve) { y0 = (float) (5 + (225 - yVals[0] * 2) * scale1); } else { y0 = (float) (5 + (125 - yVals[0]) * scale1); } while (x0 < 4 + 200 * scale1) { final float x1 = x0 + 1; float y1; if (pitchCurve) { y1 = (float) (5 + (225 - function.value((x1 - 5) / scale1 / 2) * 2) * scale1); } else { y1 = (float) (5 + (125 - function.value((x1 - 5) / scale1 - 100)) * scale1); } canvas.drawLine(x0, y0, x1, y1, curvePaint); x0 = x1; y0 = y1; } } else { for (i = 0; i < numPoints - 1; i++) { float x0, y0, x1, y1; if (pitchCurve) { x0 = (float) (5 + xVals[i] * 2 * scale1); y0 = (float) (5 + (225 - yVals[i] * 2) * scale1); x1 = (float) (5 + xVals[i + 1] * 2 * scale1); y1 = (float) (5 + (225 - yVals[i + 1] * 2) * scale1); } else { x0 = (float) (5 + (100 + xVals[i]) * scale1); y0 = (float) (5 + (125 - yVals[i]) * scale1); x1 = (float) (5 + (100 + xVals[i + 1]) * scale1); y1 = (float) (5 + (125 - yVals[i + 1]) * scale1); } canvas.drawLine(x0, y0, x1, y1, curvePaint); } } } return image; }
From source file:com.bilibili.socialize.share.utils.selector.PopWrapSharePlatformSelector.java
protected void createShareWindowIfNeed() { if (mShareWindow != null) return;//www.j a v a 2 s. c o m Context context = getContext(); GridView grid = createShareGridView(context, getItemClickListener()); mShareWindow = new PopupWindow(grid, WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT, true); mShareWindow.setBackgroundDrawable(new ColorDrawable(Color.WHITE)); mShareWindow.setOutsideTouchable(true); mShareWindow.setAnimationStyle(R.style.socialize_shareboard_animation); mShareWindow.setOnDismissListener(new PopupWindow.OnDismissListener() { @Override public void onDismiss() { if (getDismissListener() != null) getDismissListener().onDismiss(); } }); }
From source file:com.knurld.dropboxdemo.KnurldActivity.java
public PopupWindow showLoadingPopup(View view) { View spinnerView = LayoutInflater.from((Activity) context).inflate(R.layout.loading_popup, null); ProgressBar progressBar = (ProgressBar) spinnerView.findViewById(R.id.speakProgress); progressBar.getIndeterminateDrawable().setColorFilter(Color.WHITE, PorterDuff.Mode.MULTIPLY); PopupWindow popupWindow = new PopupWindow(spinnerView, 500, 500); popupWindow.setFocusable(true);/*from w w w.ja v a 2 s. c om*/ popupWindow.showAtLocation(view, Gravity.CENTER, 0, 0); return popupWindow; }
From source file:com.death.yttorrents.activity.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); haveStoragePermission();/*from w w w .jav a2 s .co m*/ Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); toolbar.setTitleTextColor(Color.WHITE); toolbar.setTitle(R.string.app_name); final SharedPreferences preferences = getSharedPreferences(Constants.PREFERENCE_NAME, MODE_APPEND); Boolean isFirstRun = preferences.getBoolean(Constants.PREFERENCE_KEY_FOR_FIRSTRUN, true); if (isFirstRun) { AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this, R.style.MyDialogTheme); alertDialogBuilder.setTitle(Html.fromHtml("<font color='#ffffff'>Disclaimer/License</font>")); alertDialogBuilder.setCancelable(true); alertDialogBuilder.setMessage( Html.fromHtml("<font color='#ffffff'>" + getResources().getString(R.string.terms) + "</font>")); alertDialogBuilder.setIcon(R.drawable.ic_icon); alertDialogBuilder.setCancelable(false) .setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); MainActivity.this.finish(); finishActivity(0); } }).setPositiveButton("Accept", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { SharedPreferences.Editor editor = preferences.edit(); editor.putBoolean(Constants.PREFERENCE_KEY_FOR_FIRSTRUN, false); editor.apply(); editor.commit(); } }); AlertDialog alertDialog = alertDialogBuilder.create(); alertDialog.setCancelable(true); alertDialog.show(); } recyclerView = (RecyclerView) findViewById(R.id.recycler_view); pDialog = new ProgressDialog(this); movies = new ArrayList<>(); mAdapter = new GalleryAdapter(getApplicationContext(), movies); mLayoutManager = new GridLayoutManager(getApplicationContext(), 2); recyclerView.addItemDecoration(new GridItemDecoration(2, UrlUtils.dpToPx(this, 5), true)); recyclerView.setLayoutManager(mLayoutManager); recyclerView.setItemAnimator(new DefaultItemAnimator()); recyclerView.setAdapter(mAdapter); /** * Click event handler on recycler view. */ recyclerView.addOnItemTouchListener(new GalleryAdapter.RecyclerTouchListener(getApplicationContext(), recyclerView, new GalleryAdapter.ClickListener() { @Override public void onClick(View view, int position) { Bundle bundle = new Bundle(); bundle.putSerializable("movies", movies); bundle.putInt("position", position); FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); SlideshowDialogFragment newFragment = SlideshowDialogFragment.newInstance(); newFragment.setArguments(bundle); newFragment.show(ft, "slideshow"); } @Override public void onLongClick(View view, int position) { } })); fetchMovies(endpoint); }
From source file:ca.appvelopers.mcgillmobile.ui.walkthrough.WalkthroughActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_walkthrough); ButterKnife.bind(this); analytics.sendScreen("Walkthrough"); //Load the adapter boolean firstOpen = getIntent().getBooleanExtra(Constants.FIRST_OPEN, false); adapter = new WalkthroughAdapter(this, firstOpen); viewPager.setAdapter(adapter);/*from w w w . jav a 2 s . com*/ //Indicator indicator.setViewPager(viewPager); indicator.setStrokeColor(Color.WHITE); indicator.setPageColor(Color.GRAY); indicator.setFillColor(ContextCompat.getColor(this, R.color.red)); indicator.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int i, float v, int i2) { } @Override public void onPageSelected(int position) { WalkthroughActivity.this.position = position; //Hide the back button on the first page back.setVisibility((position == 0) ? View.INVISIBLE : View.VISIBLE); //Set the right text on the next button if we are on the last page next.setText((position == adapter.getCount() - 1) ? R.string.start : R.string.next); } @Override public void onPageScrollStateChanged(int i) { } }); }
From source file:com.davidecirillo.dashboard.gui.viewholder.PIViewHolder.java
public void setChartWithValues(ArrayList<PieEntry> entries) { PieDataSet dataSet = new PieDataSet(entries, ""); dataSet.setSliceSpace(3f);/* w ww. jav a2 s.c o m*/ dataSet.setSelectionShift(5f); // add a lot of colors ArrayList<Integer> colors = new ArrayList<Integer>(); for (int c : ColorTemplate.MATERIAL_COLORS) colors.add(c); dataSet.setColors(colors); PieData data = new PieData(dataSet); data.setValueFormatter(new PercentFormatter()); data.setValueTextSize(11f); data.setValueTextColor(Color.WHITE); mPieChart.setUsePercentValues(true); mPieChart.setDescription(""); mPieChart.setRotationAngle(0); // enable rotation of the chart by touch mPieChart.setRotationEnabled(true); mPieChart.setHighlightPerTapEnabled(true); mPieChart.animateY(1400, Easing.EasingOption.EaseInOutQuad); Legend l = mPieChart.getLegend(); l.setPosition(Legend.LegendPosition.RIGHT_OF_CHART); l.setXEntrySpace(7f); l.setYEntrySpace(5f); l.setYOffset(0f); // entry label styling mPieChart.setEntryLabelColor(Color.WHITE); mPieChart.setEntryLabelTextSize(12f); mPieChart.setVisibility(View.VISIBLE); mPieChart.setData(data); mPieChart.highlightValues(null); mPieChart.notifyDataSetChanged(); mPieChart.invalidate(); }
From source file:com.android.launcher3.dynamicui.ExtractionUtils.java
public static boolean isSuperLight(Palette p) { return !isLegibleOnWallpaper(Color.WHITE, p.getSwatches()); }
From source file:es.hol.ecotiffins.view.LoginActivity.java
/** * Method will setup all click listeners to UI controls *//* w w w .j a v a 2 s . c o m*/ private void setOnClickListeners() { ImageView imgBack = (ImageView) findViewById(R.id.imgBack); imgBack.setColorFilter(Color.WHITE); findViewById(R.id.btnNext).setOnClickListener(this); findViewById(R.id.btnLogin).setOnClickListener(this); findViewById(R.id.imgBack).setOnClickListener(this); findViewById(R.id.txtRegister).setOnClickListener(this); findViewById(R.id.txtForget).setOnClickListener(this); }
From source file:com.google.android.apps.santatracker.doodles.shared.physics.Polygon.java
public Polygon(List<Vector2D> vertices) { this.vertices = vertices; min = Vector2D.get(0, 0);/*w ww . j ava2 s .co m*/ max = Vector2D.get(0, 0); vertexPaint = new Paint(Paint.ANTI_ALIAS_FLAG); vertexPaint.setColor(Color.RED); midpointPaint = new Paint(Paint.ANTI_ALIAS_FLAG); midpointPaint.setColor(Color.GREEN); midpointPaint.setAlpha(100); linePaint = new Paint(Paint.ANTI_ALIAS_FLAG); linePaint.setColor(Color.WHITE); linePaint.setStrokeWidth(5); updateExtents(); updateInversionStatus(); calculateNormals(); }
From source file:ayushi.view.fragment.ContactUsFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.frag_about, container, false); getActivity().setTitle("Contact Us"); mToolbar = (Toolbar) rootView.findViewById(R.id.htab_toolbar); if (mToolbar != null) { ((ECartHomeActivity) getActivity()).setSupportActionBar(mToolbar); }/*from w ww . java2s .c o m*/ if (mToolbar != null) { ((ECartHomeActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true); mToolbar.setNavigationIcon(R.drawable.ic_drawer); } mToolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ((ECartHomeActivity) getActivity()).getmDrawerLayout().openDrawer(GravityCompat.START); } }); mToolbar.setTitleTextColor(Color.WHITE); rootView.findViewById(R.id.locations).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { } }); rootView.findViewById(R.id.contact_num).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent callIntent = new Intent(Intent.ACTION_DIAL); callIntent.setData(Uri.parse("tel:" + "8888813275")); startActivity(callIntent); } }); rootView.setFocusableInTouchMode(true); rootView.requestFocus(); rootView.setOnKeyListener(new View.OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) { Utils.switchContent(R.id.frag_container, Utils.HOME_FRAGMENT, ((ECartHomeActivity) (getContext())), AnimationType.SLIDE_UP); } return true; } }); rootView.findViewById(R.id.site_dev).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://hiteshsahu.com/")); startActivity(browserIntent); } }); rootView.findViewById(R.id.email).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType("text/plain"); emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { "hiteshkumarsahu1990@gmail.com" }); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Hello There"); emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Add Message here"); emailIntent.setType("message/rfc822"); try { startActivity(Intent.createChooser(emailIntent, "Send email using...")); } catch (android.content.ActivityNotFoundException ex) { Toast.makeText(getActivity(), "No email clients installed.", Toast.LENGTH_SHORT).show(); } } }); return rootView; }