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.coinblesk.client.utils.UIUtils.java

public static SpannableString toLargeSpannable(Context context, String amount, String currency,
        float sizeSpan) {
    final int amountLength = amount.length();
    SpannableString result = new SpannableString(new StringBuffer(amount + " " + currency));
    result.setSpan(new RelativeSizeSpan(sizeSpan), 0, amountLength, 0);
    result.setSpan(new ForegroundColorSpan(Color.WHITE), 0, amountLength, 0);
    result.setSpan(new ForegroundColorSpan(ContextCompat.getColor(context, R.color.colorAccent)), amountLength,
            result.length(), 0);// w w  w. j  a va 2  s.c  om
    return result;
}

From source file:com.chinaftw.music.ui.ActionBarCastActivity.java

private void populateDrawerItems() {
    mDrawerMenuContents = new DrawerMenuContents(this);
    final int selectedPosition = mDrawerMenuContents.getPosition(this.getClass());
    final int unselectedColor = Color.WHITE;
    final int selectedColor = getResources().getColor(R.color.drawer_item_selected_background);
    SimpleAdapter adapter = new SimpleAdapter(this, mDrawerMenuContents.getItems(), R.layout.drawer_list_item,
            new String[] { DrawerMenuContents.FIELD_TITLE, DrawerMenuContents.FIELD_ICON },
            new int[] { R.id.drawer_item_title, R.id.drawer_item_icon }) {
        @Override//from  w  w  w  .  j a va2s .  c  om
        public View getView(int position, View convertView, ViewGroup parent) {
            View view = super.getView(position, convertView, parent);
            int color = unselectedColor;
            if (position == selectedPosition) {
                color = selectedColor;
            }
            view.setBackgroundColor(color);
            return view;
        }
    };

    mDrawerList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            if (position != selectedPosition) {
                view.setBackgroundColor(getResources().getColor(R.color.drawer_item_selected_background));
                mItemToOpenWhenDrawerCloses = position;
            }
            mDrawerLayout.closeDrawers();
        }
    });
    mDrawerList.setAdapter(adapter);
}

From source file:com.achenging.view.SlidingTabLayout.java

/**
 * Create a default view to be used for tabs. This is called if a custom tab view is not set via
 * {@link #setCustomTabView(int, int)}.//from  w w w  .j a va  2 s.c  o m
 */
protected TextView createDefaultTabView(Context context) {
    AppCompatTextView textView = new AppCompatTextView(context);
    textView.setGravity(Gravity.CENTER);
    textView.setBackgroundColor(Color.WHITE);
    textView.setPadding(mTextPadding, mTextPadding, mTextPadding, mTextPadding);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP);

    if (mAvgSplit) {
        int screenWidth = getResources().getDisplayMetrics().widthPixels;
        textView.setWidth(screenWidth / mViewPager.getAdapter().getCount());
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        // If we're running on Honeycomb or newer, then we can use the Theme's
        // selectableItemBackground to ensure that the View has a pressed state
        TypedValue outValue = new TypedValue();
        getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true);
        textView.setBackgroundResource(outValue.resourceId);
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        // If we're running on ICS or newer, enable all-caps to match the Action Bar tab style
        textView.setAllCaps(true);
    }

    return textView;
}

From source file:com.propelics.pdfcreator.PdfcreatorModule.java

private void generateiTextPDFfunction(HashMap args) {
    Log.d(PROXY_NAME, "generateiTextPDFfunction()");

    String filename = "";
    TiUIView webview = null;/*from   www .ja va2  s  .  co  m*/
    int quality = 100;

    try {
        if (args.containsKey("filename")) {
            filename = (String) args.get("filename");
            Log.d(PROXY_NAME, "filename: " + filename);
        } else
            return;

        if (args.containsKey("webview")) {
            TiViewProxy viewProxy = (TiViewProxy) args.get("webview");
            webview = viewProxy.getOrCreateView();
            Log.d(PROXY_NAME, "webview: " + webview.toString());
        } else
            return;

        if (args.containsKey("quality")) {
            quality = TiConvert.toInt(args.get("quality"));
        }

        TiBaseFile file = TiFileFactory.createTitaniumFile(filename, true);
        Log.d(PROXY_NAME, "file full path: " + file.nativePath());

        OutputStream outputStream = file.getOutputStream();
        final int MARGIN = 0;
        final float PDF_WIDTH = PageSize.LETTER.getWidth() - MARGIN * 2; // A4: 595 //Letter: 612
        final float PDF_HEIGHT = PageSize.LETTER.getHeight() - MARGIN * 2; // A4: 842 //Letter: 792
        final int DEFAULT_VIEW_WIDTH = 980;
        final int DEFAULT_VIEW_HEIGHT = 1384;
        int viewWidth = DEFAULT_VIEW_WIDTH;
        int viewHeight = DEFAULT_VIEW_HEIGHT;

        Document pdfDocument = new Document(PageSize.LETTER, MARGIN, MARGIN, MARGIN, MARGIN);
        PdfWriter docWriter = PdfWriter.getInstance(pdfDocument, outputStream);

        Log.d(PROXY_NAME, "PDF_WIDTH: " + PDF_WIDTH);
        Log.d(PROXY_NAME, "PDF_HEIGHT: " + PDF_HEIGHT);

        WebView view = (WebView) webview.getNativeView();

        if (TiApplication.isUIThread()) {

            viewWidth = view.capturePicture().getWidth();
            viewHeight = view.capturePicture().getHeight();

            if (viewWidth <= 0) {
                viewWidth = DEFAULT_VIEW_WIDTH;
            }

            if (viewHeight <= 0) {
                viewHeight = DEFAULT_VIEW_HEIGHT;
            }

        } else {
            Log.e(PROXY_NAME, "NO UI THREAD");
            viewWidth = DEFAULT_VIEW_WIDTH;
            viewHeight = DEFAULT_VIEW_HEIGHT;
        }

        view.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
        Log.d(PROXY_NAME, "viewWidth: " + viewWidth);
        Log.d(PROXY_NAME, "viewHeight: " + viewHeight);

        float scaleFactorWidth = 1 / (viewWidth / PDF_WIDTH);
        float scaleFactorHeight = 1 / (viewHeight / PDF_HEIGHT);

        Log.d(PROXY_NAME, "scaleFactorWidth: " + scaleFactorWidth);
        Log.d(PROXY_NAME, "scaleFactorHeight: " + scaleFactorHeight);

        Bitmap viewBitmap = Bitmap.createBitmap(viewWidth, viewHeight, Bitmap.Config.ARGB_8888);
        Canvas viewCanvas = new Canvas(viewBitmap);

        // Paint paintAntialias = new Paint();
        // paintAntialias.setAntiAlias(true);
        // paintAntialias.setFilterBitmap(true);

        Drawable bgDrawable = view.getBackground();
        if (bgDrawable != null) {
            bgDrawable.draw(viewCanvas);
        } else {
            viewCanvas.drawColor(Color.WHITE);
        }
        view.draw(viewCanvas);

        TiBaseFile pdfImg = createTempFile(filename);

        viewBitmap.compress(Bitmap.CompressFormat.PNG, quality, pdfImg.getOutputStream());

        FileInputStream pdfImgInputStream = new FileInputStream(pdfImg.getNativeFile());
        byte[] pdfImgBytes = IOUtils.toByteArray(pdfImgInputStream);
        pdfImgInputStream.close();

        pdfDocument.open();
        float yFactor = viewHeight * scaleFactorWidth;
        int pageNumber = 1;

        do {
            if (pageNumber > 1) {
                pdfDocument.newPage();
            }
            pageNumber++;
            yFactor -= PDF_HEIGHT;

            Image pageImage = Image.getInstance(pdfImgBytes, true);
            // Image pageImage = Image.getInstance(buffer.array());
            pageImage.scalePercent(scaleFactorWidth * 100);
            pageImage.setAbsolutePosition(0f, -yFactor);
            pdfDocument.add(pageImage);

            Log.d(PROXY_NAME, "yFactor: " + yFactor);
        } while (yFactor > 0);

        pdfDocument.close();

        sendCompleteEvent(filename);

    } catch (Exception exception) {
        sendErrorEvent(exception);
    }
}

From source file:cn.com.bjnews.thinker.view.MyTabPageIndicator.java

@Override
public void setCurrentItem(int item) {
    if (mViewPager == null) {
        throw new IllegalStateException("ViewPager has not been bound.");
    }/*  ww w .  j a v  a 2s .  co  m*/
    mSelectedTabIndex = item;
    mViewPager.setCurrentItem(item);

    final int tabCount = mTabLayout.getChildCount();
    for (int i = 0; i < tabCount; i++) {
        final View child = mTabLayout.getChildAt(i);
        final boolean isSelected = (i == item);
        child.setSelected(isSelected);
        if (child instanceof TextView) {
            if (isSelected)
                ((TextView) child).setTextColor(selectedColor);
            else
                ((TextView) child).setTextColor(Color.WHITE);
        }
        if (isSelected) {
            animateToTab(item);
        }
    }
}

From source file:com.digi.android.wva.fragments.ChartFragment.java

/**
 * Create the components that go into the chart.
 *
 * <p>This method is protected, rather than private, due to a bug between JaCoCo and
 * the Android build tools which causes the instrumented bytecode to be invalid when this
 * method is private:/*from w w w  .  j a  va2  s  . c om*/
 * http://stackoverflow.com/questions/17603192/dalvik-transformation-using-wrong-invoke-opcode
 * </p>
 */
protected void buildGraphPieces() {
    if (mRenderer != null || mDataset != null || mRpmRenderer != null || mSpeedRenderer != null) {
        // Don't want to leak any memory or whatnot.
        return;
    }
    mRenderer = new XYMultipleSeriesRenderer(2);
    mDataset = new XYMultipleSeriesDataset();
    mSpeedRenderer = new XYSeriesRenderer();
    mRpmRenderer = new XYSeriesRenderer();

    // Initialize renderer settings
    mRenderer.setShowGrid(true);
    mRenderer.setFitLegend(true);
    // Number of grid lines in either direction by default
    mRenderer.setXLabels(0);
    mRenderer.setYLabels(10);
    mRenderer.setXLabelsAlign(Align.RIGHT);
    mRenderer.setYLabelsAlign(Align.RIGHT);
    mRenderer.setPointSize(5f);
    // AChartEngine output defaults to a black background.
    // This doesn't fit with the general WVA color scheme.
    mRenderer.setApplyBackgroundColor(true);
    mRenderer.setBackgroundColor(Color.WHITE);
    mRenderer.setMarginsColor(Color.WHITE);
    mRenderer.setAxesColor(Color.DKGRAY);
    mRenderer.setLabelsColor(Color.BLACK);
    mRenderer.setXLabelsColor(Color.DKGRAY);
    mRenderer.setYLabelsColor(0, Color.DKGRAY);
    mRenderer.setYLabelsColor(1, Color.DKGRAY);
    mRenderer.setGridColor(Color.LTGRAY);
    mRenderer.setPanEnabled(false, false);
    mRenderer.setZoomEnabled(false, false);
    mRenderer.setXAxisMin(startTime);
    mRenderer.setXAxisMax(endTime);
    mRenderer.setXAxisMin(startTime, 1);
    mRenderer.setXAxisMax(endTime, 1);
    mRenderer.setYAxisMin(0, 0);
    mRenderer.setYAxisMax(100, 0);

    mSpeedRenderer.setColor(Color.RED);
    mSpeedRenderer.setPointStyle(PointStyle.CIRCLE);
    mSpeedRenderer.setFillPoints(true);

    mRpmRenderer.setColor(Color.BLUE);
    mRpmRenderer.setPointStyle(PointStyle.SQUARE);
    mRpmRenderer.setFillPoints(true);

    XYSeries speedSeries = new XYSeries("Vehicle Speed");
    XYSeries rpmSeries = new XYSeries("Engine RPM", 1);

    mDataset.addSeries(0, speedSeries);
    mDataset.addSeries(1, rpmSeries);
    mRenderer.addSeriesRenderer(0, mSpeedRenderer);
    mRenderer.addSeriesRenderer(1, mRpmRenderer);

    mRenderer.setYAxisMin(0, 1);
    mRenderer.setYAxisMax(10000, 1);

    mRenderer.setYTitle("VehicleSpeed");
    mRenderer.setYTitle("EngineSpeed", 1);
    mRenderer.setYAxisAlign(Align.RIGHT, 1);
    mRenderer.setYLabelsAlign(Align.RIGHT, 1);

    // Add X-axis labels with time.
    Log.d(TAG, "Time range: " + startTime + " to " + endTime);
    SimpleDateFormat fmt = new SimpleDateFormat("HH:mm:ss", Locale.US);
    for (double t = startTime; t <= endTime; t += 60 * 1000) {
        String time = fmt.format(new Date((long) t));
        Log.d(TAG, "Adding label " + t + ", " + time);
        mRenderer.addXTextLabel(t, time);
    }
}

From source file:com.sutromedia.android.core.PhotoActivity.java

public void onSetupView(View view, int viewId) {
    final IPhoto photo = getCurrentPhoto();
    if (photo != null) {

        int backgroundId = (viewId == R.layout.image_view_inside) ? R.drawable.attrib_inside
                : R.drawable.attrib_outside;

        Drawable background = getResources().getDrawable(backgroundId);
        background.setAlpha(155);//from w w w .  ja v  a2s.  com
        view.findViewById(R.image.licenseGroup).setBackgroundDrawable(background);
        setVisibility(view, R.image.caption, !mInSlideShow && !isSubsetOnEntry());
        TextView caption = (TextView) view.findViewById(R.image.caption);
        String entryName = photo.getEntryName();
        if (entryName != null) {
            entryName = entryName.replace(' ', '\u00A0');
            entryName += "\u00A0\u00A0\u25B6";
        }
        caption.setText(entryName);
        caption.setSingleLine(true);
        caption.setOnClickListener(new View.OnClickListener() {
            public void onClick(View view) {
                onReceiveEntry(new NavigationDetailWeb(photo.getEntryId()));
            }
        });

        setVisibility(view, R.image.licenseGroup, !mInSlideShow);
        Integer[] icons = PhotoLicence.getIcons(photo);
        setImageView(view, R.image.license1, 0, icons);
        setImageView(view, R.image.license2, 1, icons);
        TextView owner = (TextView) view.findViewById(R.image.owner);
        if (icons.length > 0) {
            owner.setText(photo.getAuthor());
        } else {
            view.findViewById(R.image.licenseGroup).setVisibility(View.GONE);
        }

        String url = photo.getUrl();
        View licenceGroup = view.findViewById(R.image.licenseGroup);
        if (url != null && url.length() > 0) {
            owner.setTextColor(Color.rgb(0x19, 0x49, 0x90));
            owner.setTypeface(null, Typeface.BOLD);

            licenceGroup.setOnClickListener(new View.OnClickListener() {
                public void onClick(View view) {
                    onReceiveEntry(new NavigationWeb(photo.getUrl()));
                }
            });
        } else {
            owner.setTypeface(null, Typeface.NORMAL);
            owner.setTextColor(Color.WHITE);
            licenceGroup.setOnClickListener(null);
        }

        setupTouchOnPlayButton();
        setVisibility(R.image.play_slideshow, !mInSlideShow && mShowSlideShowControls);
        setVisibility(R.image.loading, mMissingPhoto);
        setVisibility(R.image.wait, mMissingPhoto && isOnline());

        String missingTextTemplate = getString(
                mMissingPhoto && isOnline() ? R.string.missing_photo : R.string.missing_not_online);
        String missingText = String.format(missingTextTemplate, mCurrentImage + 1, getImageCountInSet());

        setText(R.image.missing, missingText);
    }
}

From source file:com.agenmate.lollipop.addedit.AddEditFragment.java

@Override
public void setColor(int color) {
    selectedColor = color;//from  w w  w.  j  a  v a 2 s  . c  o  m
    boolean isWhiteText = selectedColor == 0 || selectedColor == 5 || selectedColor == 6;
    if (isWhiteText) {
        dueDateStatus.setTextColor(Color.WHITE);
        dueDateText.setTextColor(Color.WHITE);
    } else {
        dueDateStatus.setTextColor(Color.BLACK);
        dueDateText.setTextColor(Color.BLACK);
    }
    background.setBackgroundResource(colorBackgroundIds[selectedColor]);
    dueDateText.setBackgroundResource(colorTabIds[selectedColor]);
    ((AddEditActivity) getActivity()).setBarColor(selectedColor, isWhiteText);
}

From source file:mp.paschalis.App.java

public static void setStyleDirection(TextView pTextView) {
    pTextView.setTextColor(Color.WHITE);
    pTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20);

}

From source file:com.amaze.filemanager.fragments.ProcessViewer.java

public void processResults(final DataPackage b) {
    if (!running)
        return;/*www. jav a  2s  .c  o  m*/
    if (getResources() == null)
        return;
    if (b != null) {
        int id = b.getId();
        final Integer id1 = new Integer(id);
        if (!CancelledCopyIds.contains(id1)) {
            if (CopyIds.contains(id1)) {
                boolean completed = b.isCompleted();
                View process = rootView.findViewWithTag("copy" + id);
                if (completed) {
                    try {
                        rootView.removeViewInLayout(process);
                        CopyIds.remove(CopyIds.indexOf(id1));
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                } else {
                    String name = b.getName();
                    int p1 = b.getP1();
                    int p2 = b.getP2();
                    long total = b.getTotal();
                    long done = b.getDone();
                    boolean move = b.isMove();
                    String text = utils.getString(getActivity(), R.string.copying) + "\n" + name + "\n"
                            + utils.readableFileSize(done) + "/" + utils.readableFileSize(total) + "\n" + p1
                            + "%";
                    if (move) {
                        text = utils.getString(getActivity(), R.string.moving) + "\n" + name + "\n"
                                + utils.readableFileSize(done) + "/" + utils.readableFileSize(total) + "\n" + p1
                                + "%";
                    }
                    ((TextView) process.findViewById(R.id.progressText)).setText(text);
                    ProgressBar p = (ProgressBar) process.findViewById(R.id.progressBar1);
                    p.setProgress(p1);
                    p.setSecondaryProgress(p2);
                }
            } else {
                CardView root = (android.support.v7.widget.CardView) getActivity().getLayoutInflater()
                        .inflate(R.layout.processrow, null);
                root.setTag("copy" + id);

                ImageButton cancel = (ImageButton) root.findViewById(R.id.delete_button);
                TextView progressText = (TextView) root.findViewById(R.id.progressText);

                Drawable icon = icons.getCopyDrawable();
                boolean move = b.isMove();
                if (move) {
                    icon = icons.getCutDrawable();
                }
                if (mainActivity.theme1 == 1) {

                    cancel.setImageResource(R.drawable.ic_action_cancel);
                    root.setCardBackgroundColor(R.color.cardView_foreground);
                    root.setCardElevation(0f);
                    progressText.setTextColor(Color.WHITE);
                } else {

                    icon.setColorFilter(Color.parseColor("#666666"), PorterDuff.Mode.SRC_ATOP);
                    progressText.setTextColor(Color.BLACK);
                }

                ((ImageView) root.findViewById(R.id.progressImage)).setImageDrawable(icon);
                cancel.setOnClickListener(new View.OnClickListener() {

                    public void onClick(View p1) {
                        Toast.makeText(getActivity(), utils.getString(getActivity(), R.string.stopping),
                                Toast.LENGTH_LONG).show();
                        Intent i = new Intent("copycancel");
                        i.putExtra("id", id1);
                        getActivity().sendBroadcast(i);
                        rootView.removeView(rootView.findViewWithTag("copy" + id1));

                        CopyIds.remove(CopyIds.indexOf(id1));
                        CancelledCopyIds.add(id1);
                        // TODO: Implement this method
                    }
                });

                String name = b.getName();
                int p1 = b.getP1();
                int p2 = b.getP2();

                String text = utils.getString(getActivity(), R.string.copying) + "\n" + name;
                if (move) {
                    text = utils.getString(getActivity(), R.string.moving) + "\n" + name;
                }
                progressText.setText(text);
                ProgressBar p = (ProgressBar) root.findViewById(R.id.progressBar1);
                p.setProgress(p1);
                p.setSecondaryProgress(p2);
                CopyIds.add(id1);
                rootView.addView(root);
            }
        }
    }
}