List of usage examples for android.graphics Color BLACK
int BLACK
To view the source code for android.graphics Color BLACK.
Click Source Link
From source file:com.example.mapdemo.TopView.java
/** * This is where we can add markers or lines, add listeners or move the camera. In this case, * we//from w ww. j a v a 2 s. c o m */ @Override public void onMapReady(GoogleMap map) { // map.addMarker(new MarkerOptions().position(new LatLng(0, 0)).title("Marker")); // updateMyLocation(); gps = new GeolocationService(TopView.this); // check if GPS enabled if (gps.canGetLocation()) { double latitude = gps.getLatitude(); double longitude = gps.getLongitude(); final LatLng playerLocation = new LatLng(latitude, longitude); gpsLocation = new LatLng(latitude, longitude); Log.d("location", latitude + " "); mMap = map; updateMapType(); mMap.setOnMapLongClickListener(this); mFillColor = Color.RED; mStrokeColor = Color.BLACK; mWidth = 2; // PolygonOptions options = new PolygonOptions().addAll(createRectangle(playerLocation, 500, 8)); map.addPolygon( new PolygonOptions().addAll(createRectangle(new LatLng(latitude, longitude), .00025, .00025)) .strokeColor(Color.BLUE).strokeWidth(5)); DraggableCircle circle = new DraggableCircle(gpsLocation, DEFAULT_RADIUS); UpdateBubbles(latitude, longitude); mCircles.add(circle); mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(latitude, longitude), 19.5f)); // \n is for new line //Toast.makeText(getApplicationContext(), "Your Location is - \nLat: " + latitude + "\nLong: " + longitude, Toast.LENGTH_LONG).show(); } else { // can't get location // GPS or Network is not enabled // Ask user to enable GPS/network in settings gps.showSettingsAlert(); } }
From source file:net.mypapit.mobile.myrepeater.DisplayMap.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_display_map); overridePendingTransition(R.anim.activity_open_translate, R.anim.activity_close_scale); hashMap = new HashMap<Marker, MapInfoObject>(); if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) { getActionBar().setDisplayHomeAsUpEnabled(true); }// w w w. ja v a 2s . c om map = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap(); if (map == null) { // Log.e("Map NULL", "MAP NULL"); Toast.makeText(this, "Unable to display Map", Toast.LENGTH_SHORT).show(); } else { LatLng latlng = (LatLng) getIntent().getExtras().get("LatLong"); Repeater xlocation = new Repeater("", new Double[] { latlng.latitude, latlng.longitude }); rl = RepeaterListActivity.loadData(R.raw.repeaterdata5, this); xlocation.calcDistanceAll(rl); rl.sort(); map.setMyLocationEnabled(true); map.setOnInfoWindowClickListener(this); map.getUiSettings().setZoomControlsEnabled(true); AdView mAdView = (AdView) findViewById(R.id.adViewMap); mAdView.loadAd(new AdRequest.Builder().build()); // counter i, for mapping marker with integer int i = 0; for (Repeater repeater : rl) { MarkerOptions marking = new MarkerOptions(); marking.position(new LatLng(repeater.getLatitude(), repeater.getLongitude())); marking.title(repeater.getCallsign() + " - " + repeater.getDownlink() + "MHz (" + repeater.getClub() + ")"); marking.snippet("Tone: " + repeater.getTone() + " Shift: " + repeater.getShift()); RepeaterMapInfo rmi = new RepeaterMapInfo(repeater); rmi.setIndex(i); hashMap.put(map.addMarker(marking), rmi); i++; } // Marker RKG = map.addMarker(new MarkerOptions().position(new // LatLng(6.1,100.3)).title("9M4RKG")); map.moveCamera(CameraUpdateFactory.newLatLngZoom(latlng, 10)); map.animateCamera(CameraUpdateFactory.zoomTo(10), 2000, null); cache = this.getSharedPreferences(CACHE_PREFS, 0); Date cachedate = new Date(cache.getLong(CACHE_TIME, new Date(20000).getTime())); long secs = (new Date().getTime() - cachedate.getTime()) / 1000; long hours = secs / 3600L; secs = secs % 3600L; long mins = secs / 60L; if (mins < 5) { String jsoncache = cache.getString(CACHE_JSON, "none"); if (jsoncache.compareToIgnoreCase("none") == 0) { new GetUserInfo(latlng, this).execute(); } else { loadfromCache(jsoncache); // Toast.makeText(this, "Loaded from cache: " + mins + // " mins", Toast.LENGTH_SHORT).show(); } } else { new GetUserInfo(latlng, this).execute(); } map.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter() { @Override public View getInfoWindow(Marker marker) { // TODO Auto-generated method stub return null; } @Override public View getInfoContents(Marker marker) { Context context = getApplicationContext(); // or // getActivity(), // YourActivity.this, // etc. LinearLayout info = new LinearLayout(context); info.setOrientation(LinearLayout.VERTICAL); TextView title = new TextView(context); title.setTextColor(Color.BLACK); title.setGravity(Gravity.CENTER); title.setTypeface(null, Typeface.BOLD); title.setText(marker.getTitle()); TextView snippet = new TextView(context); snippet.setTextColor(Color.GRAY); snippet.setText(marker.getSnippet()); info.addView(title); info.addView(snippet); return info; } }); } }
From source file:arun.com.chromer.util.ColorUtil.java
/** * Returns white or black based on color luminance * * @param backgroundColor the color to get foreground for * @return White for darker colors and black for ligher colors *//*from w w w . jav a2s . co m*/ @ColorInt public static int getForegroundWhiteOrBlack(@ColorInt int backgroundColor) { if (shouldUseLightForegroundOnBackground(backgroundColor)) { return Color.WHITE; } else return Color.BLACK; }
From source file:com.webileapps.fragments.CordovaFragment.java
@SuppressWarnings({ "deprecation", "ResourceType" }) protected void createViews() { //Why are we setting a constant as the ID? This should be investigated appView.getView().setId(100);// www . j ava 2s.co m appView.getView().setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); setContentView(appView.getView()); if (preferences.contains("BackgroundColor")) { int backgroundColor = preferences.getInteger("BackgroundColor", Color.BLACK); // Background of activity: appView.getView().setBackgroundColor(backgroundColor); } appView.getView().requestFocusFromTouch(); }
From source file:au.com.wallaceit.reddinator.MainActivity.java
private void setThemeColors() { int themenum = Integer.parseInt(PreferenceManager.getDefaultSharedPreferences(context) .getString(context.getString(R.string.widget_theme_pref), "1")); switch (themenum) { case 1://from ww w. j av a 2s . c om actionBar.getCustomView().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#CEE3F8"))); appView.setBackgroundColor(Color.WHITE); configbutton.setBackgroundColor(Color.parseColor("#CEE3F8")); refreshbutton.setBackgroundColor(Color.parseColor("#CEE3F8")); errorIcon.setBackgroundColor(Color.parseColor("#CEE3F8")); srtext.setTextColor(Color.parseColor("#000000")); break; case 3: case 5: Drawable header = getResources().getDrawable(android.R.drawable.dark_header); actionBar.getCustomView().setBackgroundDrawable(header); appView.setBackgroundColor(Color.BLACK); configbutton.setBackgroundDrawable(null); refreshbutton.setBackgroundDrawable(null); errorIcon.setBackgroundDrawable(header); srtext.setTextColor(Color.parseColor("#FFFFFF")); break; case 4: case 2: actionBar.getCustomView().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#5F99CF"))); appView.setBackgroundColor(Color.BLACK); configbutton.setBackgroundColor(Color.parseColor("#5F99CF")); refreshbutton.setBackgroundColor(Color.parseColor("#5F99CF")); errorIcon.setBackgroundColor(Color.parseColor("#5F99CF")); srtext.setTextColor(Color.parseColor("#000000")); break; } }
From source file:com.mutech.synergy.widget.SlidingTabLayout.java
private void populateTabStrip() { final PagerAdapter adapter = mViewPager.getAdapter(); final View.OnClickListener tabClickListener = new TabClickListener(); for (int i = 0; i < adapter.getCount(); i++) { View tabView = null;/*from w w w. jav a2 s. c o m*/ TextView tabTitleView = null; if (mTabViewLayoutId != 0) { // If there is a custom tab view layout id set, try and inflate it tabView = LayoutInflater.from(getContext()).inflate(mTabViewLayoutId, mTabStrip, false); tabTitleView = (TextView) tabView.findViewById(mTabViewTextViewId); } if (tabView == null) { tabView = createDefaultTabView(getContext()); } if (tabTitleView == null && TextView.class.isInstance(tabView)) { tabTitleView = (TextView) tabView; } if (mDistributeEvenly) { LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) tabView.getLayoutParams(); lp.width = 0; lp.weight = 1; } tabTitleView.setText(adapter.getPageTitle(i)); tabTitleView.setTextColor(Color.BLACK); tabView.setOnClickListener(tabClickListener); String desc = mContentDescriptions.get(i, null); if (desc != null) { tabView.setContentDescription(desc); } mTabStrip.addView(tabView); if (i == mViewPager.getCurrentItem()) { tabView.setSelected(true); } } }
From source file:com.anyonavinfo.commonuserregister.MainActivity.java
/** * /*from www . j av a 2 s . com*/ * * @param view */ @OnClick(R.id.user_vehicleType) public void selectVehicleType(View view) { new AlertDialog.Builder(MainActivity.this).setTitle("") .setItems(CommonData.USERINFO_CARMODEL, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { edittext_userVehicleType.setText(CommonData.USERINFO_CARMODEL[which]); edittext_userVehicleType.setTextSize(20); edittext_userVehicleType.setTextColor(Color.BLACK); } }).show(); }
From source file:eu.trentorise.smartcampus.widget.shortcuts.StackWidgetService.java
@Override public RemoteViews getViewAt(int position) { // position will always range from 0 to getCount() - 1. // We construct a remote views item based on our widget item xml // file, and set the // text based on the position. RemoteViews rv = new RemoteViews(mContext.getPackageName(), R.layout.widget_item); ShapeDrawable sd1 = new ShapeDrawable(new RectShape()); sd1.getPaint().setColor(0xFFFFFFFF); sd1.getPaint().setStyle(Style.STROKE); sd1.getPaint().setStrokeWidth(1);//from w w w. java 2 s. co m Canvas c = new Canvas(); sd1.draw(c); Bitmap b = Bitmap.createBitmap(120, 120, Bitmap.Config.ARGB_8888); c.drawBitmap(b, 0, 0, sd1.getPaint()); // Next, we set a fill-intent which will be used to fill-in the // pending intent template // which is set on the collection view in StackWidgetProvider. if (ALLPREFERENCES != null && ALLPREFERENCES[position] != null) { //ALLPREFERENCES dimensionato come le preferenze selezionate BookmarkDescriptor myDescriptor = ALLPREFERENCES[position]; // set the widgetbutton if (WidgetHelper.PARAM_TYPE.equals(myDescriptor.params.get(0).name)) { //controllare con gli input da config activity? String type = myDescriptor.params.get(0).value; if (WidgetHelper.TYPE_DT.equals(type)) { // dt -> put icons and hide text rv.setViewVisibility(R.id.text_widget_item, View.GONE); rv.setImageViewResource(R.id.image_widget_item, Integer.parseInt(myDescriptor.params.get(2).value)); rv.setInt(R.id.image_widget_item, "setBackgroundResource", R.drawable.rounded_border_dt); } else if (WidgetHelper.TYPE_JP.equals(type)) { // jp -> put text and hide icon rv.setViewVisibility(R.id.image_widget_item, View.GONE); // rv.setImageViewBitmap(R.id.text_widget_item, // getBackground(Color.parseColor("#6EB046"))); if (!("0".equals(myDescriptor.params.get(2).value))) { //bus rv.setTextViewTextSize(R.id.text_widget_item, TypedValue.COMPLEX_UNIT_DIP, 80); rv.setTextViewText(R.id.text_widget_item, RoutesHelper.getShortNameByRouteIdAndAgencyID( myDescriptor.params.get(4).value, myDescriptor.params.get(3).value)); //4,3 rv.setTextColor(R.id.text_widget_item, Integer.parseInt(myDescriptor.params.get(2).value));//rv.setInt(R.id.text_widget_item, "setBackgroundColor", //Integer.parseInt(myDescriptor.params.get(2).value)); rv.setInt(R.id.text_widget_item, "setBackgroundResource", R.drawable.rounded_border_jp); } else { //train rv.setTextViewTextSize(R.id.text_widget_item, TypedValue.COMPLEX_UNIT_DIP, 12); //controllo contesto getRouteDescriptor i vari parametri rv.setTextViewText(R.id.text_widget_item, mContext.getString( RoutesHelper.getRouteDescriptorByRouteId(myDescriptor.params.get(3).value, myDescriptor.params.get(4).value).getNameResource())); rv.setTextColor(R.id.text_widget_item, Color.BLACK);//Int(R.id.text_widget_item, "setBackgroundColor",Color.BLACK); rv.setInt(R.id.text_widget_item, "setBackgroundResource", R.drawable.rounded_border_jp); } } else if (WidgetHelper.TYPE_JP_PARKINGS.equals(type)) { // jp parcheggio -> put text and hide icon rv.setViewVisibility(R.id.text_widget_item, View.GONE); rv.setImageViewResource(R.id.image_widget_item, Integer.parseInt(myDescriptor.params.get(2).value)); rv.setInt(R.id.image_widget_item, "setBackgroundResource", R.drawable.rounded_border_jp); } BookmarkDescriptor bookmark = myDescriptor; Bundle extras = new Bundle(); extras.putString(StackWidgetProvider.EXTRA_INTENT, bookmark.getIntent()); if (bookmark.getParams() != null) { for (Param param : bookmark.getParams()) { extras.putString(param.name, param.value); } } Intent fillInIntent = new Intent(bookmark.getIntent()); fillInIntent.putExtras(extras); rv.setOnClickFillInIntent(R.id.layout, fillInIntent); } } // Return the remote views object. // AppWidgetManager manager = AppWidgetManager.getInstance(mContext); // manager.updateAppWidget(thisWidget, rv); return rv; }
From source file:com.grottworkshop.gwsmaterialcalendarview.MaterialCalendarView.java
@SuppressWarnings("deprecation") public MaterialCalendarView(Context context, AttributeSet attrs) { super(context, attrs); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { //If we're on good Android versions, turn off clipping for cool effects setClipToPadding(false);// w ww . j a va2s .co m setClipChildren(false); } else { //Old Android does not like _not_ clipping view pagers, we need to clip setClipChildren(true); setClipToPadding(true); } buttonPast = new DirectionButton(getContext()); title = new TextView(getContext()); buttonFuture = new DirectionButton(getContext()); pager = new ViewPager(getContext()); setupChildren(); title.setOnClickListener(onClickListener); buttonPast.setOnClickListener(onClickListener); buttonFuture.setOnClickListener(onClickListener); titleChanger = new TitleChanger(title); titleChanger.setTitleFormatter(DEFAULT_TITLE_FORMATTER); adapter = new MonthPagerAdapter(); adapter.setTitleFormatter(DEFAULT_TITLE_FORMATTER); pager.setAdapter(adapter); pager.setOnPageChangeListener(pageChangeListener); pager.setPageTransformer(false, new ViewPager.PageTransformer() { @Override public void transformPage(View page, float position) { position = (float) Math.sqrt(1 - Math.abs(position)); page.setAlpha(position); } }); adapter.setCallbacks(monthViewCallbacks); TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.MaterialCalendarView, 0, 0); try { int tileSize = a.getDimensionPixelSize(R.styleable.MaterialCalendarView_mcv_tileSize, -1); if (tileSize > 0) { setTileSize(tileSize); } setArrowColor(a.getColor(R.styleable.MaterialCalendarView_mcv_arrowColor, Color.BLACK)); Drawable leftMask = a.getDrawable(R.styleable.MaterialCalendarView_mcv_leftArrowMask); if (leftMask == null) { //TODO: getDrawable depreciated leftMask = getResources().getDrawable(R.drawable.mcv_action_previous); } setLeftArrowMask(leftMask); Drawable rightMask = a.getDrawable(R.styleable.MaterialCalendarView_mcv_rightArrowMask); if (rightMask == null) { //TODO: getDrawable depreciated rightMask = getResources().getDrawable(R.drawable.mcv_action_next); } setRightArrowMask(rightMask); setSelectionColor( a.getColor(R.styleable.MaterialCalendarView_mcv_selectionColor, getThemeAccentColor(context))); CharSequence[] array = a.getTextArray(R.styleable.MaterialCalendarView_mcv_weekDayLabels); if (array != null) { setWeekDayFormatter(new ArrayWeekDayFormatter(array)); } array = a.getTextArray(R.styleable.MaterialCalendarView_mcv_monthLabels); if (array != null) { setTitleFormatter(new MonthArrayTitleFormatter(array)); } setHeaderTextAppearance(a.getResourceId(R.styleable.MaterialCalendarView_mcv_headerTextAppearance, R.style.TextAppearance_MaterialCalendarWidget_Header)); setWeekDayTextAppearance(a.getResourceId(R.styleable.MaterialCalendarView_mcv_weekDayTextAppearance, R.style.TextAppearance_MaterialCalendarWidget_WeekDay)); setDateTextAppearance(a.getResourceId(R.styleable.MaterialCalendarView_mcv_dateTextAppearance, R.style.TextAppearance_MaterialCalendarWidget_Date)); setShowOtherDates(a.getBoolean(R.styleable.MaterialCalendarView_mcv_showOtherDates, false)); int firstDayOfWeek = a.getInt(R.styleable.MaterialCalendarView_mcv_firstDayOfWeek, -1); if (firstDayOfWeek < 0) { firstDayOfWeek = CalendarUtils.getInstance().getFirstDayOfWeek(); } setFirstDayOfWeek(firstDayOfWeek); } catch (Exception e) { e.printStackTrace(); } finally { a.recycle(); } currentMonth = CalendarDay.today(); setCurrentDate(currentMonth); if (isInEditMode()) { removeView(pager); MonthView monthView = new MonthView(context, currentMonth, getFirstDayOfWeek()); monthView.setSelectionColor(getSelectionColor()); monthView.setDateTextAppearance(adapter.getDateTextAppearance()); monthView.setWeekDayTextAppearance(adapter.getWeekDayTextAppearance()); monthView.setShowOtherDates(getShowOtherDates()); addView(monthView, new LayoutParams(MonthView.DEFAULT_MONTH_TILE_HEIGHT)); } }
From source file:com.pixby.texo.EditTools.ColorTool.java
private void calcSampleColors(@ColorInt int color) { mSampleColors.clear();/*w w w.java 2s . c o m*/ mSampleColors.put(R.id.swatch_white, Color.WHITE); mSampleColors.put(R.id.swatch_grey, Color.GRAY); mSampleColors.put(R.id.swatch_black, Color.BLACK); // if color is black create lighter greys if (color == Color.BLACK) { mSampleColors.put(R.id.swatch_shade1, getColorFromResource(R.color.shade_grey1)); mSampleColors.put(R.id.swatch_shade2, getColorFromResource(R.color.shade_grey2)); mSampleColors.put(R.id.swatch_tint1, getColorFromResource(R.color.tint_grey1)); mSampleColors.put(R.id.swatch_tint2, getColorFromResource(R.color.tint_grey2)); } else { mSampleColors.put(R.id.swatch_shade1, createTintOrShade(color, 0.25f)); mSampleColors.put(R.id.swatch_shade2, createTintOrShade(color, 0.33f)); mSampleColors.put(R.id.swatch_tint1, createTintOrShade(color, 0.66f)); mSampleColors.put(R.id.swatch_tint2, createTintOrShade(color, 0.75f)); } }