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:com.aniruddhc.acemusic.player.PlaylistEditorActivity.PlaylistEditorAlbumsMultiselectAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { final Cursor c = (Cursor) getItem(position); SongsListViewHolder holder = null;/*from www .j a va 2s . co m*/ if (convertView == null) { convertView = LayoutInflater.from(mContext).inflate(R.layout.music_library_editor_albums_layout, parent, false); holder = new SongsListViewHolder(); holder.image = (ImageView) convertView.findViewById(R.id.albumThumbnailMusicLibraryEditor); holder.title = (TextView) convertView.findViewById(R.id.albumNameMusicLibraryEditor); holder.checkBox = (CheckBox) convertView.findViewById(R.id.albumCheckboxMusicLibraryEditor); holder.subText = (TextView) convertView.findViewById(R.id.albumArtistNameMusicLibraryEditor); 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 songAlbum = c.getString(c.getColumnIndex(DBAccessHelper.SONG_ALBUM)); final String songAlbumArtPath = c.getString(c.getColumnIndex(DBAccessHelper.SONG_ALBUM_ART_PATH)); //Set the album's name and artist as the row's tag. convertView.setTag(R.string.album, songAlbum); convertView.setTag(R.string.artist, songArtist); holder.title.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light")); holder.title.setPaintFlags(holder.title.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG); holder.subText.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light")); holder.subText .setPaintFlags(holder.subText.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG); //Set the song title. holder.title.setText(songAlbum); holder.subText.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 { convertView.setBackgroundColor(0x00000000); holder.checkBox.setChecked(false); } 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); AsyncGetAlbumSongIds task = new AsyncGetAlbumSongIds(mContext, songAlbum, 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); AsyncGetAlbumSongIds task = new AsyncGetAlbumSongIds(mContext, songAlbum, songArtist); task.execute(new String[] { "REMOVE" }); } } } }); return convertView; }
From source file:com.andremion.counterfab.CounterFab.java
public CounterFab(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); setUseCompatPadding(true);/*www.jav a2 s . co m*/ final float density = getResources().getDisplayMetrics().density; mTextSize = TEXT_SIZE_DP * density; float textPadding = TEXT_PADDING_DP * density; mAnimationDuration = getResources().getInteger(android.R.integer.config_shortAnimTime); mAnimationFactor = 1; mTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mTextPaint.setStyle(Paint.Style.STROKE); mTextPaint.setColor(Color.WHITE); mTextPaint.setTextSize(mTextSize); mTextPaint.setTextAlign(Paint.Align.CENTER); mTextPaint.setTypeface(Typeface.SANS_SERIF); mCirclePaint = new Paint(Paint.ANTI_ALIAS_FLAG); mCirclePaint.setStyle(Paint.Style.FILL); ColorStateList colorStateList = getBackgroundTintList(); if (colorStateList != null) { mCirclePaint.setColor(colorStateList.getDefaultColor()); } else { Drawable background = getBackground(); if (background instanceof ColorDrawable) { ColorDrawable colorDrawable = (ColorDrawable) background; mCirclePaint.setColor(colorDrawable.getColor()); } } mMaskPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mMaskPaint.setStyle(Paint.Style.FILL); mMaskPaint.setColor(MASK_COLOR); Rect textBounds = new Rect(); mTextPaint.getTextBounds(MAX_COUNT_TEXT, 0, MAX_COUNT_TEXT.length(), textBounds); mTextHeight = textBounds.height(); float textWidth = mTextPaint.measureText(MAX_COUNT_TEXT); float circleRadius = Math.max(textWidth, mTextHeight) / 2f + textPadding; mCircleBounds = new Rect(0, 0, (int) (circleRadius * 2), (int) (circleRadius * 2)); mContentBounds = new Rect(); onCountChanged(); }
From source file:com.aniruddhc.acemusic.player.MusicLibraryEditorActivity.MusicLibraryEditorAlbumsMultiselectAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { final Cursor c = (Cursor) getItem(position); SongsListViewHolder holder = null;//from ww w .jav a 2s. com if (convertView == null) { convertView = LayoutInflater.from(mContext).inflate(R.layout.music_library_editor_albums_layout, parent, false); holder = new SongsListViewHolder(); holder.image = (ImageView) convertView.findViewById(R.id.albumThumbnailMusicLibraryEditor); holder.title = (TextView) convertView.findViewById(R.id.albumNameMusicLibraryEditor); holder.checkBox = (CheckBox) convertView.findViewById(R.id.albumCheckboxMusicLibraryEditor); holder.subText = (TextView) convertView.findViewById(R.id.albumArtistNameMusicLibraryEditor); 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 songAlbum = c.getString(c.getColumnIndex(DBAccessHelper.SONG_ALBUM)); final String songAlbumArtPath = c.getString(c.getColumnIndex(DBAccessHelper.SONG_ALBUM_ART_PATH)); //Set the album's name and artist as the row's tag. convertView.setTag(R.string.album, songAlbum); convertView.setTag(R.string.artist, songArtist); holder.title.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light")); holder.title.setPaintFlags(holder.title.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG); holder.subText.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light")); holder.subText .setPaintFlags(holder.subText.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG); //Set the song title. holder.title.setText(songAlbum); holder.subText.setText(songArtist); mApp.getImageLoader().displayImage(songAlbumArtPath, holder.image, MusicLibraryEditorActivity.displayImageOptions); //Check if the song's DB ID exists in the HashSet and set the appropriate checkbox status. if (MusicLibraryEditorActivity.songDBIdsList.contains(songId)) { holder.checkBox.setChecked(true); convertView.setBackgroundColor(0xCC0099CC); } else { convertView.setBackgroundColor(0x00000000); holder.checkBox.setChecked(false); } 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); AsyncGetAlbumSongIds task = new AsyncGetAlbumSongIds(songAlbum, 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); AsyncGetAlbumSongIds task = new AsyncGetAlbumSongIds(songAlbum, songArtist); task.execute(new String[] { "REMOVE" }); } } } }); return convertView; }
From source file:com.libs.golomb.extendedrecyclerview.Scroller.FastScroller2.java
public FastScroller2(Context context, FastScrollRecyclerView2 recyclerView, AttributeSet attrs) { Resources resources = context.getResources(); mRecyclerView = recyclerView;/*w w w. jav a 2 s. c om*/ mPopup = new FastScrollPopup2(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); int popupTextSize = typedArray.getDimensionPixelSize( R.styleable.FastScrollRecyclerView_fastScrollPopupTextSize, Utils.toScreenPixels(resources, 56)); int popupBackgroundSize = typedArray.getDimensionPixelSize( R.styleable.FastScrollRecyclerView_fastScrollPopupBackgroundSize, Utils.toPixels(resources, 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(FastScroller2.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) { //TODO Log.d("TGolomb", "onScrolled: " + scrollY.addAndGet(dy)); show(); } }); if (mAutoHideEnabled) { postAutoHideDelayed(); } }
From source file:com.androtex.viewpagerindicator.CirclePageIndicator.java
public CirclePageIndicator(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); //Load defaults from resources final Resources res = getResources(); final int defaultFillColor = res.getColor(R.color.default_circle_indicator_fill_color); final int defaultOrientation = res.getInteger(R.integer.default_circle_indicator_orientation); final int defaultStrokeColor = res.getColor(R.color.default_circle_indicator_stroke_color); final float defaultStrokeWidth = res.getDimension(R.dimen.default_circle_indicator_stroke_width); final float defaultRadius = res.getDimension(R.dimen.default_circle_indicator_radius); final boolean defaultCentered = res.getBoolean(R.bool.default_circle_indicator_centered); final boolean defaultSnap = res.getBoolean(R.bool.default_circle_indicator_snap); //Retrieve styles attributes TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CirclePageIndicator, defStyle, R.style.Widget_CirclePageIndicator); mCentered = a.getBoolean(R.styleable.CirclePageIndicator_centered, defaultCentered); mOrientation = a.getInt(R.styleable.CirclePageIndicator_orientation, defaultOrientation); mPaintStroke = new Paint(Paint.ANTI_ALIAS_FLAG); mPaintStroke.setStyle(Style.STROKE); mPaintStroke.setColor(a.getColor(R.styleable.CirclePageIndicator_strokeColor, defaultStrokeColor)); mPaintStroke//from w w w .j a v a 2 s. com .setStrokeWidth(a.getDimension(R.styleable.CirclePageIndicator_strokeWidth, defaultStrokeWidth)); mPaintFill = new Paint(Paint.ANTI_ALIAS_FLAG); mPaintFill.setStyle(Style.FILL); mPaintFill.setColor(a.getColor(R.styleable.CirclePageIndicator_fillColor, defaultFillColor)); mRadius = a.getDimension(R.styleable.CirclePageIndicator_radius, defaultRadius); mSnap = a.getBoolean(R.styleable.CirclePageIndicator_snap, defaultSnap); a.recycle(); }
From source file:com.androidmapsextensions.DefaultClusterOptionsProvider.java
private Paint createTextPaint(Resources resources) { Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); paint.setColor(resources.getColor(R.color.ame_default_cluster_text_color)); shadowBlurRadius = resources.getDimension(R.dimen.ame_default_cluster_text_shadow_blur_radius); if (shadowBlurRadius > 0.0f) { shadowOffsetX = resources.getDimension(R.dimen.ame_default_cluster_text_shadow_offset_x); shadowOffsetY = resources.getDimension(R.dimen.ame_default_cluster_text_shadow_offset_y); int shadowColor = resources.getColor(R.color.ame_default_cluster_text_shadow_color); paint.setShadowLayer(shadowBlurRadius, shadowOffsetX, shadowOffsetY, shadowColor); }// w w w . ja v a 2s. c o m paint.setTextSize(resources.getDimension(R.dimen.ame_default_cluster_text_size)); paint.setTypeface(Typeface.DEFAULT_BOLD); return paint; }
From source file:com.github.kubatatami.RoundedView.java
private void drawChecked(Canvas canvas) { Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.ic_check); float posX = (canvas.getWidth() - bitmap.getWidth()) / 2; float posY = (canvas.getHeight() - bitmap.getHeight()) / 2; canvas.drawBitmap(bitmap, posX, posY, paint); }
From source file:com.aniruddhc.acemusic.player.BlacklistManagerActivity.BlacklistedAlbumsMultiselectAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { final Cursor c = (Cursor) getItem(position); SongsListViewHolder holder = null;//from w w w . j a v a 2 s. c o m if (convertView == null) { convertView = LayoutInflater.from(mContext).inflate(R.layout.music_library_editor_albums_layout, parent, false); holder = new SongsListViewHolder(); holder.image = (ImageView) convertView.findViewById(R.id.albumThumbnailMusicLibraryEditor); holder.title = (TextView) convertView.findViewById(R.id.albumNameMusicLibraryEditor); holder.checkBox = (CheckBox) convertView.findViewById(R.id.albumCheckboxMusicLibraryEditor); holder.subText = (TextView) convertView.findViewById(R.id.albumArtistNameMusicLibraryEditor); 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 songAlbum = c.getString(c.getColumnIndex(DBAccessHelper.SONG_ALBUM)); final String songAlbumArtPath = c.getString(c.getColumnIndex(DBAccessHelper.SONG_ALBUM_ART_PATH)); final String songBlacklistStatus = c.getString(c.getColumnIndex(DBAccessHelper.BLACKLIST_STATUS)); //Set the album's name and artist as the row's tag. convertView.setTag(R.string.album, songAlbum); convertView.setTag(R.string.artist, songArtist); holder.title.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light")); holder.title.setPaintFlags(holder.title.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG); holder.subText.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light")); holder.subText .setPaintFlags(holder.subText.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG); //Set the song title. holder.title.setText(songAlbum); holder.subText.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. if (BlacklistManagerActivity.songIdBlacklistStatusPair.get(songId).equals("TRUE")) { holder.checkBox.setChecked(true); convertView.setBackgroundColor(0xCCFF4444); } else { convertView.setBackgroundColor(0x00000000); holder.checkBox.setChecked(false); } 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); AsyncBlacklistAlbumTask task = new AsyncBlacklistAlbumTask(songAlbum, 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); AsyncBlacklistAlbumTask task = new AsyncBlacklistAlbumTask(songAlbum, songArtist); task.execute(new String[] { "REMOVE" }); } } } }); return convertView; }
From source file:com.moblin.cellcomsms.utils.CirclePageIndicator.java
public CirclePageIndicator(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); // Load defaults from resources final Resources res = getResources(); final int defaultFillColor = res.getColor(R.color.default_circle_indicator_fill_color); final int defaultOrientation = res.getInteger(R.integer.default_circle_indicator_orientation); final int defaultStrokeColor = res.getColor(R.color.default_circle_indicator_stroke_color); final float defaultStrokeWidth = res.getDimension(R.dimen.default_circle_indicator_stroke_width); final float defaultRadius = res.getDimension(R.dimen.default_circle_indicator_radius); final boolean defaultCentered = res.getBoolean(R.bool.default_circle_indicator_centered); final boolean defaultSnap = res.getBoolean(R.bool.default_circle_indicator_snap); // Retrieve styles attributes TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CirclePageIndicator, defStyle, R.style.Widget_CirclePageIndicator); mCentered = a.getBoolean(R.styleable.CirclePageIndicator_centered, defaultCentered); mOrientation = a.getInt(R.styleable.CirclePageIndicator_orientation, defaultOrientation); mPaintStroke = new Paint(Paint.ANTI_ALIAS_FLAG); mPaintStroke.setStyle(Style.FILL_AND_STROKE); mPaintStroke.setColor(a.getColor(R.styleable.CirclePageIndicator_strokeColor, defaultStrokeColor)); mPaintStroke// w w w .j a v a2s. c om .setStrokeWidth(a.getDimension(R.styleable.CirclePageIndicator_strokeWidth, defaultStrokeWidth)); mPaintFill = new Paint(Paint.ANTI_ALIAS_FLAG); mPaintFill.setStyle(Style.FILL); mPaintFill.setColor(a.getColor(R.styleable.CirclePageIndicator_fillColor, defaultFillColor)); mRadius = a.getDimension(R.styleable.CirclePageIndicator_radius, defaultRadius); mSnap = a.getBoolean(R.styleable.CirclePageIndicator_snap, defaultSnap); a.recycle(); }
From source file:com.example.firstocr.ViewfinderView.java
public ViewfinderView(Context context, AttributeSet attrs) { super(context, attrs); // Initialize these once for performance rather than calling them every time in onDraw(). paint = new Paint(Paint.ANTI_ALIAS_FLAG); Resources resources = getResources(); //maskColor = 0x60000000; //frameColor = 0xffd6d6d6; //cornerColor = 0xffffffff; maskColor = ContextCompat.getColor(context, R.color.viewfinder_mask); frameColor = ContextCompat.getColor(context, R.color.viewfinder_frame); cornerColor = ContextCompat.getColor(context, R.color.viewfinder_corners); /*maskColor = resources.getColor(R.color.viewfinder_mask); frameColor = resources.getColor(R.color.viewfinder_frame); cornerColor = resources.getColor(R.color.viewfinder_corners); *///from w w w . j a v a 2 s . com // bounds = new Rect(); previewFrame = new Rect(); rect = new Rect(); }