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:net.micode.fileexplorer.ServerControlActivity.java
/** * This will be called by the static UiUpdater whenever the service has * changed state in a way that requires us to update our UI. We can't use * any myLog.l() calls in this function, because that will trigger an * endless loop of UI updates.//w ww . j av a2 s . com */ public void updateUi() { myLog.l(Log.DEBUG, "Updating UI", true); WifiManager wifiMgr = (WifiManager) mActivity.getSystemService(Context.WIFI_SERVICE); int wifiState = wifiMgr.getWifiState(); WifiInfo info = wifiMgr.getConnectionInfo(); String wifiId = info != null ? info.getSSID() : null; boolean isWifiReady = FTPServerService.isWifiEnabled(); setText(R.id.wifi_state, isWifiReady ? wifiId : getString(R.string.no_wifi_hint)); ImageView wifiImg = (ImageView) mRootView.findViewById(R.id.wifi_state_image); wifiImg.setImageResource(isWifiReady ? R.drawable.wifi_state4 : R.drawable.wifi_state0); boolean running = FTPServerService.isRunning(); if (running) { myLog.l(Log.DEBUG, "updateUi: server is running", true); // Put correct text in start/stop button // Fill in wifi status and address InetAddress address = FTPServerService.getWifiIp(); if (address != null) { String port = ":" + FTPServerService.getPort(); ipText.setText( "ftp://" + address.getHostAddress() + (FTPServerService.getPort() == 21 ? "" : port)); } else { // could not get IP address, stop the service Context context = mActivity.getApplicationContext(); Intent intent = new Intent(context, FTPServerService.class); context.stopService(intent); ipText.setText(""); } } startStopButton.setEnabled(isWifiReady); TextView startStopButtonText = (TextView) mRootView.findViewById(R.id.start_stop_button_text); if (isWifiReady) { startStopButtonText.setText(running ? R.string.stop_server : R.string.start_server); startStopButtonText.setCompoundDrawablesWithIntrinsicBounds( running ? R.drawable.disconnect : R.drawable.connect, 0, 0, 0); startStopButtonText.setTextColor(running ? getResources().getColor(R.color.remote_disconnect_text) : getResources().getColor(R.color.remote_connect_text)); } else { if (FTPServerService.isRunning()) { Context context = mActivity.getApplicationContext(); Intent intent = new Intent(context, FTPServerService.class); context.stopService(intent); } startStopButtonText.setText(R.string.no_wifi); startStopButtonText.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0); startStopButtonText.setTextColor(Color.GRAY); } ipText.setVisibility(running ? View.VISIBLE : View.INVISIBLE); instructionText.setVisibility(running ? View.VISIBLE : View.GONE); instructionTextPre.setVisibility(running ? View.GONE : View.VISIBLE); }
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); }//from ww w . j a v a 2 s .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:com.pixby.texo.EditTools.ColorTool.java
private void calcSampleColors(@ColorInt int color) { mSampleColors.clear();// w w w . ja v a 2 s.co 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)); } }
From source file:com.owncloud.android.utils.ThemeUtils.java
public static void tintCheckbox(AppCompatCheckBox checkBox, int color) { CompoundButtonCompat//www .j a va2 s .co m .setButtonTintList(checkBox, new ColorStateList( new int[][] { new int[] { -android.R.attr.state_checked }, new int[] { android.R.attr.state_checked }, }, new int[] { Color.GRAY, color })); }
From source file:com.iss.android.wearable.datalayer.MainActivity.java
private void showCurrentAppState() { if (SensorsDataService.itself == null) { return;//ww w . j a v a 2s . c o m } // get measured states HashMap<String, Boolean> recordedActivities = SensorsDataService.getRecordedActivities(); ImageButton morningHR = (ImageButton) findViewById(R.id.morningHR); ImageButton trainingHR = (ImageButton) findViewById(R.id.trainingHR); ImageButton startCooldown = (ImageButton) findViewById(R.id.startCooldown); ImageButton continueCooldown = (ImageButton) findViewById(R.id.continueCooldown); ImageButton eveningHR = (ImageButton) findViewById(R.id.eveningHR); morningHR.setBackgroundColor(recordedActivities.containsKey("MorningHR") ? Color.GREEN : Color.GRAY); trainingHR.setBackgroundColor(recordedActivities.containsKey("TrainingHR") ? Color.GREEN : Color.GRAY); startCooldown.setBackgroundColor(recordedActivities.containsKey("Cooldown") ? Color.GREEN : Color.GRAY); continueCooldown.setBackgroundColor(recordedActivities.containsKey("Recovery") ? Color.GREEN : Color.GRAY); eveningHR.setBackgroundColor(recordedActivities.containsKey("EveningHR") ? Color.GREEN : Color.GRAY); int inProgressColor = Color.argb(255, 255, 165, 0); if (SensorsDataService.itself.currentState.equals("Cooldown")) { startCooldown.setBackgroundColor(inProgressColor); } if (SensorsDataService.itself.currentState.equals("TrainingHR")) { trainingHR.setBackgroundColor(inProgressColor); } if (SensorsDataService.itself.currentState.equals("Recovery")) { continueCooldown.setBackgroundColor(inProgressColor); } if (SensorsDataService.itself.currentState.equals("MorningHR")) { morningHR.setBackgroundColor(inProgressColor); } if (SensorsDataService.itself.currentState.equals("EveningHR")) { eveningHR.setBackgroundColor(inProgressColor); } }
From source file:com.evilduck.piano.views.instrument.PianoView.java
@Override protected void onDraw(Canvas canvas) { if (isInEditMode()) { canvas.drawColor(Color.GRAY); return;// w w w . ja v a 2s.c om } if (measurementChanged) { measurementChanged = false; keyboard.initializeInstrument(getMeasuredHeight(), getContext()); float oldInstrumentWidth = instrumentWidth; instrumentWidth = keyboard.getWidth(); float ratio = (float) instrumentWidth / oldInstrumentWidth; xOffset = (int) (xOffset * ratio); } int localXOffset = getOffsetInsideOfBounds(); canvas.save(); canvas.scale(scaleX, 1.0f); canvas.translate(-localXOffset, 0); keyboard.updateBounds(localXOffset, canvasWidth + localXOffset); keyboard.draw(canvas); if (!notesToDraw.isEmpty()) { keyboard.drawOverlays(notesToDraw, canvas); } canvas.restore(); }
From source file:com.hezaijin.advance.widgets.view.progress.DiscreteSeekBar.java
public DiscreteSeekBar(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); setFocusable(true);//from ww w. ja va2 s. c o 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.DiscreteSeekBar, R.attr.discreteSeekBarStyle, defStyle); int max = 100; int min = 0; int value = 0; mMirrorForRtl = a.getBoolean(R.styleable.DiscreteSeekBar_dsb_mirrorForRtl, mMirrorForRtl); mAllowTrackClick = a.getBoolean(R.styleable.DiscreteSeekBar_dsb_allowTrackClickToDrag, mAllowTrackClick); int indexMax = R.styleable.DiscreteSeekBar_dsb_max; int indexMin = R.styleable.DiscreteSeekBar_dsb_min; int indexValue = R.styleable.DiscreteSeekBar_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.DiscreteSeekBar_dsb_indicatorFormatter); ColorStateList trackColor = a.getColorStateList(R.styleable.DiscreteSeekBar_dsb_trackColor); ColorStateList progressColor = a.getColorStateList(R.styleable.DiscreteSeekBar_dsb_progressColor); ColorStateList rippleColor = a.getColorStateList(R.styleable.DiscreteSeekBar_dsb_rippleColor); 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[] { 0xff009688 }); } 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); ThumbDrawable thumbDrawable = new ThumbDrawable(progressColor, thumbSize); mThumb = thumbDrawable; mThumb.setCallback(this); mThumb.setBounds(0, 0, mThumb.getIntrinsicWidth(), mThumb.getIntrinsicHeight()); if (!editMode) { mIndicator = new PopupIndicator(context, attrs, defStyle, convertValueToMessage(mMax)); mIndicator.setValue(convertValueToMessage(mValue)); mIndicator.setListener(mFloaterListener); } a.recycle(); setNumericTransformer(new DefaultNumericTransformer()); }
From source file:com.acious.android.paginationseekbar.PaginationSeekBar.java
public PaginationSeekBar(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); setFocusable(true);//w w w . j a v a 2 s. c om 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.PaginationSeekBar, R.attr.paginationSeekBarStyle, defStyle); int max = 100; int min = 0; int value = 1; mMirrorForRtl = a.getBoolean(R.styleable.PaginationSeekBar_psb_mirrorForRtl, mMirrorForRtl); mAllowTrackClick = a.getBoolean(R.styleable.PaginationSeekBar_psb_allowTrackClickToDrag, mAllowTrackClick); int indexMax = R.styleable.PaginationSeekBar_psb_max; int indexMin = R.styleable.PaginationSeekBar_psb_min; int indexValue = R.styleable.PaginationSeekBar_psb_value; pageCountPerOneBoard = R.styleable.PaginationSeekBar_psb_pageCountPerOneBoard; 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); } } if (a.getValue(pageCountPerOneBoard, out)) { pageCountPerOneBoard = a.getInteger(pageCountPerOneBoard, pageCountPerOneBoard); } mMin = min; mMax = Math.max(min + 1, max); mValue = Math.max(min, Math.min(max, value)); updateKeyboardRange(); mPrevPageText = a.getString(R.styleable.PaginationSeekBar_psb_indicatorPrevPageText); mNextPageText = a.getString(R.styleable.PaginationSeekBar_psb_indicatorNextPageText); mIndicatorFormatter = a.getString(R.styleable.PaginationSeekBar_psb_indicatorFormatter); ColorStateList trackColor = a.getColorStateList(R.styleable.PaginationSeekBar_psb_trackColor); ColorStateList progressColor = a.getColorStateList(R.styleable.PaginationSeekBar_psb_progressColor); ColorStateList rippleColor = a.getColorStateList(R.styleable.PaginationSeekBar_psb_rippleColor); int thumbTextColor = a.getColor(R.styleable.PaginationSeekBar_psb_thumbTextColor, Color.WHITE); 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[] { 0xff009688 }); } if (editMode && thumbTextColor == 0) { thumbTextColor = Color.WHITE; } 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); ThumbDrawable thumbDrawable = new ThumbDrawable(progressColor, thumbTextColor, thumbSize, mValue); mThumb = thumbDrawable; mThumb.setCallback(this); mThumb.setBounds(0, 0, mThumb.getIntrinsicWidth(), mThumb.getIntrinsicHeight()); if (!editMode) { mIndicator = new PopupIndicator(context, attrs, defStyle, convertValueToMessage(mMax), mPrevPageText, mNextPageText); mIndicator.setListener(mFloaterListener); } a.recycle(); setNumericTransformer(new DefaultNumericTransformer()); initPagecountPerOneboard(pageCountPerOneBoard); }
From source file:de.uni_weimar.mheinz.androidtouchscope.display.HandleView.java
@Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); if (mIsOn) {/*from w ww . j av a 2 s . co m*/ mShapeDrawable.getPaint().setStyle(Paint.Style.FILL_AND_STROKE); mShapeDrawable.getPaint().setColor(mColor); mShapeDrawable.getPaint().setShadowLayer(2, 2, 2, Color.GRAY); mShapeDrawable.draw(canvas); } else { /*mShapeDrawable.getPaint().setStyle(Paint.Style.FILL); mShapeDrawable.getPaint().setColor(Color.WHITE); mShapeDrawable.getPaint().setShadowLayer(2,2,2,Color.GRAY); mShapeDrawable.draw(canvas); mShapeDrawable.getPaint().setStyle(Paint.Style.STROKE); mShapeDrawable.getPaint().setColor(Color.BLACK); mShapeDrawable.draw(canvas);*/ mShapeDrawable.getPaint().setStyle(Paint.Style.FILL_AND_STROKE); mShapeDrawable.getPaint().setColor(Color.LTGRAY); mShapeDrawable.getPaint().setShadowLayer(2, 2, 2, Color.GRAY); mShapeDrawable.draw(canvas); } PointF center = getCircleCenter(); mMainTextPaint.getTextBounds(mMainText, 0, mMainText.length(), mTextBounds); if (mOrientation == HandleDirection.RIGHT) canvas.drawText(mMainText, center.x + 5, center.y + mTextBounds.height() / 2 - 1, mMainTextPaint); else if (mOrientation == HandleDirection.LEFT) canvas.drawText(mMainText, center.x - 5, center.y + mTextBounds.height() / 2 - 2, mMainTextPaint); else canvas.drawText(mMainText, center.x, center.y + mTextBounds.height() / 2, mMainTextPaint); if (mPressDrawable != null) { if (mOrientation == HandleDirection.RIGHT) { mPressDrawable.setBounds(2, (int) (center.y - HANDLE_BREADTH / 2), HANDLE_BREADTH - 3, (int) center.y + HANDLE_BREADTH / 2); mPressDrawable.draw(canvas); } else if (mOrientation == HandleDirection.LEFT) { canvas.save(); canvas.rotate(180, HANDLE_LENGTH / 2, mHandlePos); mPressDrawable.setBounds(1, (int) (center.y - HANDLE_BREADTH / 2), HANDLE_BREADTH - 5, (int) center.y + HANDLE_BREADTH / 2); mPressDrawable.draw(canvas); canvas.restore(); } } }
From source file:ca.etsmtl.applets.etsmobile.ProfileActivity.java
private void doLogin() { creds = new UserCredentials(PreferenceManager.getDefaultSharedPreferences(this)); CharSequence text = ""; boolean tag = false; int mColor = Color.RED; if (creds.isLoggedIn()) { text = getString(R.string.logout); tag = true;//from w w w . j ava 2 s. c om navBar.showLoading(); new ProfileTask(handler).execute(creds); } else { showDialog(SHOW_LOGIN, null); text = getString(R.string.login); tag = false; mColor = Color.GRAY; } btnLogin.setText(text); btnLogin.setTag(tag); btnLogin.setBackgroundColor(mColor); }