|
|
@ -13,6 +13,8 @@ import org.jsoup.helper.HttpConnection; |
|
|
|
import org.jsoup.nodes.Document; |
|
|
|
import org.jsoup.nodes.Document; |
|
|
|
import org.jsoup.select.Elements; |
|
|
|
import org.jsoup.select.Elements; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
import static com.keylesspalace.tusky.util.StringUtils.QUOTE; |
|
|
|
import static com.keylesspalace.tusky.util.StringUtils.QUOTE; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -35,9 +37,13 @@ public class ParserUtils { |
|
|
|
ClipData.Item item = clipboard.getPrimaryClip().getItemAt(0); |
|
|
|
ClipData.Item item = clipboard.getPrimaryClip().getItemAt(0); |
|
|
|
pasteData = item.getText().toString(); |
|
|
|
pasteData = item.getText().toString(); |
|
|
|
|
|
|
|
|
|
|
|
// we have to find an url for start it
|
|
|
|
// If we share with an app, it's not only an url
|
|
|
|
if (URLUtil.isValidUrl(pasteData)) { |
|
|
|
List<String> strings = StringUtils.extractUrl(pasteData); |
|
|
|
new ThreadHeaderInfo().execute(pasteData); |
|
|
|
String url = strings.get(0); // we assume that the first url is the good one
|
|
|
|
|
|
|
|
if (strings.size() > 0) { |
|
|
|
|
|
|
|
if (URLUtil.isValidUrl(url)) { |
|
|
|
|
|
|
|
new ThreadHeaderInfo().execute(url); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return null; |
|
|
|
return null; |
|
|
@ -77,9 +83,7 @@ public class ParserUtils { |
|
|
|
headerInfo.title = QUOTE + text.toUpperCase() + QUOTE; |
|
|
|
headerInfo.title = QUOTE + text.toUpperCase() + QUOTE; |
|
|
|
} |
|
|
|
} |
|
|
|
if (!TextUtils.isEmpty(imageUrl)) { |
|
|
|
if (!TextUtils.isEmpty(imageUrl)) { |
|
|
|
if (URLUtil.isValidUrl(imageUrl)) { |
|
|
|
headerInfo.image = (imageUrl); |
|
|
|
headerInfo.image = (imageUrl); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
return headerInfo; |
|
|
|
return headerInfo; |
|
|
|
} |
|
|
|
} |
|
|
|