Java Code Examples for android.graphics.Color.GRAY

The following are Jave code examples for showing how to use GRAY 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: YCBaseAdapter   File: FiveActivity.java   Source Code and License Vote up 6 votes
private void initRecycleView() {
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    adapter = new SimpleRvAdapter();
    recyclerView.setAdapter(adapter);
    adapter.showLoading();
    recyclerView.postDelayed(new Runnable() {
        @Override
        public void run() {
            adapter.hideLoading();
            List<FiveBean> fiveBeen = mockMoreData();
            adapter.setData(getCells(fiveBeen));
        }
    },2000);
    RecycleViewItemLine line = new RecycleViewItemLine(this,LinearLayoutManager.HORIZONTAL,2, Color.GRAY);
    recyclerView.addItemDecoration(line);
}
 
Example 2
Project: StatusBarManager   File: ColorUtil.java   Source Code and License Vote up 6 votes
public static @ColorInt int getColor(int index) {
    int color = Color.TRANSPARENT;
    switch (index) {
        case 0:
            color = R.color.color0;
            break;
        case 1:
            color = Color.BLUE;
            break;

        case 2:
            color = Color.GRAY;
            break;
    }

    return color;
}
 
Example 3
Project: Sprog-App   File: Bypass.java   Source Code and License Vote up 6 votes
public Options() {
    mHeaderSizes = new float[] {
            1.5f, // h1
            1.4f, // h2
            1.3f, // h3
            1.2f, // h4
            1.1f, // h5
            1.0f, // h6
    };

    mUnorderedListItem = "\u2022";
    mListItemIndentUnit = TypedValue.COMPLEX_UNIT_DIP;
    mListItemIndentSize = 10;

    mBlockQuoteColor = 0xff0000ff;
    mBlockQuoteIndentUnit = TypedValue.COMPLEX_UNIT_DIP;
    mBlockQuoteIndentSize = 10;

    mCodeBlockIndentUnit = TypedValue.COMPLEX_UNIT_DIP;
    mCodeBlockIndentSize = 10;

    mHruleColor = Color.GRAY;
    mHruleUnit = TypedValue.COMPLEX_UNIT_DIP;
    mHruleSize = 1;
}
 
Example 4
Project: Musicoco   File: RMPAdapter.java   Source Code and License Vote up 6 votes
@RequiresApi(api = Build.VERSION_CODES.M)
private void bindImageAndForeground(View image, Bitmap bitmap) {
    if (bitmap == null) {
        bitmap = BitmapUtils.bitmapResizeFromResource(context.getResources(), R.drawable.default_song, imageWidth, imageHeight);
    }

    int defaultTC = Color.WHITE;
    int defaultBC = Color.GRAY;
    int[] colors = new int[4];
    ColorUtils.get4LightColorWithTextFormBitmap(bitmap, defaultBC, defaultTC, colors);

    int color = colors[0];
    color = color == defaultBC ? colors[2] : color;
    color = android.support.v4.graphics.ColorUtils.setAlphaComponent(color, 255);
    GradientDrawable dra = new GradientDrawable(
            GradientDrawable.Orientation.LEFT_RIGHT,
            new int[]{color, Color.TRANSPARENT});
    dra.setGradientType(GradientDrawable.LINEAR_GRADIENT);
    image.setBackground(dra);
}
 
Example 5
Project: quickhybrid-android   File: ActionSheet.java   Source Code and License Vote up 6 votes
public Attributes(Context context) {
    mContext = context;
    this.background = new ColorDrawable(Color.TRANSPARENT);
    this.cancelButtonBackground = new ColorDrawable(Color.BLACK);
    ColorDrawable gray = new ColorDrawable(Color.GRAY);
    this.otherButtonTopBackground = gray;
    this.otherButtonMiddleBackground = gray;
    this.otherButtonBottomBackground = gray;
    this.otherButtonSingleBackground = gray;
    this.cancelButtonTextColor = Color.WHITE;
    this.otherButtonTextColor = Color.BLACK;
    this.padding = dp2px(20);
    this.otherButtonSpacing = dp2px(2);
    this.cancelButtonMarginTop = dp2px(10);
    this.actionSheetTextSize = dp2px(16);
}
 
Example 6
Project: PWEditText-SafeKeyboard   File: SafetyKeyboard.java   Source Code and License Vote up 5 votes
private void setDefaultNumKey(TextView view, int key) {
    view.setText(String.valueOf(key));
    if (null != mNumBgDrawSelector) {
        Drawable tempNumBg = mNumBgDrawSelector.getConstantState()
                .newDrawable();
        view.setBackgroundDrawable(tempNumBg);
    } else {
        ColorDrawable normal = new ColorDrawable(Color.WHITE);
        ColorDrawable press = new ColorDrawable(Color.GRAY);
        view.setBackgroundDrawable(getDrawableSeletor(normal, press));
    }
}
 
Example 7
Project: MusicX-music-player   File: TextDrawable.java   Source Code and License Vote up 5 votes
private Builder() {
    text = "";
    color = Color.GRAY;
    textColor = Color.WHITE;
    borderThickness = 0;
    width = -1;
    height = -1;
    shape = new RectShape();
    font = Typeface.create("sans-serif-light", Typeface.NORMAL);
    fontSize = -1;
    isBold = false;
    toUpperCase = false;
}
 
Example 8
Project: calendarview2   File: CalendarView2.java   Source Code and License Vote up 5 votes
/**
 * @param color The selection color
 */
public void setSelectionColor(int color) {
    if (color == 0) {
        if (!isInEditMode()) {
            return;
        } else {
            color = Color.GRAY;
        }
    }
    accentColor = color;
    adapter.setSelectionColor(color);
    invalidate();
}
 
Example 9
Project: GitHub   File: MaterialCalendarView.java   Source Code and License Vote up 5 votes
/**
 * @param color The selection color
 */
public void setSelectionColor(int color) {
    if (color == 0) {
        if (!isInEditMode()) {
            return;
        } else {
            color = Color.GRAY;
        }
    }
    accentColor = color;
    adapter.setSelectionColor(color);
    invalidate();
}
 
Example 10
Project: SmartMath   File: OGLChartOperator.java   Source Code and License Vote up 5 votes
public static int cvtStr2Color(String str)	{
	if (str.trim().toLowerCase(Locale.US).equals("blue"))	{
		return Color.BLUE; 	
	} else if (str.trim().toLowerCase(Locale.US).equals("cyan"))	{
		return Color.CYAN; 	
	} else if (str.trim().toLowerCase(Locale.US).equals("dkgray"))	{
		return Color.DKGRAY; 	
	} else if (str.trim().toLowerCase(Locale.US).equals("gray"))	{
		return Color.GRAY; 	
	} else if (str.trim().toLowerCase(Locale.US).equals("green"))	{
		return Color.GREEN; 	
	} else if (str.trim().toLowerCase(Locale.US).equals("ltgray"))	{
		return Color.LTGRAY; 	
	} else if (str.trim().toLowerCase(Locale.US).equals("magenta"))	{
		return Color.MAGENTA; 	
	/*} else if (str.trim().toLowerCase(Locale.US).equals("orange"))	{
		return Color.ORANGE; 	// Pink and orange are not predefined colors in Android
	} else if (str.trim().toLowerCase(Locale.US).equals("pink"))	{
		return Color.PINK; 	*/
	} else if (str.trim().toLowerCase(Locale.US).equals("red"))	{
		return Color.RED; 	
	} else if (str.trim().toLowerCase(Locale.US).equals("white"))	{
		return Color.WHITE;
	} else if (str.trim().toLowerCase(Locale.US).equals("yellow"))	{
		return Color.YELLOW;
	} else	{
		return Color.BLACK;
	}
}
 
Example 11
Project: SmartMath   File: XYChartOperator.java   Source Code and License Vote up 5 votes
public static int cvtStr2Color(String str)	{
	if (str.trim().toLowerCase(Locale.US).equals("blue"))	{
		return Color.BLUE; 	
	} else if (str.trim().toLowerCase(Locale.US).equals("cyan"))	{
		return Color.CYAN; 	
	} else if (str.trim().toLowerCase(Locale.US).equals("dkgray"))	{
		return Color.DKGRAY; 	
	} else if (str.trim().toLowerCase(Locale.US).equals("gray"))	{
		return Color.GRAY; 	
	} else if (str.trim().toLowerCase(Locale.US).equals("green"))	{
		return Color.GREEN; 	
	} else if (str.trim().toLowerCase(Locale.US).equals("ltgray"))	{
		return Color.LTGRAY; 	
	} else if (str.trim().toLowerCase(Locale.US).equals("magenta"))	{
		return Color.MAGENTA; 	
	} else if (str.trim().toLowerCase(Locale.US).equals("red"))	{
		return Color.RED; 	
	} else if (str.trim().toLowerCase(Locale.US).equals("transparent"))	{
		return Color.TRANSPARENT; 	
	} else if (str.trim().toLowerCase(Locale.US).equals("white"))	{
		return Color.WHITE;
	} else if (str.trim().toLowerCase(Locale.US).equals("yellow"))	{
		return Color.YELLOW;
	} else	{
		return Color.BLACK;
	}
}
 
Example 12
Project: YCBaseAdapter   File: SecondActivity.java   Source Code and License Vote up 5 votes
private void initRecycleView() {
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    adapter = new SecondAdapter(this,this);
    recyclerView.setAdapter(adapter);
    adapter.setData(list);
    RecycleViewItemLine line = new RecycleViewItemLine(this,LinearLayoutManager.HORIZONTAL,2, Color.GRAY);
    recyclerView.addItemDecoration(line);
}
 
Example 13
Project: Password-Storage   File: PasswordRecyclerViewAdapter.java   Source Code and License Vote up 5 votes
private int getRandomMaterialColor() {
    int returnColor = Color.GRAY;
    int arrayId = context.getResources().getIdentifier("mdcolor_400", "array", context.getPackageName());

    if (arrayId != 0) {
        TypedArray colors = context.getResources().obtainTypedArray(arrayId);
        int index = (int) (Math.random() * colors.length());
        returnColor = colors.getColor(index, Color.GRAY);
        colors.recycle();
    }
    return returnColor;
}
 
Example 14
Project: Eye   File: PersonInfoView.java   Source Code and License Vote up 5 votes
public int getRandomColor() {
    Random random = new Random();

    switch (random.nextInt(10)) {
        case 0:
            return Color.WHITE;
        case 1:
            return Color.BLACK;
        case 2:
            return Color.BLUE;
        case 3:
            return Color.CYAN;
        case 4:
            return Color.YELLOW;
        case 5:
            return Color.GREEN;
        case 6:
            return Color.RED;
        case 7:
            return Color.GRAY;
        case 8:
            return Color.LTGRAY;
        case 9:
            return Color.DKGRAY;
        default:
            return Color.MAGENTA;
    }
}
 
Example 15
Project: mongol-library   File: Key.java   Source Code and License Vote up 5 votes
private void initDefault() {
    //mDisplayText = "abc";
    //mKeyColor = Color.LTGRAY;
    mPressedColor = Color.GRAY;
    //mTextColor = Color.BLACK;
    //mBorderColor = Color.BLACK;
    //mBorderWidth = 10;
    //mBorderRadius = 30;
}
 
Example 16
Project: AmenEye   File: NavItem.java   Source Code and License Vote up 5 votes
private void init(Context context,AttributeSet attrs){
    View view = inflate(context,R.layout.nav_item,this);
    ButterKnife.bind(view);
    //自定义视图属性
    TypedArray typedArray = context.obtainStyledAttributes(attrs,R.styleable.NavItem);
    String action = typedArray.getString(R.styleable.NavItem_action);
    String actionState = typedArray.getString(R.styleable.NavItem_actionState);
    if (actionState != null){
        mTvActionState.setText(actionState);
    }
    mTvActionTitle.setText(action != null ? action:"");
    int startIcon = typedArray.getResourceId(R.styleable.NavItem_startIcon,0);
    if (startIcon != 0){
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ){
            mIvStartIcon.setImageDrawable(context.getResources().getDrawable(startIcon,context.getTheme()));
        }else {
            mIvStartIcon.setImageDrawable(context.getResources().getDrawable(startIcon));
        }
    }
    int color = typedArray.getColor(R.styleable.NavItem_textColor, Color.GRAY);
    if (color != Color.GRAY){
        mTvActionTitle.setTextColor(color);
        mTvActionState.setTextColor(color);
    }

    int tint = typedArray.getColor(R.styleable.NavItem_tint,Color.TRANSPARENT);
    if (tint != Color.TRANSPARENT){
        mIvStartIcon.setImageTintList(ColorStateList.valueOf(tint));
    }

    typedArray.recycle();
}
 
Example 17
Project: DizzyPassword   File: PswInputView.java   Source Code and License Vote up 5 votes
/**
     * 初始化相关参数
     */
    void init(AttributeSet attrs) {
        final float dp = getResources().getDisplayMetrics().density;
        this.setFocusable(true);
        this.setFocusableInTouchMode(true);
        input = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
        result = new ArrayList<>();
        if (attrs != null) {
            TypedArray ta = getContext().obtainStyledAttributes(attrs, R.styleable.PswInputView);
//            mBorderColor = ta.getColor(R.styleable.PswInputView_border_color, getResources().getColor(R.color.color_13));
            mBorderColor = ta.getColor(R.styleable.PswInputView_border_color, ThemeUtils.getPrimaryColor(AppManager.getAppManager().currentActivity()));
            mDotColor = ta.getColor(R.styleable.PswInputView_dot_color, getResources().getColor(R.color.color_bg));
            count = ta.getInt(R.styleable.PswInputView_count, 6);
            ta.recycle();
        } else {
            mBorderColor = Color.LTGRAY;
            mDotColor = Color.GRAY;
            count = 6;//默认6位密码
        }
        size = (int) (dp * 30);//默认30dp一格
        //color
        mBorderPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        mBorderPaint.setStrokeWidth(2);
        mBorderPaint.setStyle(Paint.Style.STROKE);
        mBorderPaint.setColor(mBorderColor);
        mDotPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        mDotPaint.setStrokeWidth(3);
        mDotPaint.setStyle(Paint.Style.FILL);
        mDotPaint.setColor(mDotColor);
        mRoundRect = new RectF();
        mRoundRadius = (int) (5 * dp);
        mFocusLineLength = 0;
        this.setOnKeyListener(new MyKeyListener());
    }
 
Example 18
Project: SSTVEncoder2   File: GridColorPalette.java   Source Code and License Vote up 5 votes
static int[] getStandardColors() {
    return new int[]{
            Color.BLACK,
            Color.GRAY,
            Color.LTGRAY,
            Color.WHITE,
            Color.YELLOW,
            Color.CYAN,
            Color.GREEN,
            Color.MAGENTA,
            Color.RED,
            Color.BLUE
    };
}
 
Example 19
Project: Musicoco   File: OptionsAdapter.java   Source Code and License Vote up 4 votes
public OptionsAdapter(Context context) {
    this.context = context;
    this.iconColor = this.titleColor = Color.DKGRAY;
    this.msgColor = Color.GRAY;
    this.options = new ArrayList<>();
}
 
Example 20
Project: Hitalk   File: WheelViewDialog.java   Source Code and License Vote up 4 votes
private void init() {
    LinearLayout layout = new LinearLayout(mContext);
    layout.setOrientation(LinearLayout.VERTICAL);
    layout.setPadding(WheelUtils.dip2px(mContext, 20), 0, WheelUtils.dip2px(mContext, 20), 0);

    mTitle = new TextView(mContext);
    mTitle.setTextColor(WheelConstants.DIALOG_WHEEL_COLOR);
    mTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16);
    mTitle.setGravity(Gravity.CENTER);
    LinearLayout.LayoutParams titleParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
            WheelUtils.dip2px(mContext, 50));
    layout.addView(mTitle, titleParams);

    mLine1 = new View(mContext);
    mLine1.setBackgroundColor(WheelConstants.DIALOG_WHEEL_COLOR);
    LinearLayout.LayoutParams lineParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
            WheelUtils.dip2px(mContext, 2));
    layout.addView(mLine1, lineParams);

    mWheelView = new WheelView(mContext);
    mWheelView.setSkin(WheelView.Skin.Holo);
    mWheelView.setWheelAdapter(new ArrayWheelAdapter(mContext));
    mStyle = new WheelView.WheelViewStyle();
    mStyle.textColor = Color.GRAY;
    mStyle.selectedTextZoom = 1.2f;
    mWheelView.setStyle(mStyle);

    mWheelView.setOnWheelItemSelectedListener(new WheelView.OnWheelItemSelectedListener<T>() {
        @Override
        public void onItemSelected(int position, T text) {
            mSelectedPos = position;
            mSelectedText = text;
        }
    });
    ViewGroup.MarginLayoutParams wheelParams = new ViewGroup.MarginLayoutParams(LinearLayout.LayoutParams
            .MATCH_PARENT,
            LinearLayout.LayoutParams.WRAP_CONTENT);
    layout.addView(mWheelView, wheelParams);

    mLine2 = new View(mContext);
    mLine2.setBackgroundColor(WheelConstants.DIALOG_WHEEL_COLOR);
    LinearLayout.LayoutParams line2Params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
            WheelUtils.dip2px(mContext, 1f));
    layout.addView(mLine2, line2Params);

    mButton = new TextView(mContext);
    mButton.setTextColor(WheelConstants.DIALOG_WHEEL_COLOR);
    mButton.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12);
    mButton.setGravity(Gravity.CENTER);
    mButton.setClickable(true);
    mButton.setOnClickListener(this);
    mButton.setText("OK");
    LinearLayout.LayoutParams buttonParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
            WheelUtils.dip2px(mContext, 45));
    layout.addView(mButton, buttonParams);

    mDialog = new AlertDialog.Builder(mContext).create();
    mDialog.setView(layout);
    mDialog.setCanceledOnTouchOutside(false);
}