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:Main.java

private static synchronized Bitmap createScaledBitmap(Bitmap bitmap, final int width, final int height,
        float cornerRadius) {

    if (bitmap == null) {
        return null;
    }/*from  w  w  w  .ja v a  2  s . c  o m*/

    int adjustedWidth = width;
    int adjustedHeight = height;

    final int bitmapWidth = bitmap.getWidth();
    final int bitmapHeight = bitmap.getHeight();

    //int inBytes = bitmap.getByteCount();
    if (width >= bitmapWidth && height >= bitmapHeight)
        return bitmap;

    if (width > 0 && height > 0) {
        //if (width < bitmapWidth || height < bitmapHeight) {
        final float ratio = (float) bitmapWidth / bitmapHeight;

        if (bitmapWidth > bitmapHeight) {
            adjustedHeight = (int) (width / ratio);
        } else if (bitmapHeight > bitmapWidth) {
            adjustedWidth = (int) (height * ratio);
        }

        final Bitmap.Config c = Bitmap.Config.ARGB_8888;
        final Bitmap thumb = Bitmap.createBitmap(width, height, c);
        final Canvas canvas = sScaleCanvas;
        final Paint paint = sPaint;
        canvas.setBitmap(thumb);
        paint.setDither(false);
        paint.setFilterBitmap(true);

        Rect sBounds = new Rect();
        Rect sOldBounds = new Rect();

        sBounds.set((width - adjustedWidth) >> 1, (height - adjustedHeight) >> 1, adjustedWidth,
                adjustedHeight);
        sOldBounds.set(0, 0, bitmapWidth, bitmapHeight);

        if (cornerRadius != 0) {
            //Path p = new Path();
            RectF rect = new RectF(sBounds);
            canvas.drawARGB(0, 0, 0, 0);
            paint.setColor(Color.WHITE);
            canvas.drawRoundRect(rect, cornerRadius, cornerRadius, paint);
            paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN));
            //p.addRoundRect(rect, cornerRadius, cornerRadius, Direction.CCW);
            //canvas.clipPath(p, Op.REPLACE);
        } else {
            paint.setXfermode(null);
            //canvas.clipRect(0, 0, thumb.getWidth(), thumb.getHeight());
        }

        canvas.drawBitmap(bitmap, sOldBounds, sBounds, paint);

        canvas.setBitmap(Bitmap.createBitmap(1, 1, Config.ALPHA_8));

        return thumb;

    }
    return bitmap;
}

From source file:com.dreamfactory.kurtishu.pretty.view.delegate.AboutDelegate.java

@Override
protected void initViews(Context context, Intent mIntent) {
    super.initViews(context, mIntent);
    Toolbar toolbar = get(R.id.toolbar);
    toolbar.setTitle(R.string.app_name);
    toolbar.setTitleTextColor(Color.WHITE);
    toolbar.setNavigationIcon(R.mipmap.ic_arrow_back);
    toolbar.setNavigationOnClickListener(this);

    TextView textViewVersion = get(R.id.version);
    textViewVersion.setText(context.getString(R.string.version, BuildConfig.VERSION_NAME, BuildConfig.FLAVOR));

    RecyclerView mRecyclerView = get(R.id.dp_libraries);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(context));

    ListOrderedMap<String, String> dataMap = new ListOrderedMap<String, String>();
    dataMap.put("GitHub?", "https://github.com/KurtisHu/Pretty");
    dataMap.put("  ", " ?");
    dataMap.put("square / okhttp", "https://square.github.io/okhttp/");
    dataMap.put("google / gson", "https://github.com/google/gson");
    dataMap.put("facebook / fresco", "https://github.com/facebook/fresco");
    dataMap.put("orhanobut / logger", "https://github.com/orhanobut/logger");
    dataMap.put("greenrobot / EventBus", "https://github.com/greenrobot/EventBus");
    dataMap.put("lsjwzh / RecyclerViewPager", "https://github.com/lsjwzh/RecyclerViewPager");
    dataMap.put("Syehunter / RecyclerViewManager", "https://github.com/Syehunter/RecyclerViewManager");
    dataMap.put("Apache / commons-collections", "http://commons.apache.org/proper/commons-collections/");
    dataMap.put("Realm", "https://realm.io");

    mRecyclerView.setAdapter(new LibraryAdapter(context, dataMap));
}

From source file:com.ibuildapp.romanblack.CataloguePlugin.utils.Utils.java

/**
 * convert background color to font color
 *///from  w  w  w.j av a2  s.  com
public static int BackColorToFontColor(int backColor) {
    int r = (backColor >> 16) & 0xFF;
    int g = (backColor >> 8) & 0xFF;
    int b = (backColor >> 0) & 0xFF;

    double Y = (0.299 * r + 0.587 * g + 0.114 * b);
    if (Y > 127) {
        return Color.BLACK;
    } else {
        return Color.WHITE;
    }
}

From source file:biz.wiz.android.wallet.util.ViewPagerTabs.java

public ViewPagerTabs(final Context context, final AttributeSet attrs) {
    super(context, attrs);

    setSaveEnabled(true);/*from w  ww .  ja va  2s . c  o m*/

    paint.setTextSize(getResources().getDimension(R.dimen.font_size_tiny));
    paint.setColor(Color.BLACK);
    paint.setAntiAlias(true);
    paint.setShadowLayer(2, 0, 0, Color.WHITE);
}

From source file:be.artoria.belfortapp.mixare.data.convert.DataConvertor.java

public List<Marker> load(List<POI> poiList) {
    return new ArtoriaDataProcessor().load(poiList, 0, Color.WHITE);
}

From source file:com.busdrone.android.ui.VehicleMarkerRenderer.java

private Bitmap render(int color, String text) {
    TextPaint textPaint = new TextPaint();
    textPaint.setColor(Color.WHITE);
    textPaint.setStyle(Paint.Style.FILL);
    textPaint.setAntiAlias(true);// w  w w .  j av a 2s  . c  o m
    textPaint.setTextSize(mTextSize);

    Rect textBounds = new Rect();
    textPaint.getTextBounds(text, 0, text.length(), textBounds);

    int width = mPadding + textBounds.width() + mPadding;
    int height = mPadding + textBounds.height() + mPadding;

    Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);

    Canvas canvas = new Canvas(bitmap);

    Paint paint = new Paint();
    paint.setStyle(Paint.Style.FILL);
    paint.setColor(color);
    canvas.drawRoundRect(new RectF(0, 0, width, height), mCornerRadius, mCornerRadius, paint);

    canvas.drawText(text, (width / 2f) - (textBounds.width() / 2f), (height / 2f) + (textBounds.height() / 2f),
            textPaint);

    return bitmap;
}

From source file:com.android.purenexussettings.AppPickerFragment.java

@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.slidetab, container, false);
    // slide menu items
    String[] tabTitles = getResources().getStringArray(R.array.app_pick_items);
    String[] tabFrags = getResources().getStringArray(R.array.apppick_tab_fragments);

    pager = (ViewPager) v.findViewById(R.id.viewpager);
    pager.setOffscreenPageLimit(2);//from  www . j a va 2 s  . c om

    slidingTabLayout = (SlidingTabLayout) v.findViewById(R.id.sliding_tabs);
    slidingTabLayout.setInitFrag(this);

    pager.setAdapter(new ViewPagerAdapter(getChildFragmentManager(), tabTitles, tabFrags));

    slidingTabLayout.setViewPager(pager);

    slidingTabLayout.setSelectedIndicatorColors(Color.WHITE);
    slidingTabLayout.setDistributeEvenly(false);

    return v;
}

From source file:com.erevacation.challenge.injection.modules.ActivityModule.java

@Provides
@PerActivity
MaterialMenuDrawable provMaterialMenuDrawable() {
    return new MaterialMenuDrawable(mActivity, Color.WHITE, MaterialMenuDrawable.Stroke.THIN);
}

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

public PaperPiecedBlock(float width, float height, int backgroundColor) {
    if (width < 0)
        throw new InvalidParameterException("Invalid width " + width);
    if (height < 0)
        throw new InvalidParameterException("Invalid height " + height);

    m_dirty = false;/*w ww .  j  av a2 s  .  c  o m*/
    m_width = width;
    m_height = height;
    m_backgroundColor = backgroundColor;
    m_pieces = new ArrayList<PaperPiecedBlockPiece>();

    m_backgroundPaint = new Paint();
    m_backgroundPaint.setStyle(Style.FILL);
    m_backgroundPaint.setColor(m_backgroundColor);

    m_backgroundPaintWhite = new Paint();
    m_backgroundPaintWhite.setStyle(Style.FILL);
    m_backgroundPaintWhite.setColor(Color.WHITE);
}

From source file:com.ryan.ryanreader.views.SubredditHeader.java

public SubredditHeader(final Context context, final RedditSubreddit subreddit) {

    super(context);

    final float dpScale = context.getResources().getDisplayMetrics().density;

    setOrientation(LinearLayout.VERTICAL);

    final int sidesPadding = (int) (15.0f * dpScale);
    final int topPadding = (int) (10.0f * dpScale);

    setPadding(sidesPadding, topPadding, sidesPadding, topPadding);

    final Typeface tf = Typeface.createFromAsset(context.getAssets(), "fonts/Roboto-Light.ttf");

    final TextView title = new TextView(context);
    title.setTextSize(22.0f);/*from  w w  w . jav a2 s  .  co  m*/
    title.setTypeface(tf);
    title.setText(StringEscapeUtils.unescapeHtml4(subreddit.title));
    title.setTextColor(Color.WHITE);
    addView(title);

    final TextView subs = new TextView(context);
    subs.setTextSize(14.0f);

    if (subreddit.subscribers == null) {
        subs.setText("Subscriber count is unknown");
    } else {
        subs.setText(NumberFormat.getNumberInstance(Locale.getDefault()).format(subreddit.subscribers)
                + " subscribers");
    }

    subs.setTextColor(Color.rgb(200, 200, 200));
    addView(subs);

    setBackgroundColor(Color.rgb(50, 50, 50)); // TODO theme color
}