Java Code Examples for android.graphics.Color.BLACK

The following are Jave code examples for showing how to use BLACK of the android.graphics.Color class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: BubbleView   File: BubbleLayout.java   Source Code and License Vote up 6 votes
private void initAttrs(Context context, AttributeSet attrs) {
    borderColor = Color.BLACK;
    backgroundColor = Color.WHITE;
    orientation = LEFT;
    borderWidth = DensityUtils.dip2px(context, 2);
    radius = DensityUtils.dip2px(context, 5);
    triangleWidth = DensityUtils.dip2px(context, 12);
    triangleHeight = DensityUtils.dip2px(context, 8);
    offset = DensityUtils.dip2px(context, 8);

    if (attrs == null) return;
    TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.bubbleView);
    backgroundColor = typedArray.getColor(R.styleable.bubbleView_bgColor, backgroundColor);
    borderColor = typedArray.getColor(R.styleable.bubbleView_borderColor, borderColor);
    offset = (int) typedArray.getDimension(R.styleable.bubbleView_offset, offset);
    borderWidth = (int) typedArray.getDimension(R.styleable.bubbleView_borderWidth, borderWidth);
    radius = (int) typedArray.getDimension(R.styleable.bubbleView_radius, radius);
    orientation = typedArray.getInt(R.styleable.bubbleView_orientation, orientation);
    triangleWidth = (int) typedArray.getDimension(R.styleable.bubbleView_triangleWidth, triangleWidth);
    triangleHeight = (int) typedArray.getDimension(R.styleable.bubbleView_triangleHeight, triangleHeight);
    shadowRadius = (int) typedArray.getDimension(R.styleable.bubbleView_shadowRadius, 0);
    shadowColor = typedArray.getColor(R.styleable.bubbleView_shadowColor, 0xff8D8D8D);
    clipToRadius = typedArray.getBoolean(R.styleable.bubbleView_clipToRadius, clipToRadius);
    centerArrow = typedArray.getBoolean(R.styleable.bubbleView_centerArrow, centerArrow);
    typedArray.recycle();
}
 
Example 2
Project: pm-home-station   File: ChartFragment.java   Source Code and License Vote up 6 votes
private LineDataSet createSet(String label) {
    LineDataSet set = new LineDataSet(null, label);
    set.setAxisDependency(YAxis.AxisDependency.LEFT);
    int color;
    if (label.equals(pm1Label)) {
        color = Color.BLUE;
    } else if (label.equals(pm25Label)) {
        color = Color.RED;
    } else {
        color = Color.BLACK;
    }
    set.setColor(color);
    set.setLineWidth(2f);
    set.setDrawValues(false);
    set.setDrawCircles(false);
    set.setMode(LineDataSet.Mode.LINEAR);
    return set;
}
 
Example 3
Project: microMathematics   File: ValueBar.java   Source Code and License Vote up 6 votes
/**
 * Set the bar color. <br>
 * <br>
 * Its discouraged to use this method.
 * 
 * @param color
 */
public void setColor(int color) {
	int x1, y1;
	if (mOrientation == ORIENTATION_HORIZONTAL) {
		x1 = (mBarLength + mBarPointerHaloRadius);
		y1 = mBarThickness;
	} else {
		x1 = mBarThickness;
		y1 = (mBarLength + mBarPointerHaloRadius);
	}

	Color.colorToHSV(color, mHSVColor);
	shader = new LinearGradient(mBarPointerHaloRadius, 0, x1, y1,
			new int[] { color, Color.BLACK }, null, Shader.TileMode.CLAMP);
	mBarPaint.setShader(shader);
	calculateColor(mBarPointerPosition);
	mBarPointerPaint.setColor(mColor);
	if (mPicker != null) {
		mPicker.setNewCenterColor(mColor);
		if (mPicker.hasOpacityBar())
			mPicker.changeOpacityBarColor(mColor);
	}
	invalidate();
}
 
Example 4
Project: MyFire   File: ImgSelConfig.java   Source Code and License Vote up 6 votes
public Builder(ImageLoader loader) {
    this.loader = loader;

    if (FileUtils.isSdCardAvailable())
        filePath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/Camera";
    else
        filePath = Environment.getRootDirectory().getAbsolutePath() + "/Camera";

    titleBgColor =  Color.BLACK;
    titleColor = Color.WHITE;

    btnBgColor = Color.TRANSPARENT;
    btnTextColor = Color.WHITE;

    FileUtils.createDir(filePath);
}
 
Example 5
Project: ITagAntiLost   File: DevicesAdapter.java   Source Code and License Vote up 6 votes
@Override
public void onBindViewHolder(final DevicesAdapter.Holder holder, int position) {
  Device device = devices.get(position);

  holder.image.setImageBitmap(Device.getBitmapImage(device.getImage(), holder.image.getContext().getResources()));

  int tintColor = device.isConnected() ? Color.BLACK : Color.WHITE;
  holder.toolbar.setTitle(device.getName());
  holder.toolbar.setTitleTextColor(tintColor);

  holder.toolbar.setSubtitle(device.getAddress());
  holder.toolbar.setSubtitleTextColor(tintColor);

  holder.toolbar.setBackgroundColor(device.isConnected() ? green : red);

  Drawable moreIcon = ContextCompat.getDrawable(holder.toolbar.getContext(), R.drawable.ic_more);
  DrawableCompat.setTint(moreIcon, tintColor);
  holder.toolbar.setOverflowIcon(moreIcon);

  holder.viewStatus.setEnabled(device.isConnected());
  holder.fabAlert.setImageResource(device.isAlerted() ? R.drawable.ic_volume_off : R.drawable.ic_volume_up);
  holder.textStatus.setText(device.isConnected() ? connected : disconnected);
}
 
Example 6
Project: DebugOverlay-Android   File: LogcatLineColorScheme.java   Source Code and License Vote up 6 votes
@Override
public int getTextColor(LogcatLine.Priority priority, String tag) {
    switch (priority) {
        case VERBOSE: {
            return Color.BLACK;
        }
        case DEBUG: {
            return Color.BLUE;
        }
        case INFO: {
            return Color.GREEN;
        }
        case WARNING: {
            return Color.YELLOW;
        }
        case ERROR:
        case FATAL:
        case ASSERT: {
            return Color.RED;
        }
        default: {
            return Color.WHITE;
        }
    }
}
 
Example 7
Project: memento-app   File: SlidingSearchViewExampleFragment.java   Source Code and License Vote up 6 votes
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    mSearchView = (FloatingSearchView) view.findViewById(R.id.floating_search_view);
    mHeaderView = (TextView)view.findViewById(R.id.header_view);

    mSearchResultsList = (RecyclerView) view.findViewById(R.id.search_results_list);

    mDimSearchViewBackground = view.findViewById(R.id.dim_background);
    mDimDrawable = new ColorDrawable(Color.BLACK);
    mDimDrawable.setAlpha(0);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        mDimSearchViewBackground.setBackground(mDimDrawable);
    }else {
        mDimSearchViewBackground.setBackgroundDrawable(mDimDrawable);
    }
    smar_group_id = checkSmarGroup();
    isFocus = false;
    setupFloatingSearch();
    setupResultsList();
    setupDrawer();
    Typeface font = Typeface.createFromAsset(getActivity().getAssets(), "fonts/league.ttf");
    mHeaderView.setTypeface(font);
}
 
Example 8
Project: MusicX-music-player   File: Config.java   Source Code and License Vote up 5 votes
@CheckResult
@ColorInt
public static int navigationBarColor(@NonNull Context context, @Nullable String key) {
    if (context instanceof ATENavigationBarCustomizer) {
        int color = ((ATENavigationBarCustomizer) context).getNavigationBarColor();
        if (color != ATE.USE_DEFAULT) return color;
    } else if (!coloredNavigationBar(context, key)) {
        return Color.BLACK;
    }
    return prefs(context, key).getInt(KEY_NAVIGATION_BAR_COLOR, primaryColor(context, key));
}
 
Example 9
Project: EosCommander   File: TintVtDrTextView.java   Source Code and License Vote up 5 votes
private void init(Context context, AttributeSet attrs) {
    if ( null == attrs ) {
        return;
    }

    TypedArray attributeArray = context.obtainStyledAttributes( attrs, R.styleable.TintVtDrTextView);
    Drawable[] drawables = new Drawable[4];
    int[] styleableIds = { R.styleable.TintVtDrTextView_vectorLeft, R.styleable.TintVtDrTextView_vectorTop,
            R.styleable.TintVtDrTextView_vectorRight, R.styleable.TintVtDrTextView_vectorBottom} ;

    int colorId = attributeArray.getResourceId(R.styleable.TintVtDrTextView_vectorTint, -1);
    int tintColor = Color.BLACK;
    if ( -1 != colorId ) {
        tintColor = context.getResources().getColor( colorId );
    }


    for ( int i = 0; i < drawables.length ;i++ ) {
        int rscId = attributeArray.getResourceId(styleableIds[i], -1);
        if ( -1 != rscId ){
            drawables[i] = AppCompatResources.getDrawable(context, rscId) ;

            if ( -1 != tintColor ) {
                DrawableCompat.setTint( drawables[i], tintColor);
            }
        }
    }

    // left, top, right, bottom
    setCompoundDrawablesWithIntrinsicBounds(drawables[0], drawables[1], drawables[2], drawables[3]);
    attributeArray.recycle();
}
 
Example 10
Project: RecyclerViewPreferences   File: SettingsRootView.java   Source Code and License Vote up 5 votes
private void init() {
        ColorMatrix cm = new ColorMatrix();
        cm.setSaturation(0);
        mPaint = new Paint();
//        ColorFilter filter = new PorterDuffColorFilter(SettingsManager.get().getState().isDarkTheme() ?
//                // material design: disabled text color is white with 50% opacity
//                ColorUtils.setAlphaComponent(Color.WHITE, 128) :
//                // material design: disabled text color is black with 38% opacity
//                ColorUtils.setAlphaComponent(Color.BLACK, 97), PorterDuff.Mode.SRC_ATOP);
//        ColorFilter filter = new PorterDuffColorFilter(SettingsManager.get().getState().isDarkTheme() ? Color.GRAY : Color.LTGRAY, PorterDuff.Mode.SRC_ATOP);
        ColorFilter filter = new PorterDuffColorFilter(SettingsManager.get().getState().isDarkTheme() ? Color.WHITE : Color.BLACK, PorterDuff.Mode.SRC_ATOP);
        mPaint.setColorFilter(filter);
        mPaint.setAlpha(SettingsManager.get().getState().isDarkTheme() ? 128 : 97);
//        mPaint.setColorFilter(new ColorMatrixColorFilter(cm));
    }
 
Example 11
Project: Android-CustomToast   File: CT.java   Source Code and License Vote up 5 votes
public Builder(Context context, String text) {
    this.context = context;
    this.text = text;

    shape = GradientDrawable.RECTANGLE;
    backCol = Color.WHITE;
    borderCol = Color.BLACK;
    textCol = Color.BLACK;
    imageRes = 0;
}
 
Example 12
Project: xlight_android_native   File: RangeSeekBar.java   Source Code and License Vote up 5 votes
/**
 * 计算每个按钮的位置和尺寸
 * Calculates the position and size of each button
 *
 * @param x
 * @param y
 * @param hSize
 * @param parentLineWidth
 * @param cellsMode
 * @param bmpResId
 * @param context
 */
protected void onSizeChanged(int x, int y, int hSize, int parentLineWidth, boolean cellsMode, int bmpResId, Context context) {
    heightSize = hSize;
    widthSize = heightSize ;
    left = x - widthSize / 2;
    right = x + widthSize / 2;
    top = y - heightSize / 2;
    bottom = y + heightSize / 2;

    if (cellsMode) {
        lineWidth = parentLineWidth;
    } else {
        lineWidth = parentLineWidth ;
    }

    if (bmpResId > 0) {
        Bitmap original = BitmapFactory.decodeResource(context.getResources(), bmpResId);

        if (original != null) {
            Matrix matrix = new Matrix();
            float scaleHeight = mThumbSize * 1.0f / original.getHeight();
            float scaleWidth = scaleHeight;
            matrix.postScale(scaleWidth, scaleHeight);
            bmp = Bitmap.createBitmap(original, 0, 0, original.getWidth(), original.getHeight(), matrix, true);
        }

    } else {
        defaultPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        int radius = (int) (widthSize * DEFAULT_RADIUS);
        int barShadowRadius = (int) (radius * 0.95f);
        int mShadowCenterX = widthSize/2;
        int mShadowCenterY = heightSize/2;
        shadowGradient = new RadialGradient(mShadowCenterX, mShadowCenterY, barShadowRadius, Color.BLACK, Color.TRANSPARENT, Shader.TileMode.CLAMP);
    }
}
 
Example 13
Project: AndroidBasicLibs   File: DrawerToast.java   Source Code and License Vote up 5 votes
/**
 * 重置背景和文字颜色
 */
public void resetDefaultBackgroundAndTextColor() {
    defaultTextColor = Color.WHITE;
    defaultBackgroundColor = new ColorDrawable(Color.BLACK);
    defaultBackgroundColor.setAlpha(200);
    defaultBackgroundResid = null;
}
 
Example 14
Project: BubbleView   File: BubbleImageView.java   Source Code and License Vote up 5 votes
private void init(Context context, AttributeSet attrs) {
    orientation = LEFT;
    radius = DensityUtils.dip2px(context, 5);
    triangleWidth = DensityUtils.dip2px(context, 12);
    triangleHeight = DensityUtils.dip2px(context, 8);
    offset = DensityUtils.dip2px(context, 8);
    borderColor = Color.BLACK;

    if (attrs == null) return;
    TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.bubbleView);
    offset = (int) typedArray.getDimension(R.styleable.bubbleView_offset, offset);
    radius = (int) typedArray.getDimension(R.styleable.bubbleView_radius, radius);
    orientation = typedArray.getInt(R.styleable.bubbleView_orientation, orientation);
    triangleWidth = (int) typedArray.getDimension(R.styleable.bubbleView_triangleWidth, triangleWidth);
    triangleHeight = (int) typedArray.getDimension(R.styleable.bubbleView_triangleHeight, triangleHeight);
    borderColor = typedArray.getColor(R.styleable.bubbleView_borderColor, borderColor);
    borderWidth = typedArray.getDimension(R.styleable.bubbleView_borderWidth, 0);
    centerArrow = typedArray.getBoolean(R.styleable.bubbleView_centerArrow, centerArrow);
    shadowRadius = (int) typedArray.getDimension(R.styleable.bubbleView_shadowRadius, 0);
    shadowColor = typedArray.getColor(R.styleable.bubbleView_shadowColor, 0xff8D8D8D);
    if (borderWidth != 0) {
        borderWidth = borderWidth / getResources().getDisplayMetrics().density;
    }
    typedArray.recycle();

    preSetUp = false;
    setImageDrawable(bubbleDrawable);

    if (shadowRadius != 0 && Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        setLayerType(View.LAYER_TYPE_SOFTWARE, null);
        setPadding(getPaddingLeft() + shadowRadius, getPaddingTop() + shadowRadius,
                getPaddingRight() + shadowRadius, getPaddingBottom() + shadowRadius);
    }
}
 
Example 15
Project: TaipeiTechRefined   File: CourseDetailActivity.java   Source Code and License Vote up 5 votes
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void setStatusBarColor(int color) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Window window = getWindow();
        if (color == Color.BLACK
                && window.getNavigationBarColor() == Color.BLACK) {
            window.clearFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        } else {
            window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        }
        window.setStatusBarColor(color);
    }
}
 
Example 16
Project: xlight_android_native   File: SVBar.java   Source Code and License Vote up 4 votes
@Override
public boolean onTouchEvent(MotionEvent event) {
	getParent().requestDisallowInterceptTouchEvent(true);

	// Convert coordinates to our internal coordinate system
	float dimen;
	if (mOrientation == ORIENTATION_HORIZONTAL) {
		dimen = event.getX();
	}
	else {
		dimen = event.getY();
	}

	switch (event.getAction()) {
	case MotionEvent.ACTION_DOWN:
	    	mIsMovingPointer = true;
		// Check whether the user pressed on the pointer
		if (dimen >= (mBarPointerHaloRadius)
				&& dimen <= (mBarPointerHaloRadius + mBarLength)) {
			mBarPointerPosition = Math.round(dimen);
			calculateColor(Math.round(dimen));
			mBarPointerPaint.setColor(mColor);
			invalidate();
		}
		break;
	case MotionEvent.ACTION_MOVE:
		if (mIsMovingPointer) {
			// Move the the pointer on the bar.
			if (dimen >= mBarPointerHaloRadius
					&& dimen <= (mBarPointerHaloRadius + mBarLength)) {
				mBarPointerPosition = Math.round(dimen);
				calculateColor(Math.round(dimen));
				mBarPointerPaint.setColor(mColor);
				if (mPicker != null) {
					mPicker.setNewCenterColor(mColor);
					mPicker.changeOpacityBarColor(mColor);
				}
				invalidate();
			} else if (dimen < mBarPointerHaloRadius) {
				mBarPointerPosition = mBarPointerHaloRadius;
				mColor = Color.WHITE;
				mBarPointerPaint.setColor(mColor);
				if (mPicker != null) {
					mPicker.setNewCenterColor(mColor);
					mPicker.changeOpacityBarColor(mColor);
				}
				invalidate();
			} else if (dimen > (mBarPointerHaloRadius + mBarLength)) {
				mBarPointerPosition = mBarPointerHaloRadius + mBarLength;
				mColor = Color.BLACK;
				mBarPointerPaint.setColor(mColor);
				if (mPicker != null) {
					mPicker.setNewCenterColor(mColor);
					mPicker.changeOpacityBarColor(mColor);
				}
				invalidate();
			}
		}
		break;
	case MotionEvent.ACTION_UP:
		mIsMovingPointer = false;
		break;
	}
	return true;
}
 
Example 17
Project: CustomizableCalendar   File: MonthAdapter.java   Source Code and License Vote up 4 votes
@Override
public View getView(int position, View view, ViewGroup parent) {
    final CalendarItem currentItem = days.get(position);

    if (view == null) {
        LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        view = inflater.inflate(layoutResId, null);
    }

    if (viewInteractor != null && viewInteractor.hasImplementedMonthCellBinding()) {
        view = viewInteractor.onMonthCellBindView(view, currentItem);
    } else {
        final TextView dayView = view.findViewById(android.R.id.title);
        final View background = view.findViewById(android.R.id.background);
        final View startSelectionView = view.findViewById(android.R.id.startSelectingText);
        final View endSelectionView = view.findViewById(android.R.id.stopSelectingText);

        startSelectionView.setVisibility(View.GONE);
        endSelectionView.setVisibility(View.GONE);

        if (currentItem == null) {
            background.setBackground(null);
            dayView.setText(null);
        } else if (currentItem.compareTo(calendar.getFirstMonth().withMillisOfDay(0)) < 0) {
            currentItem.setSelectable(false);
            background.setBackground(null);
            dayView.setTextColor(Color.BLACK);
            dayView.setText(currentItem.getDayString());
            dayView.setAlpha(0.6f);
        } else {
            currentItem.setSelectable(true);
            dayView.setAlpha(1f);
            Integer backgroundResource = null;
            if (firstSelectedDay != null) {
                int startSelectedCompared = currentItem.compareTo(firstSelectedDay);
                if (!multipleSelection) {
                    if (startSelectedCompared == 0) {
                        backgroundResource = R.drawable.empty_circle;
                    }
                } else if (startSelectedCompared == 0) {
                    if (lastSelectedDay == null || lastSelectedDay.equals(currentItem.getDateTime())) {
                        backgroundResource = R.drawable.circle;
                    } else {
                        backgroundResource = R.drawable.left_rounded_rectangle;
                        endSelectionView.setVisibility(View.VISIBLE);
                    }
                } else if (startSelectedCompared > 0 && lastSelectedDay != null) {
                    int endSelectedCompared = currentItem.compareTo(lastSelectedDay);
                    if (endSelectedCompared == 0) {
                        backgroundResource = R.drawable.right_rounded_rectangle;
                        startSelectionView.setVisibility(View.VISIBLE);
                    } else if (endSelectedCompared < 0) {
                        backgroundResource = R.drawable.rectangle;
                        startSelectionView.setVisibility(View.VISIBLE);
                        endSelectionView.setVisibility(View.VISIBLE);
                    }
                }
            }

            int color = Color.BLACK;
            if (backgroundResource != null) {
                background.setBackgroundResource(backgroundResource);
                if (multipleSelection) {
                    color = Color.WHITE;
                }
            } else {
                background.setBackground(null);
            }

            dayView.setTextColor(color);
            dayView.setText(currentItem.getDayString());
        }
    }

    return view;
}
 
Example 18
Project: PicKing   File: Yande.java   Source Code and License Vote up 4 votes
@Override
public int getBackgroundColor() {
    return Color.BLACK;
}
 
Example 19
Project: andcircularselect   File: QuantityDataView.java   Source Code and License Vote up 4 votes
public Builder() {
    view = new QuantityDataView();
    view.selectorColor = Color.BLACK;
    view.smallSelectorColor = Color.DKGRAY;
}
 
Example 20
Project: DepressingThoughts   File: AppWidgetConfigureActivity.java   Source Code and License Vote up 4 votes
@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    AppSettings.setDarkTheme(this);

    colors = new int[]{
            ContextCompat.getColor(this, R.color.colorWidgetDark),
            ContextCompat.getColor(this, R.color.colorWidgetLight),
            Color.TRANSPARENT,
            ContextCompat.getColor(this, R.color.colorWidgetTranslucentDark),
            ContextCompat.getColor(this, R.color.colorWidgetTranslucentLight),
            ContextCompat.getColor(this, R.color.colorAccent),
            ContextCompat.getColor(this, R.color.colorWidgetYellow),
            Color.BLACK,
            Color.WHITE,
            ContextCompat.getColor(this, R.color.colorWidgetRed),
            ContextCompat.getColor(this, R.color.colorWidgetPurple),
            ContextCompat.getColor(this, R.color.colorWidgetBlue),
            ContextCompat.getColor(this, R.color.colorWidgetCyan),
            ContextCompat.getColor(this, R.color.colorWidgetTeal),
            ContextCompat.getColor(this, R.color.colorWidgetOrange),
            ContextCompat.getColor(this, R.color.colorWidgetBrown),
            ContextCompat.getColor(this, R.color.colorWidgetGrey),
            ContextCompat.getColor(this, R.color.colorWidgetBlueGrey),
            ContextCompat.getColor(this, R.color.colorWidgetIndigo),
            ContextCompat.getColor(this, R.color.colorWidgetGreen)
    };
    backgroundColor = colors[0];
    buttonColor = colors[5];
    textColor = colors[8];

    // Set the result to CANCELED.  This will cause the widget host to cancel
    // out of the widget placement if the user presses the back button.
    setResult(RESULT_CANCELED);

    setContentView(R.layout.activity_app_widget_configure);

    settingUpViews();

    // Find the widget id from the intent.
    Intent intent = getIntent();
    Bundle extras = intent.getExtras();
    if (extras != null) {
        mAppWidgetId = extras.getInt(
                AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID);
    }

    // If this activity was started with an intent without an app widget ID, finish with an error.
    if (mAppWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID) {
        finish();
    }

}