package com.mzeat.ui.fragment; import com.mzeat.R; import com.mzeat.image.ImageResizer; import android.os.Bundle; import android.support.v4.app.Fragment; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.LinearLayout.LayoutParams; /** * <p> * Description: * </p> * * @version 1.0 * @author hongjinqun * @date 2012-12-23 */ public class ImagePagerFragment extends Fragment { private static final String KEY_IMAGEURL = "ImagePagerFragment:image_url"; private String mImageUrl; private static ImageResizer mImageWorker; private int poision; private final String TAG = "ImagePagerFragment"; public static ImagePagerFragment newInstance(ImageResizer imageWoker, String mImageUrl) { ImagePagerFragment fragment = new ImagePagerFragment(); fragment.mImageUrl = mImageUrl; mImageWorker = imageWoker; return fragment; } public void setImagePoision(int poision) { this.poision = poision; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if ((savedInstanceState != null) && savedInstanceState.containsKey(KEY_IMAGEURL)) { mImageUrl = savedInstanceState.getString(KEY_IMAGEURL); } } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.poster_item, null); //ImageView iv = (ImageView) view.findViewById(R.id.imageView_poster); try { // mImageWorker.loadImage(poision, iv); } catch (Exception e) { // TODO: handle exception e.printStackTrace(); } return view; } @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putString(KEY_IMAGEURL, mImageUrl); } }