diff options
author | daniel oeh <daniel.oeh@gmail.com> | 2014-05-25 15:40:12 +0200 |
---|---|---|
committer | daniel oeh <daniel.oeh@gmail.com> | 2014-05-25 15:40:12 +0200 |
commit | dbff918e3a41e5e348f3d501d899c463a409f93e (patch) | |
tree | cbb6174a92d16e872110d3091672555706419b6d /src/de/danoeh/antennapod/util/URLChecker.java | |
parent | eb0f48d3c34c58951c2eb914a7ec20376ddaec2a (diff) | |
download | AntennaPod-dbff918e3a41e5e348f3d501d899c463a409f93e.zip |
Added support for "pcast"-protocol, start FeedViewActivity immediately when clicking on a link. closes #425
Diffstat (limited to 'src/de/danoeh/antennapod/util/URLChecker.java')
-rw-r--r-- | src/de/danoeh/antennapod/util/URLChecker.java | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/src/de/danoeh/antennapod/util/URLChecker.java b/src/de/danoeh/antennapod/util/URLChecker.java index a3c675899..eb522ffa8 100644 --- a/src/de/danoeh/antennapod/util/URLChecker.java +++ b/src/de/danoeh/antennapod/util/URLChecker.java @@ -3,25 +3,36 @@ package de.danoeh.antennapod.util; import android.util.Log; import de.danoeh.antennapod.BuildConfig; -/** Provides methods for checking and editing a URL.*/ +/** + * Provides methods for checking and editing a URL. + */ public final class URLChecker { - /**Class shall not be instantiated.*/ + /** + * Class shall not be instantiated. + */ private URLChecker() { } - /**Logging tag.*/ + /** + * Logging tag. + */ private static final String TAG = "URLChecker"; - /** Checks if URL is valid and modifies it if necessary. - * @param url The url which is going to be prepared - * @return The prepared url - * */ + /** + * Checks if URL is valid and modifies it if necessary. + * + * @param url The url which is going to be prepared + * @return The prepared url + */ public static String prepareURL(String url) { StringBuilder builder = new StringBuilder(); if (url.startsWith("feed://")) { if (BuildConfig.DEBUG) Log.d(TAG, "Replacing feed:// with http://"); - url = url.replace("feed://", "http://"); + url = url.replaceFirst("feed://", "http://"); + } else if (url.startsWith("pcast://")) { + if (BuildConfig.DEBUG) Log.d(TAG, "Replacing pcast:// with http://"); + url = url.replaceFirst("pcast://", "http://"); } else if (!(url.startsWith("http://") || url.startsWith("https://"))) { if (BuildConfig.DEBUG) Log.d(TAG, "Adding http:// at the beginning of the URL"); builder.append("http://"); |