Search in sources :

Example 11 with ArrayMap

use of android.support.v4.util.ArrayMap in project AntennaPod by AntennaPod.

the class FeedDiscoverer method findLinks.

private Map<String, String> findLinks(Document document, String baseUrl) {
    Map<String, String> res = new ArrayMap<>();
    Elements links = document.head().getElementsByTag("link");
    for (Element link : links) {
        String rel = link.attr("rel");
        String href = link.attr("href");
        if (!TextUtils.isEmpty(href) && (rel.equals("alternate") || rel.equals("feed"))) {
            String type = link.attr("type");
            if (type.equals(MIME_RSS) || type.equals(MIME_ATOM)) {
                String title = link.attr("title");
                String processedUrl = processURL(baseUrl, href);
                if (processedUrl != null) {
                    res.put(processedUrl, (TextUtils.isEmpty(title)) ? href : title);
                }
            }
        }
    }
    return res;
}
Also used : Element(org.jsoup.nodes.Element) ArrayMap(android.support.v4.util.ArrayMap) Elements(org.jsoup.select.Elements)

Example 12 with ArrayMap

use of android.support.v4.util.ArrayMap in project AntennaPod by AntennaPod.

the class NanoHTTPD method decodeParameters.

/**
     * Decode parameters from a URL, handing the case where a single parameter name might have been
     * supplied several times, by return lists of values.  In general these lists will contain a single
     * element.
     *
     * @param queryString a query string pulled from the URL.
     * @return a map of <code>String</code> (parameter name) to <code>List&lt;String&gt;</code> (a list of the values supplied).
     */
protected Map<String, List<String>> decodeParameters(String queryString) {
    Map<String, List<String>> parms = new ArrayMap<String, List<String>>();
    if (queryString != null) {
        StringTokenizer st = new StringTokenizer(queryString, "&");
        while (st.hasMoreTokens()) {
            String e = st.nextToken();
            int sep = e.indexOf('=');
            String propertyName = (sep >= 0) ? decodePercent(e.substring(0, sep)).trim() : decodePercent(e).trim();
            if (!parms.containsKey(propertyName)) {
                parms.put(propertyName, new ArrayList<String>());
            }
            String propertyValue = (sep >= 0) ? decodePercent(e.substring(sep + 1)) : null;
            if (propertyValue != null) {
                parms.get(propertyName).add(propertyValue);
            }
        }
    }
    return parms;
}
Also used : StringTokenizer(java.util.StringTokenizer) ArrayMap(android.support.v4.util.ArrayMap) ArrayList(java.util.ArrayList) List(java.util.List)

Aggregations

ArrayMap (android.support.v4.util.ArrayMap)11 Cursor (android.database.Cursor)2 FeedMedia (de.danoeh.antennapod.core.feed.FeedMedia)2 JSONArray (org.json.JSONArray)2 JSONObject (org.json.JSONObject)2 Animator (android.animation.Animator)1 PackageInfo (android.content.pm.PackageInfo)1 PackageManager (android.content.pm.PackageManager)1 LongSparseArray (android.support.v4.util.LongSparseArray)1 Pair (android.util.Pair)1 SparseArray (android.util.SparseArray)1 SurfaceView (android.view.SurfaceView)1 TextureView (android.view.TextureView)1 View (android.view.View)1 ListView (android.widget.ListView)1 TextView (android.widget.TextView)1 JSONObject (com.alibaba.fastjson.JSONObject)1 GistFile (com.meisolsson.githubsdk.model.GistFile)1 WXSDKInstance (com.taobao.weex.WXSDKInstance)1 FeedImage (de.danoeh.antennapod.core.feed.FeedImage)1