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.bitdance.giveortake.ProfileFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setRetainInstance(true);/*from  w  ww  .ja  va2s . c  om*/

    ActiveUser activeUser = getActiveUser();
    if (activeUser == null) {
        return;
    }
    ArrayList<StaticListItem> items = new ArrayList<StaticListItem>();

    items.add(new HeaderStaticListItem(getString(R.string.account)));
    usernameItem = new LabelFieldStaticListItem();
    usernameItem.setLabel(getString(R.string.username));
    usernameItem.setField(activeUser.getUserName());
    Intent usernameIntent = new Intent(getActivity(), UpdateUsernameActivity.class);
    usernameItem.setIntentAndResult(usernameIntent, UPDATE_USERNAME_RESULT);
    items.add(usernameItem);

    emailItem = new LabelFieldStaticListItem();
    emailItem.setLabel(getString(R.string.email));
    emailItem.setField(activeUser.getEmail());
    Intent emailIntent = new Intent(getActivity(), UpdateEmailActivity.class);
    emailItem.setIntentAndResult(emailIntent, UPDATE_EMAIL_RESULT);
    items.add(emailItem);

    items.add(new HeaderStaticListItem(getString(R.string.location)));
    mapItem = new MapStaticListItem();
    Intent locationIntent = new Intent(getActivity(), UpdateLocationActivity.class);
    mapItem.setIntentAndResult(locationIntent, UPDATE_LOCATION_RESULT);
    items.add(mapItem);

    items.add(new HeaderStaticListItem(getString(R.string.karma)));
    items.add(new KarmaStaticListItem());

    items.add(new HeaderStaticListItem(getString(R.string.logout)));
    ButtonListItem logoutButtonListItem = new ButtonListItem();
    logoutButtonListItem.setText(getString(R.string.logout));
    logoutButtonListItem.setBackgroundColor(Color.RED);
    logoutButtonListItem.setTextColor(Color.WHITE);
    logoutButtonListItem.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            Intent logoutIntent = new Intent(getActivity(), LoginActivity.class);
            logoutIntent.putExtra(LoginFragment.EXTRA_LOGIN_ACTION, LoginFragment.LOGOUT);
            startActivity(logoutIntent);
            getActivity().finish();
        }
    });
    items.add(logoutButtonListItem);

    items.add(new HeaderStaticListItem(getString(R.string.more_information)));
    ButtonListItem aboutButtonListItem = new ButtonListItem();
    aboutButtonListItem.setText(getString(R.string.about));
    aboutButtonListItem.setTextColor(Color.BLUE);
    aboutButtonListItem.setBackgroundColor(Color.LTGRAY);
    aboutButtonListItem.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent openAboutPage = new Intent(Intent.ACTION_VIEW);
            openAboutPage.setData(Uri.parse(Constants.ABOUT_URL));
            startActivity(openAboutPage);
        }
    });
    items.add(aboutButtonListItem);

    ButtonListItem legalNoticesButtonListItem = new ButtonListItem();
    legalNoticesButtonListItem.setText(getString(R.string.legal_notices));
    legalNoticesButtonListItem.setTextColor(Color.BLUE);
    legalNoticesButtonListItem.setBackgroundColor(Color.LTGRAY);
    legalNoticesButtonListItem.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Log.d(TAG, "Showing legal notices");
            new AlertDialog.Builder(getActivity()).setTitle(getString(R.string.legal_notices))
                    .setMessage(GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(getActivity()))
                    .setPositiveButton(R.string.ok, null).show();
        }
    });
    items.add(legalNoticesButtonListItem);

    StaticListAdapter adapter = new StaticListAdapter(getActivity(), items);
    setListAdapter(adapter);
}

From source file:com.andremion.counterfab.CounterFab.java

public CounterFab(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    setUseCompatPadding(true);//w w  w  .j  a  v  a  2s .c o m

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

    mTextSize = TEXT_SIZE_DP * density;
    float textPadding = TEXT_PADDING_DP * density;

    mAnimationDuration = getResources().getInteger(android.R.integer.config_shortAnimTime);
    mAnimationFactor = 1;

    mTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mTextPaint.setStyle(Paint.Style.STROKE);
    mTextPaint.setColor(Color.WHITE);
    mTextPaint.setTextSize(mTextSize);
    mTextPaint.setTextAlign(Paint.Align.CENTER);
    mTextPaint.setTypeface(Typeface.SANS_SERIF);

    mCirclePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mCirclePaint.setStyle(Paint.Style.FILL);
    ColorStateList colorStateList = getBackgroundTintList();
    if (colorStateList != null) {
        mCirclePaint.setColor(colorStateList.getDefaultColor());
    } else {
        Drawable background = getBackground();
        if (background instanceof ColorDrawable) {
            ColorDrawable colorDrawable = (ColorDrawable) background;
            mCirclePaint.setColor(colorDrawable.getColor());
        }
    }

    mMaskPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mMaskPaint.setStyle(Paint.Style.FILL);
    mMaskPaint.setColor(MASK_COLOR);

    Rect textBounds = new Rect();
    mTextPaint.getTextBounds(MAX_COUNT_TEXT, 0, MAX_COUNT_TEXT.length(), textBounds);
    mTextHeight = textBounds.height();

    float textWidth = mTextPaint.measureText(MAX_COUNT_TEXT);
    float circleRadius = Math.max(textWidth, mTextHeight) / 2f + textPadding;
    mCircleBounds = new Rect(0, 0, (int) (circleRadius * 2), (int) (circleRadius * 2));
    mContentBounds = new Rect();

    onCountChanged();
}

From source file:com.bytestemplar.tonedef.international.ButtonsFragment.java

public void updateButtons(int position) {
    LinearLayout ll_btn_container = (LinearLayout) getView().findViewById(R.id.buttons_container);

    if (ll_btn_container != null) {

        _current_position = position;//  w  ww  .  j  a  va  2 s  . co m
        CountryTones current_tones = CountryTonesRepository.getInstance().getCountryAtPosition(position);

        ll_btn_container.removeAllViewsInLayout();

        // Update label
        TextView tv_name = (TextView) getView().findViewById(R.id.tv_countryname);
        tv_name.setText(current_tones.getName());
        tv_name.setTypeface(UICustom.getInstance().getTypeface());
        if (current_tones.getFlagDrawable() > 0) {
            tv_name.setCompoundDrawablesWithIntrinsicBounds(current_tones.getFlagDrawable(), 0, 0, 0);
        }

        // Generate buttons
        HashMap<String, ToneSequence> sequences = current_tones.getSequences();

        for (Object o : sequences.entrySet()) {
            Map.Entry pair = (Map.Entry) o;

            String sequence_name = (String) pair.getKey();
            final ToneSequence sequence = (ToneSequence) pair.getValue();

            Button btn = new Button(ll_btn_container.getContext());
            btn.setText(sequence_name);
            btn.setTypeface(UICustom.getInstance().getTypeface());
            btn.setBackgroundResource(R.drawable.touchpadbutton);
            btn.setTextColor(Color.WHITE);
            btn.setOnTouchListener(new View.OnTouchListener() {
                @Override
                public boolean onTouch(View v, MotionEvent event) {
                    switch (event.getAction()) {
                    case MotionEvent.ACTION_DOWN:
                        sequence.start();
                        v.setBackgroundResource(R.drawable.touchpadbutton_selected);
                        break;
                    case MotionEvent.ACTION_UP:
                    case MotionEvent.ACTION_CANCEL:
                        sequence.stop();
                        v.setBackgroundResource(R.drawable.touchpadbutton);
                        break;
                    }
                    return false;
                }
            });
            btn.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                    ViewGroup.LayoutParams.WRAP_CONTENT));
            ll_btn_container.addView(btn);
        }
    }
}

From source file:com.bookstore.qr_codescan.danmakuFlame.master.flame.danmaku.danmaku.parser.android.AcFunDanmakuParser.java

private Danmakus _parse(JSONObject jsonObject, Danmakus danmakus) {
    if (danmakus == null) {
        danmakus = new Danmakus();
    }// w w  w  . j a  v  a2s  .c  o  m
    if (jsonObject == null || jsonObject.length() == 0) {
        return danmakus;
    }
    for (int i = 0; i < jsonObject.length(); i++) {
        try {
            JSONObject obj = jsonObject;
            String c = obj.getString("c");
            String[] values = c.split(",");
            if (values.length > 0) {
                int type = Integer.parseInt(values[2]); // 
                if (type == 7)
                    // FIXME : hard code
                    // TODO : parse advance danmaku json
                    continue;
                long time = (long) (Float.parseFloat(values[0]) * 1000); // 
                int color = Integer.parseInt(values[1]) | 0xFF000000; // 
                float textSize = Float.parseFloat(values[3]); // ?
                BaseDanmaku item = mContext.mDanmakuFactory.createDanmaku(type, mContext);
                if (item != null) {
                    item.time = time;
                    item.textSize = textSize * (mDispDensity - 0.6f);
                    item.textColor = color;
                    item.textShadowColor = color <= Color.BLACK ? Color.WHITE : Color.BLACK;
                    DanmakuUtils.fillText(item, obj.optString("m", "...."));
                    item.index = i;
                    item.setTimer(mTimer);
                    danmakus.addItem(item);
                }
            }
        } catch (JSONException e) {
        } catch (NumberFormatException e) {
        }
    }
    return danmakus;
}

From source file:it.scoppelletti.mobilepower.preference.ColorPreference.java

/**
 * Restituisce il valore di default impostato via XML.
 * //from  w ww.  java  2  s. c  om
 * @param  attrs Attributi impostati.
 * @param  index Indice del valore di default.
 * @return       Valore di default.
 */
@Override
protected Object onGetDefaultValue(TypedArray attrs, int index) {
    return attrs.getInteger(index, Color.WHITE);
}

From source file:com.bangalore.barcamp.BCBUtils.java

public static void createActionBarOnActivity(final Activity activity, boolean isHome) {
    // ******** Start of Action Bar configuration
    ActionBar actionbar = (ActionBar) activity.findViewById(R.id.actionBar1);
    actionbar.setHomeLogo(R.drawable.home);
    actionbar.setHomeAction(new Action() {
        @Override//from ww w. jav  a2  s  .co  m
        public void performAction(View view) {
            ((SlidingMenuActivity) activity).toggle();
        }

        @Override
        public int getDrawable() {
            return R.drawable.home;
        }
    });

    actionbar.setTitle(R.string.app_title_text);
    TextView logo = (TextView) activity.findViewById(R.id.actionbar_title);
    Shader textShader = new LinearGradient(0, 0, 0, logo.getHeight(), new int[] { Color.WHITE, 0xff999999 },
            null, TileMode.CLAMP);
    logo.getPaint().setShader(textShader);
    actionbar.setOnTitleClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

        }
    });
    // ******** End of Action Bar configuration

}

From source file:cn.picksomething.slidingtabindicator.SlidingTabLayout.java

public SlidingTabLayout(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    TypedArray typedArray = getContext().obtainStyledAttributes(attrs, R.styleable.SlidingTabLayout);
    mTextFocusColor = typedArray.getColor(R.styleable.SlidingTabLayout_textSelectedColor, Color.WHITE);
    mTextDefaultColor = typedArray.getColor(R.styleable.SlidingTabLayout_textDefaultColor, Color.WHITE);
    typedArray.recycle();/* www .  j  a v  a 2 s  . c  o  m*/

    // Disable the Scroll Bar
    setHorizontalScrollBarEnabled(false);
    // Make sure that the Tab Strips fills this View
    setFillViewport(true);

    mTitleOffset = (int) (TITLE_OFFSET_DIPS * getResources().getDisplayMetrics().density);

    mTabStrip = new SlidingTabStrip(context);
    addView(mTabStrip, LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
}

From source file:com.pixellostudio.qqdroid.BaseQuote.java

/** Called when the activity is first created. */
@Override/*from  w ww  . j av a 2s .  c o  m*/
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setActionBarContentView(R.layout.show);

    getActionBar().setTitle(title);

    getActionBar().addItem(getActionBar().newActionBarItem(NormalActionBarItem.class)
            .setDrawable(R.drawable.seemore).setContentDescription("List"), R.id.actionbar_seemore);

    view = (ListView) findViewById(R.id.ListView);

    view.setOnCreateContextMenuListener(new OnCreateContextMenuListener() {
        public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
            menu.add(0, 1, 0, R.string.sharequote);
        }
    });

    adapter = new ArrayAdapter<String>(getBaseContext(), android.R.layout.simple_list_item_1);
    adapter2 = new ArrayAdapter<String>(getBaseContext(), android.R.layout.simple_list_item_1) {
        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(BaseQuote.this);

            TextView txt = new TextView(this.getContext());
            txt.setTextSize(Float.parseFloat(pref.getString("policesize", "20")));
            txt.setText(Html.fromHtml(this.getItem(position)));

            if (pref.getString("design", "blackonwhite").equals("blackonwhite")) {
                txt.setTextColor(Color.BLACK);
                txt.setBackgroundColor(Color.WHITE);
                txt.setBackgroundDrawable(
                        this.getContext().getResources().getDrawable(R.drawable.quote_gradient_white));
            } else if (pref.getString("design", "blackonwhite").equals("whiteonblack")) {
                txt.setTextColor(Color.WHITE);
                txt.setBackgroundColor(Color.BLACK);
                txt.setBackgroundDrawable(
                        this.getContext().getResources().getDrawable(R.drawable.quote_gradient_black));
            }

            return txt;
        }

    };

    String[] liste = (String[]) getLastNonConfigurationInstance();

    if (liste != null && liste.length != 0) {
        for (int i = 0; i < liste.length; i++) {
            adapter.add(liste[i]);
            adapter2.add(liste[i]);
        }

        this.setTitle(name);
    } else {
        new LoadQuotes().execute();
    }

    view.setAdapter(adapter2);
}

From source file:com.spoiledmilk.cykelsuperstier.break_rote.BreakRouteActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_break_route);
    textTitle = (TextView) findViewById(R.id.textTitle);
    textDistance = (TextView) findViewById(R.id.textDistance);
    textDistanceKm = (TextView) findViewById(R.id.textDistanceKm);
    btnBreak = (TexturedButton) findViewById(R.id.btnBreak);
    btnBreak.setBackgroundResource(R.drawable.btn_blue_selector);
    btnBreak.setTextureResource(R.drawable.btn_pattern_repeteable);
    btnBreak.setTextColor(Color.WHITE);
    btnBreak.setTextSize(getResources().getDimension(R.dimen.btn_break_text_size));
    textAAddress = (TextView) findViewById(R.id.textAAddress);
    textBAddress = (TextView) findViewById(R.id.textBAddress);
    btnRejseplanen = (Button) findViewById(R.id.btnRejseplanen);
    textARegion = (TextView) findViewById(R.id.textARegion);
    textBRegion = (TextView) findViewById(R.id.textBRegion);
    textDistance1 = (TextView) findViewById(R.id.textDistance1);
    textDistance2 = (TextView) findViewById(R.id.textDistance2);
    spinner1 = (Spinner) findViewById(R.id.spinner1);
    spinner2 = (Spinner) findViewById(R.id.spinner2);
    Bundle data = getIntent().getExtras();
    if (data != null) {
        source = data.getString("source");
        destination = data.getString("destination");
        distance = data.getInt("distance");
        startLoc = Util.locationFromCoordinates(data.getDouble("start_lat"), data.getDouble("start_lon"));
        endLoc = Util.locationFromCoordinates(data.getDouble("end_lat"), data.getDouble("end_lon"));
    }/*from www . j  a  v a 2s  .  c  om*/

    findViewById(R.id.progressBar).setVisibility(View.VISIBLE);
    parseStationsFromJson();
    ArrayList<String> stations = sortAndGetStationStrings();
    IssuesAdapter dataAdapter = new IssuesAdapter(this, stations, R.layout.list_row_stations,
            R.layout.spinner_layout);
    spinner1.setAdapter(dataAdapter);
    if (sortedStations.size() > 0) {
        selectedStationA = sortedStations.get(0);
    } else {
        showRouteNoBreakDialog();
    }

    spinner1.setOnItemSelectedListener(new OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
            aDistance = -1;
            findViewById(R.id.progressBar).setVisibility(View.VISIBLE);
            selectedStationA = sortedStations.get(position);
            if (metroStations.contains(selectedStationA)) {
                ((ImageView) findViewById(R.id.imgStation1)).setImageResource(R.drawable.metro_logo_pin);
                ((ImageView) findViewById(R.id.imgStation2)).setImageResource(R.drawable.metro_logo_pin);
                iconId = R.drawable.metro_logo_pin;
                setBikeDistance(selectedStationA, metroStations);
            } else if (localTrainStations.contains(selectedStationA)) {
                ((ImageView) findViewById(R.id.imgStation1)).setImageResource(R.drawable.local_train_icon_blue);
                ((ImageView) findViewById(R.id.imgStation2)).setImageResource(R.drawable.local_train_icon_blue);
                iconId = R.drawable.local_train_icon_blue;
                setBikeDistance(selectedStationA, localTrainStations);
            } else {
                ((ImageView) findViewById(R.id.imgStation1)).setImageResource(R.drawable.list_subway_icon);
                ((ImageView) findViewById(R.id.imgStation2)).setImageResource(R.drawable.list_subway_icon);
                iconId = R.drawable.list_subway_icon;
                setBikeDistance(selectedStationA, sTrainStations);
            }

            IssuesAdapter dataAdapterB = new IssuesAdapter(BreakRouteActivity.this,
                    selectedStationA.getBStationsString(), R.layout.list_row_stations, R.layout.spinner_layout);
            spinner2.setAdapter(dataAdapterB);

            if (selectedStationA.BStations == null || selectedStationA.BStations.size() == 0)
                showRouteNoBreakDialog();
            else {
                selectedStationB = selectedStationA.BStations.get(0);
                new SMHttpRequest().getRoute(selectedStationA.loc, startLoc, null, BreakRouteActivity.this);

            }

        }

        @Override
        public void onNothingSelected(AdapterView<?> parentView) {
            // your code here
        }
    });
    spinner2.setOnItemSelectedListener(new OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
            if (selectedStationA.BStations == null || selectedStationA.BStations.size() == 0)
                showRouteNoBreakDialog();
            else {
                selectedStationB = selectedStationA.BStations.get(position);
                // aDistance = -1;
                findViewById(R.id.progressBar).setVisibility(View.VISIBLE);
                new SMHttpRequest().getRoute(selectedStationB.loc, endLoc, null, BreakRouteActivity.this);
            }
        }

        @Override
        public void onNothingSelected(AdapterView<?> parentView) {
            // your code here
        }

    });
}

From source file:com.agenmate.lollipop.util.ViewUtils.java

public static RippleDrawable createRipple(@NonNull Palette palette,
        @FloatRange(from = 0f, to = 1f) float darkAlpha, @FloatRange(from = 0f, to = 1f) float lightAlpha,
        @ColorInt int fallbackColor, boolean bounded) {
    int rippleColor = fallbackColor;
    if (palette != null) {
        // try the named swatches in preference order
        if (palette.getVibrantSwatch() != null) {
            rippleColor = ColorUtils.modifyAlpha(palette.getVibrantSwatch().getRgb(), darkAlpha);

        } else if (palette.getLightVibrantSwatch() != null) {
            rippleColor = ColorUtils.modifyAlpha(palette.getLightVibrantSwatch().getRgb(), lightAlpha);
        } else if (palette.getDarkVibrantSwatch() != null) {
            rippleColor = ColorUtils.modifyAlpha(palette.getDarkVibrantSwatch().getRgb(), darkAlpha);
        } else if (palette.getMutedSwatch() != null) {
            rippleColor = ColorUtils.modifyAlpha(palette.getMutedSwatch().getRgb(), darkAlpha);
        } else if (palette.getLightMutedSwatch() != null) {
            rippleColor = ColorUtils.modifyAlpha(palette.getLightMutedSwatch().getRgb(), lightAlpha);
        } else if (palette.getDarkMutedSwatch() != null) {
            rippleColor = ColorUtils.modifyAlpha(palette.getDarkMutedSwatch().getRgb(), darkAlpha);
        }/*w  w  w  . j a  v a2 s. c om*/
    }
    return new RippleDrawable(ColorStateList.valueOf(rippleColor), null,
            bounded ? new ColorDrawable(Color.WHITE) : null);
}