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.ViewPlaylistInformationDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

    parentActivity = getActivity();/* w ww  .  j  a va 2  s .  c o  m*/
    dialogFragment = this;

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

    playlistName = getArguments().getString("PLAYLIST_NAME");
    playlistFilePath = getArguments().getString("PLAYLIST_FILE_PATH");

    //Header text declarations.
    playlistNameText = (TextView) rootView.findViewById(R.id.playlist_name_text);
    playlistNameText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light"));
    playlistNameText.setPaintFlags(playlistNameText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG
            | Paint.SUBPIXEL_TEXT_FLAG | Paint.FAKE_BOLD_TEXT_FLAG);

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

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

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

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

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

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

    //Values declarations.
    playlistNameValue = (TextView) rootView.findViewById(R.id.playlist_name_value);
    playlistNameValue.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light"));
    playlistNameValue.setPaintFlags(
            playlistNameValue.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);

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

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

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

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

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

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

    //Set the playlist name and the file format.
    playlistNameValue.setText(playlistName);

    int extensionDotIndex = playlistFilePath.lastIndexOf(".");

    String extension = "";
    if (!playlistFilePath.isEmpty()) {
        extension = playlistFilePath.substring(extensionDotIndex, playlistFilePath.length());
    } else {
        extension = "Unknown";
    }
    playlistFormatValue.setText(extension);

    /*//Retrieve the information that needs to tbe displayed in the dialog.
    DBAccessHelper dbHelper = new DBAccessHelper(parentActivity);
    Cursor cursor = dbHelper.getPlaylistByFilePath(playlistFilePath);
            
    if (cursor.getCount() > 0) {
       //Get the number of songs in the playlist.
       playlistNumberOfSongs = cursor.getCount() + "";
       playlistNumberOfSongsValue.setText(playlistNumberOfSongs);
               
       //Get the date that the playlist was added to the library.
       cursor.moveToFirst();
               
       //Note that addTime isn't the actual "Last modification" date. It's actually the date the playlist was added to the library.
       long addTime = cursor.getLong(cursor.getColumnIndex(DBAccessHelper.PLAYLIST_LAST_MODIFIED));
       Date addDate = new Date(addTime);
               
       SimpleDateFormat addDateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm aa", Locale.getDefault());
       addDateFormat.setTimeZone(TimeZone.getDefault());
       playlistAddedToLibrary = addDateFormat.format(addDate);
               
       playlistAddedToLibraryValue.setText(playlistAddedToLibrary);
               
    }
            
    //Get a File that points to the playlist file on the filesystem.
    File file = new File(playlistFilePath);
    long lastModifiedTime = file.lastModified();
            
    if (lastModifiedTime==0) {
       playlistLastModifiedValue.setText("Unknown");
    } else {
       Date lastModifiedDate = new Date(lastModifiedTime);
               
       SimpleDateFormat lastModifiedDateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm aa", Locale.getDefault());
       lastModifiedDateFormat.setTimeZone(TimeZone.getDefault());
               
       playlistLastModified = lastModifiedDateFormat.format(lastModifiedDate);
       playlistLastModifiedValue.setText(playlistLastModified);
       playlistCreatedValue.setText(playlistLastModified);
    }*/

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

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

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

        }

    });

    return builder.create();
}

From source file:com.aniruddhc.acemusic.player.BlacklistManagerActivity.BlacklistedArtistsMultiselectAdapter.java

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    final Cursor c = (Cursor) getItem(position);
    SongsListViewHolder holder = null;//from w ww.j av  a  2  s .c om

    if (convertView == null) {

        convertView = LayoutInflater.from(mContext).inflate(R.layout.music_library_editor_artists_layout,
                parent, false);
        holder = new SongsListViewHolder();
        holder.image = (ImageView) convertView.findViewById(R.id.artistThumbnailMusicLibraryEditor);
        holder.title = (TextView) convertView.findViewById(R.id.artistNameMusicLibraryEditor);
        holder.checkBox = (CheckBox) convertView.findViewById(R.id.artistCheckboxMusicLibraryEditor);

        convertView.setTag(holder);
    } else {
        holder = (SongsListViewHolder) convertView.getTag();
    }

    final View finalConvertView = convertView;
    final String songId = c.getString(c.getColumnIndex(DBAccessHelper._ID));
    final String songArtist = c.getString(c.getColumnIndex(DBAccessHelper.SONG_ARTIST));
    final String songBlacklistStatus = c.getString(c.getColumnIndex(DBAccessHelper.BLACKLIST_STATUS));
    String songAlbumArtPath = c.getString(c.getColumnIndex(DBAccessHelper.SONG_ALBUM_ART_PATH));

    holder.title.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light"));
    holder.title.setPaintFlags(holder.title.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);

    //Set the song title.
    holder.title.setText(songArtist);
    mApp.getImageLoader().displayImage(songAlbumArtPath, holder.image,
            BlacklistManagerActivity.displayImageOptions);

    //Check if the song's DB ID exists in the HashSet and set the appropriate checkbox status.
    try {
        if (BlacklistManagerActivity.songIdBlacklistStatusPair.get(songId).equals("TRUE")) {
            holder.checkBox.setChecked(true);
            convertView.setBackgroundColor(0xCCFF4444);
        } else {
            holder.checkBox.setChecked(false);
            convertView.setBackgroundColor(0x00000000);
        }

    } catch (Exception e) {
        e.printStackTrace();
    }

    //Set a tag to the row that will attach the artist's name to it.
    convertView.setTag(R.string.artist, songArtist);

    holder.checkBox.setOnCheckedChangeListener(new OnCheckedChangeListener() {

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

            if (isChecked == true) {

                //Only receive inputs by the user and ignore any system-made changes to the checkbox state.
                if (checkbox.isPressed()) {
                    finalConvertView.setBackgroundColor(0xCCFF4444);
                    AsyncBlacklistArtistTask task = new AsyncBlacklistArtistTask(songArtist);
                    task.execute(new String[] { "ADD" });
                }

            } else if (isChecked == false) {

                //Only receive inputs by the user and ignore any system-made changes to the checkbox state.
                if (checkbox.isPressed()) {
                    finalConvertView.setBackgroundColor(0x00000000);
                    AsyncBlacklistArtistTask task = new AsyncBlacklistArtistTask(songArtist);
                    task.execute(new String[] { "REMOVE" });

                }

            }

        }

    });

    return convertView;
}

From source file:com.aniruddhc.acemusic.player.PlaylistEditorActivity.PlaylistEditorArtistsMultiselectAdapter.java

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    final Cursor c = (Cursor) getItem(position);
    SongsListViewHolder holder = null;/*from  w w w  . ja v  a2  s  .  co m*/

    if (convertView == null) {

        convertView = LayoutInflater.from(mContext).inflate(R.layout.music_library_editor_artists_layout,
                parent, false);
        holder = new SongsListViewHolder();
        holder.image = (ImageView) convertView.findViewById(R.id.artistThumbnailMusicLibraryEditor);
        holder.title = (TextView) convertView.findViewById(R.id.artistNameMusicLibraryEditor);
        holder.checkBox = (CheckBox) convertView.findViewById(R.id.artistCheckboxMusicLibraryEditor);

        convertView.setTag(holder);
    } else {
        holder = (SongsListViewHolder) convertView.getTag();
    }

    final View finalConvertView = convertView;
    final String songId = c.getString(c.getColumnIndex(DBAccessHelper._ID));
    final String songArtist = c.getString(c.getColumnIndex(DBAccessHelper.SONG_ARTIST));
    String songAlbumArtPath = c.getString(c.getColumnIndex(DBAccessHelper.SONG_ALBUM_ART_PATH));

    holder.title.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light"));
    holder.title.setPaintFlags(holder.title.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);

    //Set the song title.
    holder.title.setText(songArtist);
    mApp.getImageLoader().displayImage(songAlbumArtPath, holder.image,
            PlaylistEditorActivity.displayImageOptions);

    //Check if the song's DB ID exists in the HashSet and set the appropriate checkbox status.
    if (PlaylistEditorActivity.songDBIdsList.contains(songId)) {
        holder.checkBox.setChecked(true);
        convertView.setBackgroundColor(0xCC0099CC);
    } else {
        holder.checkBox.setChecked(false);
        convertView.setBackgroundColor(0x00000000);
    }

    //Set a tag to the row that will attach the artist's name to it.
    convertView.setTag(R.string.artist, songArtist);

    holder.checkBox.setOnCheckedChangeListener(new OnCheckedChangeListener() {

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

            if (isChecked == true) {

                //Only receive inputs by the user and ignore any system-made changes to the checkbox state.
                if (checkbox.isPressed()) {
                    finalConvertView.setBackgroundColor(0xCC0099CC);
                    AsyncGetArtistSongIds task = new AsyncGetArtistSongIds(mContext, songArtist);
                    task.execute(new String[] { "ADD" });
                }

            } else if (isChecked == false) {

                //Only receive inputs by the user and ignore any system-made changes to the checkbox state.
                if (checkbox.isPressed()) {
                    finalConvertView.setBackgroundColor(0x00000000);
                    AsyncGetArtistSongIds task = new AsyncGetArtistSongIds(mContext, songArtist);
                    task.execute(new String[] { "REMOVE" });

                }

            }

        }

    });

    return convertView;
}

From source file:com.aniruddhc.acemusic.player.MusicLibraryEditorActivity.MusicLibraryEditorArtistsMultiselectAdapter.java

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    final Cursor c = (Cursor) getItem(position);
    SongsListViewHolder holder = null;//  ww  w  .java2s.c om

    if (convertView == null) {

        convertView = LayoutInflater.from(mContext).inflate(R.layout.music_library_editor_artists_layout,
                parent, false);
        holder = new SongsListViewHolder();
        holder.image = (ImageView) convertView.findViewById(R.id.artistThumbnailMusicLibraryEditor);
        holder.title = (TextView) convertView.findViewById(R.id.artistNameMusicLibraryEditor);
        holder.checkBox = (CheckBox) convertView.findViewById(R.id.artistCheckboxMusicLibraryEditor);

        convertView.setTag(holder);
    } else {
        holder = (SongsListViewHolder) convertView.getTag();
    }

    final View finalConvertView = convertView;
    final String songId = c.getString(c.getColumnIndex(DBAccessHelper._ID));
    final String songArtist = c.getString(c.getColumnIndex(DBAccessHelper.SONG_ARTIST));
    String songAlbumArtPath = c.getString(c.getColumnIndex(DBAccessHelper.SONG_ALBUM_ART_PATH));

    holder.title.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light"));
    holder.title.setPaintFlags(holder.title.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);

    //Set the song title.
    holder.title.setText(songArtist);
    mApp.getImageLoader().displayImage(songAlbumArtPath, holder.image,
            MusicLibraryEditorActivity.displayImageOptions);

    //Check if the song's DB ID exists in the HashSet and set the appropriate checkbox status.
    if (MusicLibraryEditorActivity.songDBIdsList.contains(songId)) {
        holder.checkBox.setChecked(true);
        convertView.setBackgroundColor(0xCC0099CC);
    } else {
        holder.checkBox.setChecked(false);
        convertView.setBackgroundColor(0x00000000);
    }

    //Set a tag to the row that will attach the artist's name to it.
    convertView.setTag(R.string.artist, songArtist);

    holder.checkBox.setOnCheckedChangeListener(new OnCheckedChangeListener() {

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

            if (isChecked == true) {

                //Only receive inputs by the user and ignore any system-made changes to the checkbox state.
                if (checkbox.isPressed()) {
                    finalConvertView.setBackgroundColor(0xCC0099CC);
                    AsyncGetArtistSongIds task = new AsyncGetArtistSongIds(songArtist);
                    task.execute(new String[] { "ADD" });
                }

            } else if (isChecked == false) {

                //Only receive inputs by the user and ignore any system-made changes to the checkbox state.
                if (checkbox.isPressed()) {
                    finalConvertView.setBackgroundColor(0x00000000);
                    AsyncGetArtistSongIds task = new AsyncGetArtistSongIds(songArtist);
                    task.execute(new String[] { "REMOVE" });

                }

            }

        }

    });

    return convertView;
}

From source file:se.frikod.payday.TypefaceTextView.java

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

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

    try {//from  w w w.ja v a  2 s .  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("%s", 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:com.aniruddhc.acemusic.player.BlacklistManagerActivity.BlacklistedSongsMultiselectAdapter.java

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    final Cursor c = (Cursor) getItem(position);
    SongsListViewHolder holder = null;/*  w  ww  . j a v  a 2 s.c  o  m*/

    if (convertView == null) {

        convertView = LayoutInflater.from(mContext).inflate(R.layout.music_library_editor_songs_layout, parent,
                false);
        holder = new SongsListViewHolder();
        holder.image = (ImageView) convertView.findViewById(R.id.songThumbnailMusicLibraryEditor);
        holder.title = (TextView) convertView.findViewById(R.id.songNameMusicLibraryEditor);
        holder.checkBox = (CheckBox) convertView.findViewById(R.id.songCheckboxMusicLibraryEditor);
        holder.subText = (TextView) convertView.findViewById(R.id.artistNameSongListView);

        convertView.setTag(holder);
    } else {
        holder = (SongsListViewHolder) convertView.getTag();
    }

    final View finalConvertView = convertView;
    final String songId = c.getString(c.getColumnIndex(DBAccessHelper._ID));
    final String songTitle = c.getString(c.getColumnIndex(DBAccessHelper.SONG_TITLE));
    final String songFilePath = c.getString(c.getColumnIndex(DBAccessHelper.SONG_FILE_PATH));
    String songAlbumArtPath = c.getString(c.getColumnIndex(DBAccessHelper.SONG_ALBUM_ART_PATH));
    String songArtist = c.getString(c.getColumnIndex(DBAccessHelper.SONG_ARTIST));
    String songBlacklistStatus = c.getString(c.getColumnIndex(DBAccessHelper.BLACKLIST_STATUS));

    holder.title.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light"));
    holder.title.setPaintFlags(holder.title.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);

    holder.subText.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light"));
    holder.subText
            .setPaintFlags(holder.subText.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);

    //Set the songID as the view's tag.
    convertView.setTag(R.string.song_id, songId);
    convertView.setTag(R.string.song_file_path, songFilePath);

    //Set the song title.
    holder.title.setText(songTitle);
    holder.subText.setText(songArtist);
    mApp.getImageLoader().displayImage(songAlbumArtPath, holder.image,
            BlacklistManagerActivity.displayImageOptions);

    //Check if the song's DB ID exists in the HashSet and set the appropriate checkbox status.
    if (BlacklistManagerActivity.songIdBlacklistStatusPair.get(songId).equals("TRUE")) {
        convertView.setBackgroundColor(0xCCFF4444);
        holder.checkBox.setChecked(true);
    } else {
        convertView.setBackgroundColor(0x00000000);
        holder.checkBox.setChecked(false);
    }

    holder.checkBox.setOnCheckedChangeListener(new OnCheckedChangeListener() {

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

            if (isChecked == true) {

                //Only receive inputs by the user and ignore any system-made changes to the checkbox state.
                if (checkbox.isPressed()) {
                    finalConvertView.setBackgroundColor(0xCCFF4444);
                    BlacklistManagerActivity.songIdBlacklistStatusPair.put(songId, true);
                }

            } else if (isChecked == false) {

                //Only receive inputs by the user and ignore any system-made changes to the checkbox state.
                if (checkbox.isPressed()) {
                    finalConvertView.setBackgroundColor(0x000000);
                    BlacklistManagerActivity.songIdBlacklistStatusPair.put(songId, false);
                }

            }

        }

    });

    return convertView;
}

From source file:com.aniruddhc.acemusic.player.PlaylistEditorActivity.PlaylistEditorSongsMultiselectAdapter.java

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    final Cursor c = (Cursor) getItem(position);
    SongsListViewHolder holder = null;/*w  ww .  ja va  2s.co  m*/

    if (convertView == null) {

        convertView = LayoutInflater.from(mContext).inflate(R.layout.music_library_editor_songs_layout, parent,
                false);
        holder = new SongsListViewHolder();
        holder.image = (ImageView) convertView.findViewById(R.id.songThumbnailMusicLibraryEditor);
        holder.title = (TextView) convertView.findViewById(R.id.songNameMusicLibraryEditor);
        holder.checkBox = (CheckBox) convertView.findViewById(R.id.songCheckboxMusicLibraryEditor);
        holder.subText = (TextView) convertView.findViewById(R.id.artistNameSongListView);

        convertView.setTag(holder);
    } else {
        holder = (SongsListViewHolder) convertView.getTag();
    }

    final View finalConvertView = convertView;
    final String songId = c.getString(c.getColumnIndex(DBAccessHelper._ID));
    final String songTitle = c.getString(c.getColumnIndex(DBAccessHelper.SONG_TITLE));
    String songAlbumArtPath = c.getString(c.getColumnIndex(DBAccessHelper.SONG_ALBUM_ART_PATH));
    String songArtist = c.getString(c.getColumnIndex(DBAccessHelper.SONG_ARTIST));

    holder.title.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light"));
    holder.title.setPaintFlags(holder.title.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);

    holder.subText.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light"));
    holder.subText
            .setPaintFlags(holder.subText.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);

    //Set the songID as the view's tag.
    convertView.setTag(R.string.song_id, songId);

    //Set the song title.
    holder.title.setText(songTitle);
    holder.subText.setText(songArtist);
    mApp.getImageLoader().displayImage(songAlbumArtPath, holder.image,
            PlaylistEditorActivity.displayImageOptions);

    //Check if the song's DB ID exists in the HashSet and set the appropriate checkbox status.
    if (PlaylistEditorActivity.songDBIdsList.contains(songId)) {
        convertView.setBackgroundColor(0xCC0099CC);
        holder.checkBox.setChecked(true);
    } else {
        convertView.setBackgroundColor(0x00000000);
        holder.checkBox.setChecked(false);
    }

    holder.checkBox.setOnCheckedChangeListener(new OnCheckedChangeListener() {

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

            if (isChecked == true) {

                //Only receive inputs by the user and ignore any system-made changes to the checkbox state.
                if (checkbox.isPressed()) {
                    finalConvertView.setBackgroundColor(0xCC0099CC);
                    PlaylistEditorActivity.songDBIdsList.add(songId);
                }

            } else if (isChecked == false) {

                //Only receive inputs by the user and ignore any system-made changes to the checkbox state.
                if (checkbox.isPressed()) {
                    finalConvertView.setBackgroundColor(0xCC0099CC);
                    PlaylistEditorActivity.songDBIdsList.remove(songId);
                }

            }

        }

    });

    return convertView;
}

From source file:com.aniruddhc.acemusic.player.MusicLibraryEditorActivity.MusicLibraryEditorSongsMultiselectAdapter.java

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    final Cursor c = (Cursor) getItem(position);
    SongsListViewHolder holder = null;/*from   w w w . java  2s. c o  m*/

    if (convertView == null) {

        convertView = LayoutInflater.from(mContext).inflate(R.layout.music_library_editor_songs_layout, parent,
                false);
        holder = new SongsListViewHolder();
        holder.image = (ImageView) convertView.findViewById(R.id.songThumbnailMusicLibraryEditor);
        holder.title = (TextView) convertView.findViewById(R.id.songNameMusicLibraryEditor);
        holder.checkBox = (CheckBox) convertView.findViewById(R.id.songCheckboxMusicLibraryEditor);
        holder.subText = (TextView) convertView.findViewById(R.id.artistNameSongListView);

        convertView.setTag(holder);
    } else {
        holder = (SongsListViewHolder) convertView.getTag();
    }

    final View finalConvertView = convertView;
    final String songId = c.getString(c.getColumnIndex(DBAccessHelper._ID));
    final String songTitle = c.getString(c.getColumnIndex(DBAccessHelper.SONG_TITLE));
    String songAlbumArtPath = c.getString(c.getColumnIndex(DBAccessHelper.SONG_ALBUM_ART_PATH));
    String songArtist = c.getString(c.getColumnIndex(DBAccessHelper.SONG_ARTIST));

    holder.title.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light"));
    holder.title.setPaintFlags(holder.title.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);

    holder.subText.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light"));
    holder.subText
            .setPaintFlags(holder.subText.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);

    //Set the songID as the view's tag.
    convertView.setTag(R.string.song_id, songId);

    //Set the song title.
    holder.title.setText(songTitle);
    holder.subText.setText(songArtist);
    mApp.getImageLoader().displayImage(songAlbumArtPath, holder.image,
            MusicLibraryEditorActivity.displayImageOptions);

    //Check if the song's DB ID exists in the HashSet and set the appropriate checkbox status.
    if (MusicLibraryEditorActivity.songDBIdsList.contains(songId)) {
        convertView.setBackgroundColor(0xCC0099CC);
        holder.checkBox.setChecked(true);
    } else {
        convertView.setBackgroundColor(0x00000000);
        holder.checkBox.setChecked(false);
    }

    holder.checkBox.setOnCheckedChangeListener(new OnCheckedChangeListener() {

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

            if (isChecked == true) {

                //Only receive inputs by the user and ignore any system-made changes to the checkbox state.
                if (checkbox.isPressed()) {
                    finalConvertView.setBackgroundColor(0xCC0099CC);
                    MusicLibraryEditorActivity.songDBIdsList.add(songId);
                }

            } else if (isChecked == false) {

                //Only receive inputs by the user and ignore any system-made changes to the checkbox state.
                if (checkbox.isPressed()) {
                    finalConvertView.setBackgroundColor(0xCC0099CC);
                    MusicLibraryEditorActivity.songDBIdsList.remove(songId);
                }

            }

        }

    });

    return convertView;
}

From source file:com.ipa.Tools.TypefaceTextView.java

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

    try {/*  www .  jav a2  s  .c o 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-Family.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:com.aniruddhc.acemusic.player.PlaylistEditorActivity.PlaylistEditorAlbumsMultiselectAdapter.java

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    final Cursor c = (Cursor) getItem(position);
    SongsListViewHolder holder = null;/*from   w  w  w  .j a  v  a 2s.c o  m*/

    if (convertView == null) {

        convertView = LayoutInflater.from(mContext).inflate(R.layout.music_library_editor_albums_layout, parent,
                false);
        holder = new SongsListViewHolder();
        holder.image = (ImageView) convertView.findViewById(R.id.albumThumbnailMusicLibraryEditor);
        holder.title = (TextView) convertView.findViewById(R.id.albumNameMusicLibraryEditor);
        holder.checkBox = (CheckBox) convertView.findViewById(R.id.albumCheckboxMusicLibraryEditor);
        holder.subText = (TextView) convertView.findViewById(R.id.albumArtistNameMusicLibraryEditor);

        convertView.setTag(holder);
    } else {
        holder = (SongsListViewHolder) convertView.getTag();
    }

    final View finalConvertView = convertView;
    final String songId = c.getString(c.getColumnIndex(DBAccessHelper._ID));
    final String songArtist = c.getString(c.getColumnIndex(DBAccessHelper.SONG_ARTIST));
    final String songAlbum = c.getString(c.getColumnIndex(DBAccessHelper.SONG_ALBUM));
    final String songAlbumArtPath = c.getString(c.getColumnIndex(DBAccessHelper.SONG_ALBUM_ART_PATH));

    //Set the album's name and artist as the row's tag.
    convertView.setTag(R.string.album, songAlbum);
    convertView.setTag(R.string.artist, songArtist);

    holder.title.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light"));
    holder.title.setPaintFlags(holder.title.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);
    holder.subText.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light"));
    holder.subText
            .setPaintFlags(holder.subText.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);

    //Set the song title.
    holder.title.setText(songAlbum);
    holder.subText.setText(songArtist);
    mApp.getImageLoader().displayImage(songAlbumArtPath, holder.image,
            PlaylistEditorActivity.displayImageOptions);

    //Check if the song's DB ID exists in the HashSet and set the appropriate checkbox status.
    if (PlaylistEditorActivity.songDBIdsList.contains(songId)) {
        holder.checkBox.setChecked(true);
        convertView.setBackgroundColor(0xCC0099CC);
    } else {
        convertView.setBackgroundColor(0x00000000);
        holder.checkBox.setChecked(false);
    }

    holder.checkBox.setOnCheckedChangeListener(new OnCheckedChangeListener() {

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

            if (isChecked == true) {

                //Only receive inputs by the user and ignore any system-made changes to the checkbox state.
                if (checkbox.isPressed()) {
                    finalConvertView.setBackgroundColor(0xCC0099CC);
                    AsyncGetAlbumSongIds task = new AsyncGetAlbumSongIds(mContext, songAlbum, songArtist);
                    task.execute(new String[] { "ADD" });
                }

            } else if (isChecked == false) {

                //Only receive inputs by the user and ignore any system-made changes to the checkbox state.
                if (checkbox.isPressed()) {
                    finalConvertView.setBackgroundColor(0x00000000);
                    AsyncGetAlbumSongIds task = new AsyncGetAlbumSongIds(mContext, songAlbum, songArtist);
                    task.execute(new String[] { "REMOVE" });

                }

            }

        }

    });

    return convertView;
}