Example usage for android.graphics Paint SUBPIXEL_TEXT_FLAG

List of usage examples for android.graphics Paint SUBPIXEL_TEXT_FLAG

Introduction

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

Prototype

int SUBPIXEL_TEXT_FLAG

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

Click Source Link

Document

Paint flag that enables subpixel positioning of text.

Usage

From source file:Main.java

/**
 * Set typeface for a TextView/*from   ww  w  .j  av  a 2 s.  co m*/
 *
 * @param typeFace
 * @param view
 */
public static void setTypeFace(Typeface typeFace, TextView view) {
    view.setTypeface(typeFace);
    view.setPaintFlags(view.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG);
}

From source file:io.vit.vitio.Extras.TypeFaceSpan.java

@Override
public void updateMeasureState(TextPaint p) {
    p.setTypeface(mTypeface);
    p.setFlags(p.getFlags() | Paint.SUBPIXEL_TEXT_FLAG);
}

From source file:io.vit.vitio.Extras.TypeFaceSpan.java

@Override
public void updateDrawState(TextPaint tp) {
    tp.setTypeface(mTypeface);
    tp.setFlags(tp.getFlags() | Paint.SUBPIXEL_TEXT_FLAG);
}

From source file:com.aniruddhc.acemusic.player.Utils.TypefaceSpan.java

@Override
public void updateDrawState(TextPaint tp) {
    tp.setTypeface(mTypeface);//  w  w  w  .  ja va2 s  .com
    // Note: This flag is required for proper typeface rendering
    tp.setFlags(tp.getFlags() | Paint.SUBPIXEL_TEXT_FLAG);
}

From source file:com.adrianlesniak.gamerspot.extra.CustomTypefaceSpan.java

public void updateMeasureState1(TextPaint p) {
    p.setTypeface(mTypeface);// w w w  .  ja  v a  2  s.c  o m

    // Note: This flag is required for proper typeface rendering
    p.setFlags(p.getFlags() | Paint.SUBPIXEL_TEXT_FLAG);
}

From source file:com.alcoapps.actionbarextras.TypefaceSpan.java

@Override
public void updateMeasureState(TextPaint p) {
    p.setTypeface(mTypeface);/*w  w  w  . ja va 2  s . c  o  m*/

    // Note: This flag is required for proper typeface rendering
    p.setFlags(p.getFlags() | Paint.SUBPIXEL_TEXT_FLAG);
}

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

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

    parentActivity = getActivity();//from  w w  w .  j  ava2 s.  co 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.adrianlesniak.gamerspot.extra.CustomTypefaceSpan.java

public void updateDrawState(TextPaint tp) {
    tp.setTypeface(mTypeface);/*  w ww  . j  a v a  2  s. com*/

    // Note: This flag is required for proper typeface rendering
    tp.setFlags(tp.getFlags() | Paint.SUBPIXEL_TEXT_FLAG);
}

From source file:com.alcoapps.actionbarextras.TypefaceSpan.java

@Override
public void updateDrawState(TextPaint tp) {
    tp.setTypeface(mTypeface);//from w w  w  .j  a v a2  s  . c om

    // Note: This flag is required for proper typeface rendering
    tp.setFlags(tp.getFlags() | Paint.SUBPIXEL_TEXT_FLAG);
}

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  .  j a va 2s  . c om
            .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();
}