mirror of
https://github.com/CappielloAntonio/tempo.git
synced 2026-01-31 14:43:36 +00:00
Custom glide builder now also accepts a custom url
This commit is contained in:
@@ -12,6 +12,8 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class MusicUtil {
|
||||
private static final String TAG = "MusicUtil";
|
||||
@@ -91,4 +93,21 @@ public class MusicUtil {
|
||||
String uri = MusicUtil.getSongFileUri(song);
|
||||
return MediaItem.fromUri(uri);
|
||||
}
|
||||
|
||||
public static CharSequence HTMLParser(String toParse) {
|
||||
if (toParse != null && containsHTML(toParse)) {
|
||||
return Html.fromHtml(toParse, Html.FROM_HTML_MODE_LEGACY);
|
||||
}
|
||||
else {
|
||||
return toParse;
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean containsHTML(String toParse) {
|
||||
String HTML_PATTERN = "<(\"[^\"]*\"|'[^']*'|[^'\">])*>";
|
||||
Pattern pattern = Pattern.compile(HTML_PATTERN);
|
||||
|
||||
Matcher matcher = pattern.matcher(toParse);
|
||||
return matcher.find();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user