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.example.h156252.connected_cars.CarGrid.java
/** Called when the activity is first created. */ @Override/*from ww w . j a v a 2 s . com*/ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.content_car_grid); try { Window window = getWindow(); // clear FLAG_TRANSLUCENT_STATUS flag: window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); // add FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS flag to the window window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); // finally change the color window.setStatusBarColor(Color.rgb(0, 0, 0)); android.support.v7.app.ActionBar actionBar = getSupportActionBar(); actionBar.setBackgroundDrawable(new ColorDrawable(Color.rgb(0, 0, 0))); } catch (Exception e) { // Toast.makeText(getApplicationContext(),"Exception in actionbar "+e.getLocalizedMessage(),Toast.LENGTH_SHORT).show(); } session = new SessionManagement(this); tts = new TextToSpeech(this, this); //Toast.makeText(getApplicationContext(),"Entering activity",Toast.LENGTH_SHORT).show(); Intent intent = getIntent(); String result = intent.getStringExtra(HomeScreen.EXTRA_MESSAGE); //Toast.makeText(getApplicationContext(),"obtaining result: " +result,Toast.LENGTH_SHORT).show(); ArrayList<String> listdata = new ArrayList<String>(); try { JSONArray jArray = new JSONArray(result); if (jArray != null) { for (int i = 0; i < jArray.length(); i++) { String jstr = jArray.get(i).toString(); JSONObject jObj = new JSONObject(jstr); String id = jObj.getString("id"); //String phone = jObj.getString("phone"); String brand = jObj.getString("text"); String text = jObj.getString("cartext"); String carno = jObj.getString("carnum"); String color = jObj.getString("color"); //String isDone = jObj.getString("isDone"); String result_combine = "CAR " + i + ":\nCar id : #" + id + "*\n" + "License No. : " + carno + "\n" + "Color : " + color + "\n" + "Brand : " + brand + "\n" + "Text behind car : " + text; String rr = "Success " + result_combine; //Toast.makeText(getApplicationContext(),rr,Toast.LENGTH_SHORT).show(); String own_id = session.getID(); if (!(id.equals(own_id))) listdata.add(result_combine); } } } catch (Exception e) { //Toast.makeText(getApplicationContext(),e.getLocalizedMessage(),Toast.LENGTH_SHORT).show(); } //Toast.makeText(getApplicationContext(),"out of json",Toast.LENGTH_SHORT).show(); final GridView gridview = (GridView) findViewById(R.id.gridview); // final String[] items = new String[] { "Item1", "Item2", "Item3","Item4", "Item5", "Item6", "Item7", "Item8" }; ArrayAdapter<String> ad = new ArrayAdapter<String>(getApplicationContext(), android.R.layout.simple_list_item_1, listdata); //Toast.makeText(getApplicationContext(),"setting array adapter",Toast.LENGTH_SHORT).show(); //gridview.setBackgroundColor(Color.GRAY); gridview.setNumColumns(2); gridview.setGravity(Gravity.CENTER); gridview.setAdapter(ad); gridview.setBackgroundColor(Color.GRAY); //Toast.makeText(getApplicationContext(),"setting grid view",Toast.LENGTH_SHORT).show(); gridview.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View v, int position, long arg3) { // TODO Auto-generated method stub // Toast.makeText(getApplicationContext(), "" + arg2,Toast.LENGTH_SHORT).show(); //Toast.makeText(getApplicationContext(),"Prompting speech",Toast.LENGTH_SHORT).show(); try { String s = ((TextView) v).getText().toString(); int start = 0; // '(' position in string int end = 0; // ')' position in string for (int i = 0; i < s.length(); i++) { if (s.charAt(i) == '#') // Looking for '(' position in string start = i; else if (s.charAt(i) == '*') // Looking for ')' position in string end = i; } receiver_id = s.substring(start + 1, end); //Toast.makeText(getApplicationContext(), "ID: " + receiver_id, Toast.LENGTH_SHORT).show(); //promptSpeechInput(); } catch (Exception e) { // Toast.makeText(getApplicationContext(), e.getLocalizedMessage(), Toast.LENGTH_SHORT).show(); } //receiver_id = grid_text.substring(grid_text.indexOf("#") + 1, grid_text.indexOf("#")); //Toast.makeText(getApplicationContext(),receiver_id,Toast.LENGTH_SHORT).show(); try { promptSpeechInput(); } catch (Exception e) { //Toast.makeText(getApplicationContext(), e.getLocalizedMessage(), Toast.LENGTH_SHORT).show(); } try { Intent intent_rate = new Intent(getApplicationContext(), RateDriving.class); intent_rate.putExtra(EXTRA_MESSAGE, receiver_id); startActivity(intent_rate); } catch (Exception e) { //Toast.makeText(getApplicationContext(), e.getLocalizedMessage(), Toast.LENGTH_SHORT).show(); } //new VoiceTask().execute("http://myfirst.au-syd.mybluemix.net/api/Items"); } }); }
From source file:edu.vuum.mocca.ui.tags.TagsViewFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.tags_view_fragment, container, false); container.setBackgroundColor(Color.GRAY); return view;/*from w ww . j av a2 s .c om*/ }
From source file:pl.wasat.smarthma.ui.frags.base.BaseCollectionDetailsFragment.java
@NonNull private AutoCompleteTextView buildAutoCompleteTextView(Parameter param) { String[] AUTO_PHRASES = new String[] { "[]", "[,]", "{}", "{,}", "1", "}", "]", "," }; AutoCompleteTextView autoTextView = new AutoCompleteTextView(getActivity()); TableLayout.LayoutParams layoutParams = new TableLayout.LayoutParams(TableLayout.LayoutParams.WRAP_CONTENT, TableLayout.LayoutParams.WRAP_CONTENT, 1f); layoutParams.setMargins(40, 10, 40, 10); autoTextView.setLayoutParams(layoutParams); autoTextView.setHint(String.format(getActivity().getString(R.string.set_), param.getName())); autoTextView.setHintTextColor(Color.GRAY); autoTextView.setBackgroundColor(Color.WHITE); autoTextView.setTextSize(14);/*w w w . ja v a2s .c o m*/ autoTextView = resolvePattern(autoTextView, param.getPattern()); autoTextView.addTextChangedListener(new EditTextViewInputWatcher(param)); autoTextView.setOnTouchListener(new EditTextViewInputWatcher(param)); autoTextView.setOnFocusChangeListener(new EditTextViewInputWatcher(param)); ArrayAdapter<String> adapter = new ArrayAdapter<>(getActivity(), android.R.layout.simple_dropdown_item_1line, AUTO_PHRASES); autoTextView.setAdapter(adapter); return autoTextView; }
From source file:com.dean.phonesafe.ui.SlideSwitch.java
@Override protected void onDraw(Canvas canvas) { if (shape == SHAPE_RECT) { paint.setColor(Color.GRAY); canvas.drawRect(backRect, paint); paint.setColor(color_theme);/* w w w. j a v a 2 s. c om*/ paint.setAlpha(alpha); canvas.drawRect(backRect, paint); frontRect.set(frontRect_left, RIM_SIZE, frontRect_left + getMeasuredWidth() / 2 - RIM_SIZE, getMeasuredHeight() - RIM_SIZE); paint.setColor(Color.WHITE); canvas.drawRect(frontRect, paint); } else { // draw circle int radius; radius = backRect.height() / 2 - RIM_SIZE; paint.setColor(Color.GRAY); backCircleRect.set(backRect); canvas.drawRoundRect(backCircleRect, radius, radius, paint); paint.setColor(color_theme); paint.setAlpha(alpha); canvas.drawRoundRect(backCircleRect, radius, radius, paint); frontRect.set(frontRect_left, RIM_SIZE, frontRect_left + backRect.height() - 2 * RIM_SIZE, backRect.height() - RIM_SIZE); frontCircleRect.set(frontRect); paint.setColor(Color.WHITE); canvas.drawRoundRect(frontCircleRect, radius, radius, paint); } //?? //? paint.setStrokeWidth(2); paint.setAlpha(alpha); paint.setStyle(Paint.Style.STROKE); float gap = backRect.width() - frontRect.width(); float left = frontRect.left - gap + frontRect.width() / 2; canvas.drawLine(left, backRect.height() / 4, left, backRect.height() / 4 * 3, paint); //?? paint.setAlpha(255 - alpha); left = frontRect.left + gap + frontRect.width() / 2; canvas.drawCircle(left, backRect.height() / 2, frontRect.width() / 5, paint); // paint.setStyle(Paint.Style.FILL); }
From source file:com.proper.warehousetools.replen.fragments.movelist.SlidingTabsColorsFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // BEGIN_INCLUDE (populate_tabs) /**/* w w w . j a va 2 s.c o m*/ * Populate our tab list with tabs. Each item contains a title, indicator color and divider * color, which are used by {@link com.proper.data.customcontrols.SlidingTabLayout}. */ mTabs.add(new SamplePagerItem("Move List", // Title Color.BLUE, // Indicator color Color.GRAY // Divider color )); mTabs.add(new SamplePagerItem("Move Line", // Title Color.RED, // Indicator color Color.GRAY // Divider color )); // mTabs.add(new SamplePagerItem( // "Update Line", // Title // Color.YELLOW, // Indicator color // Color.GRAY // Divider color // )); // // mTabs.add(new SamplePagerItem( // "Split Line", // Title // Color.GREEN, // Indicator color // Color.GRAY // Divider color // )); // END_INCLUDE (populate_tabs) }
From source file:org.ewicom.pps.unitinfo.TabAddressFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); unitDataSource = new UnitDataSource(getActivity()); unitDataSource.open();// w w w . ja v a 2 s . c o m unit = unitDataSource.getUnitById(unitID); helper = new Helper(); phonesGroup = (LinearLayout) getView().findViewById(R.id.group_phones); emailsGroup = (LinearLayout) getView().findViewById(R.id.group_emails); setUnitName(); setUnitParent(); setDescription(); setLocation(); new PreparePhoneButtons().execute(); new PrepareEmailButtons().execute(); if (unit.getSimg().isEmpty()) { showImage.setTextColor(Color.GRAY); showImage.setClickable(false); showImage.setEnabled(false); } }
From source file:org.openbitcoinwidget.WidgetProvider.java
private static void updateViews(RemoteViews views, TickerData prevData, TickerData newData, WidgetPreferences preferences) { String updated = "@ " + dateFormat.format(newData.getTimestamp()); String lastRounded = round(newData.getLast(), preferences); String lowRounded = round(newData.getLow(), preferences); String highRounded = round(newData.getHigh(), preferences); views.setTextViewText(R.id.appwidget_last, preferences.getCurrencyConversion().symbol + lastRounded); views.setTextColor(R.id.appwidget_updated, getColor(preferences.getColorMode(), WidgetColor.Normal)); if (newData.getTimestamp().before(getDateMinutesAgo(DATA_IS_CONSIDERED_OLD_AFTER_MINUTES))) { // Data is old, show it by "old" and "warning" colors views.setTextColor(R.id.appwidget_last, Color.GRAY); views.setTextColor(R.id.appwidget_updated, getColor(preferences.getColorMode(), WidgetColor.Warning)); } else if (prevData != null) { // We have previous data, compare to get the color views.setTextColor(R.id.appwidget_last, getColorFromValueChange(prevData.getLast(), newData.getLast(), preferences.getColorMode())); } else {//from w ww . j ava 2s . c om // No previous data, set standard color views.setTextColor(R.id.appwidget_last, getColor(preferences.getColorMode(), WidgetColor.StartValue)); } views.setTextViewText(R.id.appwidget_high, highRounded); views.setTextViewText(R.id.appwidget_low, lowRounded); views.setTextViewText(R.id.appwidget_updated, updated); // Set Litecoin logo if that is the chosen currency. switch (preferences.getCurrencyConversion().digitalCurrency) { case LITECOIN: views.setImageViewResource(R.id.appwidget_logo, R.drawable.logo); break; // The Bitcoin logo is default in the layout. } }
From source file:edu.mecc.race2ged.fragments.ClassViewPagerFragment.java
/** * {@inheritDoc}// w w w . java 2 s .com * <p> * Inflates and populates all of the counties fragments * </p> */ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_classes, container, false); //Set the pager with an adapter pager = (ViewPager) view.findViewById(R.id.pager); pager.setAdapter(classViewPagerAdapter); //Bind the title indicator to the adapter titleIndicator = (TitlePageIndicator) view.findViewById(R.id.titles); titleIndicator.setSelectedColor(Color.BLACK); titleIndicator.setFooterColor(getResources().getColor(R.color.content_color)); titleIndicator.setBackgroundColor(Color.WHITE); titleIndicator.setSelectedBold(true); titleIndicator.setTextColor(Color.GRAY); titleIndicator.setViewPager(pager); return view; }
From source file:com.money.manager.ex.adapter.AllDataAdapter.java
@SuppressWarnings({}) @Override//from ww w.j a va 2 s . c o m public void bindView(View view, Context context, Cursor cursor) { // take a pointer of object UI LinearLayout linDate = (LinearLayout) view.findViewById(R.id.linearLayoutDate); TextView txtDay = (TextView) view.findViewById(R.id.textViewDay); TextView txtMonth = (TextView) view.findViewById(R.id.textViewMonth); TextView txtYear = (TextView) view.findViewById(R.id.textViewYear); TextView txtStatus = (TextView) view.findViewById(R.id.textViewStatus); TextView txtAmount = (TextView) view.findViewById(R.id.textViewAmount); TextView txtPayee = (TextView) view.findViewById(R.id.textViewPayee); TextView txtAccountName = (TextView) view.findViewById(R.id.textViewAccountName); TextView txtCategorySub = (TextView) view.findViewById(R.id.textViewCategorySub); TextView txtNotes = (TextView) view.findViewById(R.id.textViewNotes); TextView txtBalance = (TextView) view.findViewById(R.id.textViewBalance); // header index if (!mHeadersAccountIndex.containsKey(cursor.getInt(cursor.getColumnIndex(ACCOUNTID)))) { mHeadersAccountIndex.put(cursor.getInt(cursor.getColumnIndex(ACCOUNTID)), cursor.getPosition()); } // write status txtStatus.setText(mApplication.getStatusAsString(cursor.getString(cursor.getColumnIndex(STATUS)))); // color status int colorBackground = getBackgroundColorFromStatus(cursor.getString(cursor.getColumnIndex(STATUS))); linDate.setBackgroundColor(colorBackground); txtStatus.setTextColor(Color.GRAY); // date group try { Date date = new SimpleDateFormat("yyyy-MM-dd").parse(cursor.getString(cursor.getColumnIndex(DATE))); txtMonth.setText(new SimpleDateFormat("MMM").format(date)); txtYear.setText(new SimpleDateFormat("yyyy").format(date)); txtDay.setText(new SimpleDateFormat("dd").format(date)); } catch (ParseException e) { Log.e(AllDataAdapter.class.getSimpleName(), e.getMessage()); } // take transaction amount double amount = cursor.getDouble(cursor.getColumnIndex(AMOUNT)); // set currency id setCurrencyId(cursor.getInt(cursor.getColumnIndex(CURRENCYID))); // manage transfer and change amount sign if ((cursor.getString(cursor.getColumnIndex(TRANSACTIONTYPE)) != null) && (Constants.TRANSACTION_TYPE_TRANSFER .equalsIgnoreCase(cursor.getString(cursor.getColumnIndex(TRANSACTIONTYPE))))) { if (getAccountId() != cursor.getInt(cursor.getColumnIndex(TOACCOUNTID))) { amount = -(amount); // -total } else if (getAccountId() == cursor.getInt(cursor.getColumnIndex(TOACCOUNTID))) { amount = cursor.getDouble(cursor.getColumnIndex(TOTRANSAMOUNT)); // to account = account setCurrencyId(cursor.getInt(cursor.getColumnIndex(TOCURRENCYID))); } } // check amount sign CurrencyUtils currencyUtils = new CurrencyUtils(mContext); txtAmount.setText(currencyUtils.getCurrencyFormatted(getCurrencyId(), amount)); // text color amount if (Constants.TRANSACTION_TYPE_TRANSFER .equalsIgnoreCase(cursor.getString(cursor.getColumnIndex(TRANSACTIONTYPE)))) { txtAmount.setTextColor(Color.GRAY); } else if (Constants.TRANSACTION_TYPE_DEPOSIT .equalsIgnoreCase(cursor.getString(cursor.getColumnIndex(TRANSACTIONTYPE)))) { txtAmount.setTextColor(mCore.resolveColorAttribute(R.attr.holo_green_color_theme)); } else { txtAmount.setTextColor(mCore.resolveColorAttribute(R.attr.holo_red_color_theme)); } // compose payee description txtPayee.setText(cursor.getString(cursor.getColumnIndex(PAYEE))); // compose account name if (isShowAccountName()) { if (mHeadersAccountIndex.containsValue(cursor.getPosition())) { txtAccountName.setText(cursor.getString(cursor.getColumnIndex(ACCOUNTNAME))); txtAccountName.setVisibility(View.VISIBLE); } else { txtAccountName.setVisibility(View.GONE); } } else { txtAccountName.setVisibility(View.GONE); } // write ToAccountName if ((!TextUtils.isEmpty(cursor.getString(cursor.getColumnIndex(TOACCOUNTNAME))))) { if (getAccountId() != cursor.getInt(cursor.getColumnIndex(TOACCOUNTID))) txtPayee.setText(cursor.getString(cursor.getColumnIndex(TOACCOUNTNAME))); else txtPayee.setText(cursor.getString(cursor.getColumnIndex(ACCOUNTNAME))); } // compose category description String categorySub = cursor.getString(cursor.getColumnIndex(CATEGORY)); // check sub category if (!(TextUtils.isEmpty(cursor.getString(cursor.getColumnIndex(SUBCATEGORY))))) { categorySub += " : <i>" + cursor.getString(cursor.getColumnIndex(SUBCATEGORY)) + "</i>"; } // write category/subcategory format html if (!TextUtils.isEmpty(categorySub)) { txtCategorySub.setText(Html.fromHtml(categorySub)); } else { txtCategorySub.setText(""); } // notes if (!TextUtils.isEmpty(cursor.getString(cursor.getColumnIndex(NOTES)))) { txtNotes.setText( Html.fromHtml("<small>" + cursor.getString(cursor.getColumnIndex(NOTES)) + "</small>")); txtNotes.setVisibility(View.VISIBLE); } else { txtNotes.setVisibility(View.GONE); } // check if item is checked if (mCheckedPosition.get(cursor.getPosition(), false)) { view.setBackgroundResource(R.color.holo_blue_light); } else { view.setBackgroundResource(android.R.color.transparent); } // balance account or days left if (mTypeCursor == TypeCursor.ALLDATA) { if (isShowBalanceAmount() && getDatabase() != null) { int transId = cursor.getInt(cursor.getColumnIndex(ID)); // create thread for calculate balance amount BalanceAmount balanceAmount = new BalanceAmount(); balanceAmount.setAccountId(getAccountId()); balanceAmount.setDate(cursor.getString(cursor.getColumnIndex(DATE))); balanceAmount.setTextView(txtBalance); balanceAmount.setContext(mContext); balanceAmount.setDatabase(getDatabase()); balanceAmount.setTransId(transId); // execute thread balanceAmount.execute(); } else { txtBalance.setVisibility(View.GONE); } } else { int daysLeft = cursor.getInt(cursor.getColumnIndex(QueryBillDeposits.DAYSLEFT)); if (daysLeft == 0) { txtBalance.setText(R.string.inactive); } else { txtBalance.setText(Integer.toString(Math.abs(daysLeft)) + " " + context.getString(daysLeft > 0 ? R.string.days_remaining : R.string.days_overdue)); } txtBalance.setVisibility(View.VISIBLE); } }
From source file:com.mehdi.graphview.custom.SimpleLineGraph.java
@Override public void onFinished(TickerList tickerList) { if (null == tickerList) { return;/*from w w w . ja va 2s . co m*/ } GraphView graphView = (GraphView) rootView.findViewById(R.id.graph); LineGraphSeries<DataPoint> series = new LineGraphSeries<>(); ArrayList<Tickers> tickers = tickerList.tickers; ArrayList<DataPoint> dataPointArrayList = new ArrayList<>(); for (int i = 0; i < tickers.get(0).historical.size(); i++) { dataPointArrayList.add(new DataPoint(i, //Double.parseDouble(String.valueOf(tickers.get(0).historical.get(i).get(0))), Double.parseDouble(String.valueOf(tickers.get(0).historical.get(i).get(1))))); } DataPoint[] dataPoints = dataPointArrayList.toArray(new DataPoint[dataPointArrayList.size()]); series.resetData(dataPoints); graphView.addSeries(series); // set manual X bounds graphView.getViewport().setXAxisBoundsManual(true); graphView.getViewport().setMinX(0); graphView.getViewport().setMaxX(series.getHighestValueX()); // set manual Y bounds graphView.getViewport().setYAxisBoundsManual(true); graphView.getViewport().setMinY(series.getLowestValueY()); graphView.getViewport().setMaxY(series.getHighestValueY()); graphView.getViewport().setScrollable(false); StaticLabelsFormatter staticLabelsFormatter = new StaticLabelsFormatter(graphView); // set xLabels values int middleIndex = tickers.get(0).historical.size() / 2; staticLabelsFormatter.setHorizontalLabels(new String[] { getHourMinute(String.valueOf(tickers.get(0).historical.get(0).get(0))), "", getHourMinute(String.valueOf(tickers.get(0).historical.get(middleIndex).get(0))), "", getHourMinute(String .valueOf(tickers.get(0).historical.get(tickers.get(0).historical.size() - 1).get(0))) }); staticLabelsFormatter.setVerticalLabels(new String[] { "", "", "" }); graphView.getGridLabelRenderer().setLabelFormatter(staticLabelsFormatter); // graphView.getGridLabelRenderer().setTextSize(35); // graphView.getGridLabelRenderer().setTextSize(25); float spToFloat = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 25, graphView.getContext().getResources().getDisplayMetrics()); graphView.getGridLabelRenderer().setTextSize(spToFloat); // setting label typeface if (null != getContext()) { Typeface plain = Typeface.createFromAsset(getContext().getAssets(), "SouthernAire_Personal_Use_Only.ttf"); Typeface typeface = Typeface.create(plain, Typeface.BOLD_ITALIC); graphView.getGridLabelRenderer().setLabelTypeface(typeface); } // set second scale. This one is used to show the vertical labels // on the right side as per UI Spec. graphView.getSecondScale().setMinY(getMinimumValue(tickers.get(0).historical)); graphView.getSecondScale().setMaxY(getMaximumValue(tickers.get(0).historical)); graphView.getGridLabelRenderer().setVerticalLabelsSecondScaleAlign(Paint.Align.CENTER); if (null != getContext()) { int colorStockLabelGray = Color.GRAY; graphView.getGridLabelRenderer().setVerticalLabelsSecondScaleColor(colorStockLabelGray); graphView.getGridLabelRenderer().setHorizontalLabelsColor(colorStockLabelGray); graphView.getGridLabelRenderer().setGridColor(colorStockLabelGray); } graphView.getGridLabelRenderer().setHighlightZeroLines(false); graphView.getGridLabelRenderer().setGridStyle(GridLabelRenderer.GridStyle.VERTICAL); graphView.getGridLabelRenderer().reloadStyles(); //series.setColor(Color.GREEN); series.setColor(Color.WHITE); }