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.jasonchen.microlang.view.LinearViewPagerIndicator.java
@Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); // Draw the indicator line int position = mCurrentPage * mTabWidth + (int) (mOffset * mTabWidth); Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); paint.setColor(mForeground);//ww w. j a v a2s . com canvas.drawRect(position, (mHeight - mHeight / 18), position + mTabWidth, mHeight, paint); /*if (DEBUG) { Log.d(TAG, "mWidth = " + mWidth + "; mHeight = " + mHeight + "; mTabWidth = " + mTabWidth); Log.d(TAG, "mCurrentPage = " + mCurrentPage); }*/ }
From source file:lollipop.iconics.IconicsDrawable.java
private void prepare() { mIconPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mBackgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mContourPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mContourPaint.setStyle(Paint.Style.STROKE); mPath = new Path(); mPathBounds = new RectF(); mPaddingBounds = new Rect(); }
From source file:com.mukesh.OtpView.java
public OtpView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); final Resources res = getResources(); paint = new Paint(Paint.ANTI_ALIAS_FLAG); paint.setStyle(Paint.Style.STROKE); animatorTextPaint.set(getPaint());/*from w w w.j a v a 2s .co m*/ final Resources.Theme theme = context.getTheme(); TypedArray typedArray = theme.obtainStyledAttributes(attrs, R.styleable.OtpView, defStyleAttr, 0); viewType = typedArray.getInt(R.styleable.OtpView_viewType, VIEW_TYPE_RECTANGLE); otpViewItemCount = typedArray.getInt(R.styleable.OtpView_itemCount, DEFAULT_COUNT); otpViewItemHeight = (int) typedArray.getDimension(R.styleable.OtpView_itemHeight, res.getDimensionPixelSize(R.dimen.otp_view_item_size)); otpViewItemWidth = (int) typedArray.getDimension(R.styleable.OtpView_itemWidth, res.getDimensionPixelSize(R.dimen.otp_view_item_size)); otpViewItemSpacing = typedArray.getDimensionPixelSize(R.styleable.OtpView_itemSpacing, res.getDimensionPixelSize(R.dimen.otp_view_item_spacing)); otpViewItemRadius = (int) typedArray.getDimension(R.styleable.OtpView_itemRadius, 0); lineWidth = (int) typedArray.getDimension(R.styleable.OtpView_lineWidth, res.getDimensionPixelSize(R.dimen.otp_view_item_line_width)); lineColor = typedArray.getColorStateList(R.styleable.OtpView_lineColor); isCursorVisible = typedArray.getBoolean(R.styleable.OtpView_android_cursorVisible, true); cursorColor = typedArray.getColor(R.styleable.OtpView_cursorColor, getCurrentTextColor()); cursorWidth = typedArray.getDimensionPixelSize(R.styleable.OtpView_cursorWidth, res.getDimensionPixelSize(R.dimen.otp_view_cursor_width)); itemBackground = typedArray.getDrawable(R.styleable.OtpView_android_itemBackground); hideLineWhenFilled = typedArray.getBoolean(R.styleable.OtpView_hideLineWhenFilled, false); rtlTextDirection = typedArray.getBoolean(R.styleable.OtpView_rtlTextDirection, false); typedArray.recycle(); if (lineColor != null) { cursorLineColor = lineColor.getDefaultColor(); } updateCursorHeight(); checkItemRadius(); setMaxLength(otpViewItemCount); paint.setStrokeWidth(lineWidth); setupAnimator(); super.setCursorVisible(false); setTextIsSelectable(false); }
From source file:com.aniruddhc.acemusic.player.Dialogs.BlacklistedElementsDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { mApp = (Common) getActivity().getApplicationContext(); final BlacklistedElementsDialog dialog = this; MANAGER_TYPE = getArguments().getString("MANAGER_TYPE"); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); //Get a cursor with a list of blacklisted elements. if (MANAGER_TYPE.equals("ARTISTS")) { builder.setTitle(R.string.blacklisted_artists); cursor = mApp.getDBAccessHelper().getBlacklistedArtists(); } else if (MANAGER_TYPE.equals("ALBUMS")) { builder.setTitle(R.string.blacklisted_albums); cursor = mApp.getDBAccessHelper().getBlacklistedAlbums(); } else if (MANAGER_TYPE.equals("SONGS")) { builder.setTitle(R.string.blacklisted_songs); cursor = mApp.getDBAccessHelper().getAllBlacklistedSongs(); } else if (MANAGER_TYPE.equals("PLAYLISTS")) { builder.setTitle(R.string.blacklisted_playlists); /*DBAccessHelper playlistsDBHelper = new DBAccessHelper(getActivity()); cursor = playlistsDBHelper.getAllBlacklistedPlaylists();*/ } else {/*from ww w . j ava 2 s .co m*/ Toast.makeText(getActivity(), R.string.error_occurred, Toast.LENGTH_LONG).show(); return builder.create(); } //Dismiss the dialog if there are no blacklisted elements. if (cursor.getCount() == 0) { Toast.makeText(getActivity(), R.string.no_blacklisted_items_found, Toast.LENGTH_LONG).show(); return builder.create(); } //Loop through checkboxStatuses and insert "TRUE" at every position by default. for (int i = 0; i < cursor.getCount(); i++) { checkboxStatuses.add(true); } View rootView = this.getLayoutInflater(savedInstanceState).inflate(R.layout.fragment_blacklist_manager, null); TextView blacklistManagerInfoText = (TextView) rootView.findViewById(R.id.blacklist_manager_info_text); ListView blacklistManagerListView = (ListView) rootView.findViewById(R.id.blacklist_manager_list); blacklistManagerInfoText.setTypeface(TypefaceHelper.getTypeface(getActivity(), "RobotoCondensed-Light")); blacklistManagerInfoText.setPaintFlags( blacklistManagerInfoText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); blacklistManagerListView.setFastScrollEnabled(true); BlacklistedElementsAdapter adapter = new BlacklistedElementsAdapter(getActivity(), cursor); blacklistManagerListView.setAdapter(adapter); builder.setView(rootView); builder.setNegativeButton(R.string.cancel, new OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { dialog.dismiss(); } }); builder.setPositiveButton(R.string.done, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { //Loop through checkboxStatuses and unblacklist the elements that have been unchecked. for (int i = 0; i < checkboxStatuses.size(); i++) { cursor.moveToPosition(i); if (checkboxStatuses.get(i) == true) { //The item is still blacklisted. continue; } else { //The item has been unblacklisted. if (MANAGER_TYPE.equals("ARTISTS")) { mApp.getDBAccessHelper().setBlacklistForArtist( cursor.getString(cursor.getColumnIndex(DBAccessHelper.SONG_ARTIST)), false); } else if (MANAGER_TYPE.equals("ALBUMS")) { mApp.getDBAccessHelper().setBlacklistForAlbum( cursor.getString(cursor.getColumnIndex(DBAccessHelper.SONG_ALBUM)), cursor.getString(cursor.getColumnIndex(DBAccessHelper.SONG_ARTIST)), false); } else if (MANAGER_TYPE.equals("SONGS")) { mApp.getDBAccessHelper().setBlacklistForSong( cursor.getString(cursor.getColumnIndex(DBAccessHelper.SONG_FILE_PATH)), false); } else if (MANAGER_TYPE.equals("PLAYLISTS")) { /*DBAccessHelper playlistsDBHelper = new DBAccessHelper(getActivity()); playlistsDBHelper.unBlacklistPlaylist(cursor.getString(cursor.getColumnIndex(DBAccessHelper.PLAYLIST_BLACKLIST_STATUS)));*/ } } } dialog.dismiss(); } }); return builder.create(); }
From source file:com.kerkr.edu.widget.viewpager.CircleZoomPageIndicator.java
public CircleZoomPageIndicator(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, 0); mCentered = a.getBoolean(R.styleable.CirclePageIndicator_centered, defaultCentered); mOrientation = HORIZONTAL;/*from www. ja v a 2 s .c o m*/ mRadius = a.getDimension(R.styleable.CirclePageIndicator_radius, defaultRadius); mMaxRadius = (int) (mRadius * 1.25f); mSnap = a.getBoolean(R.styleable.CirclePageIndicator_snap, defaultSnap); mSelectedCorlor = a.getColor(R.styleable.CirclePageIndicator_strokeColor, defaultStrokeColor); mNormalCorlor = a.getColor(R.styleable.CirclePageIndicator_fillColor, defaultFillColor); a.recycle(); mPaintNormal = new Paint(Paint.ANTI_ALIAS_FLAG); mPaintNormal.setStyle(Style.FILL); mPaintNormal.setColor(mNormalCorlor); mPaintCur = new Paint(Paint.ANTI_ALIAS_FLAG); mPaintCur.setStyle(Style.FILL); mPaintCur.setColor(mSelectedCorlor); mPaintTarget = new Paint(Paint.ANTI_ALIAS_FLAG); mPaintTarget.setStyle(Paint.Style.FILL); mPaintTarget.setColor(mNormalCorlor); mRadiusCur = mMaxRadius; final ViewConfiguration configuration = ViewConfiguration.get(context); mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration); }
From source file:sg.rghis.android.views.drawable.IconicsDrawable.java
private void prepare() { mIconPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mBackgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mContourPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mContourPaint.setStyle(Paint.Style.STROKE); mPath = new Path(); mPathBounds = new RectF(); mPaddingBounds = new Rect(); constantState = new ConstantState(this); }
From source file:android.support.design.widget.SubtitleCollapsingTextHelper.java
public SubtitleCollapsingTextHelper(View view) { mView = view;// ww w . j a v a 2 s. c om mTitlePaint = new TextPaint(Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); mSubPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); mCollapsedBounds = new Rect(); mExpandedBounds = new Rect(); mCurrentBounds = new RectF(); }
From source file:com.muzakki.ahmad.widget.CollapsingTextHelper.java
public CollapsingTextHelper(View view) { mView = view;//from w w w . j a v a 2 s . c om mTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); mSubPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); // modification mCollapsedBounds = new Rect(); mExpandedBounds = new Rect(); mCurrentBounds = new RectF(); }
From source file:com.crs4.roodin.moduletester.CustomView.java
/** * @return/*from ww w.j a va 2 s . co m*/ */ private Picture drawBarreds() { Picture pictureContent = new Picture(); Canvas canvasContent = pictureContent.beginRecording(getWidth(), getHeight()); Paint paintContent = new Paint(Paint.ANTI_ALIAS_FLAG); canvasContent.save(); paintContent.setColor(Color.BLUE); paintContent.setStyle(Style.STROKE); paintContent.setStrokeWidth(2); paintContent.setAlpha(50); try { cellDimension = block.getCellDimension(); JSONArray barred = block.getBarred(); int rows = block.getShape().getInt(0); int cols = block.getShape().getInt(1); // this code draws all the shape: for (int i = 0; i < rows; i++) { for (int j = 0; j < cols; j++) { canvasContent.drawRect(cellDimension * j, cellDimension * i, cellDimension * j + cellDimension, cellDimension * i + cellDimension, paintContent); } } paintContent.setColor(Color.RED); paintContent.setStyle(Style.FILL); paintContent.setAlpha(50); for (int i = 0; i < barred.length(); i++) { JSONArray pos = barred.getJSONArray(i); canvasContent.drawRect(cellDimension * pos.getInt(1), cellDimension * pos.getInt(0), cellDimension * pos.getInt(1) + cellDimension, cellDimension * pos.getInt(0) + cellDimension, paintContent); } this.paintBoxList(canvasContent, paintContent); } catch (JSONException e) { e.printStackTrace(); Log.e("Exception in DrawComponents.drawBarreds", "" + e.getMessage()); } canvasContent.restore(); pictureContent.endRecording(); return pictureContent; }
From source file:android.support.design.widget.CustomCollapsingTextHelper.java
public CustomCollapsingTextHelper(View view) { mView = view;// ww w . j av a2 s . co m mTitlePaint = new TextPaint(Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); mSubPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); mCollapsedBounds = new Rect(); mExpandedBounds = new Rect(); mCurrentBounds = new RectF(); }