You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
implement Uri.Builder with hack for content:// URIs
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package android.net;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
|
||||
import libcore.net.UriCodec;
|
||||
|
||||
import java.io.File;
|
||||
@@ -147,9 +149,39 @@ public class Uri implements Parcelable {
|
||||
}
|
||||
|
||||
public static final class Builder {
|
||||
private String scheme;
|
||||
private String authority;
|
||||
private String path;
|
||||
|
||||
public Builder appendQueryParameter(String key, String value) {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder scheme(String scheme) {
|
||||
this.scheme = scheme;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder authority(String authority) {
|
||||
this.authority = authority;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder encodedPath(String encodedPath) {
|
||||
this.path = decode(encodedPath);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Uri build() throws URISyntaxException {
|
||||
if ("content".equals(scheme)) { // hack: content providers not yet supported
|
||||
scheme = "file";
|
||||
authority = null;
|
||||
path = path.substring(path.indexOf("/"));
|
||||
}
|
||||
Uri ret = new Uri();
|
||||
ret.uri = new URI(scheme, authority, path, null, null);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
public String getScheme() {
|
||||
|
||||
Reference in New Issue
Block a user