Search in sources :

Example 1 with BitmapAjaxCallback

use of com.androidquery.callback.BitmapAjaxCallback in project androidquery by androidquery.

the class AQueryImageTest method testImageByCallback2.

public void testImageByCallback2() {
    clearCache();
    AQUtility.post(new Runnable() {

        @Override
        public void run() {
            BitmapAjaxCallback cb = new BitmapAjaxCallback() {

                protected void callback(String url, ImageView iv, Bitmap bm, AjaxStatus status) {
                    iv.setImageBitmap(bm);
                }
            };
            aq.id(R.id.image).image(ICON_URL, true, true, 0, 0, cb);
        }
    });
    waitAsync(2000);
    assertLoaded(aq.getImageView(), true);
    Bitmap bm = aq.getCachedImage(ICON_URL);
    assertNotNull(bm);
}
Also used : BitmapAjaxCallback(com.androidquery.callback.BitmapAjaxCallback) Bitmap(android.graphics.Bitmap) ImageView(android.widget.ImageView) AjaxStatus(com.androidquery.callback.AjaxStatus)

Example 2 with BitmapAjaxCallback

use of com.androidquery.callback.BitmapAjaxCallback in project androidquery by androidquery.

the class AQueryImageTest method testAutoRotate.

/*
	public void testIfModified() {
		
		String url = ICON_URL;
		
		AjaxCallback<Bitmap> cb = new AjaxCallback<Bitmap>();
		cb.type(Bitmap.class).url(url);
		
		aq.sync(cb);
		
		Bitmap bm = cb.getResult();
		AjaxStatus status = cb.getStatus();
		
		assertNotNull(bm);
		
		assertEquals(304, status.getCode());
		
		File file;
		
		
	}
	*/
public void testAutoRotate() throws IOException {
    String imageUrl = "http://res.dbkon.co.kr/resource/201302091360376386575001.jpg";
    BitmapAjaxCallback cb = new BitmapAjaxCallback();
    cb.url(imageUrl).targetWidth(300).rotate(true);
    aq.id(R.id.image).image(cb);
    cb.block();
    Bitmap bm = cb.getResult();
    AjaxStatus status = cb.getStatus();
    assertNotNull(bm);
}
Also used : BitmapAjaxCallback(com.androidquery.callback.BitmapAjaxCallback) Bitmap(android.graphics.Bitmap) AjaxStatus(com.androidquery.callback.AjaxStatus)

Example 3 with BitmapAjaxCallback

use of com.androidquery.callback.BitmapAjaxCallback in project androidquery by androidquery.

the class ImageLoadingActivity method image_advance.

public void image_advance() {
    aq.id(R.id.image).width(LayoutParams.FILL_PARENT);
    String imageUrl = "http://farm3.static.flickr.com/2199/2218403922_062bc3bcf2.jpg";
    BitmapAjaxCallback cb = new BitmapAjaxCallback();
    cb.url(imageUrl).animation(AQuery.FADE_IN).ratio(1.0f);
    aq.id(R.id.image).image(cb);
}
Also used : BitmapAjaxCallback(com.androidquery.callback.BitmapAjaxCallback)

Example 4 with BitmapAjaxCallback

use of com.androidquery.callback.BitmapAjaxCallback in project androidquery by androidquery.

the class AQueryImageTest method testImageByCallbackAsync.

public void testImageByCallbackAsync() {
    clearCache();
    AQUtility.post(new Runnable() {

        @Override
        public void run() {
            // aq.id(R.id.image).image(ICON_URL, true, true, 0, 0, null, AQuery.FADE_IN);
            BitmapAjaxCallback cb = new BitmapAjaxCallback();
            cb.url(ICON_URL);
            // aq.id(R.id.image).image(cb);
            ImageView iv = aq.id(R.id.image).getImageView();
            cb.imageView(iv).async(getActivity());
        }
    });
    waitAsync(2000);
    assertLoaded(aq.getImageView(), true);
    Bitmap bm = aq.getCachedImage(ICON_URL);
    assertNotNull(bm);
}
Also used : BitmapAjaxCallback(com.androidquery.callback.BitmapAjaxCallback) Bitmap(android.graphics.Bitmap) ImageView(android.widget.ImageView)

Example 5 with BitmapAjaxCallback

use of com.androidquery.callback.BitmapAjaxCallback in project androidquery by androidquery.

the class ImageLoadingActivity method image_auto_rotate.

public void image_auto_rotate() {
    String imageUrl = "http://res.dbkon.co.kr/resource/201302091360376386575001.jpg";
    // imageUrl = "http://www.androidquery.com/z/images/vikispot/android-w.png";
    BitmapAjaxCallback cb = new BitmapAjaxCallback();
    cb.url(imageUrl).targetWidth(300).rotate(true);
    aq.id(R.id.image).image(cb);
}
Also used : BitmapAjaxCallback(com.androidquery.callback.BitmapAjaxCallback)

Aggregations

BitmapAjaxCallback (com.androidquery.callback.BitmapAjaxCallback)11 Bitmap (android.graphics.Bitmap)7 ImageView (android.widget.ImageView)5 AjaxStatus (com.androidquery.callback.AjaxStatus)5 File (java.io.File)2