Example usage for android.graphics Paint ANTI_ALIAS_FLAG

List of usage examples for android.graphics Paint ANTI_ALIAS_FLAG

Introduction

In this page you can find the example usage for android.graphics Paint ANTI_ALIAS_FLAG.

Prototype

int ANTI_ALIAS_FLAG

To view the source code for android.graphics Paint ANTI_ALIAS_FLAG.

Click Source Link

Document

Paint flag that enables antialiasing when drawing.

Usage

From source file:io.plaidapp.ui.widget.CutoutTextView.java

public CutoutTextView(Context context, AttributeSet attrs) {
    super(context, attrs);

    textPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);

    final TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.CutoutTextView, 0, 0);
    if (a.hasValue(R.styleable.CutoutTextView_android_fontFamily)) {
        try {//w  w  w .ja v  a  2  s  .com
            Typeface font = ResourcesCompat.getFont(getContext(),
                    a.getResourceId(R.styleable.CutoutTextView_android_fontFamily, 0));
            if (font != null) {
                textPaint.setTypeface(font);
            }
        } catch (Resources.NotFoundException nfe) {
        }
    }
    if (a.hasValue(R.styleable.CutoutTextView_foregroundColor)) {
        foregroundColor = a.getColor(R.styleable.CutoutTextView_foregroundColor, foregroundColor);
    }
    if (a.hasValue(R.styleable.CutoutTextView_android_text)) {
        text = a.getString(R.styleable.CutoutTextView_android_text);
    }
    maxTextSize = context.getResources().getDimensionPixelSize(R.dimen.display_4_text_size);
    a.recycle();
}

From source file:org.telegram.ui.Cells.BotHelpCell.java

public BotHelpCell(Context context) {
    super(context);

    textPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
    textPaint.setTextSize(AndroidUtilities.dp(16));
    textPaint.setColor(ContextCompat.getColor(context, R.color.primary_text));
    textPaint.linkColor = Theme.MSG_LINK_TEXT_COLOR;

    urlPaint = new Paint();
    urlPaint.setColor(Theme.MSG_LINK_SELECT_BACKGROUND_COLOR);
}

From source file:com.aniruddhc.acemusic.player.Dialogs.DeterminateProgressDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

    parentActivity = getActivity();//from  w  w  w  .  ja v  a 2 s  .  c  o m
    dialog = this;
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

    String title = getArguments().getString("TITLE");
    String text = getArguments().getString("TEXT");

    View progressView = parentActivity.getLayoutInflater().inflate(R.layout.determinate_progress_dialog, null);
    progressText = (TextView) progressView.findViewById(R.id.determinate_progress_dialog_text);
    progressText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light"));
    progressText.setPaintFlags(progressText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);
    progressText.setText(text);

    progressBar = (ProgressBar) progressView.findViewById(R.id.determinate_progress_dialog_bar);

    builder.setTitle(title);
    builder.setView(progressView);

    return builder.create();
}

From source file:com.microsoft.mimickeralarm.onboarding.BubblePagerIndicator.java

public BubblePagerIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPaint.setColor(Color.WHITE);
    mPaint.setStyle(Paint.Style.FILL);
    mTotalPositions = 0;//from   ww w .  jav  a 2 s. co  m

    invalidate();
}

From source file:com.grarak.kerneladiutor.views.XYGraph.java

public XYGraph(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    mPaintLine = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPaintEdge = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPaintGraph = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPaintGraphStroke = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPathGraph = new Path();

    mPaintEdge.setStyle(Paint.Style.STROKE);

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.XYGraph, defStyleAttr, 0);

    int accentColor = ContextCompat.getColor(context, R.color.colorAccent);
    mPaintLine.setColor(a.getColor(R.styleable.XYGraph_linecolor, accentColor));
    mPaintEdge.setColor(a.getColor(R.styleable.XYGraph_edgecolor, accentColor));
    mPaintEdge.setStrokeWidth(a.getDimension(R.styleable.XYGraph_edgestrokewidth,
            getResources().getDimension(R.dimen.xygraph_edge_stroke_width)));

    int graphColor = a.getColor(R.styleable.XYGraph_graphcolor, accentColor);

    mPaintGraphStroke.setColor(graphColor);
    mPaintGraphStroke.setStyle(Paint.Style.STROKE);
    mPaintGraphStroke.setStrokeWidth(a.getDimension(R.styleable.XYGraph_graphstrokewidth,
            getResources().getDimension(R.dimen.xygraph_graph_stroke_width)));

    graphColor = Color.argb(120, Color.red(graphColor), Color.green(graphColor), Color.blue(graphColor));

    mPaintGraph.setColor(graphColor);/*from  ww w.ja v  a2s .co m*/
    mPaintGraph.setStyle(Paint.Style.FILL);
    mPathGraph.setFillType(Path.FillType.EVEN_ODD);

    mEdgeVisible = a.getBoolean(R.styleable.XYGraph_edgevisibile, true);

    a.recycle();
}

From source file:android.support.design.widget.CircularBorderDrawable.java

public CircularBorderDrawable() {
    mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPaint.setStyle(Paint.Style.STROKE);
}

From source file:com.rks.musicx.misc.widgets.DiagonalLayout.java

public void init(Context context, AttributeSet attrs) {
    settings = new com.rks.musicx.misc.widgets.DiagonalLayoutSettings(context, attrs);
    settings.setElevation(ViewCompat.getElevation(this));

    paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    paint.setColor(Color.WHITE);//from   w  w  w.j  a  v a 2 s  .c o  m

    pdMode = new PorterDuffXfermode(PorterDuff.Mode.CLEAR);
}

From source file:com.aniruddhc.acemusic.player.Dialogs.AddMusicLibraryDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

    libraryLabelID = "circle_blue_dark";
    View rootView = getActivity().getLayoutInflater().inflate(R.layout.dialog_add_music_library, null);
    TextView instructions = (TextView) rootView.findViewById(R.id.add_music_library_instructions);
    instructions.setTypeface(TypefaceHelper.getTypeface(getActivity(), "RobotoCondensed-Light"));
    instructions.setPaintFlags(instructions.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);

    final ImageButton labelButton = (ImageButton) rootView.findViewById(R.id.add_music_library_label_button);
    final EditText musicLibraryName = (EditText) rootView.findViewById(R.id.add_music_library_text_field);
    musicLibraryName.setTypeface(TypefaceHelper.getTypeface(getActivity(), "RobotoCondensed-Light"));
    musicLibraryName/*  w w w. ja v a2 s  .  c o  m*/
            .setPaintFlags(musicLibraryName.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);

    labelButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {

            //Create a new array with a list of all the library labels.
            final Drawable[] labelsArray = {
                    getActivity().getResources().getDrawable(R.drawable.circle_blue_dark),
                    getActivity().getResources().getDrawable(R.drawable.circle_blue_light),
                    getActivity().getResources().getDrawable(R.drawable.circle_green_dark),
                    getActivity().getResources().getDrawable(R.drawable.circle_green_light),
                    getActivity().getResources().getDrawable(R.drawable.circle_purple_dark),
                    getActivity().getResources().getDrawable(R.drawable.circle_purple_light),
                    getActivity().getResources().getDrawable(R.drawable.circle_red_dark),
                    getActivity().getResources().getDrawable(R.drawable.circle_red_light),
                    getActivity().getResources().getDrawable(R.drawable.circle_yellow_dark),
                    getActivity().getResources().getDrawable(R.drawable.circle_yellow_light) };

            //Create a new array with a list of all the library labels.
            final String[] labelsIdsArray = { "circle_blue_dark", "circle_blue_light", "circle_green_dark",
                    "circle_green_light", "circle_purple_dark", "circle_purple_light", "circle_red_dark",
                    "circle_red_light", "circle_yellow_dark", "circle_yellow_light" };

            AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
            builder.setTitle(R.string.music_library_label);
            ArrayList<String> labelTitles = new ArrayList<String>();
            labelTitles
                    .addAll(Arrays.asList(getActivity().getResources().getStringArray(R.array.library_labels)));
            builder.setAdapter(new LibraryLabelsAdapter(getActivity(), labelTitles), new OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                    libraryLabelID = labelsIdsArray[which];
                    labelButton.setImageDrawable(labelsArray[which]);

                }

            });

            builder.create().show();

        }

    });

    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

    //Set the dialog title.
    builder.setTitle(R.string.add_music_library);
    builder.setView(rootView);
    builder.setPositiveButton(R.string.ok, new OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int arg1) {
            String libraryName = musicLibraryName.getText().toString();

            Intent intent = new Intent(getActivity(), MusicLibraryEditorActivity.class);
            Bundle bundle = new Bundle();
            bundle.putString("LIBRARY_NAME", libraryName);
            bundle.putString("LIBRARY_ICON", libraryLabelID);
            intent.putExtras(bundle);
            startActivity(intent);

            dialog.dismiss();
            getActivity().finish();

        }

    });

    builder.setNegativeButton(R.string.cancel, new OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int arg1) {
            dialog.dismiss();
            getActivity().finish();

        }

    });

    return builder.create();
}

From source file:me.uucky.colorpicker.internal.ColorView.java

public ColorView(final Context context, final AttributeSet attrs, final int defStyle) {
    super(context, attrs, defStyle);
    final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ColorView);
    mRect = new RectF();
    mColorPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    final Bitmap bitmap = Utils
            .getAlphaPatternBitmap(Math.round(getResources().getDisplayMetrics().density * 8));
    mAlphaPatternPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mAlphaPatternPaint.setShader(new BitmapShader(bitmap, TileMode.REPEAT, TileMode.REPEAT));
    mRadius = a.getDimension(R.styleable.ColorView_cp_cornerRadius, 0);
    ViewCompat.setElevation(this, a.getDimension(R.styleable.ColorView_cp_elevation, 0));
    a.recycle();/*  w w  w.j av a2s.c o  m*/
    if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) {
        Internal.setOutlineProvider(this);
    }
}

From source file:com.aniruddhc.acemusic.player.Dialogs.AddEQPresetDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

    mApp = (Common) getActivity().getApplicationContext();
    mEqualizerFragment = (EqualizerActivity) getActivity();
    dialog = this;

    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    dialogView = getActivity().getLayoutInflater().inflate(R.layout.add_new_equalizer_preset_dialog_layout,
            null);//from  w w  w . jav  a  2  s .c o  m

    newPresetNameField = (EditText) dialogView.findViewById(R.id.new_preset_name_text_field);
    newPresetNameField.setTypeface(TypefaceHelper.getTypeface(getActivity(), "Roboto-Light"));
    newPresetNameField.setPaintFlags(
            newPresetNameField.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);

    //Set the dialog title.
    builder.setTitle(R.string.new_eq_preset);
    builder.setView(dialogView);
    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) {

            //Get the preset name from the text field.
            String presetName = newPresetNameField.getText().toString();

            //Add the preset and it's values to the DB.
            mApp.getDBAccessHelper().addNewEQPreset(presetName, mEqualizerFragment.getFiftyHertzLevel(),
                    mEqualizerFragment.getOneThirtyHertzLevel(), mEqualizerFragment.getThreeTwentyHertzLevel(),
                    mEqualizerFragment.getEightHundredHertzLevel(), mEqualizerFragment.getTwoKilohertzLevel(),
                    mEqualizerFragment.getFiveKilohertzLevel(),
                    mEqualizerFragment.getTwelvePointFiveKilohertzLevel(),
                    (short) mEqualizerFragment.getVirtualizerSeekBar().getProgress(),
                    (short) mEqualizerFragment.getBassBoostSeekBar().getProgress(),
                    (short) mEqualizerFragment.getReverbSpinner().getSelectedItemPosition());

            Toast.makeText(getActivity(), R.string.preset_saved, Toast.LENGTH_SHORT).show();
            dialog.dismiss();
        }

    });

    return builder.create();
}