A powerful image downloading and caching library with spinner and refresh button for Android
- build.gradle (Project.Your_App)
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
- build.gradle (Module.app)
dependencies {
implementation 'com.github.zakaryaasadi:URLImageView:0.0.5'
}
- Mainfests
<uses-permission android:name="android.permission.INTERNET"/>
- Xml
<com.zak.URLImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="232.3dp"
app:scaleType="CENTER_INSIDE"
app:Spinner_Style="ThreeBounce"
app:Spinner_Color="#fff"
app:adjustViewBounds="true"
android:background="#333"
app:Placeholder="@drawable/gradient_rect"/>
- Java
URLImageView imageView = findViewById(R.id.image);
imageView.load("https://i.ytimg.com/vi/scYvJUUOHK4/maxresdefault.jpg");
- Java with events
image.setCallback(new URLImageView.Callback() {
@Override
public void onStartLoad() {
Log.d("onStartLoad : ", "Start load");
}
@Override
public void onSuccess(Bitmap bitmap) {
Log.d("onSuccess : ", "success load");
}
@Override
public void onError(Exception e) {
Log.d("onError : ", e.getMessage());
}
}).load("https://i.ytimg.com/vi/scYvJUUOHK4/maxresdefault.jpg");
Another method
image.setResolution(1000, 667);
image.setCallback(new URLImageView.Callback() {
@Override
public void onStartLoad() {
Log.d("onStartLoad : ", "Start load");
}
@Override
public void onSuccess(Bitmap bitmap) {
Log.d("onSuccess : ", "success load");
}
@Override
public void onError(Exception e) {
Log.d("onError : ", e.getMessage());
}
});
image.load("https://i.ytimg.com/vi/scYvJUUOHK4/maxresdefault.jpg");
Style | Preview |
---|---|
RotatingPlane | |
DoubleBounce | |
Wave | |
WanderingCubes | |
Pulse | |
ChasingDots | |
ThreeBounce | |
Circle | |
CubeGrid | |
FadingCircle | |
FoldingCube | |
RotatingCircle |