android.provider.MediaStore.Audio.ArtistColumns Java Examples

The following examples show how to use android.provider.MediaStore.Audio.ArtistColumns. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ApolloUtils.java    From mobile-manager-tool with MIT License 5 votes vote down vote up
/**
 * @return A custom ContextMenu header
 */
public static  View setHeaderLayout(String Type, Cursor cursor, Activity activity) {
    LayoutInflater inflater = activity.getLayoutInflater();
    View header = inflater.inflate(R.layout.music_context_menu_header, null, false);

    // Artist image
    final ImageView mHanderImage = (ImageView)header.findViewById(R.id.header_image);
    String albumId="",artistName="",albumName="";

    if(Type == TYPE_ALBUM){
        albumName = cursor.getString(cursor.getColumnIndexOrThrow(AlbumColumns.ALBUM));
        artistName = cursor.getString(cursor.getColumnIndexOrThrow(AlbumColumns.ARTIST));
        albumId = cursor.getString(cursor.getColumnIndexOrThrow(BaseColumns._ID));
    }
    else{
        artistName = cursor.getString(cursor.getColumnIndexOrThrow(ArtistColumns.ARTIST));
    }
    
    
    ImageInfo mInfo = new ImageInfo();
    mInfo.type = Type;
    mInfo.size = SIZE_THUMB;
    mInfo.source = SRC_FIRST_AVAILABLE;
    mInfo.data = (Type == TYPE_ALBUM ? new String[]{ albumId , artistName, albumName } : new String[]{ artistName});
   
    ImageProvider.getInstance(activity).loadImage( mHanderImage, mInfo );

    // Set artist name
    TextView headerText = (TextView)header.findViewById(R.id.header_text);
    headerText.setText( (Type == TYPE_ALBUM ? albumName : artistName));
    headerText.setBackgroundColor((activity).getResources().getColor(R.color.transparent_black));
    return header;
}
 
Example #2
Source File: TracksBrowser.java    From mobile-manager-tool with MIT License 5 votes vote down vote up
/**
  * @return number of albums from Bundle
  */
 public String getNumSongs() {
 	String[] projection = {
             BaseColumns._ID, ArtistColumns.ARTIST, ArtistColumns.NUMBER_OF_TRACKS
     };
 	Uri uri = Audio.Artists.EXTERNAL_CONTENT_URI;
     Long id = ApolloUtils.getArtistId(getArtist(), ARTIST_ID, this);
     Cursor cursor = null;
     try{
     	cursor = this.getContentResolver().query(uri, projection, BaseColumns._ID+ "=" + DatabaseUtils.sqlEscapeString(String.valueOf(id)), null, null);
     }
     catch(Exception e){
     	e.printStackTrace();
     }
     if(cursor == null)
     	return String.valueOf(0);
     int mArtistNumAlbumsIndex = cursor.getColumnIndexOrThrow(ArtistColumns.NUMBER_OF_TRACKS);
     if(cursor.getCount()>0){
  	cursor.moveToFirst();
      String numAlbums = cursor.getString(mArtistNumAlbumsIndex);
cursor.close();
      if(numAlbums != null){
      	return numAlbums;
      }
     }
     return String.valueOf(0);
 }
 
Example #3
Source File: TracksBrowser.java    From mobile-manager-tool with MIT License 5 votes vote down vote up
/**
  * @return number of albums from Bundle
  */
 public String getNumAlbums() {
     if (bundle.getString(NUMALBUMS) != null)
         return bundle.getString(NUMALBUMS);
     String[] projection = {
             BaseColumns._ID, ArtistColumns.ARTIST, ArtistColumns.NUMBER_OF_ALBUMS
     };
     Uri uri = Audio.Artists.EXTERNAL_CONTENT_URI;
     Long id = ApolloUtils.getArtistId(getArtist(), ARTIST_ID, this);
     Cursor cursor = null;
     try{
     	cursor = this.getContentResolver().query(uri, projection, BaseColumns._ID+ "=" + DatabaseUtils.sqlEscapeString(String.valueOf(id)), null, null);
     }
     catch(Exception e){
     	e.printStackTrace();
     }
     if(cursor == null)
     	return String.valueOf(0);
     int mArtistNumAlbumsIndex = cursor.getColumnIndexOrThrow(ArtistColumns.NUMBER_OF_ALBUMS);
     if(cursor.getCount()>0){
  	cursor.moveToFirst();
      String numAlbums = cursor.getString(mArtistNumAlbumsIndex);
cursor.close();
      if(numAlbums != null){
      	return numAlbums;
      }
     }
     return String.valueOf(0);
 }
 
Example #4
Source File: ArtistsFragment.java    From mobile-manager-tool with MIT License 5 votes vote down vote up
public void setupFragmentData(){
	mAdapter = new ArtistAdapter(getActivity(), R.layout.music_gridview_items, null,
									new String[] {}, new int[] {}, 0); 
	mProjection = new String []{
            BaseColumns._ID, ArtistColumns.ARTIST, ArtistColumns.NUMBER_OF_ALBUMS
    };
    mUri = Audio.Artists.EXTERNAL_CONTENT_URI;
    mSortOrder = Audio.Artists.DEFAULT_SORT_ORDER;
    mFragmentGroupId = 1;
    mType = TYPE_ARTIST;
}
 
Example #5
Source File: ArtistAdapter.java    From mobile-manager-tool with MIT License 5 votes vote down vote up
public void setupViewData(Cursor mCursor){

    	mLineOneText = mCursor.getString(mCursor.getColumnIndexOrThrow(ArtistColumns.ARTIST));
        int albums_plural = mCursor.getInt(mCursor.getColumnIndexOrThrow(ArtistColumns.NUMBER_OF_ALBUMS));
        boolean unknown = mLineOneText == null || mLineOneText.equals(MediaStore.UNKNOWN_STRING);
        mLineTwoText = MusicUtils.makeAlbumsLabel(mContext, albums_plural, 0, unknown);        
        mGridType = TYPE_ARTIST;        
        mImageData = new String[]{mLineOneText};
        mPlayingId = MusicUtils.getCurrentArtistId();
        mCurrentId = mCursor.getLong(mCursor.getColumnIndexOrThrow(BaseColumns._ID));
        
    }
 
Example #6
Source File: MediaArtistsView.java    From AlarmOn with Apache License 2.0 5 votes vote down vote up
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
  super.onItemClick(parent, view, position, id);
  albumsView.query(Albums.EXTERNAL_CONTENT_URI, ArtistColumns.ARTIST_KEY + " = '" + getLastSelectedName() + "'");
  getFlipper().setInAnimation(getContext(), R.anim.slide_in_left);
  getFlipper().setOutAnimation(getContext(), R.anim.slide_out_left);
  getFlipper().showNext();
}
 
Example #7
Source File: MediaArtistsView.java    From AlarmOn with Apache License 2.0 4 votes vote down vote up
public void query(Uri contentUri, String selection) {
  super.query(contentUri, ArtistColumns.ARTIST_KEY, selection, R.layout.media_picker_row, artistsColumns, artistsResIDs);
}