List of usage examples for android.graphics Paint ANTI_ALIAS_FLAG
int ANTI_ALIAS_FLAG
To view the source code for android.graphics Paint ANTI_ALIAS_FLAG.
Click Source Link
From source file:me.lizheng.deckview.helpers.FakeShadowDrawable.java
public FakeShadowDrawable(Context context, DeckViewConfig config) { mShadowStartColor = ContextCompat.getColor(context, R.color.fake_shadow_start_color); mShadowEndColor = ContextCompat.getColor(context, R.color.fake_shadow_end_color); mInsetShadow = context.getResources().getDimension(R.dimen.fake_shadow_inset); setShadowSize(context.getResources().getDimensionPixelSize(R.dimen.fake_shadow_size), context.getResources().getDimensionPixelSize(R.dimen.fake_shadow_size)); mCornerShadowPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG); mCornerShadowPaint.setStyle(Paint.Style.FILL); mCornerShadowPaint.setDither(true);//ww w. j a va2s . c o m mCornerRadius = config.taskViewRoundedCornerRadiusPx; mCardBounds = new RectF(); mEdgeShadowPaint = new Paint(mCornerShadowPaint); }
From source file:com.github.jokar.rxupload.widget.ProgressDownloadView.java
public ProgressDownloadView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); mPadding = (int) (30 * mDensity); mBubbleWidth = (int) (45 * mDensity); mBubbleHeight = (int) (35 * mDensity); setPadding(mPadding, 0, mPadding, 0); mPaintBlack = new Paint(Paint.ANTI_ALIAS_FLAG); mPaintBlack.setStyle(Paint.Style.STROKE); mPaintBlack.setStrokeWidth(5 * mDensity); mPaintBlack.setColor(ContextCompat.getColor(getContext(), R.color.red_wood)); mPaintBlack.setStrokeCap(Paint.Cap.ROUND); //mPaintBlack.setPathEffect(new CornerPathEffect(5*mDensity)); mPaintWhite = new Paint(Paint.ANTI_ALIAS_FLAG); mPaintWhite.setStyle(Paint.Style.STROKE); mPaintWhite.setStrokeWidth(5 * mDensity); mPaintWhite.setColor(Color.RED); mPaintWhite.setStrokeCap(Paint.Cap.ROUND); //mPaintWhite.setPathEffect(new CornerPathEffect(5*mDensity)); mPaintBubble = new Paint(Paint.ANTI_ALIAS_FLAG); mPaintBubble.setColor(Color.RED); mPaintBubble.setStyle(Paint.Style.FILL); mPaintText = new Paint(Paint.ANTI_ALIAS_FLAG); mPaintText.setColor(Color.WHITE); mPaintText.setStyle(Paint.Style.FILL); mPaintText.setTextSize(12 * mDensity); }
From source file:com.appsummary.luoxf.myappsummary.recyclerView.fastscroll.Views.FastScroller.java
public FastScroller(Context context, FastScrollRecyclerView recyclerView, AttributeSet attrs) { Resources resources = context.getResources(); mRecyclerView = recyclerView;/*from w ww . j ava 2s .c o m*/ mPopup = new FastScrollPopup(resources, recyclerView); mThumbHeight = Utils.toPixels(resources, 48); mWidth = Utils.toPixels(resources, 8); mTouchInset = Utils.toPixels(resources, -24); mThumb = new Paint(Paint.ANTI_ALIAS_FLAG); mTrack = new Paint(Paint.ANTI_ALIAS_FLAG); TypedArray typedArray = context.getTheme().obtainStyledAttributes(attrs, R.styleable.FastScrollRecyclerView, 0, 0); try { mAutoHideEnabled = typedArray.getBoolean(R.styleable.FastScrollRecyclerView_fastScrollAutoHide, true); mAutoHideDelay = typedArray.getInteger(R.styleable.FastScrollRecyclerView_fastScrollAutoHideDelay, DEFAULT_AUTO_HIDE_DELAY); int trackColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollTrackColor, 0x1f000000); int thumbColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollThumbColor, 0xff000000); int popupBgColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollPopupBgColor, 0xff000000); int popupTextColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollPopupTextColor, 0xffffffff); mTrack.setColor(trackColor); mThumb.setColor(thumbColor); mPopup.setBgColor(popupBgColor); mPopup.setTextColor(popupTextColor); } finally { typedArray.recycle(); } mHideRunnable = new Runnable() { @Override public void run() { if (!mIsDragging) { if (mAutoHideAnimator != null) { mAutoHideAnimator.cancel(); } mAutoHideAnimator = ObjectAnimator.ofInt(FastScroller.this, "offsetX", (Utils.isRtl(mRecyclerView.getResources()) ? -1 : 1) * mWidth); mAutoHideAnimator.setInterpolator(new FastOutLinearInInterpolator()); mAutoHideAnimator.setDuration(200); mAutoHideAnimator.start(); } } }; mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { super.onScrolled(recyclerView, dx, dy); show(); } }); if (mAutoHideEnabled) { postAutoHideDelayed(); } }
From source file:org.telegram.ui.Cells.SharedLinkCell.java
public SharedLinkCell(Context context) { super(context); if (titleTextPaint == null) { titleTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); titleTextPaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); TEXT_COLOR = ContextCompat.getColor(context, R.color.primary_text); titleTextPaint.setColor(TEXT_COLOR); descriptionTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); paint = new Paint(); paint.setColor(ContextCompat.getColor(context, R.color.divider)); paint.setStrokeWidth(1);//from ww w.ja va 2 s .c om urlPaint = new Paint(); urlPaint.setColor(Theme.MSG_LINK_SELECT_BACKGROUND_COLOR); } titleTextPaint.setTextSize(AndroidUtilities.dp(16)); descriptionTextPaint.setTextSize(AndroidUtilities.dp(16)); setWillNotDraw(false); linkImageView = new ImageReceiver(this); letterDrawable = new LetterDrawable(); checkBox = new CheckBox(context, R.drawable.round_check2); checkBox.setVisibility(INVISIBLE); addView(checkBox, LayoutHelper.createFrame(22, 22, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 0 : 44, 44, LocaleController.isRTL ? 44 : 0, 0)); }
From source file:com.amitupadhyay.aboutexample.ui.widget.FabOverlapTextView.java
private void init(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { paint = new TextPaint(Paint.ANTI_ALIAS_FLAG); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.FabOverlapTextView); float defaultTextSize = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, DEFAULT_TEXT_SIZE_SP, getResources().getDisplayMetrics()); setFabOverlapGravity(a.getInt(R.styleable.FabOverlapTextView_fabGravity, Gravity.BOTTOM | Gravity.RIGHT)); setFabOverlapHeight(a.getDimensionPixelSize(R.styleable.FabOverlapTextView_fabOverlayHeight, 0)); setFabOverlapWidth(a.getDimensionPixelSize(R.styleable.FabOverlapTextView_fabOverlayWidth, 0)); if (a.hasValue(R.styleable.FabOverlapTextView_android_textAppearance)) { final int textAppearance = a.getResourceId(R.styleable.FabOverlapTextView_android_textAppearance, android.R.style.TextAppearance); TypedArray atp = getContext().obtainStyledAttributes(textAppearance, R.styleable.FontTextAppearance); paint.setColor(atp.getColor(R.styleable.FontTextAppearance_android_textColor, Color.BLACK)); paint.setTextSize(atp.getDimensionPixelSize(R.styleable.FontTextAppearance_android_textSize, (int) defaultTextSize)); if (atp.hasValue(R.styleable.FontTextAppearance_font)) { paint.setTypeface(FontUtil.get(getContext(), atp.getString(R.styleable.FontTextAppearance_font))); }//ww w.j a v a2 s . c o m atp.recycle(); } if (a.hasValue(R.styleable.FabOverlapTextView_font)) { setFont(a.getString(R.styleable.FabOverlapTextView_font)); } if (a.hasValue(R.styleable.FabOverlapTextView_android_textColor)) { setTextColor(a.getColor(R.styleable.FabOverlapTextView_android_textColor, 0)); } if (a.hasValue(R.styleable.FabOverlapTextView_android_textSize)) { setTextSize(a.getDimensionPixelSize(R.styleable.FabOverlapTextView_android_textSize, (int) defaultTextSize)); } lineHeightHint = a.getDimensionPixelSize(R.styleable.FabOverlapTextView_lineHeightHint, 0); unalignedTopPadding = getPaddingTop(); unalignedBottomPadding = getPaddingBottom(); breakStrategy = a.getInt(R.styleable.FabOverlapTextView_android_breakStrategy, Layout.BREAK_STRATEGY_BALANCED); a.recycle(); }
From source file:com.aniruddhc.acemusic.player.BlacklistManagerActivity.BlacklistedArtistsMultiselectAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { final Cursor c = (Cursor) getItem(position); SongsListViewHolder holder = null;/*w w w . j ava2 s. c om*/ if (convertView == null) { convertView = LayoutInflater.from(mContext).inflate(R.layout.music_library_editor_artists_layout, parent, false); holder = new SongsListViewHolder(); holder.image = (ImageView) convertView.findViewById(R.id.artistThumbnailMusicLibraryEditor); holder.title = (TextView) convertView.findViewById(R.id.artistNameMusicLibraryEditor); holder.checkBox = (CheckBox) convertView.findViewById(R.id.artistCheckboxMusicLibraryEditor); convertView.setTag(holder); } else { holder = (SongsListViewHolder) convertView.getTag(); } final View finalConvertView = convertView; final String songId = c.getString(c.getColumnIndex(DBAccessHelper._ID)); final String songArtist = c.getString(c.getColumnIndex(DBAccessHelper.SONG_ARTIST)); final String songBlacklistStatus = c.getString(c.getColumnIndex(DBAccessHelper.BLACKLIST_STATUS)); String songAlbumArtPath = c.getString(c.getColumnIndex(DBAccessHelper.SONG_ALBUM_ART_PATH)); holder.title.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light")); holder.title.setPaintFlags(holder.title.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG); //Set the song title. holder.title.setText(songArtist); mApp.getImageLoader().displayImage(songAlbumArtPath, holder.image, BlacklistManagerActivity.displayImageOptions); //Check if the song's DB ID exists in the HashSet and set the appropriate checkbox status. try { if (BlacklistManagerActivity.songIdBlacklistStatusPair.get(songId).equals("TRUE")) { holder.checkBox.setChecked(true); convertView.setBackgroundColor(0xCCFF4444); } else { holder.checkBox.setChecked(false); convertView.setBackgroundColor(0x00000000); } } catch (Exception e) { e.printStackTrace(); } //Set a tag to the row that will attach the artist's name to it. convertView.setTag(R.string.artist, songArtist); holder.checkBox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton checkbox, boolean isChecked) { if (isChecked == true) { //Only receive inputs by the user and ignore any system-made changes to the checkbox state. if (checkbox.isPressed()) { finalConvertView.setBackgroundColor(0xCCFF4444); AsyncBlacklistArtistTask task = new AsyncBlacklistArtistTask(songArtist); task.execute(new String[] { "ADD" }); } } else if (isChecked == false) { //Only receive inputs by the user and ignore any system-made changes to the checkbox state. if (checkbox.isPressed()) { finalConvertView.setBackgroundColor(0x00000000); AsyncBlacklistArtistTask task = new AsyncBlacklistArtistTask(songArtist); task.execute(new String[] { "REMOVE" }); } } } }); return convertView; }
From source file:com.qs.qswlw.view.Mypager.UltraViewPagerIndicator.java
private void init() { paintStroke = new Paint(Paint.ANTI_ALIAS_FLAG); paintStroke.setStyle(Paint.Style.STROKE); paintFill = new Paint(Paint.ANTI_ALIAS_FLAG); paintFill.setStyle(Paint.Style.FILL); defaultRadius = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, DEFAULT_RADIUS, getResources().getDisplayMetrics()); }
From source file:io.hefuyi.listener.widget.fastscroller.FastScroller.java
public FastScroller(Context context, FastScrollRecyclerView recyclerView, AttributeSet attrs) { Resources resources = context.getResources(); mRecyclerView = recyclerView;/*from ww w . j a v a 2 s . co m*/ mPopup = new FastScrollPopup(resources, recyclerView); mThumbHeight = DensityUtil.dip2px(context, 48); mWidth = DensityUtil.dip2px(context, 8); mTouchInset = DensityUtil.dip2px(context, -24); mThumb = new Paint(Paint.ANTI_ALIAS_FLAG); mTrack = new Paint(Paint.ANTI_ALIAS_FLAG); TypedArray typedArray = context.getTheme().obtainStyledAttributes(attrs, R.styleable.FastScrollRecyclerView, 0, 0); try { mAutoHideEnabled = typedArray.getBoolean(R.styleable.FastScrollRecyclerView_fastScrollAutoHide, true); mAutoHideDelay = typedArray.getInteger(R.styleable.FastScrollRecyclerView_fastScrollAutoHideDelay, DEFAULT_AUTO_HIDE_DELAY); int trackColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollTrackColor, 0x1f000000); int thumbColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollThumbColor, ATEUtil.getThemePrimaryColor(context)); int popupBgColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollPopupBgColor, ATEUtil.getThemePrimaryColor(context)); int popupTextColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollPopupTextColor, 0xffffffff); int popupTextSize = typedArray.getDimensionPixelSize( R.styleable.FastScrollRecyclerView_fastScrollPopupTextSize, DensityUtil.dip2sp(context, 56)); int popupBackgroundSize = typedArray.getDimensionPixelSize( R.styleable.FastScrollRecyclerView_fastScrollPopupBackgroundSize, DensityUtil.dip2px(context, 88)); mTrack.setColor(trackColor); mThumb.setColor(thumbColor); mPopup.setBgColor(popupBgColor); mPopup.setTextColor(popupTextColor); mPopup.setTextSize(popupTextSize); mPopup.setBackgroundSize(popupBackgroundSize); } finally { typedArray.recycle(); } mHideRunnable = new Runnable() { @Override public void run() { if (!mIsDragging) { if (mAutoHideAnimator != null) { mAutoHideAnimator.cancel(); } mAutoHideAnimator = ObjectAnimator.ofInt(FastScroller.this, "offsetX", (ListenerUtil.isRtl(mRecyclerView.getResources()) ? -1 : 1) * mWidth); mAutoHideAnimator.setInterpolator(new FastOutLinearInInterpolator()); mAutoHideAnimator.setDuration(200); mAutoHideAnimator.start(); } } }; mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { super.onScrolled(recyclerView, dx, dy); show(); } }); if (mAutoHideEnabled) { postAutoHideDelayed(); } }
From source file:com.gxy.fastscrollrecyclerview.views.FastScroller.java
public FastScroller(Context context, FastScrollRecyclerView recyclerView, AttributeSet attrs) { Resources resources = context.getResources(); mRecyclerView = recyclerView;//from w w w . j ava2 s . c o m mPopup = new FastScrollPopup(resources, recyclerView); mThumbHeight = Utils.toPixels(resources, 32); mWidth = Utils.toPixels(resources, 4); mWidthBg = Utils.toPixels(resources, 2); mTouchInset = Utils.toPixels(resources, -30); mThumb = new Paint(Paint.ANTI_ALIAS_FLAG); mTrack = new Paint(Paint.ANTI_ALIAS_FLAG); TypedArray typedArray = context.getTheme().obtainStyledAttributes(attrs, R.styleable.FastScrollRecyclerView, 0, 0); try { mAutoHideEnabled = typedArray.getBoolean(R.styleable.FastScrollRecyclerView_fastScrollAutoHide, true); mAutoHideDelay = typedArray.getInteger(R.styleable.FastScrollRecyclerView_fastScrollAutoHideDelay, DEFAULT_AUTO_HIDE_DELAY); int trackColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollTrackColor, 0x1f000000); int thumbColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollThumbColor, 0xff000000); int popupBgColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollPopupBgColor, 0xff000000); int popupTextColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollPopupTextColor, 0xffffffff); mTrack.setColor(trackColor); mThumb.setColor(thumbColor); mPopup.setBgColor(popupBgColor); mPopup.setTextColor(popupTextColor); } finally { typedArray.recycle(); } mHideRunnable = new Runnable() { @Override public void run() { if (!mIsDragging) { if (mAutoHideAnimator != null) { mAutoHideAnimator.cancel(); } mAutoHideAnimator = ObjectAnimator.ofInt(FastScroller.this, "offsetX", (Utils.isRtl(mRecyclerView.getResources()) ? -1 : 1) * mWidth); mAutoHideAnimator.setInterpolator(new FastOutLinearInInterpolator()); mAutoHideAnimator.setDuration(200); mAutoHideAnimator.start(); } } }; mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { super.onScrolled(recyclerView, dx, dy); show(); } }); if (mAutoHideEnabled) { postAutoHideDelayed(); } }
From source file:com.aniruddhc.acemusic.player.PlaylistEditorActivity.PlaylistEditorArtistsMultiselectAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { final Cursor c = (Cursor) getItem(position); SongsListViewHolder holder = null;//from w ww .j a v a 2s . c o m if (convertView == null) { convertView = LayoutInflater.from(mContext).inflate(R.layout.music_library_editor_artists_layout, parent, false); holder = new SongsListViewHolder(); holder.image = (ImageView) convertView.findViewById(R.id.artistThumbnailMusicLibraryEditor); holder.title = (TextView) convertView.findViewById(R.id.artistNameMusicLibraryEditor); holder.checkBox = (CheckBox) convertView.findViewById(R.id.artistCheckboxMusicLibraryEditor); convertView.setTag(holder); } else { holder = (SongsListViewHolder) convertView.getTag(); } final View finalConvertView = convertView; final String songId = c.getString(c.getColumnIndex(DBAccessHelper._ID)); final String songArtist = c.getString(c.getColumnIndex(DBAccessHelper.SONG_ARTIST)); String songAlbumArtPath = c.getString(c.getColumnIndex(DBAccessHelper.SONG_ALBUM_ART_PATH)); holder.title.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light")); holder.title.setPaintFlags(holder.title.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG); //Set the song title. holder.title.setText(songArtist); mApp.getImageLoader().displayImage(songAlbumArtPath, holder.image, PlaylistEditorActivity.displayImageOptions); //Check if the song's DB ID exists in the HashSet and set the appropriate checkbox status. if (PlaylistEditorActivity.songDBIdsList.contains(songId)) { holder.checkBox.setChecked(true); convertView.setBackgroundColor(0xCC0099CC); } else { holder.checkBox.setChecked(false); convertView.setBackgroundColor(0x00000000); } //Set a tag to the row that will attach the artist's name to it. convertView.setTag(R.string.artist, songArtist); holder.checkBox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton checkbox, boolean isChecked) { if (isChecked == true) { //Only receive inputs by the user and ignore any system-made changes to the checkbox state. if (checkbox.isPressed()) { finalConvertView.setBackgroundColor(0xCC0099CC); AsyncGetArtistSongIds task = new AsyncGetArtistSongIds(mContext, songArtist); task.execute(new String[] { "ADD" }); } } else if (isChecked == false) { //Only receive inputs by the user and ignore any system-made changes to the checkbox state. if (checkbox.isPressed()) { finalConvertView.setBackgroundColor(0x00000000); AsyncGetArtistSongIds task = new AsyncGetArtistSongIds(mContext, songArtist); task.execute(new String[] { "REMOVE" }); } } } }); return convertView; }