Java Code Examples for com.nostra13.universalimageloader.core.download.ImageDownloader.Scheme#ofUri()

The following examples show how to use com.nostra13.universalimageloader.core.download.ImageDownloader.Scheme#ofUri() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BaseImageDownloader.java    From letv with Apache License 2.0 6 votes vote down vote up
public InputStream getStream(String imageUri, Object extra) throws IOException {
    switch (Scheme.ofUri(imageUri)) {
        case HTTP:
        case HTTPS:
            return getStreamFromNetwork(imageUri, extra);
        case FILE:
            return getStreamFromFile(imageUri, extra);
        case CONTENT:
            return getStreamFromContent(imageUri, extra);
        case ASSETS:
            return getStreamFromAssets(imageUri, extra);
        case DRAWABLE:
            return getStreamFromDrawable(imageUri, extra);
        default:
            return getStreamFromOtherSource(imageUri, extra);
    }
}
 
Example 2
Source File: ImageLoaderConfiguration.java    From letv with Apache License 2.0 5 votes vote down vote up
public InputStream getStream(String imageUri, Object extra) throws IOException {
    InputStream imageStream = this.wrappedDownloader.getStream(imageUri, extra);
    switch (Scheme.ofUri(imageUri)) {
        case HTTP:
        case HTTPS:
            return new FlushedInputStream(imageStream);
        default:
            return imageStream;
    }
}
 
Example 3
Source File: BaseImageDownloaderTest.java    From android-open-project-demo with Apache License 2.0 5 votes vote down vote up
@Test
public void testSchemeContent() throws Exception {
	String uri = "content://path/to/content";
	Scheme result = Scheme.ofUri(uri);
	Scheme expected = Scheme.CONTENT;
	Assertions.assertThat(result).isEqualTo(expected);
}
 
Example 4
Source File: BaseImageDownloaderTest.java    From Android-Universal-Image-Loader-Modify with Apache License 2.0 5 votes vote down vote up
@Test
public void testSchemeHttps() throws Exception {
	String uri = "https://image.com/1.png";
	Scheme result = Scheme.ofUri(uri);
	Scheme expected = Scheme.HTTPS;
	Assertions.assertThat(result).isEqualTo(expected);
}
 
Example 5
Source File: BaseImageDownloaderTest.java    From android-open-project-demo with Apache License 2.0 5 votes vote down vote up
@Test
public void testSchemeAssets() throws Exception {
	String uri = "assets://folder/1.png";
	Scheme result = Scheme.ofUri(uri);
	Scheme expected = Scheme.ASSETS;
	Assertions.assertThat(result).isEqualTo(expected);
}
 
Example 6
Source File: BaseImageDownloaderTest.java    From android-open-project-demo with Apache License 2.0 5 votes vote down vote up
@Test
public void testSchemeUnknown() throws Exception {
	String uri = "other://image.com/1.png";
	Scheme result = Scheme.ofUri(uri);
	Scheme expected = Scheme.UNKNOWN;
	Assertions.assertThat(result).isEqualTo(expected);
}
 
Example 7
Source File: BaseImageDownloaderTest.java    From Android-Universal-Image-Loader-Modify with Apache License 2.0 5 votes vote down vote up
@Test
public void testSchemeUnknown() throws Exception {
	String uri = "other://image.com/1.png";
	Scheme result = Scheme.ofUri(uri);
	Scheme expected = Scheme.UNKNOWN;
	Assertions.assertThat(result).isEqualTo(expected);
}
 
Example 8
Source File: BaseImageDownloaderTest.java    From Android-Universal-Image-Loader-Modify with Apache License 2.0 5 votes vote down vote up
@Test
public void testSchemeDrawables() throws Exception {
	String uri = "drawable://123456890";
	Scheme result = Scheme.ofUri(uri);
	Scheme expected = Scheme.DRAWABLE;
	Assertions.assertThat(result).isEqualTo(expected);
}
 
Example 9
Source File: BaseImageDownloaderTest.java    From Android-Universal-Image-Loader-Modify with Apache License 2.0 5 votes vote down vote up
@Test
public void testSchemeAssets() throws Exception {
	String uri = "assets://folder/1.png";
	Scheme result = Scheme.ofUri(uri);
	Scheme expected = Scheme.ASSETS;
	Assertions.assertThat(result).isEqualTo(expected);
}
 
Example 10
Source File: BaseImageDownloaderTest.java    From android-open-project-demo with Apache License 2.0 5 votes vote down vote up
@Test
public void testSchemeDrawables() throws Exception {
	String uri = "drawable://123456890";
	Scheme result = Scheme.ofUri(uri);
	Scheme expected = Scheme.DRAWABLE;
	Assertions.assertThat(result).isEqualTo(expected);
}
 
Example 11
Source File: BaseImageDownloaderTest.java    From candybar with Apache License 2.0 5 votes vote down vote up
@Test
public void testSchemePackage() throws Exception {
    String uri = "package://com.google.android.youtube";
    Scheme result = Scheme.ofUri(uri);
    Scheme expected = Scheme.PACKAGE;
    Assertions.assertThat(result).isEqualTo(expected);
}
 
Example 12
Source File: BaseImageDownloaderTest.java    From android-open-project-demo with Apache License 2.0 5 votes vote down vote up
@Test
public void testSchemeFile() throws Exception {
	String uri = "file://path/on/the/device/1.png";
	Scheme result = Scheme.ofUri(uri);
	Scheme expected = Scheme.FILE;
	Assertions.assertThat(result).isEqualTo(expected);
}
 
Example 13
Source File: BaseImageDownloaderTest.java    From candybar with Apache License 2.0 5 votes vote down vote up
@Test
public void testSchemeDrawables() throws Exception {
    String uri = "drawable://123456890";
    Scheme result = Scheme.ofUri(uri);
    Scheme expected = Scheme.DRAWABLE;
    Assertions.assertThat(result).isEqualTo(expected);
}
 
Example 14
Source File: BaseImageDownloaderTest.java    From android-open-project-demo with Apache License 2.0 5 votes vote down vote up
@Test
public void testSchemeHttps() throws Exception {
	String uri = "https://image.com/1.png";
	Scheme result = Scheme.ofUri(uri);
	Scheme expected = Scheme.HTTPS;
	Assertions.assertThat(result).isEqualTo(expected);
}
 
Example 15
Source File: BaseImageDownloaderTest.java    From candybar with Apache License 2.0 5 votes vote down vote up
@Test
public void testSchemeContent() throws Exception {
    String uri = "content://path/to/content";
    Scheme result = Scheme.ofUri(uri);
    Scheme expected = Scheme.CONTENT;
    Assertions.assertThat(result).isEqualTo(expected);
}
 
Example 16
Source File: BaseImageDownloaderTest.java    From candybar with Apache License 2.0 5 votes vote down vote up
@Test
public void testSchemeHttps() throws Exception {
    String uri = "https://image.com/1.png";
    Scheme result = Scheme.ofUri(uri);
    Scheme expected = Scheme.HTTPS;
    Assertions.assertThat(result).isEqualTo(expected);
}
 
Example 17
Source File: BaseImageDownloaderTest.java    From android-open-project-demo with Apache License 2.0 5 votes vote down vote up
@Test
public void testSchemeHttp() throws Exception {
	String uri = "http://image.com/1.png";
	Scheme result = Scheme.ofUri(uri);
	Scheme expected = Scheme.HTTP;
	Assertions.assertThat(result).isEqualTo(expected);
}
 
Example 18
Source File: BaseImageDecoder.java    From mobile-manager-tool with MIT License 4 votes vote down vote up
private boolean canDefineExifParams(String imageUri, String mimeType) {
	return "image/jpeg".equalsIgnoreCase(mimeType) && (Scheme.ofUri(imageUri) == Scheme.FILE);
}
 
Example 19
Source File: BaseImageDecoder.java    From BigApp_WordPress_Android with Apache License 2.0 4 votes vote down vote up
private boolean canDefineExifParams(String imageUri, String mimeType) {
    return "image/jpeg".equalsIgnoreCase(mimeType) && (Scheme.ofUri(imageUri) == Scheme.FILE);
}
 
Example 20
Source File: BaseImageDecoder.java    From Android-Universal-Image-Loader-Modify with Apache License 2.0 4 votes vote down vote up
private boolean canDefineExifParams(String imageUri, String mimeType) {
	return "image/jpeg".equalsIgnoreCase(mimeType) && (Scheme.ofUri(imageUri) == Scheme.FILE);
}