Search in sources :

Example 1 with ArtistSearchResult

use of org.musicbrainz.android.api.data.ArtistSearchResult in project musicbrainz-android by jdamcd.

the class ArtistSearchAdapter method getView.

public View getView(int position, View convertView, ViewGroup parent) {
    View artist = convertView;
    ArtistSearchHolder holder = null;
    if (artist == null) {
        LayoutInflater inflater = context.getLayoutInflater();
        artist = inflater.inflate(R.layout.list_search_artist, parent, false);
        holder = new ArtistSearchHolder(artist);
        artist.setTag(holder);
    } else {
        holder = (ArtistSearchHolder) artist.getTag();
    }
    ArtistSearchResult artistData = resultData.get(position);
    holder.getArtistName().setText(artistData.getName());
    TextView option = holder.getDisambiguation();
    String disambiguation = artistData.getDisambiguation();
    option.setText(disambiguation);
    if (disambiguation != null) {
        option.setVisibility(View.VISIBLE);
    } else {
        option.setVisibility(View.GONE);
    }
    return artist;
}
Also used : LayoutInflater(android.view.LayoutInflater) ArtistSearchResult(org.musicbrainz.android.api.data.ArtistSearchResult) TextView(android.widget.TextView) TextView(android.widget.TextView) View(android.view.View)

Example 2 with ArtistSearchResult

use of org.musicbrainz.android.api.data.ArtistSearchResult in project musicbrainz-android by jdamcd.

the class MusicBrainzWebClient method searchArtist.

@Override
public LinkedList<ArtistSearchResult> searchArtist(String searchTerm) throws IOException {
    HttpEntity entity = get(QueryBuilder.artistSearch(searchTerm));
    LinkedList<ArtistSearchResult> artists = responseParser.parseArtistSearch(entity.getContent());
    entity.consumeContent();
    return artists;
}
Also used : HttpEntity(org.apache.http.HttpEntity) ArtistSearchResult(org.musicbrainz.android.api.data.ArtistSearchResult)

Example 3 with ArtistSearchResult

use of org.musicbrainz.android.api.data.ArtistSearchResult in project musicbrainz-android by jdamcd.

the class ArtistSearchHandler method startElement.

public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException {
    if (localName.equals("artist")) {
        result = new ArtistSearchResult();
        result.setMbid(atts.getValue("id"));
    } else if (localName.equals("name") && !inTag && !inUnsupported) {
        buildString();
    } else if (localName.equals("disambiguation")) {
        buildString();
    } else if (localName.equals("tag")) {
        inTag = true;
    } else if (isUnsupported(localName)) {
        inUnsupported = true;
    }
}
Also used : ArtistSearchResult(org.musicbrainz.android.api.data.ArtistSearchResult)

Aggregations

ArtistSearchResult (org.musicbrainz.android.api.data.ArtistSearchResult)3 LayoutInflater (android.view.LayoutInflater)1 View (android.view.View)1 TextView (android.widget.TextView)1 HttpEntity (org.apache.http.HttpEntity)1