Java Code Examples for android.graphics.Color
The following examples show how to use
android.graphics.Color. These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: Focus Source File: StatusBarUtil.java License: GNU General Public License v3.0 | 6 votes |
/** * 为 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 2
Source Project: NIM_Android_UIKit Source File: RobotTextView.java License: MIT License | 6 votes |
@Override public void onBindContentView() { if (element != null) { textView.setText(element.getContent()); if (element.getColor() != null) { try { textView.setTextColor(Color.parseColor("#" + element.getColor())); } catch (IllegalArgumentException e) { e.printStackTrace(); } } else if (color != -1) { textView.setTextColor(color); } } else if (!TextUtils.isEmpty(content)) { textView.setText(content); } }
Example 3
Source Project: visual-goodies Source File: ListFragment2.java License: Apache License 2.0 | 6 votes |
@Override public void bindDataToItem(int index, View itemView, View detailsView, ImageView imageViewOrAvatar, ImageButton imageButton, TextView... txt) { DummyObject current = (DummyObject) objects[index]; itemView.setBackgroundColor(Color.parseColor("#F3F3F3")); Picasso.with(getActivity()).load((Integer) current.getAvatar()).into(imageViewOrAvatar); txt[0].setText(current.getName()); //1st text view's text txt[1].setText(current.getDescription()); //2nd imageButton.setImageDrawable(ContextCompat.getDrawable(getActivity(), IMAGE_BUTTON_RESID)); }
Example 4
Source Project: secureit Source File: MicrophoneVolumePicker.java License: MIT License | 6 votes |
private void drawPlot(Canvas canvas, int width) { float step = 10*(_drawableAreaHeight/((float)FULL_SCALE)); float lineLevel = PADDING_TOP + _drawableAreaHeight; float left = PADDING_LEFT + _drawableAreaWidth/2 - 60; float right = PADDING_LEFT + _drawableAreaWidth/2 + 100; for (int i=0; i< FULL_SCALE/10 + 1; i++) { paint.setColor(Color.BLACK); if (i*10 == NOISE_THRESHOLD || i*10 == CLIPPING_THRESHOLD) { paint.setStrokeWidth(3.0f); canvas.drawLine(left, lineLevel, right, lineLevel, paint); paint.setStrokeWidth(0); } else { canvas.drawLine(left, lineLevel, right, lineLevel, paint); } if (i%2 == 0) { paint.setTextAlign(Paint.Align.RIGHT); canvas.drawText(Integer.toString(i*10), left - 10, lineLevel, paint); } else { paint.setTextAlign(Paint.Align.LEFT); canvas.drawText(Integer.toString(i*10), right + 10, lineLevel, paint); } lineLevel = lineLevel - step; } }
Example 5
Source Project: GLEXP-Team-onebillion Source File: OC_Reading.java License: Apache License 2.0 | 6 votes |
public void prepare() { super.prepare(); loadFingers(); highlightColour = Color.RED; backgroundColour = Color.argb(255,0,243,243); sharedLock = new ReentrantLock(); sharedCondition = sharedLock.newCondition(); pageNo = 0; if (parameters.get("page") != null) pageNo = Integer.parseInt(parameters.get("page")); doArrowDemo = !OBUtils.coalesce(parameters.get("arrowdemo"),"true").equals("false"); initialised = true; paragraphs = loadPageXML(getLocalPath("book.xml")); loadTemplate(); int i = 1; for (OBReadingPara para : paragraphs) { loadTimingsPara(para,getLocalPath(String.format("p%d_%d.etpa",pageNo,i)),false); loadTimingsPara(para,getLocalPath(String.format("ps%d_%d.etpa",pageNo,i)),true); i++; } //setButtons(); setUpScene(); }
Example 6
Source Project: 920-text-editor-v2 Source File: JecActivity.java License: Apache License 2.0 | 6 votes |
protected void setStatusBarColor(ViewGroup drawerLayout) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { return; } if (isFullScreenMode()) return; TypedArray a = getTheme().obtainStyledAttributes(new int[]{R.attr.colorPrimary}); int color = a.getColor(0, Color.TRANSPARENT); a.recycle(); if (drawerLayout != null) { StatusBarUtil.setColorForDrawerLayout(this, drawerLayout, color, 0); } else { StatusBarUtil.setColor(this, color, 0); } }
Example 7
Source Project: UltimateAndroid Source File: SnackbarRecyclerViewSampleActivity.java License: Apache License 2.0 | 6 votes |
@Override public boolean onOptionsItemSelected(MenuItem item) { switch(item.getItemId()) { case android.R.id.home: finish(); return true; case R.id.action_add_snackbar: SnackbarManager.show( Snackbar.with(SnackbarRecyclerViewSampleActivity.this) .text("Woo, snackbar!") .actionLabel("Close") .actionColor(Color.parseColor("#FF8A80")) .duration(Snackbar.SnackbarDuration.LENGTH_LONG) .attachToRecyclerView(mRecyclerView)); return true; default: return super.onOptionsItemSelected(item); } }
Example 8
Source Project: SmartFlasher Source File: BorderCircleView.java License: GNU General Public License v3.0 | 6 votes |
public BorderCircleView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); if (isClickable()) { setForeground(ViewUtils.getSelectableBackground(context)); } mCheck = ContextCompat.getDrawable(context, R.drawable.ic_done); DrawableCompat.setTint(mCheck, Color.WHITE); mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mPaint.setColor(ViewUtils.getThemeAccentColor(context)); mPaintBorder = new Paint(Paint.ANTI_ALIAS_FLAG); mPaintBorder.setColor(ViewUtils.getColorPrimaryColor(context)); mPaintBorder.setStrokeWidth((int) getResources().getDimension(R.dimen.circleview_border)); mPaintBorder.setStyle(Paint.Style.STROKE); setWillNotDraw(false); }
Example 9
Source Project: javaide Source File: ColorPickerView.java License: GNU General Public License v3.0 | 6 votes |
private ColorCircle findNearestByColor(int color) { float[] hsv = new float[3]; Color.colorToHSV(color, hsv); ColorCircle near = null; double minDiff = Double.MAX_VALUE; double x = hsv[1] * Math.cos(hsv[0] * Math.PI / 180); double y = hsv[1] * Math.sin(hsv[0] * Math.PI / 180); for (ColorCircle colorCircle : renderer.getColorCircleList()) { float[] hsv1 = colorCircle.getHsv(); double x1 = hsv1[1] * Math.cos(hsv1[0] * Math.PI / 180); double y1 = hsv1[1] * Math.sin(hsv1[0] * Math.PI / 180); double dx = x - x1; double dy = y - y1; double dist = dx * dx + dy * dy; if (dist < minDiff) { minDiff = dist; near = colorCircle; } } return near; }
Example 10
Source Project: API-Calling-Flow Source File: ApiCallingFlow.java License: Apache License 2.0 | 6 votes |
/** * <b>private void initializeViews()</b> * <p>This function is used to initialize required views.</p> * Created by - Rohit */ private void initializeViews() { btnTryAgain = ((Button) progressLayout.findViewById(R.id.btnTryAgain)); btnTryAgain.setVisibility(View.GONE); pbLoading = ((ProgressBar) progressLayout.findViewById(R.id.progressBar)); pbLoading.getIndeterminateDrawable().setColorFilter(ContextCompat.getColor(mContext, mProgressBarColor), android.graphics.PorterDuff.Mode.MULTIPLY); pbLoading.setVisibility(View.GONE); tvApiError = ((TextView) progressLayout.findViewById(R.id.tvApiError)); tvApiError.setVisibility(View.GONE); ivCancel = (ImageView) progressLayout.findViewById(R.id.imgCancel); ivCancel.setVisibility(View.GONE); tvEnableNetwork = (TextView) progressLayout.findViewById(R.id.tvEnableNetwork); tvEnableNetwork.setVisibility(View.GONE); RelativeLayout rlBaseLayout = (RelativeLayout) progressLayout.findViewById(R.id.rl_base_layout); if (isTransparent) { rlBaseLayout.setBackgroundColor(Color.TRANSPARENT); } else { rlBaseLayout.setBackgroundColor(Color.WHITE); } }
Example 11
Source Project: rtmp-rtsp-stream-client-java Source File: TextStreamObject.java License: Apache License 2.0 | 6 votes |
private Bitmap textAsBitmap(String text, float textSize, int textColor, Typeface typeface) { Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); paint.setTextSize(textSize); paint.setColor(textColor); paint.setAlpha(255); if (typeface != null) paint.setTypeface(typeface); paint.setTextAlign(Paint.Align.LEFT); float baseline = -paint.ascent(); // ascent() is negative int width = (int) (paint.measureText(text) + 0.5f); // round int height = (int) (baseline + paint.descent() + 0.5f); Bitmap image = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(image); canvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR); canvas.drawText(text, 0, baseline, paint); return image; }
Example 12
Source Project: PocketEOS-Android Source File: ImmersionBar.java License: GNU Lesser General Public License v3.0 | 6 votes |
/** * 初始化android 5.0以上状态栏和导航栏 * * @param uiFlags the ui flags * @return the int */ @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) private int initBarAboveLOLLIPOP(int uiFlags) { uiFlags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN; //Activity全屏显示,但状态栏不会被隐藏覆盖,状态栏依然可见,Activity顶端布局部分会被状态栏遮住。 if (mBarParams.fullScreen && mBarParams.navigationBarEnable) { uiFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION; //Activity全屏显示,但导航栏不会被隐藏覆盖,导航栏依然可见,Activity底部布局部分会被导航栏遮住。 } mWindow.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); if (mConfig.hasNavigtionBar()) { //判断是否存在导航栏 mWindow.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); } mWindow.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); //需要设置这个才能设置状态栏颜色 if (mBarParams.statusBarFlag) mWindow.setStatusBarColor(ColorUtils.blendARGB(mBarParams.statusBarColor, mBarParams.statusBarColorTransform, mBarParams.statusBarAlpha)); //设置状态栏颜色 else mWindow.setStatusBarColor(ColorUtils.blendARGB(mBarParams.statusBarColor, Color.TRANSPARENT, mBarParams.statusBarAlpha)); //设置状态栏颜色 if (mBarParams.navigationBarEnable) mWindow.setNavigationBarColor(ColorUtils.blendARGB(mBarParams.navigationBarColor, mBarParams.navigationBarColorTransform, mBarParams.navigationBarAlpha)); //设置导航栏颜色 return uiFlags; }
Example 13
Source Project: TextOcrExample Source File: PreviewBorderView.java License: Apache License 2.0 | 6 votes |
/** * 初始化绘图变量 */ private void init() { this.mHolder = getHolder(); this.mHolder.addCallback(this); this.mHolder.setFormat(PixelFormat.TRANSPARENT); setZOrderOnTop(true); setZOrderMediaOverlay(true); this.mPaint = new Paint(); this.mPaint.setAntiAlias(true); this.mPaint.setColor(Color.WHITE); this.mPaint.setStyle(Paint.Style.FILL_AND_STROKE); this.mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR)); this.mPaintLine = new Paint(); this.mPaintLine.setColor(Color.BLUE); this.mPaintLine.setStrokeWidth(5.0F); this.mTextPaint = new Paint(); this.mTextPaint.setColor(Color.WHITE); this.mTextPaint.setStrokeWidth(3.0F); setKeepScreenOn(true); }
Example 14
Source Project: 365browser Source File: CompositorView.java License: Apache License 2.0 | 6 votes |
/** * Creates a {@link CompositorView}. This can be called only after the native library is * properly loaded. * @param c The Context to create this {@link CompositorView} in. * @param host The renderer host owning this view. */ public CompositorView(Context c, LayoutRenderHost host) { super(c); mRenderHost = host; mCompositorSurfaceManager = new CompositorSurfaceManager(this, this); // Cover the black surface before it has valid content. Set this placeholder view to // visible, but don't yet make SurfaceView visible, in order to delay // surfaceCreate/surfaceChanged calls until the native library is loaded. setBackgroundColor(Color.WHITE); super.setVisibility(View.VISIBLE); // Request the opaque surface. We might need the translucent one, but // we don't know yet. We'll switch back later if we discover that // we're on a low memory device that always uses translucent. mCompositorSurfaceManager.requestSurface(PixelFormat.OPAQUE); }
Example 15
Source Project: ChromeLikeTabSwitcher Source File: TabSwitcherDrawable.java License: Apache License 2.0 | 6 votes |
/** * Creates a new drawable, which allows to display the number of tabs, which are currently * contained by a {@link TabSwitcher}. * * @param context * The context, which should be used by the drawable, as an instance of the class {@link * Context}. The context may not be null */ public TabSwitcherDrawable(@NonNull final Context context) { Condition.INSTANCE.ensureNotNull(context, "The context may not be null"); Resources resources = context.getResources(); size = resources.getDimensionPixelSize(R.dimen.tab_switcher_drawable_size); textSizeNormal = resources.getDimensionPixelSize(R.dimen.tab_switcher_drawable_font_size_normal); textSizeSmall = resources.getDimensionPixelSize(R.dimen.tab_switcher_drawable_font_size_small); background = ContextCompat.getDrawable(context, R.drawable.tab_switcher_drawable_background) .mutate(); paint = new Paint(Paint.ANTI_ALIAS_FLAG); paint.setColor(Color.WHITE); paint.setTextAlign(Align.CENTER); paint.setTextSize(textSizeNormal); paint.setTypeface(Typeface.create(Typeface.SANS_SERIF, Typeface.BOLD)); label = Integer.toString(0); int tint = ThemeUtil.getColor(context, android.R.attr.textColorPrimary); setColorFilter(tint, PorterDuff.Mode.MULTIPLY); }
Example 16
Source Project: LeafChart Source File: OutsideLineRenderer.java License: Apache License 2.0 | 6 votes |
/** * 画圆点 * @param canvas */ public void drawPoints(Canvas canvas, Line line, Axis axisY, int moveX) { if (line != null && line.isHasPoints() && isShow) { List<PointValue> values = line.getValues(); float radius = LeafUtil.dp2px(mContext, line.getPointRadius()); float strokeWidth = LeafUtil.dp2px(mContext, 1); PointValue point; canvas.save(Canvas.CLIP_SAVE_FLAG); canvas.clipRect(axisY.getStartX(), 0, mWidth, mHeight); for (int i = 0, size = values.size(); i < size; i++) { point = values.get(i); labelPaint.setStyle(Paint.Style.FILL); labelPaint.setColor(line.getPointColor()); canvas.drawCircle(point.getOriginX() + moveX, point.getOriginY(), radius , labelPaint); labelPaint.setStyle(Paint.Style.STROKE); labelPaint.setColor(Color.WHITE); labelPaint.setStrokeWidth(strokeWidth); canvas.drawCircle(point.getOriginX() + moveX, point.getOriginY(), radius , labelPaint); } canvas.restore(); } }
Example 17
Source Project: YCProgress Source File: RingProgressBar.java License: Apache License 2.0 | 6 votes |
private void initialize(Context context, AttributeSet attrs) { TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.RingProgressBar); // 获取自定义属性值或默认值 progressMax = ta.getInteger(R.styleable.RingProgressBar_progressMax, 100); dotColor = ta.getColor(R.styleable.RingProgressBar_dotColor, Color.WHITE); dotBgColor = ta.getColor(R.styleable.RingProgressBar_dotBgColor, Color.GRAY); showMode = ta.getInt(R.styleable.RingProgressBar_showMode, ProgressBarUtils.RingShowMode.SHOW_MODE_PERCENT); if (showMode != ProgressBarUtils.RingShowMode.SHOW_MODE_NULL) { percentTextSize = ta.getDimension(R.styleable.RingProgressBar_percentTextSize, ProgressBarUtils.dp2px(context,30)); percentTextColor = ta.getInt(R.styleable.RingProgressBar_percentTextColor, Color.WHITE); percentThinPadding = ta.getInt(R.styleable.RingProgressBar_percentThinPadding, 0); unitText = ta.getString(R.styleable.RingProgressBar_unitText); unitTextSize = ta.getDimension(R.styleable.RingProgressBar_unitTextSize, percentTextSize); unitTextColor = ta.getInt(R.styleable.RingProgressBar_unitTextColor, Color.BLACK); unitTextAlignMode = ta.getInt(R.styleable.RingProgressBar_unitTextAlignMode, UNIT_TEXT_ALIGN_MODE_DEFAULT); if (unitText == null) { unitText = "%"; } } ta.recycle(); }
Example 18
Source Project: android-kline Source File: LineChartRenderer.java License: Apache License 2.0 | 5 votes |
public LineChartRenderer(LineDataProvider chart, ChartAnimator animator, ViewPortHandler viewPortHandler) { super(animator, viewPortHandler); mChart = chart; mCirclePaintInner = new Paint(Paint.ANTI_ALIAS_FLAG); mCirclePaintInner.setStyle(Paint.Style.FILL); mCirclePaintInner.setColor(Color.WHITE); }
Example 19
Source Project: ColorPicker Source File: ColorPreference.java License: Apache License 2.0 | 5 votes |
@Override protected void onClick() { int[] colors = mColors.length != 0 ? mColors : new int[] { Color.BLACK, Color.WHITE, Color .RED, Color.GREEN, Color.BLUE }; ColorPickerDialog d = ColorPickerDialog.newInstance(mTitle, colors, mCurrentValue, mColumns, ColorPickerDialog.SIZE_SMALL, mBackwardsOrder, mStrokeWidth, mStrokeColor); d.setOnColorSelectedListener(this); d.show(((Activity) getContext()).getFragmentManager(), null); }
Example 20
Source Project: adt-leanback-support Source File: ShadowHelperApi21.java License: Apache License 2.0 | 5 votes |
public static Object addShadow(ViewGroup shadowContainer, boolean roundedCorners) { initializeResources(shadowContainer.getResources()); if (roundedCorners) { RoundedRectHelperApi21.setRoundedRectBackground(shadowContainer, Color.TRANSPARENT); } else { shadowContainer.setOutlineProvider(sOutlineProvider); } shadowContainer.setZ(sNormalZ); shadowContainer.setTransitionGroup(true); return shadowContainer; }
Example 21
Source Project: SwipePlaybarDemo Source File: MainActivity.java License: Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = ButterKnife.findById(this, R.id.my_awesome_toolbar); setSupportActionBar(toolbar); materialMenu = new MaterialMenuIconToolbar(this, Color.WHITE, MaterialMenuDrawable.Stroke.REGULAR) { @Override public int getToolbarViewId() { return R.id.my_awesome_toolbar; } }; getSupportFragmentManager().beginTransaction().replace(R.id.container_play_ctrl_bar, PlayCtrlBarFragment.instance()) .commitAllowingStateLoss(); }
Example 22
Source Project: geoar-app Source File: Radar.java License: Apache License 2.0 | 5 votes |
@Override protected void initDrawingTools() { radarCirclePaint = new Paint(); radarCirclePaint.setAntiAlias(true); radarCirclePaint.setStyle(Paint.Style.STROKE); radarCirclePaint.setStrokeWidth(0.05f); radarCirclePaint.setShader(new LinearGradient(0.40f, 0.0f, 0.60f, 1.0f, Color.rgb(0xf0, 0xf5, 0xf0), Color.rgb(0x30, 0x31, 0x30), Shader.TileMode.CLAMP)); radarOvalPaint = new Paint(); radarOvalPaint.setAntiAlias(true); radarOvalPaint.setStyle(Paint.Style.FILL); radarOvalPaint.setColor(Color.argb(100, 0, 0, 200)); }
Example 23
Source Project: droidddle Source File: ThemeListPreference.java License: Apache License 2.0 | 5 votes |
public static Bitmap getPreviewBitmap(float density, String colorStr) { int color = Color.GRAY; try { color = Color.parseColor(colorStr); } catch (Exception e) { } return getPreviewBitmap(density, color); }
Example 24
Source Project: android-common-utils Source File: CustomSwipeBaseAdapter.java License: Apache License 2.0 | 5 votes |
/** * Makes a new view that combines itemView and swipeLeftView to hold the * data pointed to by position. * * @param context Interface to application's global information * @param position The position from which to get the data. * @param parent The View to which the new view is attached to * @return */ private View newView(Context context, int position, ViewGroup parent) { // get a new itemView and init it. View itemView = newItemView(context, position, parent); if (itemView == null) throw new IllegalStateException("the itemView can't be null!"); // set a tag for the itemMainView which is used in CustomSwipeListView. itemView.setTag(CustomSwipeListView.ITEMMAIN_LAYOUT_TAG); // itemLayout indicates the outermost layout of the new view. RelativeLayout itemLayout = new RelativeLayout(context); itemLayout.setLayoutParams(new AbsListView.LayoutParams( itemView.getLayoutParams().width, itemView.getLayoutParams().height)); itemLayout.addView(itemView); // get a new swipeLeftView and init it. View swipeLeftView = newSwipeLeftView(context, position, parent); if (swipeLeftView == null) return itemLayout; // set a tag for the swipeLeftView which is used in CustomSwipeListView. swipeLeftView.setTag(CustomSwipeListView.ITEMSWIPE_LAYOUT_TAG); swipeLeftView.setVisibility(View.GONE); // itemSwipeLeftLayout indicates the layout of the swipeLeftView. RelativeLayout itemSwipeLeftLayout = new RelativeLayout(context); itemSwipeLeftLayout.setLayoutParams(new AbsListView.LayoutParams( itemView.getLayoutParams().width, itemView.getLayoutParams().height)); itemSwipeLeftLayout.setHorizontalGravity(Gravity.END); itemSwipeLeftLayout.setBackgroundColor(Color.TRANSPARENT); itemSwipeLeftLayout.addView(swipeLeftView); itemLayout.addView(itemSwipeLeftLayout); return itemLayout; }
Example 25
Source Project: Conversations Source File: Message.java License: GNU General Public License v3.0 | 5 votes |
@Override public int getAvatarBackgroundColor() { if (type == Message.TYPE_STATUS && getCounterparts() != null && getCounterparts().size() > 1) { return Color.TRANSPARENT; } else { return UIHelper.getColorForName(UIHelper.getMessageDisplayName(this)); } }
Example 26
Source Project: YImagePicker Source File: ShowTypeImageView.java License: Apache License 2.0 | 5 votes |
private void init() { mCirclePaint = new Paint(); mCirclePaint.setAntiAlias(true); mCirclePaint.setColor(Color.parseColor("#ffffff")); mCirclePaint.setAlpha(200); mMaskPaint = new Paint(); mMaskPaint.setAntiAlias(true); mMaskPaint.setColor(Color.parseColor("#40000000")); mBitmapPaint = new Paint(); mBitmapPaint.setAntiAlias(true); mTextPaint = new Paint(); mTextPaint.setAntiAlias(true); mTextPaint.setColor(Color.parseColor("#90000000")); mTextPaint.setTextSize(sp(12)); mTextPaint.setTypeface(Typeface.DEFAULT_BOLD); rectF = new RectF(); mSelectPaint = new Paint(); mSelectPaint.setAntiAlias(true); mSelectPaint.setStrokeWidth(dp(4)); mSelectPaint.setStyle(Paint.Style.STROKE); try { videoBitmap = ((BitmapDrawable) getResources().getDrawable(R.mipmap.picker_item_video)).getBitmap(); } catch (Exception ignored) { } }
Example 27
Source Project: excelPanel Source File: MainActivity.java License: Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); pager = (ViewPager) findViewById(R.id.pager); tabLayout = (TabLayout) findViewById(R.id.tab_layout); pager.setAdapter(new ExcelPagerAdapter(getSupportFragmentManager())); tabLayout.setupWithViewPager(pager); tabLayout.setTabTextColors(Color.WHITE,Color.WHITE); }
Example 28
Source Project: Alarmio Source File: AppIconView.java License: Apache License 2.0 | 5 votes |
public AppIconView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); paint = new Paint(); paint.setAntiAlias(true); paint.setColor(Color.parseColor("#212121")); paint.setDither(true); animator = ValueAnimator.ofFloat(bgScale, 0.8f); animator.setInterpolator(new OvershootInterpolator()); animator.setDuration(750); animator.setStartDelay(250); animator.addUpdateListener(animator -> { bgScale = (float) animator.getAnimatedValue(); invalidate(); }); animator.start(); animator = ValueAnimator.ofFloat(rotation, 0); animator.setInterpolator(new DecelerateInterpolator()); animator.setDuration(1000); animator.setStartDelay(250); animator.addUpdateListener(animator -> { fgScale = animator.getAnimatedFraction() * 0.8f; rotation = (float) animator.getAnimatedValue(); invalidate(); }); animator.start(); animator = ValueAnimator.ofFloat(bgRotation, 0); animator.setInterpolator(new DecelerateInterpolator()); animator.setDuration(1250); animator.setStartDelay(250); animator.addUpdateListener(animator -> { bgRotation = (float) animator.getAnimatedValue(); invalidate(); }); animator.start(); }
Example 29
Source Project: AndroidFaceRecognizer Source File: FaceDetectionActivity.java License: MIT License | 5 votes |
private void initOtherViews(){ RelativeLayout.LayoutParams captureButtonParams = new RelativeLayout.LayoutParams(3*screenWidth/10, screenHeight/8); captureButtonParams.addRule(RelativeLayout.CENTER_HORIZONTAL); captureButtonParams.topMargin = screenHeight / 30; captureButton.setLayoutParams(captureButtonParams); captureText.setLayoutParams(captureButtonParams); captureText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, screenHeight/40); RelativeLayout.LayoutParams nameEditParams = new RelativeLayout.LayoutParams(3*screenWidth/10, screenHeight/8); nameEditParams.addRule(RelativeLayout.CENTER_HORIZONTAL); nameEditParams.addRule(RelativeLayout.BELOW, captureButton.getId()); nameEditParams.topMargin = screenHeight / 30; nameEdit.setLayoutParams(nameEditParams); nameEdit.setTextSize(TypedValue.COMPLEX_UNIT_DIP, screenHeight/42); nameEdit.setTextColor(Color.BLACK); RelativeLayout.LayoutParams saveButtonParams = new RelativeLayout.LayoutParams(3*screenWidth/10, screenHeight/8); saveButtonParams.addRule(RelativeLayout.CENTER_HORIZONTAL); saveButtonParams.addRule(RelativeLayout.BELOW, nameEdit.getId()); saveButtonParams.topMargin = screenHeight / 30; saveButton.setLayoutParams(saveButtonParams); saveButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, screenHeight/40); if(!isTraining){ deleteButtonFirstPos = screenHeight / 8 + screenHeight /15; deleteButtonSecondPos = 3*screenHeight / 8 + 2*screenHeight /15; RelativeLayout.LayoutParams deleteButtonParams = new RelativeLayout.LayoutParams(3*screenWidth/10, screenHeight/8); deleteButtonParams.topMargin = deleteButtonFirstPos; deleteButtonParams.addRule(RelativeLayout.CENTER_HORIZONTAL); deleteButton.setLayoutParams(deleteButtonParams); deleteButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, screenHeight/42); } }
Example 30
Source Project: AndroidPicker Source File: ColorPanelView.java License: MIT License | 5 votes |
private int getColorForGradient(float[] hsv) { // fixed: 17-1-7 Equality tests should not be made with floating point values. if ((int) hsv[2] != 1) { float oldV = hsv[2]; hsv[2] = 1; int color = Color.HSVToColor(hsv); hsv[2] = oldV; return color; } else { return Color.HSVToColor(hsv); } }