Search in sources :

Example 1 with ImageCallback

use of cn.eoe.app.utils.ImageUtil.ImageCallback in project android-app by eoecn.

the class UserIntroFragment method initGridView.

private void initGridView() {
    getData();
    mAdapter = new SimpleAdapter(mContext, mList, R.layout.user_gridview_item_medal, new String[] { "img" }, new int[] { R.id.user_imageview_medal }) {

        @Override
        public void setViewImage(ImageView v, String value) {
            // TODO Auto-generated method stub
            super.setViewImage(v, value);
            ImageUtil.setThumbnailView(value, v, mContext, new imageCallback(), false);
        }

        class imageCallback implements ImageCallback {

            @Override
            public void loadImage(Bitmap bitmap, String imagePath) {
                // TODO Auto-generated method stub
                try {
                    ImageView img = (ImageView) gvGrid.findViewWithTag(imagePath);
                    img.setImageBitmap(bitmap);
                } catch (NullPointerException ex) {
                    Log.e("error", "ImageView = null");
                }
            }
        }
    };
    gvGrid.setAdapter(mAdapter);
}
Also used : Bitmap(android.graphics.Bitmap) SimpleAdapter(android.widget.SimpleAdapter) ImageCallback(cn.eoe.app.utils.ImageUtil.ImageCallback) ImageView(android.widget.ImageView)

Example 2 with ImageCallback

use of cn.eoe.app.utils.ImageUtil.ImageCallback in project android-app by eoecn.

the class DetailsDiscussActivity method initList.

private void initList() {
    mlist = new ArrayList<Map<String, Object>>();
    mAdapter = new SimpleAdapter(this, mlist, R.layout.details_discuss_item, new String[] { "image", "name", "content", "time" }, new int[] { R.id.details_imageview_head, R.id.details_textview_name, R.id.details_textview_content, R.id.details_textview_time }) {

        @Override
        public void setViewImage(ImageView v, String value) {
            // TODO Auto-generated method stub
            super.setViewImage(v, value);
            ImageUtil.setThumbnailView(value, v, DetailsDiscussActivity.this, callback, false);
        }

        ImageCallback callback = new ImageCallback() {

            @Override
            public void loadImage(Bitmap bitmap, String imagePath) {
                // TODO Auto-generated method stub
                try {
                    ImageView img = (ImageView) mListview.findViewWithTag(imagePath);
                    img.setImageBitmap(bitmap);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        };
    };
    mListview.setAdapter(mAdapter);
}
Also used : Bitmap(android.graphics.Bitmap) SimpleAdapter(android.widget.SimpleAdapter) ImageCallback(cn.eoe.app.utils.ImageUtil.ImageCallback) ImageView(android.widget.ImageView) HashMap(java.util.HashMap) Map(java.util.Map) JsonMappingException(org.codehaus.jackson.map.JsonMappingException) IOException(java.io.IOException) JsonParseException(org.codehaus.jackson.JsonParseException)

Aggregations

Bitmap (android.graphics.Bitmap)2 ImageView (android.widget.ImageView)2 SimpleAdapter (android.widget.SimpleAdapter)2 ImageCallback (cn.eoe.app.utils.ImageUtil.ImageCallback)2 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 JsonParseException (org.codehaus.jackson.JsonParseException)1 JsonMappingException (org.codehaus.jackson.map.JsonMappingException)1