Java 类android.graphics.Color 实例源码

项目:GitHub    文件:SingleRequestTest.java   
@Test
public void testDoesNotSetErrorDrawableIfRequestCoordinatorDoesntAllowIt() {
  harness.errorDrawable = new ColorDrawable(Color.RED);
  SingleRequest<List> request = harness.getRequest();
  when(harness.requestCoordinator.canNotifyStatusChanged(any(Request.class))).thenReturn(false);
  request.onLoadFailed(new GlideException("test"));

  verify(harness.target, never()).onLoadFailed(any(Drawable.class));
}
项目:baselibrary-master    文件:SmoothCheckBox.java   
private static int getGradientColor(int startColor, int endColor, float percent)
{
    int startA = Color.alpha(startColor);
    int startR = Color.red(startColor);
    int startG = Color.green(startColor);
    int startB = Color.blue(startColor);

    int endA = Color.alpha(endColor);
    int endR = Color.red(endColor);
    int endG = Color.green(endColor);
    int endB = Color.blue(endColor);

    int currentA = (int) (startA * (1 - percent) + endA * percent);
    int currentR = (int) (startR * (1 - percent) + endR * percent);
    int currentG = (int) (startG * (1 - percent) + endG * percent);
    int currentB = (int) (startB * (1 - percent) + endB * percent);
    return Color.argb(currentA, currentR, currentG, currentB);
}
项目:XERUNG    文件:Slider.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.number_indicator_spinner);
    setCanceledOnTouchOutside(false);

    RelativeLayout content = (RelativeLayout) this.findViewById(R.id.number_indicator_spinner_content);
    indicator = new Indicator(this.getContext());
    content.addView(indicator);

    numberIndicator = new TextView(getContext());
    numberIndicator.setTextColor(Color.WHITE);
    numberIndicator.setGravity(Gravity.CENTER);
    content.addView(numberIndicator);

    indicator.setLayoutParams(new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.MATCH_PARENT,
            RelativeLayout.LayoutParams.MATCH_PARENT));
}
项目:KernelAdiutor-Mod    文件:ColorTable.java   
@Override
public void draw(Canvas canvas) {
    super.draw(canvas);

    float width = getMeasuredWidth();
    float height = getMeasuredHeight();

    for (int i = 0; i < sColors.length; i++) {
        float top = height / sColors.length * i;
        float bottom = height / sColors.length * (i + 1);
        for (int x = 0; x < sColors[i].length; x++) {
            float left = width / sColors[i].length * x;
            float right = width / sColors[i].length * (x + 1);
            mColorPaint.setColor(Color.parseColor(sColors[i][x]));
            canvas.drawRect(left, top, right, bottom, mColorPaint);
        }
    }
}
项目:Hillffair17    文件:HomeAdapter.java   
@Override
public void onBindViewHolder(viewHolder holder, int position) {

    HomeModel m=arrayList.get(position);
    holder.imageView.setImageResource(m.getPhoto_id());
    holder.textView.setText(m.getName());

    if(position==0)
        holder.cardView.setBackgroundColor(Color.rgb(255,205,210));
    else if(position==1)
        holder.cardView.setBackgroundColor(Color.rgb(157,255,164));
    else if(position==2)
        holder.cardView.setBackgroundColor(Color.rgb(209,196,233));
    else if(position==3)
        holder.cardView.setBackgroundColor(Color.rgb(187,222,251));
    else if(position==4)
        holder.cardView.setBackgroundColor(Color.rgb(255,204,128));
    else if(position==5)
        holder.cardView.setBackgroundColor(Color.rgb(255,245,157));
    else if(position==6)
        holder.cardView.setBackgroundColor(Color.rgb(248,187,208));
    else if(position==7)
        holder.cardView.setBackgroundColor(Color.rgb(198,193,250));

}
项目:CCDownload    文件:InputInfoActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    service = new Intent(this, UploadService.class);
    inputLayout = new RelativeLayout(this);
    inputLayout.setBackgroundColor(Color.WHITE);
    inputLayout.setHorizontalGravity(Gravity.CENTER_HORIZONTAL);
    inputLayout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    getCategory();
    initView();

       bindService(service, serviceConnection, Context.BIND_AUTO_CREATE);

       String path = getIntent().getStringExtra("filePath");
       if (path != null) {
        filePath = path;
    }

       getActionBar().setDisplayHomeAsUpEnabled(true);
       uploadButton.setOnClickListener(this);

       setContentView(inputLayout);
}
项目:boohee_v5.6    文件:BooheeCircleProgressBar.java   
protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);
    int width = getWidth();
    int height = getHeight();
    if (width != height) {
        int min = Math.min(width, height);
        width = min;
        height = min;
    }
    this.paint.setAntiAlias(true);
    this.paint.setColor(-1);
    canvas.drawColor(0);
    this.paint.setStrokeWidth((float) this.progressStrokeWidth);
    this.paint.setStyle(Style.STROKE);
    this.oval.left = (float) (this.progressStrokeWidth / 2);
    this.oval.top = (float) (this.progressStrokeWidth / 2);
    this.oval.right = (float) (width - (this.progressStrokeWidth / 2));
    this.oval.bottom = (float) (height - (this.progressStrokeWidth / 2));
    this.paint.setColor(Color.parseColor("#4cd964"));
    canvas.drawArc(this.oval, -90.0f, 360.0f * (((float) this.progress) / ((float) this
            .maxProgress)), false, this.paint);
}
项目:SmoothChartView    文件:SmoothLineChartView.java   
public SmoothLineChartView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    mContext = context;
    float scale = context.getResources().getDisplayMetrics().density;
    mCircleSize = scale * CIRCLE_SIZE;
    mStrokeSize = scale * STROKE_SIZE;
    mSelectedCircleSize = scale * SELECTED_CIRCLE_SIZE;
    mEnableDrawArea = true;
    mEnableShowTag = true;
    mDrawAreaColor = (CHART_COLOR & 0xFFFFFF) | 0x10000000;
    mLineColor = CHART_COLOR;
    mCircleColor = CHART_COLOR;
    mInnerCircleColor = Color.WHITE;
    mTextColor = Color.WHITE;
    mTextSize = DensityUtils.sp2px(context, 12);
    mTextOffset = TEXT_POSITION_OFFSET;
    mNodeStyle = NODE_STYLE_CIRCLE;
    mPaint = new Paint();
    mPaint.setAntiAlias(true);
    mPath = new Path();
    mBorder = 2 * mCircleSize;
}
项目:Mire    文件:MorphTransform.java   
public static void setup(@NonNull Activity activity, @Nullable View targetView, @ColorInt int endColor, int endCornerRadius) 
{
       final Intent intent = activity.getIntent();
       if (intent == null || !intent.hasExtra(EXTRA_SHARED_ELEMENT_START_COLOR) || !intent.hasExtra(EXTRA_SHARED_ELEMENT_START_CORNER_RADIUS))
    {
        return;
    }

       final int startColor = activity.getIntent().getIntExtra(EXTRA_SHARED_ELEMENT_START_COLOR, Color.TRANSPARENT);
       final int startCornerRadius = intent.getIntExtra(EXTRA_SHARED_ELEMENT_START_CORNER_RADIUS, 0);

       final MorphTransform sharedEnter = new MorphTransform(startColor, endColor, startCornerRadius, endCornerRadius);
       final MorphTransform sharedReturn = new MorphTransform(endColor, startColor, endCornerRadius, startCornerRadius);
       if (targetView != null)
    {
           sharedEnter.addTarget(targetView);
           sharedReturn.addTarget(targetView);
       }
       activity.getWindow().setSharedElementEnterTransition(sharedEnter);
       activity.getWindow().setSharedElementReturnTransition(sharedReturn);
   }
项目:Qeet-Remote    文件:ToastListAdapter.java   
@Override
public void onBindViewHolder(ToastViewHolder holder, int position) {
    holder.name.setText(list.get(position).getName());
    holder.status.setText(list.get(position).getStatus());
    if(list.get(position).getStatus().toString().equals(this.context.getResources().getString(R.string.on).toString()) ){
        //holder.status.setBackgroundColor(Color.parseColor("#dff2bf"));
        holder.status.setBackgroundColor(context.getResources().getColor(R.color.colorAccent));

        holder.status.setTextColor(Color.parseColor("#4f8a10"));
    }
    else if(list.get(position).getStatus().toString().equals("off")){
        holder.status.setBackgroundColor(context.getResources().getColor(R.color.greyColor));
    }
    else {
        holder.status.setBackgroundColor(context.getResources().getColor(R.color.errorBackground));
        holder.status.setTextColor(context.getResources().getColor(R.color.errorTextColor));
    }
}
项目:FastEc    文件:ShopCartDelegate.java   
@OnClick(R2.id.icon_shop_cart_select_all)
void onClickSelectAll() {

    final int tag = (int) mIconSelectAll.getTag();
    if (tag == 0) {
        mIconSelectAll.setTextColor
                (ContextCompat.getColor(getContext(), R.color.app_main));
        mIconSelectAll.setTag(1);
        mAdapter.setIsSelectedAll(true);
        //更新RecyclerView的显示状态
        mAdapter.notifyItemRangeChanged(0, mAdapter.getItemCount());
    } else {
        mIconSelectAll.setTextColor(Color.GRAY);
        mIconSelectAll.setTag(0);
        mAdapter.setIsSelectedAll(false);
        mAdapter.notifyItemRangeChanged(0, mAdapter.getItemCount());
    }


}
项目:Pocket-Plays-for-Twitch    文件:Service.java   
public static Bitmap makeTransparent(Bitmap bit, int transparentColor) {
    int width =  bit.getWidth();
    int height = bit.getHeight();
    Bitmap myBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
    int [] allpixels = new int [ myBitmap.getHeight()*myBitmap.getWidth()];
    bit.getPixels(allpixels, 0, myBitmap.getWidth(), 0, 0, myBitmap.getWidth(), myBitmap.getHeight());
    myBitmap.setPixels(allpixels, 0, width, 0, 0, width, height);

    for(int i =0; i<myBitmap.getHeight()*myBitmap.getWidth();i++){
        if( allpixels[i] == transparentColor)
            allpixels[i] = Color.alpha(Color.TRANSPARENT);
    }

    myBitmap.setPixels(allpixels, 0, myBitmap.getWidth(), 0, 0, myBitmap.getWidth(), myBitmap.getHeight());
    return myBitmap;
}
项目:MySelfDemo    文件:MyView2.java   
/**
 * 画扇形
 *
 * @param canvas
 */
private void drawArc(Canvas canvas) {
    Paint paint = new Paint();
    paint.setStyle(Paint.Style.STROKE);
    paint.setColor(Color.RED);
    paint.setAntiAlias(true);
    float x = (getWidth() - getHeight() / 2) / 2;
    float y = getHeight() / 4;

    RectF oval = new RectF(x, y,
            getWidth() - x, getHeight() - y);
    canvas.drawRect(oval, paint);

    Paint paint_over = new Paint();
    paint_over.setStyle(Paint.Style.FILL);
    paint_over.setColor(Color.BLUE);

    canvas.drawArc(oval, -90, 90, true, paint_over);//其中的参数 : RectF oval 一个矩形  , float startAngle 开始的偏移量 正数代表顺时针  负数代表逆时针, float sweepAngle  画圈的大下, boolean useCenter 是否连接到圆心,@NonNull Paint paint
}
项目:WaveAudioVizualization    文件:VoiceWaveViewTV.java   
@Override   // will be called on UI thread
public void onSurfaceTextureAvailable(SurfaceTexture st, int width, int height) {
    Log.d(TAG, "onSurfaceTextureAvailable(" + width + "x" + height + ")");
    mWidth = width;
    mHeight = height;
    mMaxAmpl = height / 2;
    mPaints.get(0).setShader(new LinearGradient(0, 0, mWidth, mHeight, Color.parseColor("#CA67B7"), Color.parseColor("#C081C1"), Shader.TileMode.MIRROR));
    mPaints.get(0).setStrokeWidth(ScreenUtils.dp2px(getContext(), 2));
    mPaints.get(1).setColor(Color.parseColor("#D5E3FA"));
    mPaints.get(1).setStrokeWidth(ScreenUtils.dp2px(getContext(), 2));
    mPaints.get(2).setStrokeWidth(ScreenUtils.dp2px(getContext(), 1));
    mPaints.get(3).setStrokeWidth(ScreenUtils.dp2px(getContext(), 1));
    mPaints.get(2).setShader(new LinearGradient(0, 0, mWidth, mHeight, Color.parseColor("#E67EA5"), Color.parseColor("#7F7AE1"), Shader.TileMode.MIRROR));
    mPaints.get(3).setShader(new LinearGradient(0, 0, mWidth, mHeight, Color.parseColor("#E67EA5"), Color.parseColor("#7F7AE1"), Shader.TileMode.MIRROR));
    synchronized (mLock) {
        mSurfaceTexture = st;
        mLock.notify();
    }
}
项目:SmartChart    文件:PieChartRenderer.java   
public PieChartRenderer(Context context, Chart chart, PieChartDataProvider dataProvider) {
    super(context, chart);
    this.dataProvider = dataProvider;
    touchAdditional = ChartUtils.dp2px(density, DEFAULT_TOUCH_ADDITIONAL_DP);

    slicePaint.setAntiAlias(true);
    slicePaint.setStyle(Paint.Style.FILL);

    centerCirclePaint.setAntiAlias(true);
    centerCirclePaint.setStyle(Paint.Style.FILL);
    centerCirclePaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC));

    centerCircleText1Paint.setAntiAlias(true);
    centerCircleText1Paint.setTextAlign(Align.CENTER);

    centerCircleText2Paint.setAntiAlias(true);
    centerCircleText2Paint.setTextAlign(Align.CENTER);

    separationLinesPaint.setAntiAlias(true);
    separationLinesPaint.setStyle(Paint.Style.STROKE);
    separationLinesPaint.setStrokeCap(Paint.Cap.ROUND);
    separationLinesPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
    separationLinesPaint.setColor(Color.TRANSPARENT);
}
项目:FastEc    文件:TranslucentBehavior.java   
@Override
public void onNestedPreScroll(CoordinatorLayout coordinatorLayout, Toolbar child, View target, int dx, int dy, int[] consumed) {
    super.onNestedPreScroll(coordinatorLayout, child, target, dx, dy, consumed);
    mDistanceY += dy;
    //toolbar的高度
    final int targetHeight = child.getBottom();

    //当滑动时,并且距离小于 toolbar 高度的时候,调整渐变色
    if (mDistanceY > 0 && mDistanceY <= targetHeight) {
        final float scale = (float) mDistanceY / targetHeight;
        final float alpha = scale * 255;
        child.setBackgroundColor(Color.argb((int) alpha, RGB_VALUE.red(), RGB_VALUE.green(), RGB_VALUE.blue()));
    } else if (mDistanceY > targetHeight) {
        child.setBackgroundColor(Color.rgb(RGB_VALUE.red(), RGB_VALUE.green(), RGB_VALUE.blue()));
    }

}
项目:SimpleUILauncher    文件:BaseRecyclerViewFastScrollBar.java   
public BaseRecyclerViewFastScrollBar(BaseRecyclerView rv, Resources res) {
    mRv = rv;
    mPopup = new BaseRecyclerViewFastScrollPopup(rv, res);
    mTrackPaint = new Paint();
    mTrackPaint.setColor(rv.getFastScrollerTrackColor(Color.BLACK));
    mTrackPaint.setAlpha(MAX_TRACK_ALPHA);
    mThumbActiveColor = mThumbInactiveColor = Utilities.getColorAccent(rv.getContext());
    mThumbPaint = new Paint();
    mThumbPaint.setAntiAlias(true);
    mThumbPaint.setColor(mThumbInactiveColor);
    mThumbPaint.setStyle(Paint.Style.FILL);
    mThumbWidth = mThumbMinWidth = res.getDimensionPixelSize(R.dimen.container_fastscroll_thumb_min_width);
    mThumbMaxWidth = res.getDimensionPixelSize(R.dimen.container_fastscroll_thumb_max_width);
    mThumbHeight = res.getDimensionPixelSize(R.dimen.container_fastscroll_thumb_height);
    mThumbCurvature = mThumbMaxWidth - mThumbMinWidth;
    mTouchInset = res.getDimensionPixelSize(R.dimen.container_fastscroll_thumb_touch_inset);
}
项目:BookyMcBookface    文件:GetBooksActivity.java   
private void displayWeb(String name, String url, boolean first) {
    TextView v = new TextView(this);
    v.setTextSize(24);
    v.setTextColor(Color.BLUE);
    v.setPadding(16,16,8,8);
    v.setText(name);
    v.setTag(url);
    v.setOnClickListener(this);
    v.setOnLongClickListener(this);
    if (first) {
        list.addView(v, 0);
    } else {
        list.addView(v);
    }

}
项目:Mobike    文件:ViewfinderView.java   
private void drawScanner(Canvas canvas, Rect frame) {
    if (showPossiblePoint) {
        // Draw getUrl red "laser scanner" line through the middle to show decoding is active
        paint.setColor(laserColor);
        paint.setAlpha(SCANNER_ALPHA[scannerAlpha]);
        scannerAlpha = (scannerAlpha + 1) % SCANNER_ALPHA.length;
        int middle = frame.height() / 2 + frame.top;
        canvas.drawRect(frame.left + 2, middle - 1, frame.right - 1, middle + 2, paint);
    } else {
        paint.setColor(Color.parseColor("#03A9F4"));
        scannerAlpha = (scannerAlpha + 1) % SCANNER_ALPHA.length;
        canvas.translate(0, translateY);
        canvas.drawRect(frame.left + 10, frame.top, frame.right - 10, frame.top + 10, paint);

        translateY += 5f;
        if (translateY >= 670) {
            translateY = 5f;
        }
    }
}
项目:yyox    文件:SwipeBackActivityHelper.java   
public void onActivityCreate() {
    Window window = mActivity.getWindow();
    window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    window.getDecorView().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    mSwipeBackLayout = new SwipeBackLayout(mActivity);
    mSwipeBackLayout.addSwipeListener(new SwipeBackLayout.SwipeListener() {
        @Override
        public void onScrollStateChange(int state, float scrollPercent) {

        }

        @Override
        public void onEdgeTouch(int edgeFlag) {
            Utils.convertActivityToTranslucent(mActivity);
        }

        @Override
        public void onScrollOverThreshold() {

        }
    });
}
项目:IdeaTrackerPlus    文件:HorizontalAdapter.java   
private void setupIdeaTile(MyViewHolder holder, LinearLayout container) {
    holder.txtView.setSingleLine();
    holder.txtView.setText(mIdea);
    holder.txtView.setGravity(Gravity.CENTER_VERTICAL | Gravity.START);

    if (mDarkTheme) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            container.setBackgroundResource(R.drawable.grey_ripple);
        } else {
            container.setBackgroundResource(R.color.md_grey_800);
        }
        holder.txtView.setTextColor(Color.WHITE);
    } else {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            container.setBackgroundResource(R.drawable.white_ripple);
        } else {
            container.setBackgroundResource(R.color.white);
        }
        holder.txtView.setTextColor(Color.BLACK);
    }

    //Listeners
    RecyclerOnClickListener listener = new RecyclerOnClickListener(mRecyclerView, mTabNumber);
    container.setOnClickListener(listener);
    container.setOnLongClickListener(mListener);
}
项目:Mire    文件:ActivitySetWallpapers.java   
@Override
protected void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_set_image);
    Preferences.makeAppFullscreen(this, Color.TRANSPARENT);

    setEnter();
    if (savedInstanceState != null) 
    {
           image = savedInstanceState.getString(URL);
           title = savedInstanceState.getString(NAME);
        text = savedInstanceState.getString(TEXT);
       }

    Bundle bundle = getIntent().getExtras();
       if (bundle != null)
    {
           image = bundle.getString(URL);
           title = bundle.getString(NAME);
        text = bundle.getString(TEXT);
       }

    wallpaper = (DoubleTapImageView)findViewById(R.id.id_image);
    progress = (ProgressBar)findViewById(R.id.id_progress);
    apply = (ImageView)findViewById(R.id.id_apply);

    mColor = Preferences.getAttributeColor(this, R.attr.colorAccent);
    anim = AnimationUtils.loadAnimation(this, R.anim.slide_left_from_right);
    _anim = AnimationUtils.loadAnimation(this, R.anim.slide_right_from_left);

    exitTransition = ActivityTransition.with(this.getIntent())
        .to(this, wallpaper, "walls")
        .duration(300)
        .start(savedInstanceState);

    apply.setOnLongClickListener(applyLongClick);
}
项目:ElasticViews    文件:ExampleActivity2.java   
@OnClick({R.id.example2_view0, R.id.example2_view1, R.id.example2_view2, R.id.example2_view3, R.id.example2_imv, R.id.example2_textView0, R.id.example2_fab})
public void Views(View v){
    if(v.getId() == R.id.example2_view3){
        // set your duration time
        int duration = 500;

        // ElasticAction : doAction
        ElasticAction.doAction(v, duration, 0.85f, 0.85f); // argument : ViewGroup, duration, scaleX, scaleY

        // PostDelayed : delay duration time
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                //Do something after duration time
            }
        }, duration);
    }
    else if(v.getId() == R.id.example2_imv)
        Snackbar.make(v, "This is ElasticImageView", Snackbar.LENGTH_LONG).setActionTextColor(Color.WHITE).show();
    else if(v.getId() == R.id.example2_textView0)
        ElasticAction.doAction(v, 500, 0.75f, 0.75f);
    else if(v.getId() == R.id.example2_fab)
        Snackbar.make(v, "This is ElasticFloatActionButton", Snackbar.LENGTH_LONG).setActionTextColor(Color.WHITE).show();
}
项目:AndroFish    文件:AndroidFishEatingFish.java   
@Override protected void onDraw(Canvas canvas) {
adjustDimensions(canvas);
canvas.drawColor(Color.WHITE);
Paint paint = new Paint();
         paint.setStrokeWidth(0);
         paint.setColor(Color.BLACK);
drawBackground(canvas, paint);
drawTargetMarker(canvas, paint);
drawFood(canvas, paint);
drawComputerFishs(canvas, paint, SIZE_1, playerFish.size);
drawPlayerFish(canvas, paint);
drawComputerFishs(canvas, paint, playerFish.size+1, SIZE_5);
drawGoodies(canvas, paint);
drawFrames(canvas, paint);
drawWaypoints(canvas, paint, mTouchedWaypoints);
     }
项目:BrotherWeather    文件:XStatusBar.java   
/**
 * 为 DrawerLayout 布局设置状态栏透明
 *
 * @param activity     需要设置的activity
 * @param drawerLayout DrawerLayout
 */
public static void setTransparentForDrawerLayout(Activity activity, DrawerLayout drawerLayout) {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
        return;
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        activity.getWindow().setStatusBarColor(Color.TRANSPARENT);
    } else {
        activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    }

    ViewGroup contentLayout = (ViewGroup) drawerLayout.getChildAt(0);
    // 内容布局不是 LinearLayout 时,设置padding top
    if (!(contentLayout instanceof LinearLayout) && contentLayout.getChildAt(1) != null) {
        contentLayout.getChildAt(1).setPadding(0, getStatusBarHeight(activity), 0, 0);
    }

    // 设置属性
    setDrawerLayoutProperty(drawerLayout, contentLayout);
}
项目:ShotsNewsApp    文件:ModuleAdapter.java   
private void waveviews(WaveLoadingView mWaveLoadingView){
    mWaveLoadingView.setShapeType(WaveLoadingView.ShapeType.CIRCLE);
    //mWaveLoadingView.setTopTitle("Top Title");
    mWaveLoadingView.setCenterTitleColor(Color.GRAY);
    mWaveLoadingView.setBottomTitleSize(18);
    mWaveLoadingView.setProgressValue(60);
    mWaveLoadingView.setBorderWidth(7);
    mWaveLoadingView.setAmplitudeRatio(60);
    mWaveLoadingView.setWaveColor(Color.parseColor("#2AFFD4"));
    mWaveLoadingView.setBorderColor(Color.parseColor("#2BFFD4"));
    mWaveLoadingView.setTopTitleStrokeColor(Color.BLUE);
    mWaveLoadingView.setTopTitleStrokeWidth(2);
    mWaveLoadingView.setAnimDuration(2000);
    // mWaveLoadingView.pauseAnimation();
    // mWaveLoadingView.resumeAnimation();
    //   mWaveLoadingView.cancelAnimation();
    mWaveLoadingView.startAnimation();

}
项目:FlickLauncher    文件:BaseRecyclerViewFastScrollBar.java   
public BaseRecyclerViewFastScrollBar(BaseRecyclerView rv, Resources res) {
    mRv = rv;
    mPopup = new BaseRecyclerViewFastScrollPopup(rv, res);
    mTrackPaint = new Paint();
    mTrackPaint.setColor(rv.getFastScrollerTrackColor(Color.BLACK));
    mTrackPaint.setAlpha(MAX_TRACK_ALPHA);
    mThumbActiveColor = mThumbInactiveColor = Utilities.getColorAccent(rv.getContext());
    mThumbPaint = new Paint();
    mThumbPaint.setAntiAlias(true);
    mThumbPaint.setColor(mThumbInactiveColor);
    mThumbPaint.setStyle(Paint.Style.FILL);
    mThumbWidth = mThumbMinWidth = res.getDimensionPixelSize(R.dimen.container_fastscroll_thumb_min_width);
    mThumbMaxWidth = res.getDimensionPixelSize(R.dimen.container_fastscroll_thumb_max_width);
    mThumbHeight = res.getDimensionPixelSize(R.dimen.container_fastscroll_thumb_height);
    mThumbCurvature = mThumbMaxWidth - mThumbMinWidth;
    mTouchInset = res.getDimensionPixelSize(R.dimen.container_fastscroll_thumb_touch_inset);
}
项目:empty-state-recyclerview    文件:ContentItemLoadingStateFactory.java   
@Override
public final void onDrawState(final EmptyStateRecyclerView rv, Canvas canvas) {
    final int width = rv.getMeasuredWidth();
    final int height = rv.getMeasuredHeight();

    // Draw all of our content items
    renderContent(numberOfContentItems, width, height, canvas, contentPaint);

    // Setup and start animation, if possible
    if (animateContentItems) {
        if (anim == null) {
            this.anim = ObjectAnimator.ofObject(contentPaint, "color", new ArgbEvaluator(),
                    Color.parseColor("#E0E0E0"), Color.parseColor("#BDBDBD"), Color.parseColor("#9E9E9E"));
            onInterceptAnimatorCreation(anim);
            this.anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
                @Override
                public void onAnimationUpdate(ValueAnimator animation) {
                    rv.invalidate();
                }
            });
            this.anim.start();
        }
    }
}
项目:GitHub    文件:LineChartActivityColored.java   
private LineData getData(int count, float range) {

        ArrayList<Entry> yVals = new ArrayList<Entry>();

        for (int i = 0; i < count; i++) {
            float val = (float) (Math.random() * range) + 3;
            yVals.add(new Entry(i, val));
        }

        // create a dataset and give it a type
        LineDataSet set1 = new LineDataSet(yVals, "DataSet 1");
        // set1.setFillAlpha(110);
        // set1.setFillColor(Color.RED);

        set1.setLineWidth(1.75f);
        set1.setCircleRadius(5f);
        set1.setCircleHoleRadius(2.5f);
        set1.setColor(Color.WHITE);
        set1.setCircleColor(Color.WHITE);
        set1.setHighLightColor(Color.WHITE);
        set1.setDrawValues(false);

        // create a data object with the datasets
        LineData data = new LineData(set1);

        return data;
    }
项目:JInOne    文件:BasePresenterActivity.java   
protected void hideNavBar(){
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        Window window = getWindow();
        window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        window.setStatusBarColor(Color.TRANSPARENT);
        getWindow().getDecorView().setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN|View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
    }
}
项目:kognitivo    文件:WebDialog.java   
@Override
public void onPageFinished(WebView view, String url) {
    super.onPageFinished(view, url);
    if (!isDetached) {
        spinner.dismiss();
    }
    /*
     * Once web view is fully loaded, set the contentFrameLayout background to be transparent
     * and make visible the 'x' image.
     */
    contentFrameLayout.setBackgroundColor(Color.TRANSPARENT);
    webView.setVisibility(View.VISIBLE);
    crossImageView.setVisibility(View.VISIBLE);
    isPageFinished = true;
}
项目:GitHub    文件:CombinedChartActivity.java   
private BarData generateBarData() {

        ArrayList<BarEntry> entries1 = new ArrayList<BarEntry>();
        ArrayList<BarEntry> entries2 = new ArrayList<BarEntry>();

        for (int index = 0; index < itemcount; index++) {
            entries1.add(new BarEntry(0, getRandom(25, 25)));

            // stacked
            entries2.add(new BarEntry(0, new float[]{getRandom(13, 12), getRandom(13, 12)}));
        }

        BarDataSet set1 = new BarDataSet(entries1, "Bar 1");
        set1.setColor(Color.rgb(60, 220, 78));
        set1.setValueTextColor(Color.rgb(60, 220, 78));
        set1.setValueTextSize(10f);
        set1.setAxisDependency(YAxis.AxisDependency.LEFT);

        BarDataSet set2 = new BarDataSet(entries2, "");
        set2.setStackLabels(new String[]{"Stack 1", "Stack 2"});
        set2.setColors(new int[]{Color.rgb(61, 165, 255), Color.rgb(23, 197, 255)});
        set2.setValueTextColor(Color.rgb(61, 165, 255));
        set2.setValueTextSize(10f);
        set2.setAxisDependency(YAxis.AxisDependency.LEFT);

        float groupSpace = 0.06f;
        float barSpace = 0.02f; // x2 dataset
        float barWidth = 0.45f; // x2 dataset
        // (0.45 + 0.02) * 2 + 0.06 = 1.00 -> interval per "group"

        BarData d = new BarData(set1, set2);
        d.setBarWidth(barWidth);

        // make this BarData object grouped
        d.groupBars(0, groupSpace, barSpace); // start at x = 0

        return d;
    }
项目:xlight_android_native    文件:SVBar.java   
@Override
protected void onRestoreInstanceState(Parcelable state) {
    Bundle savedState = (Bundle) state;

    Parcelable superState = savedState.getParcelable(STATE_PARENT);
    super.onRestoreInstanceState(superState);

    setColor(Color.HSVToColor(savedState.getFloatArray(STATE_COLOR)));
    if (savedState.containsKey(STATE_SATURATION)) {
        setSaturation(savedState.getFloat(STATE_SATURATION));
    } else {
        setValue(savedState.getFloat(STATE_VALUE));
    }
}
项目:Selector    文件:GoodSAttrRvNAdapter10.java   
@Override public void onBindViewHolder(final GoodSAttrRvNAdapter10.MyAdapter holder, final int position) {
  holder.attr.setText(mlist.get(position));
  //强制禁止recycleview复用
  holder.setIsRecyclable(false);
  //用来接收综合界面传递过来的选择
  for (int i = 0; i < selectedlist.size(); i++) {
    if (selectedlist.contains(mlist.get(position))) {
      holder.attr.setBackgroundResource(R.drawable.goods_attr_selected_shape);
      holder.attr.setTextColor(Color.WHITE);
    }
  }
  /**
   * 根据选中状态来设置item的背景和字体颜色
   */
  holder.attr.setOnClickListener(new View.OnClickListener() {
    @Override public void onClick(View v) {
      if (selectedlist.size() <= 0) {
        holder.attr.setBackgroundResource(R.drawable.goods_attr_selected_shape);
        holder.attr.setTextColor(Color.WHITE);
        EventBus.getDefault().post(new Eventil(mlist.get(position)));

      } else {
        if (!selectedlist.contains(mlist.get(position))) {
          holder.attr.setBackgroundResource(R.drawable.goods_attr_selected_shape);
          holder.attr.setTextColor(Color.WHITE);
          EventBus.getDefault().post(new Eventil(mlist.get(position)));
        } else {
          holder.attr.setBackgroundResource(R.drawable.goods_attr_unselected_shape);
          holder.attr.setTextColor(Color.BLACK);
        }
      }
      //保存
      DataPresenter.getSingleTon().saveSelect(mlist.get(position));
      EventBus.getDefault().post(new SecondEventil());
    }
  });
}
项目:Artist    文件:CategoryAdapter.java   
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
    CategoryViewHolder categoryViewHolder = (CategoryViewHolder)holder;
    categoryViewHolder.titleText.setText(datas.get(position).getTitle());
    categoryViewHolder.countText.setText(datas.get(position).getCount());
    int color = Color.parseColor(datas.get(position).getColor());
    categoryViewHolder.colorView.setBackgroundColor(color);
}
项目:JZAndroidChart    文件:App.java   
@Override public void onCreate() {
  super.onCreate();
  if (BuildConfig.DEBUG) {
    Takt.stock(this)
        .color(Color.WHITE)
        .seat(Seat.TOP_RIGHT)
        .play();
  }
}
项目:MinimalismJotter    文件:GalleryActivity.java   
public void isShowOkBt() {
    if (Bimp.tempSelectBitmap.size() > 0) {
        send_bt.setText("完成" + "(" + Bimp.tempSelectBitmap.size() + "/" + 9 + ")");
        send_bt.setPressed(true);
        send_bt.setClickable(true);
        send_bt.setTextColor(Color.WHITE);
    } else {
        send_bt.setPressed(false);
        send_bt.setClickable(false);
        send_bt.setTextColor(Color.parseColor("#E1E0DE"));
    }
}
项目:simple-share-android    文件:Utils.java   
public static int getComplementaryColor(int colorToInvert) {
    float[] hsv = new float[3];
    Color.RGBToHSV(Color.red(colorToInvert), Color.green(colorToInvert),
            Color.blue(colorToInvert), hsv);
    hsv[0] = (hsv[0] + 180) % 360;
    return Color.HSVToColor(hsv);
}
项目:HeroVideo-master    文件:BiliDanmukuParser.java   
@Override
public void startElement(String uri, String localName, String qName, Attributes attributes)
        throws SAXException {
    String tagName = localName.length() != 0 ? localName : qName;
    tagName = tagName.toLowerCase(Locale.getDefault()).trim();
    if (tagName.equals("d")) {
        // <d p="23.826000213623,1,25,16777215,1422201084,0,057075e9,757076900">我从未见过如此厚颜无耻之猴</d>
        // 0:时间(弹幕出现时间)
        // 1:类型(1从右至左滚动弹幕|6从左至右滚动弹幕|5顶端固定弹幕|4底端固定弹幕|7高级弹幕|8脚本弹幕)
        // 2:字号
        // 3:颜色
        // 4:时间戳 ?
        // 5:弹幕池id
        // 6:用户hash
        // 7:弹幕id
        String pValue = attributes.getValue("p");
        // parse p value to danmaku
        String[] values = pValue.split(",");
        if (values.length > 0) {
            long time = (long) (Float.parseFloat(values[0]) * 1000); // 出现时间
            int type = Integer.parseInt(values[1]); // 弹幕类型
            float textSize = Float.parseFloat(values[2]); // 字体大小
            int color = (int) ((0x00000000ff000000 | Long.parseLong(values[3])) & 0x00000000ffffffff); // 颜色
            // int poolType = Integer.parseInt(values[5]); // 弹幕池类型(忽略
            item = mContext.mDanmakuFactory.createDanmaku(type, mContext);
            if (item != null) {
                item.setTime(time);
                item.textSize = textSize * (mDispDensity - 0.6f);
                item.textColor = color;
                item.textShadowColor = color <= Color.BLACK ? Color.WHITE : Color.BLACK;
            }
        }
    }
}
项目:ZoomLayout    文件:ColorGridDrawable.java   
private static int getColor(int row, int col) {
    if (COLOR_CACHE[row][col] == 0) {
        final int r = 140 + R.nextInt(100);
        final int g = 140 + R.nextInt(100);
        final int b = 50 + R.nextInt(100);
        COLOR_CACHE[row][col] = Color.rgb(r, g, b);
    }
    return COLOR_CACHE[row][col];
}