Android Open Source - AndroidImageManager Sample Application






From Project

Back to project page AndroidImageManager.

License

The source code is released under:

Apache License

If you think the Android project AndroidImageManager listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.marczych.androidimagemanager.sample;
/*from ww  w .ja  v a 2  s.com*/
import android.app.Application;

import android.graphics.Bitmap;
import android.widget.ImageView;

import com.marczych.androidimagemanager.ImageManager;

public class SampleApplication extends Application {
   private ImageManager mImageManager;

   public ImageManager getImageManager() {
      if (mImageManager == null) {
         mImageManager = new ImageManager(this);
         mImageManager.trustAllCerts(true);
         mImageManager.trustAllHosts(true);

         mImageManager.setController(new ImageManager.Controller() {
            public boolean overrideDisplay(String url, ImageView imageView) {
               if (url.contains("0")) {
                  imageView.setImageResource(R.drawable.dog);
                  return true;
               }

               return false;
            }

            public void loading(ImageView imageView) {
               imageView.setImageResource(R.drawable.loading);
            }

            public boolean displayImage(ImageView imageView, Bitmap bitmap,
             String url) {
               if (url.contains("3")) {
                  return true;
               }

               return false;
            }

            public void fail(ImageView imageView) {
               imageView.setImageResource(R.drawable.oops);
            }
         });
      }

      return mImageManager;
   }
}




Java Source Code List

com.marczych.androidimagemanager.ImageManager.java
com.marczych.androidimagemanager.sample.SampleApplication.java
com.marczych.androidimagemanager.sample.SampleImageManagerActivity.java