Search in sources :

Example 1 with WebLink

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

the class LinksFragment method onListItemClick.

@Override
public void onListItemClick(ListView l, View v, int position, long id) {
    super.onListItemClick(l, v, position, id);
    WebLink link = (WebLink) getListAdapter().getItem(position);
    startBrowserLink(link.getUrl());
}
Also used : WebLink(org.musicbrainz.android.api.data.WebLink)

Example 2 with WebLink

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

the class ReleaseGroupLookupHandler method startElement.

public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException {
    if (localName.equals("release-group")) {
        releaseGroup.setMbid(atts.getValue("id"));
        releaseGroup.setType(atts.getValue("type"));
    } else if (localName.equals("title")) {
        buildString();
    } else if (localName.equals("first-release-date")) {
        buildString();
    } else if (localName.equals("artist")) {
        artist = new ReleaseArtist();
        artist.setMbid(atts.getValue("id"));
        inArtist = true;
    } else if (localName.equals("rating")) {
        releaseGroup.setRatingCount(Integer.parseInt(atts.getValue("votes-count")));
        buildString();
    } else if (localName.equals("name")) {
        buildString();
    } else if (localName.equals("tag")) {
        inTag = true;
        buildString();
        tag = new Tag();
        tag.setCount(Integer.parseInt(atts.getValue("count")));
    } else if (localName.equals("relation")) {
        link = new WebLink();
        link.setType(atts.getValue("type"));
    } else if (localName.equals("target")) {
        buildString();
    }
}
Also used : ReleaseArtist(org.musicbrainz.android.api.data.ReleaseArtist) Tag(org.musicbrainz.android.api.data.Tag) WebLink(org.musicbrainz.android.api.data.WebLink)

Example 3 with WebLink

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

the class WeblinkAdapter method getView.

public View getView(int position, View convertView, ViewGroup parent) {
    View link = convertView;
    LinkHolder holder;
    if (link == null) {
        LayoutInflater inflater = context.getLayoutInflater();
        link = inflater.inflate(R.layout.list_link, parent, false);
        holder = new LinkHolder(link);
        link.setTag(holder);
    } else {
        holder = (LinkHolder) link.getTag();
    }
    WebLink linkData = links.get(position);
    holder.getLinkTitle().setText(linkData.getPrettyType());
    holder.getLink().setText(linkData.getPrettyUrl());
    holder.getIcon().setImageResource(findIconForLink(linkData));
    return link;
}
Also used : LayoutInflater(android.view.LayoutInflater) TextView(android.widget.TextView) ImageView(android.widget.ImageView) View(android.view.View) WebLink(org.musicbrainz.android.api.data.WebLink)

Example 4 with WebLink

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

the class ArtistLookupHandler method startElement.

public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException {
    if (localName.equals("artist") && !inArtistRelations) {
        artist.setMbid(atts.getValue("id"));
        artist.setType(atts.getValue("type"));
    } else if (localName.equals("name")) {
        buildString();
    } else if (localName.equals("tag")) {
        inTag = true;
        buildString();
        tag = new Tag();
        tag.setCount(Integer.parseInt(atts.getValue("count")));
    } else if (localName.equals("rating")) {
        artist.setRatingCount(Integer.parseInt(atts.getValue("votes-count")));
        buildString();
    } else if (localName.equals("country")) {
        buildString();
    } else if (localName.equals("relation") && inUrlRelations) {
        buildString();
        link = new WebLink();
        link.setType(atts.getValue("type"));
    } else if (localName.equals("target")) {
        buildString();
    } else if (localName.equals("life-span")) {
        inLifeSpan = true;
    } else if (localName.equals("begin")) {
        buildString();
    } else if (localName.equals("end")) {
        buildString();
    } else if (localName.equals("relation-list")) {
        setRelationStatus(atts.getValue("target-type"));
    } else if (inUnsupported(localName)) {
        inUnsupported = true;
    }
}
Also used : Tag(org.musicbrainz.android.api.data.Tag) WebLink(org.musicbrainz.android.api.data.WebLink)

Example 5 with WebLink

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

the class LabelLookupHandler method startElement.

public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException {
    if (localName.equals("label")) {
        label.setMbid(atts.getValue("id"));
    } else if (localName.equals("name") && !inTag) {
        buildString();
    } else if (localName.equals("tag")) {
        inTag = true;
        tag = new Tag();
        tag.setCount(Integer.parseInt(atts.getValue("count")));
    } else if (localName.equals("rating")) {
        label.setRatingCount(Integer.parseInt(atts.getValue("votes-count")));
        buildString();
    } else if (localName.equals("country")) {
        buildString();
    } else if (localName.equals("begin")) {
        buildString();
    } else if (localName.equals("end")) {
        buildString();
    } else if (localName.equals("relation-list")) {
        if (atts.getValue("target-type").equals("url")) {
            inUrlRelations = true;
        }
    } else if (localName.equals("relation") && inUrlRelations) {
        buildString();
        link = new WebLink();
        link.setType(atts.getValue("type"));
    }
}
Also used : Tag(org.musicbrainz.android.api.data.Tag) WebLink(org.musicbrainz.android.api.data.WebLink)

Aggregations

WebLink (org.musicbrainz.android.api.data.WebLink)5 Tag (org.musicbrainz.android.api.data.Tag)3 LayoutInflater (android.view.LayoutInflater)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 ReleaseArtist (org.musicbrainz.android.api.data.ReleaseArtist)1