List of usage examples for android.graphics Color GRAY
int GRAY
To view the source code for android.graphics Color GRAY.
Click Source Link
From source file:com.todotxt.todotxttouch.util.Util.java
public static void setGray(SpannableString ss, List<String> items) { String data = ss.toString();/*ww w. j a va 2 s .c o m*/ for (String item : items) { int i = data.indexOf("@" + item); if (i != -1) { ss.setSpan(new ForegroundColorSpan(Color.GRAY), i, i + 1 + item.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); } int j = data.indexOf("+" + item); if (j != -1) { ss.setSpan(new ForegroundColorSpan(Color.GRAY), j, j + 1 + item.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); } } }
From source file:com.money.manager.ex.adapter.AllDataAdapter.java
public int getBackgroundColorFromStatus(String status) { if (Constants.TRANSACTION_STATUS_RECONCILED.equalsIgnoreCase(status)) { return mContext.getResources().getColor(R.color.holo_green_dark); } else if (Constants.TRANSACTION_STATUS_VOID.equalsIgnoreCase(status)) { return mContext.getResources().getColor(R.color.holo_red_dark); } else if (Constants.TRANSACTION_STATUS_FOLLOWUP.equalsIgnoreCase(status)) { return mContext.getResources().getColor(R.color.holo_orange_dark); } else if (Constants.TRANSACTION_STATUS_DUPLICATE.equalsIgnoreCase(status)) { return mContext.getResources().getColor(R.color.holo_blue_dark); } else {// w w w . java 2s. c o m return Color.GRAY; } }
From source file:com.android.gallery3d.filtershow.FilterShowActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); boolean onlyUsePortrait = getResources().getBoolean(R.bool.only_use_portrait); if (onlyUsePortrait) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); }//from ww w. j a v a 2s . co m clearGalleryBitmapPool(); doBindService(); getWindow().setBackgroundDrawable(new ColorDrawable(Color.GRAY)); setContentView(R.layout.filtershow_splashscreen); }
From source file:org.uguess.android.sysinfo.ProcessManager.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { rootView = inflater.inflate(R.layout.proc_lst_view, container, false); ListView listView = (ListView) rootView.findViewById(android.R.id.list); registerForContextMenu(listView);// w w w .ja v a2s . com View listHeader = rootView.findViewById(R.id.list_head); listHeader.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { boolean showWarning = Util.getBooleanOption(getActivity(), PSTORE_PROCESSMANAGER, PREF_KEY_SHOW_KILL_WARN); if (showWarning) { OnClickListener listener = new OnClickListener() { public void onClick(DialogInterface dialog, int which) { endAllExcept(null); } }; new AlertDialog.Builder(getActivity()).setTitle(R.string.warning) .setMessage(R.string.end_all_prompt).setPositiveButton(android.R.string.ok, listener) .setNegativeButton(android.R.string.cancel, null).create().show(); } else { endAllExcept(null); } } }); ArrayAdapter<ProcessItem> adapter = new ArrayAdapter<ProcessItem>(getActivity(), R.layout.proc_item) { public android.view.View getView(int position, android.view.View convertView, android.view.ViewGroup parent) { Activity ctx = getActivity(); View view; TextView txt_name, txt_mem, txt_cpu; ImageView img_type; if (convertView == null) { view = ctx.getLayoutInflater().inflate(R.layout.proc_item, parent, false); } else { view = convertView; } if (position >= getCount()) { return view; } ProcessItem itm = getItem(position); img_type = (ImageView) view.findViewById(R.id.img_proc_icon); txt_name = (TextView) view.findViewById(R.id.txt_proc_name); txt_mem = (TextView) view.findViewById(R.id.txt_mem); txt_cpu = (TextView) view.findViewById(R.id.txt_cpu); boolean showMem = Util.getBooleanOption(ctx, PSTORE_PROCESSMANAGER, PREF_KEY_SHOW_MEM); boolean showCpu = Util.getBooleanOption(ctx, PSTORE_PROCESSMANAGER, PREF_KEY_SHOW_CPU); String lb = itm.label == null ? itm.procInfo.processName : itm.label; if (itm.sys) { lb += " *"; //$NON-NLS-1$ } else if (ignoreList.contains(itm.procInfo.processName)) { lb += " ~"; //$NON-NLS-1$ } txt_name.setText(lb); switch (itm.procInfo.importance) { case RunningAppProcessInfo.IMPORTANCE_FOREGROUND: txt_name.setTextColor(Color.CYAN); break; case RunningAppProcessInfo.IMPORTANCE_PERCEPTIBLE: case RunningAppProcessInfo.IMPORTANCE_VISIBLE: txt_name.setTextColor(Color.GREEN); break; case RunningAppProcessInfo.IMPORTANCE_SERVICE: txt_name.setTextColor(Color.GRAY); break; case RunningAppProcessInfo.IMPORTANCE_BACKGROUND: txt_name.setTextColor(Color.YELLOW); break; case RunningAppProcessInfo.IMPORTANCE_EMPTY: default: txt_name.setTextColor(Color.WHITE); break; } img_type.setImageDrawable(itm.icon); if (showMem) { txt_mem.setVisibility(View.VISIBLE); txt_mem.setText(itm.mem); } else { txt_mem.setVisibility(View.GONE); } if (showCpu) { txt_cpu.setVisibility(View.VISIBLE); long delta = itm.lastcputime == 0 ? 0 : (itm.cputime - itm.lastcputime); long cu = totalDelta == 0 ? 0 : (delta * 100 / totalDelta); if (cu < 0) { cu = 0; } if (cu > 100) { cu = 100; } txt_cpu.setText(String.valueOf(cu)); } else { txt_cpu.setVisibility(View.GONE); } return view; } }; setListAdapter(adapter); return rootView; }
From source file:in.sc9.discreteslider.DiscreteSlider.java
public DiscreteSlider(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); setFocusable(true);// w ww. jav a 2 s.co m setWillNotDraw(false); mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop(); float density = context.getResources().getDisplayMetrics().density; mTrackHeight = (int) (1 * density); mScrubberHeight = (int) (4 * density); int thumbSize = (int) (density * ThumbDrawable.DEFAULT_SIZE_DP); //Extra pixels for a touch area of 48dp int touchBounds = (int) (density * 32); mAddedTouchBounds = (touchBounds - thumbSize) / 2; TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.DiscreteSlider, defStyleAttr, R.style.Widget_DiscreteSeekBar); int max = 100; int min = 0; int value = 0; mMirrorForRtl = a.getBoolean(R.styleable.DiscreteSlider_dsb_mirrorForRtl, mMirrorForRtl); mAllowTrackClick = a.getBoolean(R.styleable.DiscreteSlider_dsb_allowTrackClickToDrag, mAllowTrackClick); mIndicatorPopupEnabled = a.getBoolean(R.styleable.DiscreteSlider_dsb_indicatorPopupEnabled, mIndicatorPopupEnabled); mIndicatorTextFromArray = a.getBoolean(R.styleable.DiscreteSlider_dsb_indicatorTextFromArray, mIndicatorTextFromArray); int indexMax = R.styleable.DiscreteSlider_dsb_max; int indexMin = R.styleable.DiscreteSlider_dsb_min; int indexValue = R.styleable.DiscreteSlider_dsb_value; final TypedValue out = new TypedValue(); //Not sure why, but we wanted to be able to use dimensions here... if (a.getValue(indexMax, out)) { if (out.type == TypedValue.TYPE_DIMENSION) { max = a.getDimensionPixelSize(indexMax, max); } else { max = a.getInteger(indexMax, max); } } if (a.getValue(indexMin, out)) { if (out.type == TypedValue.TYPE_DIMENSION) { min = a.getDimensionPixelSize(indexMin, min); } else { min = a.getInteger(indexMin, min); } } if (a.getValue(indexValue, out)) { if (out.type == TypedValue.TYPE_DIMENSION) { value = a.getDimensionPixelSize(indexValue, value); } else { value = a.getInteger(indexValue, value); } } mMin = min; mMax = Math.max(min + 1, max); mValue = Math.max(min, Math.min(max, value)); updateKeyboardRange(); mIndicatorFormatter = a.getString(R.styleable.DiscreteSlider_dsb_indicatorFormatter); mDiscretePointsEnabled = a.getBoolean(R.styleable.DiscreteSlider_dsb_discretePointsEnabled, false); mDiscretePointsShowAlways = a.getBoolean(R.styleable.DiscreteSlider_dsb_discretePointsShowAlways, false); ColorStateList trackColor = a.getColorStateList(R.styleable.DiscreteSlider_dsb_trackColor); ColorStateList progressColor = a.getColorStateList(R.styleable.DiscreteSlider_dsb_progressColor); ColorStateList rippleColor = a.getColorStateList(R.styleable.DiscreteSlider_dsb_rippleColor); int discretePointColor = a.getColor(R.styleable.DiscreteSlider_dsb_discretePointsColor, Color.RED); mtextColor = a.getColor(R.styleable.DiscreteSlider_dsb_textColor, Color.BLACK); mTextSize = a.getDimensionPixelSize(R.styleable.DiscreteSlider_dsb_TextSize, mTextSize); mTextPaddingTop = a.getDimensionPixelSize(R.styleable.DiscreteSlider_dsb_TextSize, mTextPaddingTop); textStyle = a.getInt(R.styleable.DiscreteSlider_dsb_TextStyle, textStyle); boolean editMode = isInEditMode(); if (editMode || rippleColor == null) { rippleColor = new ColorStateList(new int[][] { new int[] {} }, new int[] { Color.DKGRAY }); } if (editMode || trackColor == null) { trackColor = new ColorStateList(new int[][] { new int[] {} }, new int[] { Color.GRAY }); } if (editMode || progressColor == null) { progressColor = new ColorStateList(new int[][] { new int[] {} }, new int[] { DEFAULT_THUMB_COLOR }); } if (editMode) { discretePointColor = Color.RED; mtextColor = Color.BLACK; } mRipple = SeekBarCompat.getRipple(rippleColor); if (isLollipopOrGreater) { SeekBarCompat.setBackground(this, mRipple); } else { mRipple.setCallback(this); } TrackRectDrawable shapeDrawable = new TrackRectDrawable(trackColor); mTrack = shapeDrawable; mTrack.setCallback(this); shapeDrawable = new TrackRectDrawable(progressColor); mScrubber = shapeDrawable; mScrubber.setCallback(this); mThumb = new ThumbDrawable(progressColor, thumbSize); mThumb.setCallback(this); mThumb.setBounds(0, 0, mThumb.getIntrinsicWidth(), mThumb.getIntrinsicHeight()); textArray = new String[((mMax - mMin) + 1)]; int j = mMin; for (int i = 0; i < ((mMax - mMin) + 1); i++) { if (j <= mMax) { textArray[i] = j + ""; j++; } else break; } if (!editMode) { mIndicator = new PopupIndicator(context, attrs, defStyleAttr, convertValueToMessage(mMax)); mIndicator.setListener(mFloaterListener); } a.recycle(); setNumericTransformer(new DefaultNumericTransformer()); mDiscretePoints = new Paint(Paint.ANTI_ALIAS_FLAG); mDiscretePoints.setColor(discretePointColor); mDiscretePoints.setStyle(Paint.Style.FILL); mDiscretePointsTran = new Paint(Paint.ANTI_ALIAS_FLAG); mDiscretePointsTran.setColor(Color.TRANSPARENT); mDiscretePointsTran.setStyle(Paint.Style.FILL_AND_STROKE); position = new RectF(); }
From source file:com.money.manager.ex.fragment.HomeFragment.java
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor data) { MainActivity mainActivity = null;/* w w w . ja va 2 s. co m*/ if (getActivity() != null && getActivity() instanceof MainActivity) mainActivity = (MainActivity) getActivity(); switch (loader.getId()) { case ID_LOADER_USER_NAME: if (data != null && data.moveToFirst()) { while (data.isAfterLast() == false) { String infoValue = data.getString(data.getColumnIndex(infoTable.INFONAME)); // save into preferences username and basecurrency id if (Constants.INFOTABLE_USERNAME.equalsIgnoreCase(infoValue)) { application.setUserName(data.getString(data.getColumnIndex(infoTable.INFOVALUE))); } else if (Constants.INFOTABLE_BASECURRENCYID.equalsIgnoreCase(infoValue)) { //application.setBaseCurrencyId(data.getInt(data.getColumnIndex(infoTable.INFOVALUE))); } data.moveToNext(); } } // show username if (!TextUtils.isEmpty(application.getUserName())) ((SherlockFragmentActivity) getActivity()).getSupportActionBar() .setSubtitle(application.getUserName()); // set user name on drawer if (mainActivity != null) mainActivity.setDrawableUserName(application.getUserName()); break; case ID_LOADER_ACCOUNT_BILLS: double curTotal = 0, curReconciled = 0; AccountBillsAdapter adapter = null; linearHome.setVisibility(data != null && data.getCount() > 0 ? View.VISIBLE : View.GONE); linearWelcome.setVisibility(linearHome.getVisibility() == View.GONE ? View.VISIBLE : View.GONE); // cycle cursor if (data != null && data.moveToFirst()) { while (data.isAfterLast() == false) { curTotal += data.getDouble(data.getColumnIndex(QueryAccountBills.TOTALBASECONVRATE)); curReconciled += data.getDouble(data.getColumnIndex(QueryAccountBills.RECONCILEDBASECONVRATE)); data.moveToNext(); } // create adapter adapter = new AccountBillsAdapter(getActivity(), data); } // write accounts total txtTotalAccounts.setText(currencyUtils.getBaseCurrencyFormatted(curTotal)); // manage footer listview if (linearFooter == null) { linearFooter = (LinearLayout) getActivity().getLayoutInflater().inflate(R.layout.item_account_bills, null); // textview into layout txtFooterSummary = (TextView) linearFooter.findViewById(R.id.textVievItemAccountTotal); txtFooterSummaryReconciled = (TextView) linearFooter .findViewById(R.id.textVievItemAccountTotalReconciled); // set text TextView txtTextSummary = (TextView) linearFooter.findViewById(R.id.textVievItemAccountName); txtTextSummary.setText(R.string.summary); // invisibile image ImageView imgSummary = (ImageView) linearFooter.findViewById(R.id.imageViewAccountType); imgSummary.setVisibility(View.INVISIBLE); // set color textview txtTextSummary.setTextColor(Color.GRAY); txtFooterSummary.setTextColor(Color.GRAY); txtFooterSummaryReconciled.setTextColor(Color.GRAY); } // remove footer lstAccountBills.removeFooterView(linearFooter); // set text txtFooterSummary.setText(txtTotalAccounts.getText()); txtFooterSummaryReconciled.setText(currencyUtils.getBaseCurrencyFormatted(curReconciled)); // add footer lstAccountBills.addFooterView(linearFooter, null, false); // set adapter and shown lstAccountBills.setAdapter(adapter); setListViewAccountBillsVisible(true); // set total accounts in drawer if (mainActivity != null) { mainActivity.setDrawableTotalAccounts(txtTotalAccounts.getText().toString()); } break; case ID_LOADER_BILL_DEPOSITS: mainActivity.setDrawableRepeatingTransactions(data != null ? data.getCount() : 0); break; case ID_LOADER_INCOME_EXPENSES: double income = 0, expenses = 0; if (data != null && data.moveToFirst()) { while (!data.isAfterLast()) { expenses = data.getDouble(data.getColumnIndex(QueryReportIncomeVsExpenses.Expenses)); income = data.getDouble(data.getColumnIndex(QueryReportIncomeVsExpenses.Income)); //move to next record data.moveToNext(); } } TextView txtIncome = (TextView) getActivity().findViewById(R.id.textViewIncome); TextView txtExpenses = (TextView) getActivity().findViewById(R.id.textViewExpenses); TextView txtDifference = (TextView) getActivity().findViewById(R.id.textViewDifference); // set value if (txtIncome != null) txtIncome.setText(currencyUtils.getCurrencyFormatted(currencyUtils.getBaseCurrencyId(), income)); if (txtExpenses != null) txtExpenses.setText( currencyUtils.getCurrencyFormatted(currencyUtils.getBaseCurrencyId(), Math.abs(expenses))); if (txtDifference != null) txtDifference.setText(currencyUtils.getCurrencyFormatted(currencyUtils.getBaseCurrencyId(), income - Math.abs(expenses))); // manage progressbar final ProgressBar barIncome = (ProgressBar) getActivity().findViewById(R.id.progressBarIncome); final ProgressBar barExpenses = (ProgressBar) getActivity().findViewById(R.id.progressBarExpenses); if (barIncome != null && barExpenses != null) { barIncome.setMax((int) (Math.abs(income) + Math.abs(expenses))); barExpenses.setMax((int) (Math.abs(income) + Math.abs(expenses))); if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) { ObjectAnimator animationIncome = ObjectAnimator.ofInt(barIncome, "progress", (int) Math.abs(income)); animationIncome.setDuration(1000); // 0.5 second animationIncome.setInterpolator(new DecelerateInterpolator()); animationIncome.start(); ObjectAnimator animationExpenses = ObjectAnimator.ofInt(barExpenses, "progress", (int) Math.abs(expenses)); animationExpenses.setDuration(1000); // 0.5 second animationExpenses.setInterpolator(new DecelerateInterpolator()); animationExpenses.start(); } else { barIncome.setProgress((int) Math.abs(income)); barExpenses.setProgress((int) Math.abs(expenses)); } } } }
From source file:org.gnucash.android.ui.chart.PieChartActivity.java
/** * Sets the image button to the given state and grays-out the icon * * @param enabled the button's state/*from www . ja v a2 s. c o m*/ * @param button the button item to modify */ private void setImageButtonEnabled(ImageButton button, boolean enabled) { button.setEnabled(enabled); Drawable originalIcon = button.getDrawable(); if (enabled) { originalIcon.clearColorFilter(); } else { originalIcon.setColorFilter(Color.GRAY, PorterDuff.Mode.SRC_IN); } button.setImageDrawable(originalIcon); }
From source file:com.mk4droid.IMC_Activities.FActivity_TabHost.java
private LinearLayout make_Active_Tab(String text, Drawable dr) { LinearLayout ll = new LinearLayout(this); ll.setPadding(0, 0, 2, 1);/*from w w w. ja v a2 s . c om*/ ll.setBackgroundColor(Color.GRAY); ll.setTag("ll"); ll.setOrientation(LinearLayout.VERTICAL); ll.setLayoutParams( new LinearLayout.LayoutParams(0, android.widget.LinearLayout.LayoutParams.WRAP_CONTENT, 1)); //------ Text TextView tv = new TextView(this); tv.setBackgroundColor(Color.TRANSPARENT); tv.setTag("tv"); ll.addView(tv); // ------ hbar View hbar = new View(this); hbar.setTag("hbar"); hbar.setLayoutParams( new LinearLayout.LayoutParams(android.widget.LinearLayout.LayoutParams.FILL_PARENT, 10)); ll.addView(hbar); //////////////////////////////////////// return ActivateColorize(ll, text, dr); }
From source file:com.alimuzaffar.lib.pin.PinEntryEditText.java
private int getColorForState(int... states) { return mColorStates.getColorForState(states, Color.GRAY); }
From source file:org.sensapp.android.sensappdroid.activities.GraphDisplayerActivity.java
static public int getColorFromString(String color) { if (color.equals("Blue")) return Color.BLUE; if (color.equals("Cyan")) return Color.CYAN; if (color.equals("Dark gray")) return Color.DKGRAY; if (color.equals("Gray")) return Color.GRAY; if (color.equals("Green")) return Color.GREEN; if (color.equals("Light gray")) return Color.LTGRAY; if (color.equals("Magenta")) return Color.MAGENTA; if (color.equals("Red")) return Color.RED; if (color.equals("Yellow")) return Color.YELLOW; return -1;//from www. j a v a 2 s .c om }