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:it.scoppelletti.mobilepower.preference.ColorPreference.java

/**
 * Imposta il valore iniziale della preferenza.
 * /*from w w  w.  ja v  a2 s .com*/
 * @param restorePersistedValue Indicatore di valore già registrato.
 * @param defaultValue          Valore di default.
 */
@Override
protected void onSetInitialValue(boolean restorePersistedValue, Object defaultValue) {
    if (restorePersistedValue) {
        myValue = getPersistedInt(Color.WHITE);
    } else {
        myValue = (Integer) defaultValue;
        persistInt(myValue);
    }
}

From source file:chrisrenke.drawerarrowdrawable.SlidingTabsColorsFragment.java

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

    // BEGIN_INCLUDE (populate_tabs)
    /**/*www  . ja  v  a2s .  co  m*/
     * Populate our tab list with tabs. Each item contains a title, indicator color and divider
     * color, which are used by {@link SlidingTabLayout}.
     */
    mTabs.add(new SamplePagerItem(getString(R.string.tab_stream), // Title
            Color.parseColor("#E8E8B7"), // Indicator color
            Color.WHITE // Divider color
    ));

    mTabs.add(new SamplePagerItem(getString(R.string.tab_messages), // Title
            Color.parseColor("#E8E8B7"), // Indicator color
            Color.WHITE // Divider color
    ));

    mTabs.add(new SamplePagerItem(getString(R.string.tab_photos), // Title
            Color.parseColor("#E8E8B7"), // Indicator color
            Color.WHITE // Divider color
    ));

    mTabs.add(new SamplePagerItem(getString(R.string.tab_notifications), // Title
            Color.parseColor("#E8E8B7"), // Indicator color
            Color.WHITE // Divider color
    ));
    // END_INCLUDE (populate_tabs)
}

From source file:com.adithyaupadhya.uimodule.roundcornerprogressbar.BaseRoundCornerProgressBar.java

private void previewLayout(Context context) {
    setGravity(Gravity.CENTER);/*from w ww  .  ja  v a 2s . com*/
    TextView tv = new TextView(context);
    ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT);
    tv.setLayoutParams(params);
    tv.setGravity(Gravity.CENTER);
    tv.setText(getClass().getSimpleName());
    tv.setTextColor(Color.WHITE);
    tv.setBackgroundColor(Color.GRAY);
    addView(tv);
}

From source file:com.cocosw.accessory.views.layout.CollapsingTitleLayout.java

public CollapsingTitleLayout(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    mTextPaint = new TextPaint();
    mTextPaint.setAntiAlias(true);//from   w  ww  . j  a va2 s .c om

    mMinTextSize = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, DEFAULT_MIN_TEXT_SIZE,
            getResources().getDisplayMetrics());

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CollapsingTitleLayout);

    mExpandedMargin = a.getDimensionPixelSize(R.styleable.CollapsingTitleLayout_expandedMargin, 0);
    mRequestedExpandedTitleTextSize = a
            .getDimensionPixelSize(R.styleable.CollapsingTitleLayout_expandedTextSize, 0);
    mRequestedCollapsedTitleTextSize = a
            .getDimensionPixelSize(R.styleable.CollapsingTitleLayout_collapsedTextSize, 0);
    mTextPaint.setColor(a.getColor(R.styleable.CollapsingTitleLayout_android_textColor, Color.WHITE));

    final int defaultMinTextSize = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
            DEFAULT_MIN_TEXT_SIZE, getResources().getDisplayMetrics());
    mMinTextSize = a.getDimensionPixelSize(R.styleable.CollapsingTitleLayout_minTextSize, defaultMinTextSize);

    a.recycle();

    mTextPaintBounds = new Rect();
    mDrawnTextBounds = new Rect();
    mToolbarContentBounds = new Rect();

    setWillNotDraw(false);
}

From source file:key.secretkey.MainActivity.java

public void onResume() {
    super.onResume();
    // do not attempt to checkLocalRepository() if no storage permission: immediate crash
    if (settings.getBoolean("git_external", false)) {
        if (ContextCompat.checkSelfPermission(activity,
                Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {

            if (ActivityCompat.shouldShowRequestPermissionRationale(activity,
                    Manifest.permission.READ_EXTERNAL_STORAGE)) {
                Snackbar snack = Snackbar.make(findViewById(R.id.main_layout),
                        "The store is on the sdcard but the app does not have permission to access it. Please give permission.",
                        Snackbar.LENGTH_INDEFINITE).setAction(R.string.dialog_ok, new View.OnClickListener() {
                            @Override
                            public void onClick(View view) {
                                ActivityCompat.requestPermissions(activity,
                                        new String[] { Manifest.permission.READ_EXTERNAL_STORAGE },
                                        REQUEST_EXTERNAL_STORAGE);
                            }/*from  w w w.  ja v a  2s. c o  m*/
                        });
                snack.show();
                View view = snack.getView();
                TextView tv = (TextView) view.findViewById(android.support.design.R.id.snackbar_text);
                tv.setTextColor(Color.WHITE);
                tv.setMaxLines(10);
            } else {
                // No explanation needed, we can request the permission.
                ActivityCompat.requestPermissions(activity,
                        new String[] { Manifest.permission.READ_EXTERNAL_STORAGE }, REQUEST_EXTERNAL_STORAGE);
            }
        } else {
            checkLocalRepository();
        }

    } else {
        checkLocalRepository();
    }
}

From source file:ayushi.view.fragment.ProductDetailsFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.frag_product_detail, container, false);

    mToolbar = (Toolbar) rootView.findViewById(R.id.htab_toolbar);
    if (mToolbar != null) {
        ((ECartHomeActivity) getActivity()).setSupportActionBar(mToolbar);
    }//from  w ww  . j a  v a  2s. c o  m

    if (mToolbar != null) {
        ((ECartHomeActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        mToolbar.setNavigationIcon(R.drawable.ic_drawer);

    }

    mToolbar.setTitleTextColor(Color.WHITE);

    mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            ((ECartHomeActivity) getActivity()).getmDrawerLayout().openDrawer(GravityCompat.START);
        }
    });

    ((ECartHomeActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    similarProductsPager = (ClickableViewPager) rootView.findViewById(R.id.similar_products_pager);

    topSellingPager = (ClickableViewPager) rootView.findViewById(R.id.top_selleing_pager);

    itemSellPrice = ((TextView) rootView.findViewById(R.id.category_discount));

    quanitity = ((TextView) rootView.findViewById(R.id.iteam_amount));

    itemName = ((TextView) rootView.findViewById(R.id.product_name));

    itemdescription = ((TextView) rootView.findViewById(R.id.product_description));

    itemImage = (ImageView) rootView.findViewById(R.id.product_image);

    fillProductData();

    rootView.findViewById(R.id.add_item).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            if (isFromCart) {

                //Update Quantity on shopping List
                GlobaDataHolder.getGlobaDataHolder().getShoppingList().get(productListNumber)
                        .setQuantity(String.valueOf(

                                Integer.valueOf(GlobaDataHolder.getGlobaDataHolder().getShoppingList()
                                        .get(productListNumber).getQuantity()) + 1));

                //Update Ui
                quanitity.setText(GlobaDataHolder.getGlobaDataHolder().getShoppingList().get(productListNumber)
                        .getQuantity());

                Utils.vibrate(getActivity());

                //Update checkout amount on screen
                ((ECartHomeActivity) getActivity()).updateCheckOutAmount(
                        BigDecimal.valueOf(Long.valueOf(GlobaDataHolder.getGlobaDataHolder().getShoppingList()
                                .get(productListNumber).getSellMRP())),
                        true);

            } else {

                // current object
                Product tempObj = GlobaDataHolder.getGlobaDataHolder().getProductMap().get(subcategoryKey)
                        .get(productListNumber);

                // if current object is lready in shopping list
                if (GlobaDataHolder.getGlobaDataHolder().getShoppingList().contains(tempObj)) {

                    // get position of current item in shopping list
                    int indexOfTempInShopingList = GlobaDataHolder.getGlobaDataHolder().getShoppingList()
                            .indexOf(tempObj);

                    // increase quantity of current item in shopping
                    // list
                    if (Integer.parseInt(tempObj.getQuantity()) == 0) {

                        ((ECartHomeActivity) getContext()).updateItemCount(true);

                    }

                    // update quanity in shopping list
                    GlobaDataHolder.getGlobaDataHolder().getShoppingList().get(indexOfTempInShopingList)
                            .setQuantity(String.valueOf(Integer.valueOf(tempObj.getQuantity()) + 1));

                    // update checkout amount
                    ((ECartHomeActivity) getContext())
                            .updateCheckOutAmount(
                                    BigDecimal.valueOf(
                                            Long.valueOf(GlobaDataHolder.getGlobaDataHolder().getProductMap()
                                                    .get(subcategoryKey).get(productListNumber).getSellMRP())),
                                    true);

                    // update current item quanitity
                    quanitity.setText(tempObj.getQuantity());

                } else {

                    ((ECartHomeActivity) getContext()).updateItemCount(true);

                    tempObj.setQuantity(String.valueOf(1));

                    quanitity.setText(tempObj.getQuantity());

                    GlobaDataHolder.getGlobaDataHolder().getShoppingList().add(tempObj);

                    ((ECartHomeActivity) getContext())
                            .updateCheckOutAmount(
                                    BigDecimal.valueOf(
                                            Long.valueOf(GlobaDataHolder.getGlobaDataHolder().getProductMap()
                                                    .get(subcategoryKey).get(productListNumber).getSellMRP())),
                                    true);

                }

                Utils.vibrate(getContext());

            }
        }

    });

    rootView.findViewById(R.id.remove_item).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            if (isFromCart)

            {

                if (Integer.valueOf(GlobaDataHolder.getGlobaDataHolder().getShoppingList()
                        .get(productListNumber).getQuantity()) > 2) {

                    GlobaDataHolder.getGlobaDataHolder().getShoppingList().get(productListNumber)
                            .setQuantity(String.valueOf(

                                    Integer.valueOf(GlobaDataHolder.getGlobaDataHolder().getShoppingList()
                                            .get(productListNumber).getQuantity()) - 1));

                    quanitity.setText(GlobaDataHolder.getGlobaDataHolder().getShoppingList()
                            .get(productListNumber).getQuantity());

                    ((ECartHomeActivity) getActivity()).updateCheckOutAmount(
                            BigDecimal.valueOf(Long.valueOf(GlobaDataHolder.getGlobaDataHolder()
                                    .getShoppingList().get(productListNumber).getSellMRP())),
                            false);

                    Utils.vibrate(getActivity());
                }

                else if (Integer.valueOf(GlobaDataHolder.getGlobaDataHolder().getShoppingList()
                        .get(productListNumber).getQuantity()) == 1) {
                    ((ECartHomeActivity) getActivity()).updateItemCount(false);

                    ((ECartHomeActivity) getActivity()).updateCheckOutAmount(
                            BigDecimal.valueOf(Long.valueOf(GlobaDataHolder.getGlobaDataHolder()
                                    .getShoppingList().get(productListNumber).getSellMRP())),
                            false);

                    GlobaDataHolder.getGlobaDataHolder().getShoppingList().remove(productListNumber);

                    if (Integer.valueOf(((ECartHomeActivity) getActivity()).getItemCount()) == 0) {

                        MyCartFragment.updateMyCartFragment(false);

                    }

                    Utils.vibrate(getActivity());

                }

            }

            else {

                Product tempObj = GlobaDataHolder.getGlobaDataHolder().getProductMap().get(subcategoryKey)
                        .get(productListNumber);

                if (GlobaDataHolder.getGlobaDataHolder().getShoppingList().contains(tempObj)) {

                    int indexOfTempInShopingList = GlobaDataHolder.getGlobaDataHolder().getShoppingList()
                            .indexOf(tempObj);

                    if (Integer.valueOf(tempObj.getQuantity()) != 0) {

                        GlobaDataHolder.getGlobaDataHolder().getShoppingList().get(indexOfTempInShopingList)
                                .setQuantity(String.valueOf(Integer.valueOf(tempObj.getQuantity()) - 1));

                        ((ECartHomeActivity) getContext()).updateCheckOutAmount(
                                BigDecimal.valueOf(
                                        Long.valueOf(GlobaDataHolder.getGlobaDataHolder().getProductMap()
                                                .get(subcategoryKey).get(productListNumber).getSellMRP())),
                                false);

                        quanitity.setText(GlobaDataHolder.getGlobaDataHolder().getShoppingList()
                                .get(indexOfTempInShopingList).getQuantity());

                        Utils.vibrate(getContext());

                        if (Integer.valueOf(GlobaDataHolder.getGlobaDataHolder().getShoppingList()
                                .get(indexOfTempInShopingList).getQuantity()) == 0) {

                            GlobaDataHolder.getGlobaDataHolder().getShoppingList()
                                    .remove(indexOfTempInShopingList);

                            ((ECartHomeActivity) getContext()).updateItemCount(false);

                        }

                    }

                } else {

                }

            }

        }

    });

    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) {

                if (isFromCart) {

                    Utils.switchContent(R.id.frag_container, Utils.SHOPPING_LIST_TAG,
                            ((ECartHomeActivity) (getActivity())), AnimationType.SLIDE_UP);
                } else {

                    Utils.switchContent(R.id.frag_container, Utils.PRODUCT_OVERVIEW_FRAGMENT_TAG,
                            ((ECartHomeActivity) (getActivity())), AnimationType.SLIDE_RIGHT);
                }

            }
            return true;
        }
    });

    if (isFromCart) {

        similarProductsPager.setVisibility(View.GONE);

        topSellingPager.setVisibility(View.GONE);

    } else {
        showRecomondation();
    }

    return rootView;
}

From source file:app.cloud9.com.cloud9.NoticeBoard.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.noticeboard);

    progressWithoutBg = (CircleProgressBar) findViewById(R.id.progressWithoutBg);
    progressWithoutBg.setColorSchemeResources(android.R.color.holo_red_light);

    client = new DefaultHttpClient();
    new Read(this).execute();

    Toolbar toolbar = (Toolbar) findViewById(R.id.c9_toolbar); //Appcompat support for a sexier action bar
    //        toolbar.setNavigationIcon(R.drawable.ic_drawer);
    toolbar.setTitleTextColor(Color.WHITE);
    toolbar.setTitle(R.string.noticeboard_title);
    setSupportActionBar(toolbar);//from w w  w.j  a v a2s.c  om
    toolbar.setTitle(R.string.noticeboard_title);
    //        toolbar.setNavigationIcon(R.drawable.ic_drawer);
    //
    //        mNavigationDrawerFragment = (NavigationDrawerFragment) getFragmentManager().findFragmentById(R.id.fragment_drawer);
    //        mNavigationDrawerFragment.setup(R.id.fragment_drawer, (DrawerLayout) findViewById(R.id.drawer), toolbar);

    emptyNotice = (RelativeLayout) findViewById(R.id.rl_empty_notice);
    //        loadingAnim = (ProgressBar) findViewById(R.id.loadingPanel);
    emptyNotice.setVisibility(View.GONE);

    initData();
    initRecyclerView();
    handleIntent(getIntent());

}

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

@SuppressLint("NewApi")
public void setBarColor(int color, boolean isWhiteText) {
    appBar.setBackgroundColor(ContextCompat.getColor(this, colorBarIds[color]));
    String title = taskId == null ? "New Task" : "Edit Task";
    toolbar.setTitleTextColor(isWhiteText ? Color.WHITE : Color.BLACK);
    toolbar.setTitle(title);/*w w w  .  ja  v a  2 s .  com*/
    final Drawable upArrow = ContextCompat.getDrawable(this, R.drawable.abc_ic_ab_back_material);
    upArrow.setColorFilter(isWhiteText ? Color.WHITE : Color.BLACK, PorterDuff.Mode.SRC_ATOP);
    getSupportActionBar().setHomeAsUpIndicator(upArrow);
    setStatusBarColor(color);

    if (menu != null) {
        for (int i = 0; i < menu.size(); i++) {
            Drawable drawable = menu.getItem(i).getIcon();
            if (drawable != null) {
                drawable.mutate();
                drawable.setColorFilter(isWhiteText ? Color.WHITE : Color.BLACK, PorterDuff.Mode.SRC_ATOP);
            }
        }
    }

}

From source file:com.android.deskclock.timer.TimerSetupView.java

@Override
protected void onFinishInflate() {
    super.onFinishInflate();

    final View v1 = findViewById(R.id.first);
    final View v2 = findViewById(R.id.second);
    final View v3 = findViewById(R.id.third);
    final View v4 = findViewById(R.id.fourth);

    mDivider = findViewById(R.id.divider);
    mDelete = (ImageButton) findViewById(R.id.delete);
    mDelete.setOnClickListener(this);
    mDelete.setOnLongClickListener(this);
    mEnteredTime = (TimerView) findViewById(R.id.timer_time_text);

    mNumbers[1] = (Button) v1.findViewById(R.id.key_left);
    mNumbers[2] = (Button) v1.findViewById(R.id.key_middle);
    mNumbers[3] = (Button) v1.findViewById(R.id.key_right);

    mNumbers[4] = (Button) v2.findViewById(R.id.key_left);
    mNumbers[5] = (Button) v2.findViewById(R.id.key_middle);
    mNumbers[6] = (Button) v2.findViewById(R.id.key_right);

    mNumbers[7] = (Button) v3.findViewById(R.id.key_left);
    mNumbers[8] = (Button) v3.findViewById(R.id.key_middle);
    mNumbers[9] = (Button) v3.findViewById(R.id.key_right);

    mNumbers[0] = (Button) v4.findViewById(R.id.key_middle);
    v4.findViewById(R.id.key_left).setVisibility(INVISIBLE);
    v4.findViewById(R.id.key_right).setVisibility(INVISIBLE);

    final UiDataModel uiDataModel = UiDataModel.getUiDataModel();
    for (int i = 0; i < mNumbers.length; i++) {
        mNumbers[i].setOnClickListener(this);
        mNumbers[i].setText(uiDataModel.getFormattedNumber(i, 1));
        mNumbers[i].setTextColor(Color.WHITE);
        mNumbers[i].setTag(R.id.numbers_key, i);
    }/*from www. j a v a2s.c om*/

    updateTime();
    updateDeleteButtonAndDivider();
}

From source file:com.figo.campaignhelper.GenerateActivity.java

Bitmap encodeAsBitmap(String contents) throws WriterException {
    String contentsToEncode = contents;
    if (contentsToEncode == null) {
        return null;
    }//from  w w w. j  ava 2 s  .c om
    Map<EncodeHintType, Object> hints = null;
    String encoding = guessAppropriateEncoding(contentsToEncode);
    if (encoding != null) {
        hints = new EnumMap<EncodeHintType, Object>(EncodeHintType.class);
        hints.put(EncodeHintType.CHARACTER_SET, encoding);
    }
    MultiFormatWriter writer = new MultiFormatWriter();

    WindowManager manager = (WindowManager) getSystemService(WINDOW_SERVICE);
    Display display = manager.getDefaultDisplay();
    int widthD = display.getWidth();
    int heightD = display.getHeight();
    int dimension = widthD < heightD ? widthD : heightD;
    dimension = dimension * 7 / 8;

    BitMatrix result = writer.encode(contentsToEncode, BarcodeFormat.QR_CODE, dimension, dimension, hints);
    int width = result.getWidth();
    int height = result.getHeight();
    int[] pixels = new int[width * height];
    for (int y = 0; y < height; y++) {
        int offset = y * width;
        for (int x = 0; x < width; x++) {
            pixels[offset + x] = result.get(x, y) ? Color.BLACK : Color.WHITE;
        }
    }

    Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
    bitmap.setPixels(pixels, 0, width, 0, 0, width, height);
    return bitmap;
}