Skip to content

zakaryaasadi/URLImageView

Repository files navigation

URLImageView

A powerful image downloading and caching library with spinner and refresh button for Android

Gradle Dependency

  • 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'
}

Permission

  • Mainfests
<uses-permission android:name="android.permission.INTERNET"/>       

Usage

  • 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

Style Preview
RotatingPlane RotatingPlane
DoubleBounce DoubleBounce
Wave Wave
WanderingCubes WanderingCubes
Pulse Pulse
ChasingDots ChasingDots
ThreeBounce ThreeBounce
Circle Circle
CubeGrid CubeGrid
FadingCircle FadingCircle
FoldingCube FoldingCube
RotatingCircle RotatingCircle

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages