Example usage for android.graphics Color WHITE

List of usage examples for android.graphics Color WHITE

Introduction

In this page you can find the example usage for android.graphics Color WHITE.

Prototype

int WHITE

To view the source code for android.graphics Color WHITE.

Click Source Link

Usage

From source file:com.artemchep.horario.ui.activities.SubjectActivity.java

@SuppressLint("NewApi")
private void bind(@NonNull SubjectInfo subject) {
    mCollapsingToolbar.setTitle(subject.name);

    int color = subject.color;
    color |= 0xFF000000; // ignore alpha bits
    final boolean isColorDark = ColorUtil.isColorDark(color);

    if (Device.hasLollipopApi()) {
        int statusBarColor = ColorUtils.blendARGB(color, Color.BLACK, 0.4f);
        getWindow().setStatusBarColor(statusBarColor);
    }//  www  . j a v a  2  s.c  o m

    Drawable overflowIcon;
    if (isColorDark) {
        mToolbar.setNavigationIcon(R.drawable.ic_keyboard_backspace_white_24dp);
        mCollapsingToolbar.setExpandedTitleColor(Color.WHITE);
        mCollapsingToolbar.setCollapsedTitleTextColor(Color.WHITE);
        overflowIcon = ContextCompat.getDrawable(this, R.drawable.ic_dots_vertical_white_24dp);
        if (mSmartTabLayout != null) {
            mSmartTabLayout.setDefaultTabTextColor(Color.WHITE);
            mSmartTabLayout.setSelectedIndicatorColors(Color.WHITE);
        }
    } else {
        mToolbar.setNavigationIcon(R.drawable.ic_keyboard_backspace_black_24dp);
        mCollapsingToolbar.setExpandedTitleColor(Color.BLACK);
        mCollapsingToolbar.setCollapsedTitleTextColor(Color.BLACK);
        overflowIcon = ContextCompat.getDrawable(this, R.drawable.ic_dots_vertical_black_24dp);
        if (mSmartTabLayout != null) {
            mSmartTabLayout.setDefaultTabTextColor(Color.BLACK);
            mSmartTabLayout.setSelectedIndicatorColors(Color.BLACK);
        }
    }

    mCollapsingToolbar.setContentScrimColor(color);
    if (mBackdropToolbar != null) {
        mBackdropToolbar.setBackgroundColor(color);
    } else
        mAppBar.setBackgroundColor(color);
    mToolbar.setOverflowIcon(overflowIcon);

    mSmartTabLayout.setViewPager(mViewPager);
}

From source file:com.androidinspain.deskclock.alarms.AlarmActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setVolumeControlStream(AudioManager.STREAM_ALARM);
    final long instanceId = AlarmInstance.getId(getIntent().getData());
    mAlarmInstance = AlarmInstance.getInstance(getContentResolver(), instanceId);
    if (mAlarmInstance == null) {
        // The alarm was deleted before the activity got created, so just finish()
        LOGGER.e("Error displaying alarm for intent: %s", getIntent());
        finish();//from  w w  w . ja va 2s  . c  o m
        return;
    } else if (mAlarmInstance.mAlarmState != AlarmInstance.FIRED_STATE) {
        LOGGER.i("Skip displaying alarm for instance: %s", mAlarmInstance);
        finish();
        return;
    }

    LOGGER.i("Displaying alarm for instance: %s", mAlarmInstance);

    // Get the volume/camera button behavior setting
    mVolumeBehavior = DataModel.getDataModel().getAlarmVolumeButtonBehavior();

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
            | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
            | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
            | WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON);

    // Hide navigation bar to minimize accidental tap on Home key
    hideNavigationBar();

    // Close dialogs and window shade, so this is fully visible
    sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS));

    // Honor rotation on tablets; fix the orientation on phones.
    if (!getResources().getBoolean(com.androidinspain.deskclock.R.bool.rotateAlarmAlert)) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR);
    }

    mAccessibilityManager = (AccessibilityManager) getSystemService(ACCESSIBILITY_SERVICE);

    setContentView(com.androidinspain.deskclock.R.layout.alarm_activity);

    mAlertView = (ViewGroup) findViewById(com.androidinspain.deskclock.R.id.alert);
    mAlertTitleView = (TextView) mAlertView.findViewById(com.androidinspain.deskclock.R.id.alert_title);
    mAlertInfoView = (TextView) mAlertView.findViewById(com.androidinspain.deskclock.R.id.alert_info);

    mContentView = (ViewGroup) findViewById(com.androidinspain.deskclock.R.id.content);
    mAlarmButton = (ImageView) mContentView.findViewById(com.androidinspain.deskclock.R.id.alarm);
    mSnoozeButton = (ImageView) mContentView.findViewById(com.androidinspain.deskclock.R.id.snooze);
    mDismissButton = (ImageView) mContentView.findViewById(com.androidinspain.deskclock.R.id.dismiss);
    mHintView = (TextView) mContentView.findViewById(com.androidinspain.deskclock.R.id.hint);

    final TextView titleView = (TextView) mContentView.findViewById(com.androidinspain.deskclock.R.id.title);
    final TextClock digitalClock = (TextClock) mContentView
            .findViewById(com.androidinspain.deskclock.R.id.digital_clock);
    final CircleView pulseView = (CircleView) mContentView
            .findViewById(com.androidinspain.deskclock.R.id.pulse);

    titleView.setText(mAlarmInstance.getLabelOrDefault(this));
    Utils.setTimeFormat(digitalClock, false);

    mCurrentHourColor = ThemeUtils.resolveColor(this, android.R.attr.windowBackground);
    getWindow().setBackgroundDrawable(new ColorDrawable(mCurrentHourColor));

    mAlarmButton.setOnTouchListener(this);
    mSnoozeButton.setOnClickListener(this);
    mDismissButton.setOnClickListener(this);

    mAlarmAnimator = AnimatorUtils.getScaleAnimator(mAlarmButton, 1.0f, 0.0f);
    mSnoozeAnimator = getButtonAnimator(mSnoozeButton, Color.WHITE);
    mDismissAnimator = getButtonAnimator(mDismissButton, mCurrentHourColor);
    mPulseAnimator = ObjectAnimator.ofPropertyValuesHolder(pulseView,
            PropertyValuesHolder.ofFloat(CircleView.RADIUS, 0.0f, pulseView.getRadius()),
            PropertyValuesHolder.ofObject(CircleView.FILL_COLOR, AnimatorUtils.ARGB_EVALUATOR,
                    ColorUtils.setAlphaComponent(pulseView.getFillColor(), 0)));
    mPulseAnimator.setDuration(PULSE_DURATION_MILLIS);
    mPulseAnimator.setInterpolator(PULSE_INTERPOLATOR);
    mPulseAnimator.setRepeatCount(ValueAnimator.INFINITE);
    mPulseAnimator.start();
}

From source file:com.dwdesign.tweetings.fragment.AccountsFragment.java

@Override
public void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
    switch (requestCode) {
    case REQUEST_SET_COLOR: {
        if (resultCode == Activity.RESULT_OK)
            if (data != null && data.getExtras() != null) {
                final int color = data.getIntExtra(Accounts.USER_COLOR, Color.WHITE);
                final ContentValues values = new ContentValues();
                values.put(Accounts.USER_COLOR, color);
                final String where = Accounts.USER_ID + " = " + mSelectedUserId;
                mResolver.update(Accounts.CONTENT_URI, values, where, null);
                getLoaderManager().restartLoader(0, null, this);
            }//from  ww  w .j  a v a2 s .  c  o  m
        break;
    }
    }
    super.onActivityResult(requestCode, resultCode, data);
}

From source file:com.androidinspain.deskclock.alarms.dataadapter.ExpandedAlarmViewHolder.java

private void bindDaysOfWeekButtons(Alarm alarm, Context context) {
    final List<Integer> weekdays = DataModel.getDataModel().getWeekdayOrder().getCalendarDays();
    for (int i = 0; i < weekdays.size(); i++) {
        final CompoundButton dayButton = dayButtons[i];
        if (alarm.daysOfWeek.isBitOn(weekdays.get(i))) {
            dayButton.setChecked(true);/*from   ww w. ja v a 2s . c  o m*/
            dayButton.setTextColor(ThemeUtils.resolveColor(context, android.R.attr.windowBackground));
        } else {
            dayButton.setChecked(false);
            dayButton.setTextColor(Color.WHITE);
        }
    }
    if (alarm.daysOfWeek.isRepeating()) {
        repeat.setChecked(true);
        repeatDays.setVisibility(View.VISIBLE);
    } else {
        repeat.setChecked(false);
        repeatDays.setVisibility(View.GONE);
    }
}

From source file:net.networksaremadeofstring.rhybudd.ZenossWidgetGraph.java

@SuppressWarnings("unused")
private Bitmap RenderLineGraph() {
    Bitmap emptyBmap = Bitmap.createBitmap(290, 150, Config.ARGB_8888);

    int width = emptyBmap.getWidth();
    int height = emptyBmap.getHeight();
    Bitmap charty = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);

    Canvas canvas = new Canvas(charty);
    final int color = 0xff0B0B61;
    final Paint paint = new Paint();

    paint.setStyle(Paint.Style.FILL);
    paint.setColor(Color.WHITE);

    //if(warningEvents > )
    canvas.drawText("100", 0, 10, paint);

    //y/*from   w  w w .  j a  v  a2s .c om*/
    canvas.drawLine(25, 0, 25, 289, paint);
    //x
    canvas.drawLine(25, 149, 289, 149, paint);

    int CritArray[] = { 5, 4, 6, 10, 10, 6, 4, 4 };
    int curX = 25;

    int divisor = 148 / 10;
    paint.setColor(Color.RED);
    int curY = 148 - (CritArray[0] * divisor);

    for (int a : CritArray) {
        canvas.drawLine(curX, curY, curX + 32, (148 - (a * divisor)), paint);
        curX += 32;
        curY = 148 - (a * divisor);
    }

    int ErrArray[] = { 1, 2, 2, 2, 4, 2, 1, 0 };
    curX = 25;

    paint.setColor(Color.rgb(255, 102, 0));
    curY = 148 - (ErrArray[0] * divisor);

    for (int a : ErrArray) {
        canvas.drawLine(curX, curY, curX + 32, (148 - (a * divisor)), paint);
        curX += 32;
        curY = 148 - (a * divisor);
    }

    int WarnArray[] = { 0, 2, 4, 8, 10, 4, 2, 2 };
    curX = 25;

    paint.setColor(Color.YELLOW);
    curY = 148 - (WarnArray[0] * divisor);

    Path myPath = new Path();

    for (int a : WarnArray) {
        canvas.drawLine(curX, curY, curX + 32, (148 - (a * divisor)), paint);
        curX += 32;
        curY = 148 - (a * divisor);
    }

    ByteArrayOutputStream out = new ByteArrayOutputStream();
    charty.compress(CompressFormat.PNG, 50, out);

    return BitmapFactory.decodeByteArray(out.toByteArray(), 0, out.size());
}

From source file:brostore.maquillage.custom.PagerSlidingTabStrip.java

private void addCustomTextTab(final int position, String title) {
    LinearLayout conteneur = new LinearLayout(getContext());
    LinearLayout.LayoutParams param = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
            LinearLayout.LayoutParams.WRAP_CONTENT);
    conteneur.setOrientation(LinearLayout.HORIZONTAL);
    conteneur.setGravity(Gravity.CENTER);
    TextView tab = new TextView(getContext());
    TextView tabCust = new TextView(getContext());
    //tabCust.setBackgroundResource(R.drawable.live_nombre);
    tabCust.setGravity(Gravity.CENTER);//from  w  ww. j av  a2s .co  m
    tabCust.setTextColor(Color.WHITE);
    tabCust.setTypeface(tabTypeface);
    tabCust.setTextSize(11);
    tabCust.setVisibility(View.GONE);
    int fiveDip = Utils.convertDpToPixel(5, getResources());
    tabCust.setPadding(fiveDip, 0, fiveDip, 0);
    tabCust.setText("0");
    tab.setText(title);
    tab.setGravity(Gravity.CENTER);
    tab.setSingleLine();

    conteneur.addView(tab, param);
    param.leftMargin = Utils.convertDpToPixel(10, getResources());
    conteneur.addView(tabCust, param);
    addTab(position, conteneur);
}

From source file:com.Anderson.example.games.tanc.GameplayFragment.java

void SetColor() {

    Button b1 = (Button) getView().findViewById(R.id.option_button_1);
    Button b2 = (Button) getView().findViewById(R.id.option_button_2);
    Button b3 = (Button) getView().findViewById(R.id.option_button_3);
    Button b4 = (Button) getView().findViewById(R.id.option_button_4);
    b1.getBackground().setColorFilter(Color.WHITE, PorterDuff.Mode.MULTIPLY);
    b2.getBackground().setColorFilter(Color.WHITE, PorterDuff.Mode.MULTIPLY);
    b3.getBackground().setColorFilter(Color.WHITE, PorterDuff.Mode.MULTIPLY);
    b4.getBackground().setColorFilter(Color.WHITE, PorterDuff.Mode.MULTIPLY);

}

From source file:com.progym.custom.fragments.FoodProgressMonthlyLineFragment.java

public void setLineData3(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 ava2 s  .  c  o 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(graphView);
                        } catch (Exception edsx) {
                            edsx.printStackTrace();
                        }

                    }
                });

                date.setDate(1);
                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 First day of the month as first month

                int[] x = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
                        23, 24, 25, 26, 27, 28, 29, 30, 31 };

                // Creating an XYSeries for Consumed water
                XYSeries protein = new XYSeries("Protein");
                XYSeries fat = new XYSeries("Fat");
                XYSeries carbs = new XYSeries("Carbs");

                List<Ingridient> list;
                Date dt = date; // *
                // Adding data to Income and Expense Series
                for (int i = 1; i <= daysInMonth; i++) {
                    // get all water records consumed per this month
                    list = DataBaseUtils.getAllFoodConsumedInMonth(
                            Utils.formatDate(dt, DataBaseUtils.DATE_PATTERN_YYYY_MM_DD));
                    // init "average" data
                    double totalProtein = 0, totalFat = 0, totalCarbs = 0;
                    if (null != list) {
                        for (Ingridient ingridient : list) {
                            totalProtein += ingridient.protein;
                            totalFat += ingridient.fat;
                            totalCarbs += ingridient.carbohydrates;
                        }
                    }

                    protein.add(i, (double) Math.round(totalProtein * 100) / 100);
                    fat.add(i, (double) Math.round(totalFat * 100) / 100);
                    carbs.add(i, (double) Math.round(totalCarbs * 100) / 100);
                    // calories.add(i, totalCallories);
                    dt = DateUtils.addDays(dt, 1);

                    yMaxAxisValue = Math.max(yMaxAxisValue, (int) totalProtein);
                    yMaxAxisValue = Math.max(yMaxAxisValue, (int) totalFat);
                    yMaxAxisValue = Math.max(yMaxAxisValue, (int) totalCarbs);
                }

                // Creating a dataset to hold each series
                final XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
                // Adding Income Series to the dataset
                dataset.addSeries(protein);
                dataset.addSeries(carbs);
                dataset.addSeries(fat);

                // Creating XYSeriesRenderer to customize protein series
                XYSeriesRenderer proteinRenderer = new XYSeriesRenderer();
                proteinRenderer.setColor(Color.rgb(50, 255, 50));
                proteinRenderer.setFillPoints(true);
                proteinRenderer.setLineWidth(3);
                proteinRenderer.setDisplayChartValues(true);

                // Creating XYSeriesRenderer to customize protein series
                XYSeriesRenderer fatRenderer = new XYSeriesRenderer();
                fatRenderer.setColor(Color.rgb(123, 111, 00));
                fatRenderer.setFillPoints(true);
                fatRenderer.setLineWidth(3);
                fatRenderer.setDisplayChartValues(true);

                // Creating XYSeriesRenderer to customize protein series
                XYSeriesRenderer carbsRenderer = new XYSeriesRenderer();
                carbsRenderer.setColor(Color.rgb(222, 13, 11));
                carbsRenderer.setFillPoints(true);
                carbsRenderer.setLineWidth(3);
                carbsRenderer.setDisplayChartValues(true);

                // Creating a XYMultipleSeriesRenderer to customize the whole chart
                final XYMultipleSeriesRenderer multiRenderer = new XYMultipleSeriesRenderer();
                // multiRenderer.setXLabels(0);

                for (int i = 0; i < x.length; i++) {
                    multiRenderer.addXTextLabel(i, String.valueOf(x[i]));
                }

                // Adding incomeRenderer and expenseRenderer to multipleRenderer
                // Note: The order of adding dataseries to dataset and renderers to multipleRenderer
                // should be same
                multiRenderer.setChartTitle(String.format("Protein/Carbs/Fat statistic "));
                multiRenderer.setXTitle(Utils.getSpecificDateValue(DATE, "MMM") + " of "
                        + Utils.formatDate(DATE, DataBaseUtils.DATE_PATTERN_YYYY));
                multiRenderer.setYTitle("Amount (g)          ");
                multiRenderer.setAxesColor(Color.WHITE);
                multiRenderer.setShowLegend(true);
                multiRenderer.addSeriesRenderer(proteinRenderer);
                multiRenderer.addSeriesRenderer(carbsRenderer);
                multiRenderer.addSeriesRenderer(fatRenderer);

                multiRenderer.setShowGrid(true);
                multiRenderer.setClickEnabled(true);
                multiRenderer.setXLabelsAngle(20);
                multiRenderer.setXLabelsColor(Color.WHITE);
                multiRenderer.setZoomButtonsVisible(false);
                // configure visible area
                multiRenderer.setXAxisMax(31);
                multiRenderer.setXAxisMin(1);
                multiRenderer.setYAxisMax(yMaxAxisValue + 30);
                multiRenderer.setAxisTitleTextSize(15);
                multiRenderer.setZoomEnabled(true);

                getActivity().runOnUiThread(new Runnable() {

                    @Override
                    public void run() {
                        try {
                            graphView = ChartFactory.getLineChartView(getActivity(), dataset, multiRenderer);
                            rlRootGraphLayout.addView(graphView, 0);

                            if (isLeftIn) {
                                rightIn.setDuration(1000);
                                graphView.startAnimation(rightIn);
                            } else {
                                leftIn.setDuration(1000);
                                graphView.startAnimation(leftIn);
                            }
                        } catch (Exception edsx) {
                            edsx.printStackTrace();
                        }

                    }
                });

            } catch (Exception e) {
                e.printStackTrace();
            }
            ringProgressDialog.dismiss();
        }
    }).start();

}

From source file:com.spoiledmilk.cykelsuperstier.navigation.SMRouteNavigationActivity.java

public void onMetroContainerClick(View v) {
    v.setBackgroundColor(isMetroSelected ? Color.rgb(255, 255, 255) : Color.rgb(236, 104, 0));
    ((ImageView) findViewById(R.id.imgCheckbox4))
            .setImageResource(isMetroSelected ? R.drawable.check_field : R.drawable.check_in_orange);
    ((ImageView) findViewById(R.id.imgMetro))
            .setImageResource(isMetroSelected ? R.drawable.metro_icon : R.drawable.metro_icon_white);
    textMetro.setTextColor(isMetroSelected ? getResources().getColor(R.color.DarkGrey) : Color.WHITE);
    if (isMetroSelected)
        getMapFragment().overlaysManager.removeMetroStations();
    else// www  .  ja  v a  2  s . c  o m
        getMapFragment().overlaysManager.drawMetroStations(this);
    isMetroSelected = !isMetroSelected;
}

From source file:org.cocos2dx.lib.Cocos2dxBitmap.java

private static Paint newPaint(String fontName, int fontSize, int alignment) {
    Paint paint = new Paint();
    paint.setColor(Color.WHITE);
    paint.setTextSize(fontSize);/*  ww  w .  j a v a2  s.c o  m*/
    paint.setAntiAlias(true);

    /*
     * Set type face for paint, now it support .ttf file.
     */
    if (fontName.endsWith(".ttf")) {
        try {
            //Typeface typeFace = Typeface.createFromAsset(context.getAssets(), fontName);
            Typeface typeFace = Cocos2dxTypefaces.get(context, fontName);
            paint.setTypeface(typeFace);
        } catch (Exception e) {
            Log.e("Cocos2dxBitmap", "error to create ttf type face: " + fontName);

            /*
             * The file may not find, use system font
             */
            paint.setTypeface(Typeface.create(fontName, Typeface.NORMAL));
        }
    } else {
        paint.setTypeface(Typeface.create(fontName, Typeface.NORMAL));
    }

    int hAlignment = alignment & 0x0F;
    switch (hAlignment) {
    case HALIGNCENTER:
        paint.setTextAlign(Align.CENTER);
        break;

    case HALIGNLEFT:
        paint.setTextAlign(Align.LEFT);
        break;

    case HALIGNRIGHT:
        paint.setTextAlign(Align.RIGHT);
        break;

    default:
        paint.setTextAlign(Align.LEFT);
        break;
    }

    return paint;
}