Example usage for android.graphics Color BLACK

List of usage examples for android.graphics Color BLACK

Introduction

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

Prototype

int BLACK

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

Click Source Link

Usage

From source file:com.google.mcommerce.sample.android.chapter09.googleMap.PolygonDemoActivity.java

private void setUpMap() {
    // Create a rectangle with two rectangular holes.
    mMap.addPolygon(new PolygonOptions().addAll(createRectangle(new LatLng(-20, 130), 5, 5))
            .addHole(createRectangle(new LatLng(-22, 128), 1, 1))
            .addHole(createRectangle(new LatLng(-18, 133), 0.5, 1.5)).fillColor(Color.CYAN)
            .strokeColor(Color.BLUE).strokeWidth(5));

    // Create an ellipse centered at Sydney.
    PolygonOptions options = new PolygonOptions();
    int numPoints = 400;
    float semiHorizontalAxis = 10f;
    float semiVerticalAxis = 5f;
    double phase = 2 * Math.PI / numPoints;
    for (int i = 0; i <= numPoints; i++) {
        options.add(new LatLng(SYDNEY.latitude + semiVerticalAxis * Math.sin(i * phase),
                SYDNEY.longitude + semiHorizontalAxis * Math.cos(i * phase)));
    }/*from ww w  .ja va  2 s  .c om*/

    int fillColor = Color.HSVToColor(mAlphaBar.getProgress(), new float[] { mColorBar.getProgress(), 1, 1 });
    mMutablePolygon = mMap.addPolygon(
            options.strokeWidth(mWidthBar.getProgress()).strokeColor(Color.BLACK).fillColor(fillColor));

    mColorBar.setOnSeekBarChangeListener(this);
    mAlphaBar.setOnSeekBarChangeListener(this);
    mWidthBar.setOnSeekBarChangeListener(this);

    // Move the map so that it is centered on the mutable polygon.
    mMap.moveCamera(CameraUpdateFactory.newLatLng(SYDNEY));
}

From source file:br.liveo.ndrawer.ui.fragment.MainFragment51.java

public void onStop() {
    super.onStop();
    mv.stopPlayback();
    mv.setBackgroundColor(Color.BLACK);
}

From source file:com.cyrilmottier.android.polaris2demo.PolygonDemoActivity.java

private void setUpMap() {
    // Create a rectangle with two rectangular holes.
    mMap.addPolygon(new PolygonOptions().addAll(createCWRectangle(new LatLng(-20, 130), 5, 5))
            .addHole(createCWRectangle(new LatLng(-22, 128), 1, 1))
            .addHole(createCWRectangle(new LatLng(-18, 133), 0.5, 1.5)).fillColor(Color.CYAN)
            .strokeColor(Color.BLUE).strokeWidth(5));

    // Create an ellipse centered at Sydney.
    PolygonOptions options = new PolygonOptions();
    int numPoints = 400;
    float semiHorizontalAxis = 10f;
    float semiVerticalAxis = 5f;
    double phase = 2 * Math.PI / numPoints;
    for (int i = 0; i <= numPoints; i++) {
        options.add(new LatLng(SYDNEY.latitude + semiVerticalAxis * Math.sin(i * phase),
                SYDNEY.longitude + semiHorizontalAxis * Math.cos(i * phase)));
    }/*w ww.j  ava 2s .  c om*/

    int fillColor = Color.HSVToColor(mAlphaBar.getProgress(), new float[] { mColorBar.getProgress(), 1, 1 });
    mMutablePolygon = mMap.addPolygon(
            options.strokeWidth(mWidthBar.getProgress()).strokeColor(Color.BLACK).fillColor(fillColor));

    mColorBar.setOnSeekBarChangeListener(this);
    mAlphaBar.setOnSeekBarChangeListener(this);
    mWidthBar.setOnSeekBarChangeListener(this);

    // Move the map so that it is centered on the mutable polygon.
    mMap.moveCamera(CameraUpdateFactory.newLatLng(SYDNEY));
}

From source file:com.example.fansonlib.widget.calendar.CalendarView.java

public CalendarView(@NonNull Context context, @Nullable AttributeSet attrs) {
    super(context, attrs);
    TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.CalendarView);
    mCurDayTextColor = array.getColor(R.styleable.CalendarView_current_day_text_color, Color.RED);
    mSchemeStyle = array.getInt(R.styleable.CalendarView_scheme_theme_style, CalendarCardView.STYLE_STROKE);
    mSelectThemeStyle = array.getInt(R.styleable.CalendarView_selected_theme_style,
            CalendarCardView.STYLE_STROKE);
    mSchemeTextColor = array.getColor(R.styleable.CalendarView_scheme_text_color, Color.RED);
    mSchemeThemeColor = array.getColor(R.styleable.CalendarView_scheme_theme_color, 0x50CFCFCF);
    isShowLunar = array.getBoolean(R.styleable.CalendarView_show_lunar, true);
    mCalendarCardViewClass = array.getString(R.styleable.CalendarView_calendar_card_view);

    mWeekBackground = array.getColor(R.styleable.CalendarView_week_background, Color.WHITE);
    mWeekTextColor = array.getColor(R.styleable.CalendarView_week_text_color, Color.BLACK);

    mSelectedThemeColor = array.getColor(R.styleable.CalendarView_selected_theme_color, 0x50CFCFCF);
    mSelectedTextColor = array.getColor(R.styleable.CalendarView_selected_text_color, 0xFF111111);

    mCurrentMonthTextColor = array.getColor(R.styleable.CalendarView_current_month_text_color, 0xFF111111);
    mOtherMonthTextColor = array.getColor(R.styleable.CalendarView_other_month_text_color, 0xFFe1e1e1);

    mLunarTextColor = array.getColor(R.styleable.CalendarView_lunar_text_color, Color.GRAY);
    mMinYear = array.getInt(R.styleable.CalendarView_min_year, 2010);
    mMaxYear = array.getInt(R.styleable.CalendarView_max_year, 2050);
    if (mMinYear <= 1900)
        mMaxYear = 1900;/*from   ww w.  j a  v  a  2 s. c om*/
    if (mMaxYear >= 2099)
        mMaxYear = 2099;
    array.recycle();
    init(context);
}

From source file:com.onlyapps.sample.DetailActivity.java

private void applyPaletee(Bitmap bitmap) {
    Palette palette = Palette.generate(bitmap);

    mHeaderTitle.setTextColor(palette.getLightMutedColor(Color.WHITE));
    mHeaderTitle.setBackgroundColor(palette.getDarkMutedColor(Color.BLACK));

    mText.setTextColor(palette.getLightVibrantColor(Color.WHITE));
    mText.setBackgroundColor(palette.getDarkVibrantColor(Color.BLACK));

}

From source file:com.android.mail.ui.FolderItemView.java

public void bind(final Folder folder, final DropHandler dropHandler, final BidiFormatter bidiFormatter) {
    mFolder = folder;//  w  w  w  . ja v a  2s.co m
    mDropHandler = dropHandler;

    mFolderTextView.setText(bidiFormatter.unicodeWrap(folder.name));

    mFolderParentIcon.setVisibility(mFolder.hasChildren ? View.VISIBLE : View.GONE);
    if (mFolder.isInbox() && mFolder.unseenCount > 0) {
        mUnreadCountTextView.setVisibility(View.GONE);
        setUnseenCount(mFolder.getBackgroundColor(Color.BLACK), mFolder.unseenCount);
    } else {
        mUnseenCountTextView.setVisibility(View.GONE);
        setUnreadCount(Utils.getFolderUnreadDisplayCount(mFolder));
    }
}

From source file:com.richtodd.android.quiltdesign.block.Quilt.java

public void draw(Bitmap bitmap, RenderOptions renderOptions) {
    Canvas canvas = new Canvas(bitmap);
    canvas.drawColor(Color.BLACK);
    draw(canvas, renderOptions);//  w w  w .  j  a v  a  2  s.  co  m
}

From source file:com.binu.LogarithmicGraph.DrawGraphAsyncTask.java

@Override
protected Object doInBackground(Object[] params) {

    Bitmap bitmapBackground = Bitmap.createBitmap(mViewWidth, mViewHeight, Bitmap.Config.ARGB_8888);

    Canvas canvasBackground = new Canvas(bitmapBackground);
    Paint paint = new Paint();
    paint.setStrokeWidth(1f);//  w ww  . ja va 2s.  c  om
    int starty = 0;
    int endy = mViewHeight;
    canvasBackground.drawColor(Color.BLACK);
    double ratio = Math.pow(Math.E, Math.log(MAX_FREQUENCY / MIN_FREQUENCY) / mViewWidth);
    mLogScaledX_values = new double[mViewWidth];
    for (int i = 0; i < mViewWidth; i++) {
        if (i == 0) {
            mLogScaledX_values[i] = 20;
        } else {
            mLogScaledX_values[i] = mLogScaledX_values[i - 1] * ratio;
        }
    }

    //Major lines
    for (int i = 0; i < MAJOR_GRIDLINE_POINTS.length; i++) {
        paint.setColor(ContextCompat.getColor(mContext, R.color.graph_grid_color));
        float xStart = (float) findNearestNumberPosition(mLogScaledX_values, MAJOR_GRIDLINE_POINTS[i]);
        float textSize = (getPixelDensity(mContext) * mLabelTextSize) / 480;
        paint.setTextSize(textSize);
        Log.i("Density", "" + getPixelDensity(mContext));
        if (Math.round(MAJOR_GRIDLINE_POINTS[i]) == 20) {
            if (isShowLabels())
                canvasBackground.drawText(getFormattedLabel(MAJOR_GRIDLINE_POINTS[i]),
                        xStart + (getPixelDensity(mContext) * 10) / 480,
                        endy - (getPixelDensity(mContext) * 10) / 480, paint);
        } else if (Math.round(MAJOR_GRIDLINE_POINTS[i]) == 20000) {
            if (isShowLabels())
                canvasBackground.drawText(getFormattedLabel(MAJOR_GRIDLINE_POINTS[i]),
                        xStart - (getPixelDensity(mContext) * 70) / 480,
                        endy - (getPixelDensity(mContext) * 10) / 480, paint);
        } else {
            if (isShowLabels())
                canvasBackground.drawText(getFormattedLabel(MAJOR_GRIDLINE_POINTS[i]),
                        xStart - (getPixelDensity(mContext) * 30) / 480,
                        endy - (getPixelDensity(mContext) * 10) / 480, paint);
            canvasBackground.drawLine(xStart, starty, xStart + 1, endy, paint);
        }
    }

    //Minor lines
    for (int i = 0; i < MINOR_GRIDLINE_POINTS.length; i++) {
        paint.setColor(ContextCompat.getColor(mContext, R.color.graph_grid_color_dull));
        float xStart = (float) findNearestNumberPosition(mLogScaledX_values, MINOR_GRIDLINE_POINTS[i]);
        canvasBackground.drawLine(xStart, starty, xStart + 1, endy, paint);

        if (isShowLabels()) {
            paint.setColor(ContextCompat.getColor(mContext, R.color.graph_grid_color));
            if (MINOR_GRIDLINE_POINTS[i] == 50 || MINOR_GRIDLINE_POINTS[i] == 500
                    || MINOR_GRIDLINE_POINTS[i] == 5000)
                canvasBackground.drawText(getFormattedLabel(MINOR_GRIDLINE_POINTS[i]),
                        xStart - (getPixelDensity(mContext) * 30) / 480,
                        endy - (getPixelDensity(mContext) * 10) / 480, paint);
        }
    }

    float[] Y_points = calculateGraphYAxis();
    float div = mViewHeight / (Y_points.length - 1);
    //Level lines
    for (int i = 0; i < Y_points.length - 1; i++) {
        paint.setColor(ContextCompat.getColor(mContext, R.color.graph_grid_color_dull));
        canvasBackground.drawLine(0, div * (i + 1), mViewWidth, (div * (i + 1)) + 1, paint);
    }

    //Level labels
    if (isShowLabels()) {
        for (int i = 0; i < Y_points.length; i++) {
            paint.setColor(ContextCompat.getColor(mContext, R.color.graph_grid_color));
            if (i == 0)
                canvasBackground.drawText("dB", 0, (div * i) + (getPixelDensity(mContext) * 50) / 480, paint);
            else if (i == Y_points.length - 1)
                canvasBackground.drawText("", 0, div * i, paint);
            else
                canvasBackground.drawText("" + Math.round(Y_points[i]), 0, div * i, paint);
        }
    }

    BitmapDrawable drawable = new BitmapDrawable(mContext.getResources(), bitmapBackground);
    mDrawableBackground = drawable;

    //Plotting the curve points

    Bitmap bitmapForeground = Bitmap.createBitmap(mViewWidth, mViewHeight, Bitmap.Config.ARGB_8888);
    Canvas canvasForeground = new Canvas(bitmapForeground);
    Paint plotPaint = new Paint();
    plotPaint.setStyle(Paint.Style.STROKE);
    plotPaint.setStrokeCap(Paint.Cap.ROUND);
    plotPaint.setStrokeWidth(PLOT_THICKNESS);
    plotPaint.setAntiAlias(true);
    plotPaint.setColor(ContextCompat.getColor(mContext, R.color.graph_plot_color));

    for (int i = 0; i < X_values.length; i++) {
        //            canvasForeground.drawCircle(i, mViewHeight - mPlotPoint[i], 2f, plotPaint);
        /*float startX, float startY, float stopX, float stopY,
        @NonNull Paint paint*/
        float startX = (float) getGetPixelValueForX(X_values[i]);
        float startY = mViewHeight
                - getPixelValueFromdB((int) GAIN_MAX, (int) GAIN_MIN, mViewHeight, Y_values[i]);
        float stopX;
        float stopY;
        if (i == X_values.length - 1) {
            stopX = (float) getGetPixelValueForX(X_values[i]);
            stopY = mViewHeight - getPixelValueFromdB((int) GAIN_MAX, (int) GAIN_MIN, mViewHeight, Y_values[i]);
        } else {
            stopX = (float) getGetPixelValueForX(X_values[i + 1]);
            stopY = mViewHeight
                    - getPixelValueFromdB((int) GAIN_MAX, (int) GAIN_MIN, mViewHeight, Y_values[i + 1]);
        }

        canvasForeground.drawLine(startX, startY, stopX, stopY, plotPaint);

    }

    BitmapDrawable drawableFore = new BitmapDrawable(mContext.getResources(), bitmapForeground);
    mDrawableForeground = drawableFore;
    return null;
}

From source file:com.example.george.sharedelementimplementation.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_animations);

    mGridView = (MyGridView) findViewById(R.id.gv_photo_grid);
    PhotoGridAdapter mAdapter = new PhotoGridAdapter(this);
    pictures = mBitmapUtils.loadPhotos(getResources());
    mAdapter.updateData(pictures);/*from  w w w  .  j a  v a  2  s. c om*/
    mGridView.setAdapter(mAdapter);

    // the image for pop up animation effect
    mImage = (ClippingImageView) findViewById(R.id.iv_animation);
    mImage.setVisibility(View.GONE);

    // set the background color in the fullscreen
    mTopLevelLayout = (RelativeLayout) findViewById(R.id.rl_fullscreen_bg);
    mBackground = new ColorDrawable(Color.BLACK);
    mBackground.setAlpha(0);
    mTopLevelLayout.setBackground(mBackground);

    mPager = (ClickableViewPager) findViewById(R.id.pager);
    mPager.setVisibility(View.GONE);

    // enable/disable touch event
    mGridView.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            if (mIsInFullscreen) {
                // returning true means that this event has been consumed
                // in fullscreen the grid view is not responding any finger interaction
                return true;
            }
            return false;
        }
    });

    mGridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

            mIsInFullscreen = true;
            // set the animating image to the clicked item
            Drawable drawable = ((ImageView) view).getDrawable();
            mImage.setImageDrawable(drawable);
            mImage.setVisibility(View.VISIBLE);

            // reset image translation
            mImage.setTranslationX(0);
            mImage.setTranslationY(0);

            // reset pager's adapter every time a view in Grid view is clicked
            mPager.setAdapter(new PhotoViewAdapter(MainActivity.this, pictures));
            mPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
                @Override
                public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {

                }

                @Override
                public void onPageSelected(int position) {
                }

                @Override
                public void onPageScrollStateChanged(int state) {
                    // the GirdView should follow the Pager
                    mGridView.smoothScrollToPosition(mPager.getCurrentItem());
                }
            });
            mPager.setCurrentItem(position, false);

            final float drawableWidth = drawable.getIntrinsicWidth();
            final float drawableHeight = drawable.getIntrinsicHeight();
            // calculate the clicked view's location and width/height
            final float heightWidthRatio = drawableHeight / drawableWidth;
            final int thumbnailWidth = view.getWidth();
            final int thumbnailHeight = view.getHeight();

            int[] viewLocation = new int[2];
            int[] gridViewLocation = new int[2];
            view.getLocationOnScreen(viewLocation);
            mGridView.getLocationOnScreen(gridViewLocation);
            final int thumbnailX = viewLocation[0] + thumbnailWidth / 2;
            final int thumbnailY = viewLocation[1] + thumbnailHeight / 2;
            final int fullscreenX = gridViewLocation[0] + mGridView.getWidth() / 2;
            final int fullscreenY = gridViewLocation[1] + mGridView.getHeight() / 2;

            Log.d(TAG, "viewLocation=" + viewLocation[0] + ", " + viewLocation[1] + "\ngridViewLocation="
                    + gridViewLocation[0] + ", " + gridViewLocation[1]);
            Log.d(TAG, "thumbnailX=" + thumbnailX + ", thumbnailY=" + thumbnailY + "\nfullscreenX="
                    + fullscreenX + ", fullscreenY=" + fullscreenY);

            // for image transform, we need 3 arguments to transform properly:
            // deltaX and deltaY - the translation of the image
            // scale value - the resize value
            // clip ratio - the reveal part of the image

            // figure out where the thumbnail and full size versions are, relative
            // to the screen and each other
            mXDelta = thumbnailX - fullscreenX;
            mYDelta = thumbnailY - fullscreenY;

            // Scale factors to make the large version the same size as the thumbnail
            if (heightWidthRatio < 1) {
                mImageScale = (float) thumbnailHeight / mImage.getLayoutParams().height;
            } else {
                mImageScale = (float) thumbnailWidth / mImage.getLayoutParams().width;
            }

            // clip ratio
            if (heightWidthRatio < 1) {
                // if the original picture is in landscape
                clipRatio = 1 - heightWidthRatio;
            } else {
                // if the original picture is in portrait
                clipRatio = 1 - 1 / heightWidthRatio;
            }

            Log.d(TAG, "*************************Enter Animation*************************");
            Log.d(TAG, "(mXDelta, mTopDelta)=(" + mXDelta + ", " + mYDelta + ")\nmImageScale=" + mImageScale
                    + "\nclipRatio=" + clipRatio);

            runEnterAnimation();
        }
    });
}

From source file:com.jrummyapps.android.widget.AnimatedSvgView.java

private void init(Context context, AttributeSet attrs) {
    mFillPaint = new Paint();
    mFillPaint.setAntiAlias(true);/*from ww w. j  a v  a 2  s  . c om*/
    mFillPaint.setStyle(Paint.Style.FILL);

    mTraceColors = new int[1];
    mTraceColors[0] = Color.BLACK;
    mTraceResidueColors = new int[1];
    mTraceResidueColors[0] = 0x32000000;

    if (attrs != null) {
        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.AnimatedSvgView);
        mViewportWidth = a.getInt(R.styleable.AnimatedSvgView_animatedSvgImageSizeX, 512);
        aspectRatioWidth = a.getInt(R.styleable.AnimatedSvgView_animatedSvgImageSizeX, 512);
        mViewportHeight = a.getInt(R.styleable.AnimatedSvgView_animatedSvgImageSizeY, 512);
        aspectRatioHeight = a.getInt(R.styleable.AnimatedSvgView_animatedSvgImageSizeY, 512);
        mTraceTime = a.getInt(R.styleable.AnimatedSvgView_animatedSvgTraceTime, 2000);
        mTraceTimePerGlyph = a.getInt(R.styleable.AnimatedSvgView_animatedSvgTraceTimePerGlyph, 1000);
        mFillStart = a.getInt(R.styleable.AnimatedSvgView_animatedSvgFillStart, 1200);
        mFillTime = a.getInt(R.styleable.AnimatedSvgView_animatedSvgFillTime, 1000);
        int traceMarkerLength = a.getInt(R.styleable.AnimatedSvgView_animatedSvgTraceMarkerLength, 16);
        mMarkerLength = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, traceMarkerLength,
                getResources().getDisplayMetrics());

        // int glyphStringsId = a.getResourceId(R.styleable.AnimatedSvgView_animatedSvgGlyphStrings, 0);

        int traceResidueColorsId = a.getResourceId(R.styleable.AnimatedSvgView_animatedSvgTraceResidueColors,
                0);
        int traceColorsId = a.getResourceId(R.styleable.AnimatedSvgView_animatedSvgTraceColors, 0);

        //int fillColorsId = a.getResourceId(R.styleable.AnimatedSvgView_animatedSvgFillColors, 0);

        a.recycle();

        //      if (glyphStringsId != 0) {
        //        setGlyphStrings(getResources().getStringArray(glyphStringsId));
        //         setTraceResidueColor(Color.argb(50, 0, 0, 0));
        //        setTraceColor(Color.BLACK);
        //      }
        if (traceResidueColorsId != 0) {
            setTraceResidueColors(getResources().getIntArray(traceResidueColorsId));
        }
        if (traceColorsId != 0) {
            setTraceColors(getResources().getIntArray(traceColorsId));
        }
        //      if (fillColorsId != 0) {
        //        setFillColors(getResources().getIntArray(fillColorsId));
        //      }

        mViewport = new PointF(mViewportWidth, mViewportHeight);
    }

    // Note: using a software layer here is an optimization. This view works with hardware accelerated rendering but
    // every time a path is modified (when the dash path effect is modified), the graphics pipeline will rasterize
    // the path again in a new texture. Since we are dealing with dozens of paths, it is much more efficient to
    // rasterize the entire view into a single re-usable texture instead. Ideally this should be toggled using a
    // heuristic based on the number and or dimensions of paths to render.
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        setLayerType(LAYER_TYPE_SOFTWARE, null);
    }
}