mirror of
https://github.com/mihonapp/mihon.git
synced 2024-10-31 21:20:59 -04:00
6f297161de
* Saving to SD working * Rename imagePath to uri * Handle android < 21 * Minor changes * Separate downloader from the manager. Optimize folder lookups * Persist downloads across restarts * Fix for #511 * Updated ReactiveNetwork. Add some documentation * More documentation and minor fixes * Handle persistent notifications. Other minor changes * Improve downloader and add documentation * Rename pageNumber to index in Page class * Remove unused methods * Use chop method * Make sure dest dir is created * Reset downloads dir preference * Use invalidate options menu in download fragment and fix wrong condition * Fix empty download queue after application restart * Use addAll method in download queue to avoid too many notifications * Inform download manager changes
26 lines
680 B
Java
26 lines
680 B
Java
package eu.kanade.tachiyomi.util;
|
|
|
|
import java.net.URI;
|
|
import java.net.URISyntaxException;
|
|
|
|
public final class UrlUtil {
|
|
|
|
private UrlUtil() throws InstantiationException {
|
|
throw new InstantiationException("This class is not for instantiation");
|
|
}
|
|
|
|
public static String getPath(String s) {
|
|
try {
|
|
URI uri = new URI(s);
|
|
String out = uri.getPath();
|
|
if (uri.getQuery() != null)
|
|
out += "?" + uri.getQuery();
|
|
if (uri.getFragment() != null)
|
|
out += "#" + uri.getFragment();
|
|
return out;
|
|
} catch (URISyntaxException e) {
|
|
return s;
|
|
}
|
|
}
|
|
|
|
}
|