Java Code Examples for android.graphics.Color

The following are top voted examples for showing how to use android.graphics.Color. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: GitHub   File: SingleRequestTest.java   Source Code and License 8 votes vote down vote up
@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));
}
 
Example 2
Project: baselibrary-master   File: SmoothCheckBox.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 3
Project: XERUNG   File: Slider.java   Source Code and License 6 votes vote down vote up
@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));
}
 
Example 4
Project: KernelAdiutor-Mod   File: ColorTable.java   Source Code and License 6 votes vote down vote up
@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);
        }
    }
}
 
Example 5
Project: simple-share-android   File: Utils.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 6
Project: Hillffair17   File: HomeAdapter.java   Source Code and License 6 votes vote down vote up
@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));

}
 
Example 7
Project: CCDownload   File: InputInfoActivity.java   Source Code and License 6 votes vote down vote up
@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);
}
 
Example 8
Project: boohee_v5.6   File: BooheeCircleProgressBar.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 9
Project: SmoothChartView   File: SmoothLineChartView.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 10
Project: Mire   File: MorphTransform.java   Source Code and License 6 votes vote down vote up
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);
   }
 
Example 11
Project: Qeet-Remote   File: ToastListAdapter.java   Source Code and License 6 votes vote down vote up
@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));
    }
}
 
Example 12
Project: FastEc   File: ShopCartDelegate.java   Source Code and License 6 votes vote down vote up
@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());
    }


}
 
Example 13
Project: Pocket-Plays-for-Twitch   File: Service.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 14
Project: MySelfDemo   File: MyView2.java   Source Code and License 6 votes vote down vote up
/**
 * 画扇形
 *
 * @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
}
 
Example 15
Project: WaveAudioVizualization   File: VoiceWaveViewTV.java   Source Code and License 6 votes vote down vote up
@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();
    }
}
 
Example 16
Project: SmartChart   File: PieChartRenderer.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 17
Project: FastEc   File: TranslucentBehavior.java   Source Code and License 6 votes vote down vote up
@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()));
    }

}
 
Example 18
Project: SimpleUILauncher   File: BaseRecyclerViewFastScrollBar.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 19
Project: BookyMcBookface   File: GetBooksActivity.java   Source Code and License 6 votes vote down vote up
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);
    }

}
 
Example 20
Project: Mobike   File: ViewfinderView.java   Source Code and License 6 votes vote down vote up
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;
        }
    }
}
 
Example 21
Project: yyox   File: SwipeBackActivityHelper.java   Source Code and License 6 votes vote down vote up
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() {

        }
    });
}
 
Example 22
Project: IdeaTrackerPlus   File: HorizontalAdapter.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 23
Project: Mire   File: ActivitySetWallpapers.java   Source Code and License 6 votes vote down vote up
@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);
}
 
Example 24
Project: ElasticViews   File: ExampleActivity2.java   Source Code and License 6 votes vote down vote up
@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();
}
 
Example 25
Project: AndroFish   File: AndroidFishEatingFish.java   Source Code and License 6 votes vote down vote up
@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);
     }
 
Example 26
Project: BrotherWeather   File: XStatusBar.java   Source Code and License 6 votes vote down vote up
/**
 * 为 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);
}
 
Example 27
Project: ShotsNewsApp   File: ModuleAdapter.java   Source Code and License 6 votes vote down vote up
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();

}
 
Example 28
Project: FlickLauncher   File: BaseRecyclerViewFastScrollBar.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 29
Project: empty-state-recyclerview   File: ContentItemLoadingStateFactory.java   Source Code and License 6 votes vote down vote up
@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();
        }
    }
}
 
Example 30
Project: GitHub   File: LineChartActivityColored.java   Source Code and License 5 votes vote down vote up
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;
    }
 
Example 31
Project: JInOne   File: BasePresenterActivity.java   Source Code and License 5 votes vote down vote up
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);
    }
}
 
Example 32
Project: kognitivo   File: WebDialog.java   Source Code and License 5 votes vote down vote up
@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;
}
 
Example 33
Project: GitHub   File: CombinedChartActivity.java   Source Code and License 5 votes vote down vote up
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;
    }
 
Example 34
Project: xlight_android_native   File: SVBar.java   Source Code and License 5 votes vote down vote up
@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));
	}
}
 
Example 35
Project: Selector   File: GoodSAttrRvNAdapter10.java   Source Code and License 5 votes vote down vote up
@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());
    }
  });
}
 
Example 36
Project: Artist   File: CategoryAdapter.java   Source Code and License 5 votes vote down vote up
@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);
}
 
Example 37
Project: JZAndroidChart   File: App.java   Source Code and License 5 votes vote down vote up
@Override public void onCreate() {
  super.onCreate();
  if (BuildConfig.DEBUG) {
    Takt.stock(this)
        .color(Color.WHITE)
        .seat(Seat.TOP_RIGHT)
        .play();
  }
}
 
Example 38
Project: MinimalismJotter   File: GalleryActivity.java   Source Code and License 5 votes vote down vote up
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"));
    }
}
 
Example 39
Project: HeroVideo-master   File: BiliDanmukuParser.java   Source Code and License 5 votes vote down vote up
@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;
            }
        }
    }
}
 
Example 40
Project: ZoomLayout   File: ColorGridDrawable.java   Source Code and License 5 votes vote down vote up
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];
}
 
Example 41
Project: buildAPKsApps   File: ColorPicker.java   Source Code and License 5 votes vote down vote up
private void drawPointerArrow(Canvas canvas) {

        int centerX = getWidth() / 2;
        int centerY = getHeight() / 2;

        double tipAngle = (colorHSV[2] - 0.5f) * Math.PI;
        double leftAngle = tipAngle + Math.PI / 96;
        double rightAngle = tipAngle - Math.PI / 96;

        double tipAngleX = Math.cos(tipAngle) * outerWheelRadius;
        double tipAngleY = Math.sin(tipAngle) * outerWheelRadius;
        double leftAngleX = Math.cos(leftAngle) * (outerWheelRadius + arrowPointerSize);
        double leftAngleY = Math.sin(leftAngle) * (outerWheelRadius + arrowPointerSize);
        double rightAngleX = Math.cos(rightAngle) * (outerWheelRadius + arrowPointerSize);
        double rightAngleY = Math.sin(rightAngle) * (outerWheelRadius + arrowPointerSize);

        arrowPointerPath.reset();
        arrowPointerPath.moveTo((float) tipAngleX + centerX, (float) tipAngleY + centerY);
        arrowPointerPath.lineTo((float) leftAngleX + centerX, (float) leftAngleY + centerY);
        arrowPointerPath.lineTo((float) rightAngleX + centerX, (float) rightAngleY + centerY);
        arrowPointerPath.lineTo((float) tipAngleX + centerX, (float) tipAngleY + centerY);

        valuePointerArrowPaint.setColor(Color.HSVToColor(colorHSV));
        valuePointerArrowPaint.setStyle(Style.FILL);
        canvas.drawPath(arrowPointerPath, valuePointerArrowPaint);

        valuePointerArrowPaint.setStyle(Style.STROKE);
        valuePointerArrowPaint.setStrokeJoin(Join.ROUND);
        valuePointerArrowPaint.setColor(Color.BLACK);
        canvas.drawPath(arrowPointerPath, valuePointerArrowPaint);

    }
 
Example 42
Project: EosCommander   File: TintVtDrTextView.java   Source Code and License 5 votes vote down vote up
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 43
Project: LaunchEnr   File: PendingAppWidgetHostView.java   Source Code and License 5 votes vote down vote up
private void updateSettingColor() {
    int color = IconColorExtractor.get(getContext(), mIcon);
    // Make the dominant color bright.
    float[] hsv = new float[3];
    Color.colorToHSV(color, hsv);
    hsv[1] = Math.min(hsv[1], MIN_SATUNATION);
    hsv[2] = 1;
    color = Color.HSVToColor(hsv);

    mSettingIconDrawable.setColorFilter(color,  PorterDuff.Mode.SRC_IN);
}
 
Example 44
Project: Leanplum-Android-SDK   File: BackgroundImageView.java   Source Code and License 5 votes vote down vote up
@Override
protected void onDraw(Canvas canvas) {
  super.onDraw(canvas);
  if (fullscreen) {
    return;
  }
  if (loadedBitmap) {
    loadedBitmap = false;
    return;
  }
  Bitmap bitmap = loadBitmapFromView(this);
  canvas.drawColor(Color.TRANSPARENT, Mode.CLEAR);
  bitmap = BitmapUtil.getRoundedCornerBitmap(bitmap, SizeUtil.dp20);
  canvas.drawBitmap(bitmap, emptyMatrix, paint);
}
 
Example 45
Project: Mire   File: ButtonIcon.java   Source Code and License 5 votes vote down vote up
public ButtonIcon setTextColor(String parseTextColor)
{
	mParceTextColor = parseTextColor;
	if (buttonText != null)
	{
		buttonText.setTextColor(Color.parseColor(parseTextColor));
	}
	return this;
}
 
Example 46
Project: Android-Code-Demos   File: Sketch.java   Source Code and License 5 votes vote down vote up
public Sketch(Context context, @Nullable AttributeSet attrs) {
    super(context, attrs);
    mPaint.setStrokeWidth(5);
    mPaint.setStyle(Paint.Style.STROKE);
    mPaint.setColor(Color.BLACK);
    mPaint.setAntiAlias(true);
}
 
Example 47
Project: UpdogFarmer   File: AboutDialog.java   Source Code and License 5 votes vote down vote up
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    final WebView webView = (WebView) LayoutInflater.from(getActivity()).inflate(R.layout.about_dialog, null);
    final String lang = Locale.getDefault().getLanguage();
    String uri = "file:///android_asset/about.html";
    try {
        // Load language-specific version of the about page if available.
        final List<String> assets = Arrays.asList(getResources().getAssets().list(""));
        if (assets.contains(String.format("about-%s.html", lang))) {
            uri = String.format("file:///android_asset/about-%s.html", lang);
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
    if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) {
        // Getting Chromium crashes on certain KitKat devices. Might be caused by hardware acceleration
        webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    }
    webView.loadUrl(uri);
    webView.setBackgroundColor(Color.TRANSPARENT);
    return new AlertDialog.Builder(getActivity())
            .setTitle(R.string.about)
            .setView(webView)
            .setPositiveButton(R.string.ok, null)
            .create();
}
 
Example 48
Project: yyox   File: EmoticonPageView.java   Source Code and License 5 votes vote down vote up
public EmoticonPageView(Context context, AttributeSet attrs) {
    super(context, attrs);
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = inflater.inflate(R.layout.kf5_emoticon_page, this);
    mGvEmotion = (GridView) view.findViewById(R.id.kf5_grid_view_emotion);

    if (Build.VERSION.SDK_INT > Build.VERSION_CODES.HONEYCOMB) {
        mGvEmotion.setMotionEventSplittingEnabled(false);
    }
    mGvEmotion.setStretchMode(GridView.STRETCH_COLUMN_WIDTH);
    mGvEmotion.setCacheColorHint(0);
    mGvEmotion.setSelector(new ColorDrawable(Color.TRANSPARENT));
    mGvEmotion.setVerticalScrollBarEnabled(false);
}
 
Example 49
Project: chat-sdk-android-push-firebase   File: BMessageEntity.java   Source Code and License 5 votes vote down vote up
public static int randomColor(){
    Random random = new Random();
    switch (random.nextInt(9))
    {
        case 0:
            return Color.parseColor("#eea9a4");

        case 1:
            return Color.parseColor("#e2b27b");

        case 2:
            return Color.parseColor("#a28daf");

        case 3:
            return Color.parseColor("#bcc9ab");

        case 4:
            return Color.parseColor("#f4e6b8");

        case 5:
            return Color.parseColor("#8ebdd1");

        case 6:
            return Color.parseColor("#c0d2a1");

        case 7:
            return Color.parseColor("#9acccb");

        case 8:
            return Color.parseColor("#9ccaa7");
    }

    return 0;
}
 
Example 50
Project: buddybox   File: MainActivity.java   Source Code and License 5 votes vote down vote up
private void lovedActivate() {
    final Handler handler = new Handler();
    handler.postDelayed(new Runnable() {
        @Override
        public void run() {
            dispatch(LOVED_VIEWED);
        }
    }, 2000);
    findViewById(R.id.frameLoved).setVisibility(View.VISIBLE);
    ((TextView) findViewById(R.id.lovedText)).setTextColor(Color.parseColor("#4fc3f7"));
    ((ImageView) findViewById(R.id.lovedNavbarBtn)).setImageResource(R.drawable.ic_loved_blue);
}
 
Example 51
Project: OSchina_resources_android   File: RichEditText.java   Source Code and License 5 votes vote down vote up
private void setSectionStyle(TextSection section) {
    setColorSpan(Color.parseColor(("#" + section.getColorHex())));
    setBold(section.isBold());
    setItalic(section.isItalic());
    setMidLine(section.isMidLine());
    setAlignStyle(section.getAlignment());
    setTextSizeSpan(section.getTextSize());

}
 
Example 52
Project: MainCalendar   File: FilePicker.java   Source Code and License 5 votes vote down vote up
@Nullable
@Override
protected View makeFooterView() {
    textView = new MarqueeTextView(activity);
    textView.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT, WRAP_CONTENT));
    textView.setTextColor(Color.BLACK);
    textView.setGravity(Gravity.CENTER_VERTICAL);
    int padding = ConvertUtils.toPx(activity, 10);
    textView.setPadding(padding, padding, padding, padding);
    return textView;
}
 
Example 53
Project: QuranAndroid   File: TafseerShowAdapter.java   Source Code and License 5 votes vote down vote up
public ViewHolder(View layout)
{
    titleAndInfo = (TextView) layout.findViewById(R.id.titleAndInfo);
    aya = (TextView) layout.findViewById(R.id.aya);
    tafseer = (WebView) layout.findViewById(R.id.tafseer);

    tafseer.setBackgroundColor(Color.TRANSPARENT);
    ayaguide = (TextView) layout.findViewById(R.id.ayaguide);
}
 
Example 54
Project: GitHub   File: TextBadgeItem.java   Source Code and License 5 votes vote down vote up
/**
 * @param context to fetch color
 * @return background color
 */
private int getBackgroundColor(Context context) {
    if (this.mBackgroundColorResource != 0) {
        return ContextCompat.getColor(context, mBackgroundColorResource);
    } else if (!TextUtils.isEmpty(mBackgroundColorCode)) {
        return Color.parseColor(mBackgroundColorCode);
    } else {
        return mBackgroundColor;
    }
}
 
Example 55
Project: mvvm-template   File: GitHubContributionsView.java   Source Code and License 5 votes vote down vote up
/**
 * Set a base color for blocks.
 * The tone depends on the number of contributions for a day.
 * Supported formats See {@link Color#parseColor(String)}
 *
 * @param baseColor
 *         base color supported formats
 */
public void setBaseColor(String baseColor) {
    try {
        this.baseColor = Color.parseColor(baseColor);
    } catch (IllegalArgumentException e) {
        e.printStackTrace();
    }
    invalidate();
}
 
Example 56
Project: mdb-android-application   File: MoviesGridAdapter.java   Source Code and License 5 votes vote down vote up
public void setMovieItem(final MovieEntity movieEntity) {
    this.movieEntity = movieEntity;
    setupFavoritesButton();
    ViewCompat.setTransitionName(moviePoster, movieEntity.getTitle());
    Glide.with(context)
            .load(Uri.parse(ApiConstants.BASE_IMAGE_URL + movieEntity.getPosterPath()))
            .placeholder(Color.GRAY)
            .diskCacheStrategy(DiskCacheStrategy.RESULT)
            .centerCrop()
            .crossFade()
            .into(moviePoster);
    itemView.setOnClickListener(this);
}
 
Example 57
Project: mapbox-plugins-android   File: AutocompleteLauncherActivity.java   Source Code and License 5 votes vote down vote up
@OnClick(R.id.fabFullScreen)
public void onFullScreenFabClick(View view) {
  Intent intent = new PlaceAutocomplete.IntentBuilder()
    .accessToken(Mapbox.getAccessToken())
    .placeOptions(PlaceOptions.builder()
      .backgroundColor(Color.WHITE)
      .addInjectedFeature(home)
      .addInjectedFeature(work)
      .build())
    .build(AutocompleteLauncherActivity.this);
  startActivityForResult(intent, REQUEST_CODE_AUTOCOMPLETE);
}
 
Example 58
Project: BilibiliClient   File: BiliDanmukuParser.java   Source Code and License 5 votes vote down vote up
@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;
      }
    }
  }
}
 
Example 59
Project: mobile-store   File: ShareChooserDialog.java   Source Code and License 5 votes vote down vote up
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    final Dialog dialog = super.onCreateDialog(savedInstanceState);
    dialog.setOnShowListener(new DialogInterface.OnShowListener() {
        @Override
        public void onShow(DialogInterface dialogInterface) {
            dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
            dialog.getWindow().setLayout(
                    parentWidth - Utils.dpToPx(0, getContext()), // Set margins here!
                    ViewGroup.LayoutParams.MATCH_PARENT);
        }
    });
    return dialog;
}
 
Example 60
Project: multi-copy   File: NewNoteActivity.java   Source Code and License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_note_edit_actvity);
    Toolbar toolbar = (Toolbar) findViewById(R.id.my_toolbar);
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setHomeButtonEnabled(true);
    actionBar.setTitle("New Note");
    toolbar.setTitleTextColor(Color.WHITE);
    etNotes = (EditText) findViewById(R.id.etNoteEdit);
}