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:uk.org.crimetalk.fragments.ArticleContentFragment.java
@Override public void onLoadFinished(Loader<List<ArticleContentItem>> loader, List<ArticleContentItem> articleContentItemList) { // The Loader returned no results if (articleContentItemList.size() == 0) { // The device has Internet so something strange happened if (InternetUtils.hasInternet(getActivity())) { this.setEmptyText(getResources().getString(R.string.internet_error)); ((TextView) this.getListView().getEmptyView()).setTextColor(Color.GRAY); ((TextView) this.getListView().getEmptyView()).setTextSize(22); // The device has no Internet so remind the user } else {/*from ww w . j a v a 2 s . co m*/ this.setEmptyText(getResources().getString(R.string.internet_none)); ((TextView) this.getListView().getEmptyView()).setTextColor(Color.GRAY); ((TextView) this.getListView().getEmptyView()).setTextSize(22); } // The Loader returned results } else { /* There is a spacer being used to offset the Progressbar due to the Toolbar overlay, get rid of it now that we have content to show */ getActivity().findViewById(R.id.space).setVisibility(View.GONE); this.mArticleContentAdapter.setData(articleContentItemList); // There is no header on the ListView, set one to offset the Toolbar overlay if (getListView().getHeaderViewsCount() == 0) { @SuppressLint("InflateParams") final View dummyHeader = getActivity().getLayoutInflater().inflate(R.layout.dummy_header, null); getListView().addHeaderView(dummyHeader); } } this.setListAdapter(mArticleContentAdapter); }
From source file:edu.cmu.cylab.starslinger.view.IntroductionFragment.java
public void updateValues(Bundle extras) { // general state RecipientDbAdapter dbRecipient = RecipientDbAdapter.openInstance(getActivity()); DraftData d = DraftData.INSTANCE;/*ww w. j ava 2 s . c om*/ // make sure view is already inflated... if (mEditTextMessage1 == null) { return; } // recipient 1 mImageViewRecipPhoto1.setImageResource(0); RecipientRow r1 = d.getRecip1(); if (d.existsRecip1()) { drawUserData(R.string.label_SendTo, r1.getName(), r1.getPhoto(), mTextViewRecipName1, mTextViewRecipKey1, mImageViewRecipPhoto1, r1.getKeyid(), r1.getKeydate()); mTextViewRecipName1.setTextColor(Color.BLACK); } else { mTextViewRecipName1.setTextColor(Color.GRAY); mTextViewRecipName1.setText(R.string.label_SelectRecip); mTextViewRecipKey1.setText(""); mImageViewRecipPhoto1.setImageResource(R.drawable.ic_silhouette_select); } // recipient 2 mImageViewRecipPhoto2.setImageResource(0); RecipientRow r2 = d.getRecip2(); if (d.existsRecip2()) { drawUserData(R.string.label_SendTo, r2.getName(), r2.getPhoto(), mTextViewRecipName2, mTextViewRecipKey2, mImageViewRecipPhoto2, r2.getKeyid(), r2.getKeydate()); mTextViewRecipName2.setTextColor(Color.BLACK); } else { mTextViewRecipName2.setTextColor(Color.GRAY); mTextViewRecipName2.setText(R.string.label_SelectRecip); mTextViewRecipKey2.setText(""); mImageViewRecipPhoto2.setImageResource(R.drawable.ic_silhouette_select); } // message if (d.existsRecip1() && d.existsRecip2()) { // if recip1 and recip2 mEditTextMessage1.setVisibility(View.VISIBLE); mEditTextMessage2.setVisibility(View.VISIBLE); mEditTextMessage1 .setText(String.format(getString(R.string.label_messageIntroduceNameToYou), r2.getName())); mEditTextMessage2 .setText(String.format(getString(R.string.label_messageIntroduceNameToYou), r1.getName())); } else { // if empty.recip1, hide mEditTextMessage1.setVisibility(View.GONE); // if empty.recip2, hide mEditTextMessage2.setVisibility(View.GONE); } }
From source file:fr.kwiatkowski.apktrack.ui.AppViewHolder.java
private void _set_version(InstalledApp app, Context ctx) { if (app.is_last_ckeck_error()) { String text = app.get_version(); if (app.get_error_message() != null) { text += " (" + app.get_error_message() + ")"; } else if (text != null && app.get_latest_version() != null) { text += " (" + app.get_latest_version() + ")"; }//from w w w. j av a2 s .c o m _app_version.setText(text); _app_version.setTextColor(Color.GRAY); return; } if (app.get_latest_version() == null) { _app_version.setText(app.get_version()); _app_version.setTextColor(_default_color); return; } if (!app.is_update_available()) { // App is more recent than the latest version found if (app.get_version() != null && !app.get_version().equals(app.get_latest_version())) { _app_version.setText(String.format("%s (> %s)", app.get_version(), app.get_latest_version())); } else { _app_version.setText(app.get_version()); } _app_version.setTextColor(Color.GREEN); } else // App is outdated { _app_version.setText(String.format("%s (%s %s)", app.get_version(), ctx.getResources().getString(R.string.current), app.get_latest_version())); _app_version.setTextColor(Color.RED); } }
From source file:uk.org.crimetalk.fragments.SearchFragment.java
@Override public void onLoadFinished(Loader<List<ArticleListItem>> loader, List<ArticleListItem> data) { this.setListAdapter(mArticleListAdapter); // Sometimes this method is called before content view is created new Handler().postDelayed(new Runnable() { @Override/*from w w w.ja va 2 s .c om*/ public void run() { try { setListShown(true); } catch (IllegalStateException illegalStateException) { Log.e(TAG, illegalStateException.toString()); } } }, 1000); // The Loader returned no results if (data.size() == 0) { // The device has Internet so something strange happened if (InternetUtils.hasInternet(getActivity())) { this.setEmptyText(getResources().getString(R.string.search_error)); ((TextView) this.getListView().getEmptyView()).setTextColor(Color.GRAY); ((TextView) this.getListView().getEmptyView()).setTextSize(22); // The device has no Internet so remind the user } else { this.setEmptyText(getResources().getString(R.string.internet_none)); ((TextView) this.getListView().getEmptyView()).setTextColor(Color.GRAY); ((TextView) this.getListView().getEmptyView()).setTextSize(22); } // The Loader returned results } else { this.mArticleListAdapter.setData(data); } }
From source file:com.mci.firstidol.view.ActionSheet.java
@SuppressWarnings("deprecation") private View createView() { FrameLayout parent = new FrameLayout(getActivity()); parent.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT)); mBg = new View(getActivity()); mBg.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT)); mBg.setBackgroundColor(Color.argb(136, 0, 0, 0)); mBg.setId(ActionSheet.BG_VIEW_ID);/*from w w w. j a va 2 s. co m*/ mBg.setOnClickListener(this); mPanel = new LinearLayout(getActivity()); FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT); params.gravity = Gravity.BOTTOM; mPanel.setLayoutParams(params); mPanel.setOrientation(LinearLayout.VERTICAL); TextView titleView = new TextView(getActivity()); titleView.setText(TextUtils.isEmpty(getTitle()) ? "" : getTitle()); titleView.setGravity(Gravity.CENTER); titleView.setTextColor(Color.GRAY); titleView.setBackgroundDrawable(mAttrs.actionSheetTitleBackground); mPanel.addView(titleView); parent.addView(mBg); parent.addView(mPanel); return parent; }
From source file:wfa.com.tma.wfa.chips.ChipsView.java
private void initAttr(Context context, AttributeSet attrs) { TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.ChipsView, 0, 0); try {//from ww w . j a v a2 s . co m mMaxHeight = a.getDimensionPixelSize(R.styleable.ChipsView_cv_max_height, DEFAULT_MAX_HEIGHT); mVerticalSpacing = a.getDimensionPixelSize(R.styleable.ChipsView_cv_vertical_spacing, (int) (DEFAULT_VERTICAL_SPACING * mDensity)); mChipsBgColor = a.getColor(R.styleable.ChipsView_cv_bg_color, ContextCompat.getColor(context, R.color.chip_bg)); mChipsBgColorClicked = a.getColor(R.styleable.ChipsView_cv_bg_color_clicked, ContextCompat.getColor(context, R.color.blue)); mChipsBgColorIndelible = a.getColor(R.styleable.ChipsView_cv_bg_color_indelible, mChipsBgColor); mChipsTextColor = a.getColor(R.styleable.ChipsView_cv_text_color, Color.BLACK); mChipsTextColorClicked = a.getColor(R.styleable.ChipsView_cv_text_color_clicked, Color.WHITE); mChipsTextColorIndelible = a.getColor(R.styleable.ChipsView_cv_text_color_indelible, mChipsTextColor); mChipsPlaceholderTint = a.getColor(R.styleable.ChipsView_cv_icon_placeholder_tint, 0); mChipsDeleteBtnResId = a.getResourceId(R.styleable.ChipsView_cv_icon_delete, R.drawable.ic_chip_close_24dp); mChipsDeleteBtnResColor = a.getResourceId(R.styleable.ChipsView_cv_icon_delete_color, Color.WHITE); mChipsDeleteBtnBgColor = a.getResourceId(R.styleable.ChipsView_cv_icon_delete_bg_color, Color.GRAY); mChipsDeleteBtnBgColorClicked = a.getResourceId(R.styleable.ChipsView_cv_icon_delete_bg_clicked_color, ContextCompat.getColor(context, R.color.mediumBlue)); mChipsHintText = a.getString(R.styleable.ChipsView_cv_text_hint); mChipsMargin = a.getDimensionPixelSize(R.styleable.ChipsView_cv_chips_margin, 0); } finally { a.recycle(); } }
From source file:ca.liquidlabs.android.speedtestvisualizer.fragments.GraphViewMasterFragment.java
/** * {@inheritDoc} <br/>//from w w w. j a v a2s . c o m * * @see OnDataProcessorListener */ @Override public void onComplete(final GraphViewDataInterface[]... dataSets) { // Check after all processing done, if this fragment is still visible. if (this.isRemoving() || this.isDetached()) { Tracer.debug(LOG_TAG, "onComplete() >> Fragment is removing or already detached."); // do nothing, view is already gone. return; } // first - hide the progress indicator hideProgressIndicator(); Tracer.debug(LOG_TAG, "onComplete (multi): " + dataSets); Tracer.debug(LOG_TAG, "onComplete (multi) > data available? - " + dataSets.length); GraphViewDataInterface[][] availableDataSets = dataSets; /* * For single series graph, use BAR chart. Usually used for single * dimension graph. Eg. Download VS Date, Upload VS Date and so on. */ if (availableDataSets.length == 1) { addSingleSeriesGraph(availableDataSets[0]); return; } // graph with dynamically genereated horizontal and vertical labels LineGraphView graphView; graphView = new LineGraphView(getActivity().getApplicationContext(), mGraphType.getGraphTitle()); for (int index = 0; index < availableDataSets.length; index++) { /* * Since we have limited type of multi series data, hardcode the * type for now. FIXME: Fix this in next release and generalize the * return type after data is processed. */ if (index == 0) { // DONWLOAD data - FIXME: Hardcoded value - must be fixed!!!!!!! GraphViewSeries seriesData = new GraphViewSeries("Download", new GraphViewSeriesStyle(Color.rgb(200, 50, 00), 3), availableDataSets[index]); graphView.addSeries(seriesData); } else if (index == 1) { // UPLOAD data - FIXME: Hardcoded value - must be fixed!!!!!!! GraphViewSeries seriesData = new GraphViewSeries("Upload", new GraphViewSeriesStyle(Color.rgb(90, 250, 00), 3), availableDataSets[index]); graphView.addSeries(seriesData); } else { GraphViewSeries seriesData = new GraphViewSeries("Data: " + index, new GraphViewSeriesStyle(Color.rgb(200, 50, 00), 5), availableDataSets[index]); // add data graphView.addSeries(seriesData); } } // set legend graphView.setShowLegend(true); graphView.getGraphViewStyle().setHorizontalLabelsColor(Color.GRAY); graphView.getGraphViewStyle().setVerticalLabelsColor(Color.GRAY); graphView.setCustomLabelFormatter(mGraphDateLabelFormatter); // set view port, start=2, size=40 // graphView.setViewPort(2, 40); // graphView.setScrollable(true); // add graph to the view mGraphViewContainer.addView(graphView); }
From source file:com.alimuzaffar.lib.pin.PinEntryEditText.java
private void init(Context context, AttributeSet attrs) { float multi = context.getResources().getDisplayMetrics().density; mLineStroke = multi * mLineStroke;// ww w.ja va 2s . c om mLineStrokeSelected = multi * mLineStrokeSelected; mSpace = multi * mSpace; //convert to pixels for our density mTextBottomPadding = multi * mTextBottomPadding; //convert to pixels for our density TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.PinEntryEditText, 0, 0); try { TypedValue outValue = new TypedValue(); ta.getValue(R.styleable.PinEntryEditText_pinAnimationType, outValue); mAnimatedType = outValue.data; mMask = ta.getString(R.styleable.PinEntryEditText_pinCharacterMask); mSingleCharHint = ta.getString(R.styleable.PinEntryEditText_pinRepeatedHint); mLineStroke = ta.getDimension(R.styleable.PinEntryEditText_pinLineStroke, mLineStroke); mLineStrokeSelected = ta.getDimension(R.styleable.PinEntryEditText_pinLineStrokeSelected, mLineStrokeSelected); mSpace = ta.getDimension(R.styleable.PinEntryEditText_pinCharacterSpacing, mSpace); mTextBottomPadding = ta.getDimension(R.styleable.PinEntryEditText_pinTextBottomPadding, mTextBottomPadding); mIsDigitSquare = ta.getBoolean(R.styleable.PinEntryEditText_pinBackgroundIsSquare, mIsDigitSquare); mPinBackground = ta.getDrawable(R.styleable.PinEntryEditText_pinBackgroundDrawable); ColorStateList colors = ta.getColorStateList(R.styleable.PinEntryEditText_pinLineColors); if (colors != null) { mColorStates = colors; } } finally { ta.recycle(); } mCharPaint = new Paint(getPaint()); mLastCharPaint = new Paint(getPaint()); mSingleCharPaint = new Paint(getPaint()); mLinesPaint = new Paint(getPaint()); mLinesPaint.setStrokeWidth(mLineStroke); TypedValue outValue = new TypedValue(); context.getTheme().resolveAttribute(R.attr.colorControlActivated, outValue, true); int colorSelected = outValue.data; mColors[0] = colorSelected; int colorFocused = isInEditMode() ? Color.GRAY : ContextCompat.getColor(context, R.color.pin_normal); mColors[1] = colorFocused; int colorUnfocused = isInEditMode() ? Color.GRAY : ContextCompat.getColor(context, R.color.pin_normal); mColors[2] = colorUnfocused; setBackgroundResource(0); mMaxLength = attrs.getAttributeIntValue(XML_NAMESPACE_ANDROID, "maxLength", 4); mNumChars = mMaxLength; //Disable copy paste super.setCustomSelectionActionModeCallback(new ActionMode.Callback() { public boolean onPrepareActionMode(ActionMode mode, Menu menu) { return false; } public void onDestroyActionMode(ActionMode mode) { } public boolean onCreateActionMode(ActionMode mode, Menu menu) { return false; } public boolean onActionItemClicked(ActionMode mode, MenuItem item) { return false; } }); // When tapped, move cursor to end of text. super.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { setSelection(getText().length()); if (mClickListener != null) { mClickListener.onClick(v); } } }); super.setOnLongClickListener(new OnLongClickListener() { @Override public boolean onLongClick(View v) { setSelection(getText().length()); return true; } }); //If input type is password and no mask is set, use a default mask if ((getInputType() & InputType.TYPE_TEXT_VARIATION_PASSWORD) == InputType.TYPE_TEXT_VARIATION_PASSWORD && TextUtils.isEmpty(mMask)) { mMask = "\u25CF"; } else if ((getInputType() & InputType.TYPE_NUMBER_VARIATION_PASSWORD) == InputType.TYPE_NUMBER_VARIATION_PASSWORD && TextUtils.isEmpty(mMask)) { mMask = "\u25CF"; } if (!TextUtils.isEmpty(mMask)) { mMaskChars = getMaskChars(); } //Height of the characters, used if there is a background drawable getPaint().getTextBounds("|", 0, 1, mTextHeight); mAnimate = mAnimatedType > -1; }
From source file:com.markupartist.sthlmtraveling.PlaceSearchActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.place_search_layout); registerScreen("Place Search"); Bundle extras = getIntent().getExtras(); if (extras != null) { if (extras.containsKey(ARG_ONLY_STOPS)) { mSearchOnlyStops = extras.getBoolean(ARG_ONLY_STOPS); }//www .j a va 2 s . c om } initGoogleApiClient(false); createSearchHandler(); if (savedInstanceState != null) { if (savedInstanceState.containsKey(STATE_SEARCH_FILTER)) { mCurrentSearchFilterType = savedInstanceState.getInt(STATE_SEARCH_FILTER); } } mHistoryDbAdapter = new HistoryDbAdapter(this).open(); ImageButton backButton = (ImageButton) findViewById(R.id.search_back); ViewHelper.tint(backButton, ContextCompat.getColor(this, R.color.primary_dark)); ViewHelper.flipIfRtl(backButton); backButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onBackPressed(); } }); mSearchEdit = (EditText) findViewById(R.id.search_edit); mSearchEdit.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) || (actionId == EditorInfo.IME_ACTION_DONE)) { mSearchResultAdapter.getFilter().filter(mSearchEdit.getText()); } return false; } }); mSearchEdit.requestFocus(); mClearButton = (ImageButton) findViewById(R.id.search_clear); ViewHelper.tintIcon(mClearButton.getDrawable(), Color.GRAY); mClearButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mSearchEdit.setText(""); mSearchResultAdapter.clear(); } }); mSearchFailed = findViewById(R.id.search_result_error); mProgressBar = (ContentLoadingProgressBar) findViewById(R.id.search_progress_bar); setupHistoryViews(); if (!mSearchOnlyStops) { getSupportLoaderManager().initLoader(LOADER_HISTORY, null, this); } setupSearchResultViews(); if (!shouldSearchGooglePlaces()) { setSearchFilter(FILTER_TYPE_STHLM_TRAVELING); } mMyLocationManager = new LocationManager(this, getGoogleApiClient()); mMyLocationManager.setLocationListener(this); mMyLocationManager.setAccuracy(false); registerPlayService(mMyLocationManager); if (!mSearchOnlyStops) { verifyLocationPermission(); mMyLocationManager.requestLocation(); } }
From source file:com.github.andrewlord1990.snackbarbuildersample.SampleActivity.java
private void setupData() { samples = new LinkedHashMap<>(); samples.put(MESSAGE, new OnClickListener() { @Override//from www.j a v a 2 s .c o m public void onClick(View view) { new SnackbarBuilder(SampleActivity.this).message(MESSAGE).build().show(); } }); samples.put(ACTION, new OnClickListener() { @Override public void onClick(View view) { new SnackbarBuilder(SampleActivity.this).message(MESSAGE).actionText(ACTION) .actionClickListener(getActionClickListener()).build().show(); } }); samples.put("Custom Text Colours Using Resources", new OnClickListener() { @Override public void onClick(View view) { new SnackbarBuilder(SampleActivity.this).message("Message in different color").actionText(ACTION) .actionClickListener(getActionClickListener()).messageTextColorRes(R.color.red) .actionTextColorRes(R.color.green).build().show(); } }); samples.put("Custom Text Colours Using Colors", new OnClickListener() { @Override public void onClick(View view) { new SnackbarBuilder(SampleActivity.this).message("Message in different color").actionText(ACTION) .actionClickListener(getActionClickListener()).messageTextColor(green).actionTextColor(red) .build().show(); } }); samples.put("Standard callback", new OnClickListener() { @Override public void onClick(View view) { new SnackbarBuilder(SampleActivity.this).message(MESSAGE).actionText(ACTION) .callback(createCallback()).build().show(); } }); samples.put("SnackbarBuilder callback", new OnClickListener() { @Override public void onClick(View view) { new SnackbarBuilder(SampleActivity.this).message(MESSAGE).actionText(ACTION) .snackbarCallback(createSnackbarCallback()).build().show(); } }); samples.put("Timeout callback", new OnClickListener() { @Override public void onClick(View view) { new SnackbarBuilder(SampleActivity.this).message(MESSAGE).actionText(ACTION) .timeoutDismissCallback(new SnackbarTimeoutDismissCallback() { @Override public void onSnackbarTimedOut(Snackbar snackbar) { showToast("Timed out"); } }).build().show(); } }); samples.put("Lowercase action", new OnClickListener() { @Override public void onClick(View view) { new SnackbarBuilder(SampleActivity.this).message(MESSAGE).actionText(ACTION).lowercaseAction() .build().show(); } }); samples.put("Custom timeout", new OnClickListener() { @Override public void onClick(View view) { new SnackbarBuilder(SampleActivity.this).message("This has a custom timeout").duration(10000) .build().show(); } }); samples.put("Icon", new OnClickListener() { @Override public void onClick(View view) { new SnackbarBuilder(SampleActivity.this).icon(R.drawable.ic_android_24dp) .iconMarginStartRes(R.dimen.snackbar_icon_margin) .iconMarginEndRes(R.dimen.snackbar_icon_margin).message("This has an icon on it") .duration(Snackbar.LENGTH_LONG).build().show(); } }); samples.put("Multicolour", new OnClickListener() { @Override public void onClick(View view) { new SnackbarBuilder(SampleActivity.this).message("this").appendMessage(" message", Color.RED) .appendMessage(" has", Color.GREEN).appendMessage(" lots", Color.BLUE) .appendMessage(" of", Color.GRAY).appendMessage(" colors", Color.MAGENTA) .duration(Snackbar.LENGTH_LONG).build().show(); } }); samples.put("Using wrapper", new OnClickListener() { @Override public void onClick(View view) { SnackbarWrapper wrapper = new SnackbarBuilder(SampleActivity.this).message("Using wrapper") .duration(Snackbar.LENGTH_LONG).buildWrapper(); wrapper.appendMessage(" to add more text", Color.YELLOW).show(); } }); samples.put("Toast with red text", new OnClickListener() { @Override public void onClick(View view) { new ToastBuilder(SampleActivity.this).message("Custom toast").messageTextColor(Color.RED).build() .show(); } }); samples.put("Toast with custom position", new OnClickListener() { @Override public void onClick(View view) { new ToastBuilder(SampleActivity.this).message("Positioned toast").duration(Toast.LENGTH_LONG) .gravity(Gravity.TOP).gravityOffsetX(100).gravityOffsetY(300).build().show(); } }); }