forked from Piasy/BigImageViewer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2. prepare for multiple image load libraries support; 3. update perf data;
- Loading branch information
Showing
25 changed files
with
278 additions
and
146 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...gImageViewer/src/main/AndroidManifest.xml → BigImageViewer/src/main/AndroidManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
BigImageViewer/src/main/java/com/github/piasy/biv/BigImageViewer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.github.piasy.biv; | ||
|
||
import android.net.Uri; | ||
import com.github.piasy.biv.loader.ImageLoader; | ||
|
||
/** | ||
* Created by Piasy{github.com/Piasy} on 06/11/2016. | ||
* | ||
* This is not a singleton, you can initialize it multiple times, but before you initialize it | ||
* again, it will use the same {@link ImageLoader} globally. | ||
*/ | ||
|
||
public final class BigImageViewer { | ||
private static volatile BigImageViewer sInstance; | ||
|
||
private final ImageLoader mImageLoader; | ||
|
||
private BigImageViewer(ImageLoader imageLoader) { | ||
mImageLoader = imageLoader; | ||
} | ||
|
||
public static void initialize(ImageLoader imageLoader) { | ||
sInstance = new BigImageViewer(imageLoader); | ||
} | ||
|
||
public static ImageLoader imageLoader() { | ||
if (sInstance == null) { | ||
throw new IllegalStateException("You must initialize BigImageViewer before use it!"); | ||
} | ||
return sInstance.mImageLoader; | ||
} | ||
|
||
public static void prefetch(Uri... uris) { | ||
if (uris == null) { | ||
return; | ||
} | ||
|
||
ImageLoader imageLoader = imageLoader(); | ||
for (Uri uri : uris) { | ||
imageLoader.prefetch(uri); | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
BigImageViewer/src/main/java/com/github/piasy/biv/loader/ImageLoader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.github.piasy.biv.loader; | ||
|
||
import android.net.Uri; | ||
import android.support.annotation.UiThread; | ||
import android.support.annotation.WorkerThread; | ||
import java.io.File; | ||
|
||
/** | ||
* Created by Piasy{github.com/Piasy} on 08/11/2016. | ||
*/ | ||
|
||
public interface ImageLoader { | ||
|
||
void loadImage(Uri uri, Callback callback); | ||
|
||
void prefetch(Uri uri); | ||
|
||
interface Callback { | ||
@UiThread | ||
void onCacheHit(File image); | ||
|
||
@WorkerThread | ||
void onCacheMiss(File image); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 0 additions & 47 deletions
47
...mageViewer/src/main/java/com/github/piasy/fresco/bigimageviewer/FrescoBigImageViewer.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
apply plugin: 'com.android.library' | ||
apply from: "https://raw.githubusercontent.com/Piasy/BintrayUploadScript/master/bintray.gradle" | ||
|
||
android { | ||
compileSdkVersion rootProject.ext.androidCompileSdkVersion | ||
buildToolsVersion rootProject.ext.androidBuildToolsVersion | ||
|
||
defaultConfig { | ||
minSdkVersion rootProject.ext.minSdkVersion | ||
targetSdkVersion rootProject.ext.targetSdkVersion | ||
versionCode rootProject.ext.releaseVersionCode | ||
versionName rootProject.ext.releaseVersionName | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
compile project(':BigImageViewer') | ||
|
||
compile "com.facebook.fresco:fresco:$rootProject.ext.frescoVersion" | ||
compile "commons-io:commons-io:$rootProject.ext.commonsVersion" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Add project specific ProGuard rules here. | ||
# By default, the flags in this file are appended to flags specified | ||
# in /Users/piasy/tools/android-sdk/tools/proguard/proguard-android.txt | ||
# You can edit the include path and order by changing the proguardFiles | ||
# directive in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# Add any project specific keep options here: | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<manifest package="com.github.piasy.biv.loader.fresco"/> |
Oops, something went wrong.