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.bolaa.medical.view.banner.CirclePageIndicator.java
public CirclePageIndicator(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); //Load defaults from resources final Resources res = getResources(); final int defaultPageColor = res.getColor(R.color.default_circle_indicator_page_color); 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); mPaintPageFill = new Paint(Paint.ANTI_ALIAS_FLAG); mPaintPageFill.setStyle(Style.STROKE); mPaintPageFill.setStrokeWidth(1);// mPaintPageFill.setColor(a.getColor(R.styleable.CirclePageIndicator_pageColor, defaultPageColor)); 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 va 2 s .co m*/ .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(); final ViewConfiguration configuration = ViewConfiguration.get(context); mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration); }
From source file:com.bolaa.medical.view.banner.LoopCirclePageIndicator.java
public LoopCirclePageIndicator(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); //Load defaults from resources final Resources res = getResources(); final int defaultPageColor = res.getColor(R.color.default_circle_indicator_page_color); 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); mPaintPageFill = new Paint(Paint.ANTI_ALIAS_FLAG); mPaintPageFill.setStyle(Style.FILL); // mPaintPageFill.setStrokeWidth(3);//? mPaintPageFill.setColor(a.getColor(R.styleable.CirclePageIndicator_pageColor, defaultPageColor)); mPaintStroke = new Paint(Paint.ANTI_ALIAS_FLAG); mPaintStroke.setStyle(Style.FILL); mPaintStroke.setStyle(Style.STROKE); mPaintStroke.setColor(a.getColor(R.styleable.CirclePageIndicator_strokeColor, defaultStrokeColor)); mPaintStroke//from w w w . j a v a2 s .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(); final ViewConfiguration configuration = ViewConfiguration.get(context); mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration); }
From source file:com.aniruddhc.acemusic.player.ListViewFragment.ListViewFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mRootView = (ViewGroup) inflater.inflate(R.layout.fragment_list_view, container, false); mContext = getActivity().getApplicationContext(); mApp = (Common) mContext;/*w ww. j a va 2s . c om*/ mFragment = this; //Set the background. We're using getGridViewBackground() since the list doesn't have card items. mRootView.setBackgroundColor(UIElementsHelper.getGridViewBackground(mContext)); //Grab the fragment. This will determine which data to load into the cursor. mFragmentId = getArguments().getInt(Common.FRAGMENT_ID); mFragmentTitle = getArguments().getString(MainActivity.FRAGMENT_HEADER); mDBColumnsMap = new HashMap<Integer, String>(); //Init the search fields. mSearchLayout = (RelativeLayout) mRootView.findViewById(R.id.search_layout); mSearchEditText = (EditText) mRootView.findViewById(R.id.search_field); mSearchEditText.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Regular")); mSearchEditText .setPaintFlags(mSearchEditText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); mSearchEditText.setTextColor(UIElementsHelper.getThemeBasedTextColor(mContext)); mSearchEditText.setFocusable(true); mSearchEditText.setCursorVisible(true); mQuickScroll = (QuickScroll) mRootView.findViewById(R.id.quickscroll); mListView = (ListView) mRootView.findViewById(R.id.generalListView); mListView.setVerticalScrollBarEnabled(false); //Apply the ListViews' dividers. if (mApp.getCurrentTheme() == Common.DARK_THEME) { mListView.setDivider(mContext.getResources().getDrawable(R.drawable.icon_list_divider)); } else { mListView.setDivider(mContext.getResources().getDrawable(R.drawable.icon_list_divider_light)); } mListView.setDividerHeight(1); //KitKat translucent navigation/status bar. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { int topPadding = Common.getStatusBarHeight(mContext); //Calculate navigation bar height. int navigationBarHeight = 0; int resourceId = getResources().getIdentifier("navigation_bar_height", "dimen", "android"); if (resourceId > 0) { navigationBarHeight = getResources().getDimensionPixelSize(resourceId); } mListView.setClipToPadding(false); mListView.setPadding(0, topPadding, 0, navigationBarHeight); mQuickScroll.setPadding(0, topPadding, 0, navigationBarHeight); RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) mListView.getLayoutParams(); layoutParams = (RelativeLayout.LayoutParams) mSearchLayout.getLayoutParams(); layoutParams.setMargins(15, topPadding + 15, 15, 0); mSearchLayout.setLayoutParams(layoutParams); } //Set the empty views. mEmptyTextView = (TextView) mRootView.findViewById(R.id.empty_view_text); mEmptyTextView.setTypeface(TypefaceHelper.getTypeface(mContext, "Roboto-Light")); mEmptyTextView .setPaintFlags(mEmptyTextView.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); //Create a set of options to optimize the bitmap memory usage. final BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; options.inJustDecodeBounds = false; options.inPurgeable = true; mHandler.postDelayed(queryRunnable, 400); return mRootView; }
From source file:com.bolaa.sleepingbar.view.banner.LoopCirclePageIndicator.java
public LoopCirclePageIndicator(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); //Load defaults from resources final Resources res = getResources(); final int defaultPageColor = res.getColor(R.color.default_circle_indicator_page_color); 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); mPaintPageFill = new Paint(Paint.ANTI_ALIAS_FLAG); mPaintPageFill.setStyle(Style.FILL); mPaintPageFill.setStrokeWidth(3);//? mPaintPageFill.setColor(a.getColor(R.styleable.CirclePageIndicator_pageColor, defaultPageColor)); mPaintStroke = new Paint(Paint.ANTI_ALIAS_FLAG); mPaintStroke.setStyle(Style.FILL); mPaintStroke.setStyle(Style.STROKE); mPaintStroke.setColor(a.getColor(R.styleable.CirclePageIndicator_strokeColor, defaultStrokeColor)); mPaintStroke//from w ww .j ava 2s. 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(); final ViewConfiguration configuration = ViewConfiguration.get(context); mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration); }
From source file:org.telegram.ui.Cells.ContextLinkCell.java
public ContextLinkCell(Context context) { super(context); if (titleTextPaint == null) { titleTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); titleTextPaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); titleTextPaint.setColor(ContextCompat.getColor(context, R.color.primary_text)); descriptionTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); paint = new Paint(); paint.setColor(ContextCompat.getColor(context, R.color.divider)); paint.setStrokeWidth(1);/*from w w w.j a va 2 s . com*/ DESCRIPTION_TEXT_COLOR = ContextCompat.getColor(context, R.color.secondary_text); } titleTextPaint.setTextSize(AndroidUtilities.dp(15)); descriptionTextPaint.setTextSize(AndroidUtilities.dp(13)); linkImageView = new ImageReceiver(this); letterDrawable = new LetterDrawable(); radialProgress = new RadialProgress(this); TAG = MediaController.getInstance().generateObserverTag(); }
From source file:com.karthikb351.vitinfo2.customwidget.TimeLineView.java
private void initialize() { density = getContext().getResources().getDisplayMetrics().density; PADDING_TOP *= density;/*from ww w. j a v a 2s . co m*/ BORDER_THICKNESS += CIRCLE_RADIUS; BORDER_THICKNESS *= density; CIRCLE_RADIUS *= density; STROKE_WIDTH_RING *= density; STROKE_WIDTH_BORDER *= density; STROKE_WIDTH_LINE *= density; paintDot = new Paint(); paintDot.setColor(ContextCompat.getColor(getContext(), R.color.text_secondary)); paintDot.setFlags(Paint.ANTI_ALIAS_FLAG); paintRing = new Paint(); paintRing.setColor(ContextCompat.getColor(getContext(), R.color.text_secondary)); paintRing.setFlags(Paint.ANTI_ALIAS_FLAG); paintRing.setStrokeWidth(STROKE_WIDTH_RING); paintRing.setStyle(Paint.Style.FILL_AND_STROKE); paintBorder = new Paint(); paintBorder.setColor(ContextCompat.getColor(getContext(), R.color.text_secondary)); paintBorder.setAlpha(90); paintBorder.setFlags(Paint.ANTI_ALIAS_FLAG); paintBorder.setStrokeWidth(STROKE_WIDTH_BORDER); paintBorder.setStyle(Paint.Style.FILL_AND_STROKE); paintLine = new Paint(); paintLine.setColor(ContextCompat.getColor(getContext(), R.color.text_secondary)); paintLine.setAlpha(70); paintLine.setFlags(Paint.ANTI_ALIAS_FLAG); paintLine.setStrokeWidth(STROKE_WIDTH_LINE); paintLine.setStyle(Paint.Style.FILL_AND_STROKE); widgetState = STATE_SCHEDULED; widgetType = TYPE_INNER; rectF = new RectF(); mPath = new Path(); }
From source file:info.papdt.blacklight.ui.common.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);/*from w ww . j ava 2s . c o m*/ 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:com.azhansy.linky.view.PagerSlidingIndicator.java
public PagerSlidingIndicator(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); setFillViewport(true);//from w w w. ja va2 s.co m setWillNotDraw(false); DisplayMetrics dm = getResources().getDisplayMetrics(); scrollOffset = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, scrollOffset, dm); backgroundStrokeWidth = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, backgroundStrokeWidth, dm); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PagerSlidingIndicator); shouldExpand = a.getBoolean(R.styleable.PagerSlidingIndicator_shouldExpand, shouldExpand); scrollOffset = a.getDimensionPixelSize(R.styleable.PagerSlidingIndicator_scrollOffset, scrollOffset); backgroundStrokeColor = a.getColor(R.styleable.PagerSlidingIndicator_background_stroke_color, backgroundStrokeColor); backgroundStrokeWidth = a.getDimensionPixelSize(R.styleable.PagerSlidingIndicator_background_stroke_width, backgroundStrokeWidth); backgroundColor = a.getColor(R.styleable.PagerSlidingIndicator_background_color, backgroundColor); checkedBackgroundColor = a.getColor(R.styleable.PagerSlidingIndicator_checked_background_color, checkedBackgroundColor); a.recycle(); // backgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG); backgroundPaint.setColor(backgroundColor); backgroundPaint.setStyle(Style.FILL); // checkedBackgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG); checkedBackgroundPaint.setColor(checkedBackgroundColor); checkedBackgroundPaint.setStyle(Style.FILL); defaultTabLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); expandedTabLayoutParams = new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1.0f); }
From source file:pl.rmakowiecki.simplemusicplayer.ui.widget.MusicCoverView.java
public MusicCoverView(Context context, AttributeSet attrs, final int defStyleAttr) { super(context, attrs, defStyleAttr); // Canvas.clipPath works wrong when running with hardware acceleration on Android N if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M) { setLayerType(View.LAYER_TYPE_HARDWARE, null); }/* ww w.ja v a 2s. com*/ final float density = getResources().getDisplayMetrics().density; mTrackSize = TRACK_SIZE * density; mTrackPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mTrackPaint.setStyle(Paint.Style.STROKE); mTrackPaint.setStrokeWidth(TRACK_WIDTH * density); mStartRotateAnimator = ObjectAnimator.ofFloat(this, View.ROTATION, 0, FULL_ANGLE); mStartRotateAnimator.setInterpolator(new LinearInterpolator()); mStartRotateAnimator.setRepeatCount(Animation.INFINITE); mStartRotateAnimator.setDuration(DURATION); mStartRotateAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { float current = getRotation(); float target = current > HALF_ANGLE ? FULL_ANGLE : 0; // Choose the shortest distance to 0 rotation float diff = target > 0 ? FULL_ANGLE - current : current; mEndRotateAnimator.setFloatValues(current, target); mEndRotateAnimator.setDuration((int) (DURATION_PER_DEGREES * diff)); mEndRotateAnimator.start(); } }); mEndRotateAnimator = ObjectAnimator.ofFloat(MusicCoverView.this, View.ROTATION, 0); mEndRotateAnimator.setInterpolator(new LinearInterpolator()); mEndRotateAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { setRotation(0); // isRunning method return true if it's called form here. // So we need call from post method to get the right returning. post(new Runnable() { @Override public void run() { if (mCallbacks != null) { mCallbacks.onRotateEnd(MusicCoverView.this); } } }); } }); mRectToCircleTransition = new MorphTransition(SHAPE_RECTANGLE); mRectToCircleTransition.addTarget(this); mRectToCircleTransition.addListener(new TransitionAdapter() { @Override public void onTransitionStart(Transition transition) { mIsMorphing = true; } @Override public void onTransitionEnd(Transition transition) { mIsMorphing = false; mShape = SHAPE_CIRCLE; if (mCallbacks != null) { mCallbacks.onMorphEnd(MusicCoverView.this); } } }); mCircleToRectTransition = new MorphTransition(SHAPE_CIRCLE); mCircleToRectTransition.addTarget(this); mCircleToRectTransition.addListener(new TransitionAdapter() { @Override public void onTransitionStart(Transition transition) { mIsMorphing = true; } @Override public void onTransitionEnd(Transition transition) { mIsMorphing = false; mShape = SHAPE_RECTANGLE; if (mCallbacks != null) { mCallbacks.onMorphEnd(MusicCoverView.this); } } }); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.MusicCoverView); @Shape int shape = a.getInt(R.styleable.MusicCoverView_cover_shape, SHAPE_RECTANGLE); @ColorInt int trackColor = a.getColor(R.styleable.MusicCoverView_trackColor, TRACK_COLOR); a.recycle(); setShape(shape); setTrackColor(trackColor); setScaleType(); }
From source file:com.example.ysh.myapplication.view.readview.PageFactory.java
public PageFactory(Context context, int width, int height, int fontSize, String bookId, List<BookMixAToc.mixToc.Chapters> chaptersList) { mContext = context;//from w w w. ja v a2 s . c om mWidth = width; mHeight = height; mFontSize = fontSize; mLineSpace = mFontSize / 5 * 2; mNumFontSize = ScreenUtils.dpToPxInt(16); marginWidth = ScreenUtils.dpToPxInt(15); marginHeight = ScreenUtils.dpToPxInt(15); mVisibleHeight = mHeight - marginHeight * 2 - mNumFontSize * 2 - mLineSpace * 2; mVisibleWidth = mWidth - marginWidth * 2; mPageLineCount = mVisibleHeight / (mFontSize + mLineSpace); rectF = new Rect(0, 0, mWidth, mHeight); mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mPaint.setTextSize(mFontSize); mPaint.setTextSize(ContextCompat.getColor(context, R.color.chapter_content_day)); mPaint.setColor(Color.BLACK); mTitlePaint = new Paint(Paint.ANTI_ALIAS_FLAG); mTitlePaint.setTextSize(mNumFontSize); mTitlePaint.setColor(ContextCompat.getColor(AppUtils.getAppContext(), R.color.chapter_title_day)); timeLen = (int) mTitlePaint.measureText("00:00"); percentLen = (int) mTitlePaint.measureText("00.00%"); // Typeface typeface = Typeface.createFromAsset(context.getAssets(),"fonts/FZBYSK.TTF"); // mPaint.setTypeface(typeface); // mNumPaint.setTypeface(typeface); this.bookId = bookId; this.chaptersList = chaptersList; time = dateFormat.format(new Date()); }