mdsami / android-query

Automatically exported from code.google.com/p/android-query
0 stars 0 forks source link

aQuery.image() with preset image overriding View's scaleType. #79

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

1. I have xml with following code:
<ImageView
        android:id="@+id/recipes_search_list_item_iv_recipe_image"
        android:layout_width="85dp"
        android:layout_height="85dp"
        android:layout_alignParentLeft="true"
        android:layout_centerVertical="true"
        android:scaleType="centerCrop"
        android:src="@drawable/recipe_image_no_image" />

2. In my adapter's getView() method I'm using this code:
AQuery aQuery = listAq.recycle(convertView);
aQuery.id(holder.recipeImage).image(scaledImageLink, false, true, 0, 0, null, 
AQuery.FADE_IN);

What is the expected output? What do you see instead?
I want to see downloaded image setted as image's src WITH centerCrop. Instead 
it just filling my view with broken aspect ratio.

What version of the product are you using? On what operating system?
0.22.10 and tried 0.23.10. Nothing changed.

Original issue reported on code.google.com by Cjay...@gmail.com on 29 Aug 2012 at 3:38

GoogleCodeExporter commented 8 years ago
Same here when I try to use a preset image in the image call. 

Original comment by JakeDaGr...@gmail.com on 6 Nov 2012 at 4:18

GoogleCodeExporter commented 8 years ago
Solved this with a custom callback.

    aq.id(holder.image).image(url, true, true, 0, 0,
                    new BitmapAjaxCallback() {

                        @Override
                        public void callback(String url, ImageView iv,
                                Bitmap bm,
                                com.androidquery.callback.AjaxStatus status) {
                            iv.setImageBitmap(bm);
                            iv.setScaleType(ImageView.ScaleType.CENTER_CROP);

                        }

                    });

Original comment by JakeDaGr...@gmail.com on 10 Nov 2013 at 3:04