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: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  . j a v  a 2 s  . co 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();
}

From source file:com.netpace.expressit.android.ui.TypefaceEditText.java

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

    // Get our custom attributes
    TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.TypefaceTextView, 0, 0);

    try {//  www.j a  v  a2s  .  co m
        String typefaceName = a.getString(R.styleable.TypefaceTextView_typeface);

        if (!isInEditMode() && !TextUtils.isEmpty(typefaceName)) {
            Typeface typeface = sTypefaceCache.get(typefaceName);

            if (typeface == null) {
                typeface = Typeface.createFromAsset(context.getAssets(),
                        String.format("fonts/%s_0.otf", typefaceName));

                // Cache the Typeface object
                sTypefaceCache.put(typefaceName, typeface);
            }
            setTypeface(typeface);

            // Note: This flag is required for proper typeface rendering
            setPaintFlags(getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG);
        }
    } finally {
        a.recycle();
    }
}

From source file:se.attentec.attenhome.TypefaceSpan.java

@Override
public void updateMeasureState(TextPaint p) {
    p.setTypeface(mTypeface);/* ww w. j  a v a  2  s.c o  m*/
    p.setTextSize(mTextSize);
    p.setColor(mColor);
    // Note: This flag is required for proper typeface rendering
    p.setFlags(p.getFlags() | Paint.SUBPIXEL_TEXT_FLAG);
}

From source file:com.beemindz.photogalley.util.TypefaceSpan.java

@Override
public void updateMeasureState(TextPaint p) {
    p.setTypeface(mTypeface);/*from   w  w  w . jav 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.aniruddhc.acemusic.player.Dialogs.RenamePlaylistDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

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

    //Retrieve the arguments.
    final String PLAYLIST_NAME = getArguments().getString("PLAYLIST_NAME");
    final String PLAYLIST_FILE_PATH = getArguments().getString("PLAYLIST_FILE_PATH");
    final String PLAYLIST_FOLDER_PATH = getArguments().getString("PLAYLIST_FOLDER_PATH");

    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    dialogView = parentActivity.getLayoutInflater().inflate(R.layout.rename_playlist_dialog_layout, null);

    playlistInfo = (TextView) dialogView.findViewById(R.id.rename_playlist_info);
    playlistInfo.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light"));
    playlistInfo.setPaintFlags(playlistInfo.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);

    playlistNameField = (EditText) dialogView.findViewById(R.id.rename_playlist_text_field);
    playlistNameField.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light"));
    playlistNameField.setPaintFlags(
            playlistNameField.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);

    playlistNameField.setText(PLAYLIST_NAME);

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

            //Create a File that points to the playlist on the filesystem.
            File file = new File(PLAYLIST_FILE_PATH);

            //Retrieve the name and file path for the playlist.
            String playlistName = playlistNameField.getText().toString();

            //Replace illegal characters in the playlistName.
            if (playlistName.contains("/")) {
                playlistName = playlistName.replace("/", "_");
            }

            if (playlistName.contains("\\")) {
                playlistName = playlistName.replace("\\", "_");
            }

            //Create another File that points to the renamed playlist file.
            File newFile = new File(PLAYLIST_FOLDER_PATH + "/" + playlistName + ".m3u");
            file.renameTo(newFile);

            /*//Update the database with the new file path and playlist name.
            DBAccessHelper playlistsDBHelper = new DBAccessHelper(parentActivity);
            playlistsDBHelper.renamePlaylist(PLAYLIST_FILE_PATH, playlistName, newFile.getAbsolutePath());
                    
            //Delete any instances of the old DB entries.
            playlistsDBHelper.deleteSpecificPlaylist(PLAYLIST_NAME, PLAYLIST_FILE_PATH);*/

            Toast.makeText(parentActivity, R.string.playlist_renamed, Toast.LENGTH_SHORT).show();

            //Refresh the playlists list view.
            //PlaylistsFragment playlistsFragment = new PlaylistsFragment();
            //playlistsFragment.refreshPlaylists();

            //playlistsDBHelper.close();
            dialog.dismiss();
        }

    });

    return builder.create();
}

From source file:com.Duo.music.player.Dialogs.GooglePlayMusicAuthenticationDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    parentActivity = getActivity();//from w w w. jav  a  2s.  co  m
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    sharedPreferences = parentActivity.getSharedPreferences("com.jams.music.player", Context.MODE_PRIVATE);
    View rootView = parentActivity.getLayoutInflater().inflate(R.layout.dialog_google_authentication_layout,
            null);

    //Check if this dialog was called from the Welcome sequence.
    mFirstRun = getArguments().getBoolean(Common.FIRST_RUN);

    infoText = (TextView) rootView.findViewById(R.id.google_authentication_dialog_text);
    infoText.setTypeface(TypefaceHelper.getTypeface(getActivity(), "RobotoCondensed-Light"));
    infoText.setPaintFlags(infoText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);

    final AccountManager accountManager = AccountManager.get(getActivity().getApplicationContext());
    final Account[] accounts = accountManager.getAccountsByType("com.google");
    final int size = accounts.length;
    String[] accountNames = new String[size];

    for (int i = 0; i < size; i++) {
        accountNames[i] = accounts[i].name;
    }

    //Set the dialog title.
    builder.setTitle(R.string.sign_in_google_play_music);
    builder.setCancelable(false);
    builder.setItems(accountNames, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            account = accounts[which];
            sharedPreferences.edit().putString("GOOGLE_PLAY_MUSIC_ACCOUNT", account.name).commit();
            AsyncGoogleMusicAuthenticationTask task = new AsyncGoogleMusicAuthenticationTask(
                    parentActivity.getApplicationContext(), parentActivity, mFirstRun, account.name);

            task.execute();

        }

    });

    return builder.create();
}

From source file:com.jelly.music.player.Dialogs.GooglePlayMusicAuthenticationDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    parentActivity = getActivity();//from w  w w. j a  v a2 s  .c o m
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    sharedPreferences = parentActivity.getSharedPreferences("com.jelly.music.player", Context.MODE_PRIVATE);
    View rootView = parentActivity.getLayoutInflater().inflate(R.layout.dialog_google_authentication_layout,
            null);

    //Check if this dialog was called from the Welcome sequence.
    mFirstRun = getArguments().getBoolean(Common.FIRST_RUN);

    infoText = (TextView) rootView.findViewById(R.id.google_authentication_dialog_text);
    infoText.setTypeface(TypefaceHelper.getTypeface(getActivity(), "RobotoCondensed-Light"));
    infoText.setPaintFlags(infoText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);

    final AccountManager accountManager = AccountManager.get(getActivity().getApplicationContext());
    final Account[] accounts = accountManager.getAccountsByType("com.google");
    final int size = accounts.length;
    String[] accountNames = new String[size];

    for (int i = 0; i < size; i++) {
        accountNames[i] = accounts[i].name;
    }

    //Set the dialog title.
    builder.setTitle(R.string.sign_in_google_play_music);
    builder.setCancelable(false);
    builder.setItems(accountNames, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            account = accounts[which];
            sharedPreferences.edit().putString("GOOGLE_PLAY_MUSIC_ACCOUNT", account.name).commit();
            AsyncGoogleMusicAuthenticationTask task = new AsyncGoogleMusicAuthenticationTask(
                    parentActivity.getApplicationContext(), parentActivity, mFirstRun, account.name);

            task.execute();

        }

    });

    return builder.create();
}

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

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    parentActivity = getActivity();/*from ww w.  ja va 2  s .  co  m*/
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    sharedPreferences = parentActivity.getSharedPreferences("com.aniruddhc.acemusic.player",
            Context.MODE_PRIVATE);
    View rootView = parentActivity.getLayoutInflater().inflate(R.layout.dialog_google_authentication_layout,
            null);

    //Check if this dialog was called from the Welcome sequence.
    mFirstRun = getArguments().getBoolean(Common.FIRST_RUN);

    infoText = (TextView) rootView.findViewById(R.id.google_authentication_dialog_text);
    infoText.setTypeface(TypefaceHelper.getTypeface(getActivity(), "RobotoCondensed-Light"));
    infoText.setPaintFlags(infoText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);

    final AccountManager accountManager = AccountManager.get(getActivity().getApplicationContext());
    final Account[] accounts = accountManager.getAccountsByType("com.google");
    final int size = accounts.length;
    String[] accountNames = new String[size];

    for (int i = 0; i < size; i++) {
        accountNames[i] = accounts[i].name;
    }

    //Set the dialog title.
    builder.setTitle(R.string.sign_in_google_play_music);
    builder.setCancelable(false);
    builder.setItems(accountNames, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            account = accounts[which];
            sharedPreferences.edit().putString("GOOGLE_PLAY_MUSIC_ACCOUNT", account.name).commit();
            AsyncGoogleMusicAuthenticationTask task = new AsyncGoogleMusicAuthenticationTask(
                    parentActivity.getApplicationContext(), parentActivity, mFirstRun, account.name);

            task.execute();

        }

    });

    return builder.create();
}

From source file:com.Duo.music.player.Dialogs.CautionEditArtistsDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

    parentActivity = getActivity();/*from   www  . j a  v a2  s.c om*/
    dialogFragment = this;

    EDIT_TYPE = this.getArguments().getString("EDIT_TYPE");
    ARTIST = this.getArguments().getString("ARTIST");

    rootView = (View) parentActivity.getLayoutInflater().inflate(R.layout.fragment_caution_edit_artists, null);

    cautionText = (TextView) rootView.findViewById(R.id.caution_text);
    cautionText.setText(R.string.caution_artists_text);
    cautionText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light"));
    cautionText.setPaintFlags(cautionText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);

    sharedPreferences = getActivity().getSharedPreferences("com.jams.music.player", Context.MODE_PRIVATE);
    sharedPreferences.edit().putBoolean("SHOW_ARTIST_EDIT_CAUTION", false).commit();

    dontShowAgainText = (TextView) rootView.findViewById(R.id.dont_show_again_text);
    dontShowAgainText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light"));
    dontShowAgainText.setPaintFlags(
            dontShowAgainText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);

    dontShowAgainCheckbox = (CheckBox) rootView.findViewById(R.id.dont_show_again_checkbox);
    dontShowAgainCheckbox.setChecked(true);

    dontShowAgainCheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton arg0, boolean isChecked) {

            if (isChecked == true) {
                sharedPreferences.edit().putBoolean("SHOW_ARTIST_EDIT_CAUTION", false).commit();
            } else {
                sharedPreferences.edit().putBoolean("SHOW_ARTIST_EDIT_CAUTION", true).commit();
            }

        }

    });

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

    //Set the dialog title.
    builder.setTitle(R.string.caution);
    builder.setView(rootView);
    builder.setNegativeButton(R.string.no, new OnClickListener() {

        @Override
        public void onClick(DialogInterface arg0, int arg1) {
            dialogFragment.dismiss();

        }

    });

    builder.setPositiveButton(R.string.yes, new OnClickListener() {

        @Override
        public void onClick(DialogInterface arg0, int arg1) {
            dialogFragment.dismiss();

            FragmentTransaction ft = getFragmentManager().beginTransaction();
            Bundle bundle = new Bundle();
            bundle.putString("EDIT_TYPE", EDIT_TYPE);
            bundle.putString("ARTIST", ARTIST);
            ID3sArtistEditorDialog dialog = new ID3sArtistEditorDialog();
            dialog.setArguments(bundle);
            dialog.show(ft, "id3ArtistEditorDialog");

        }

    });

    return builder.create();
}

From source file:com.adityarathi.muo.ui.fragments.BuildingLibraryProgressFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    mContext = getActivity().getApplicationContext();
    mApp = (Common) mContext;//from   w  w w . j a va 2s  . co  m
    mRootView = (View) getActivity().getLayoutInflater().inflate(R.layout.fragment_building_library_progress,
            null);

    mProgressElementsContainer = (RelativeLayout) mRootView.findViewById(R.id.progress_elements_container);
    mProgressElementsContainer.setVisibility(View.INVISIBLE);

    mCurrentTaskText = (TextView) mRootView.findViewById(R.id.building_library_task);
    mCurrentTaskText
            .setPaintFlags(mCurrentTaskText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);

    mProgressBar = (ProgressBar) mRootView.findViewById(R.id.building_library_progress);
    mProgressBar.setMax(1000000);

    mFadeInAnimation = AnimationUtils.loadAnimation(mContext, R.anim.fade_in);
    mFadeInAnimation.setAnimationListener(fadeInListener);
    mFadeInAnimation.setDuration(700);

    return mRootView;
}