Android Open Source - groundify-android My Lazy Adapter






From Project

Back to project page groundify-android.

License

The source code is released under:

GNU General Public License

If you think the Android project groundify-android 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 custom.adapter.pckg;
/*from  w  w w  .  j  a va  2s  . c o m*/
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;

import android.content.Context;
import android.graphics.Bitmap;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer;
import com.nostra13.universalimageloader.core.listener.ImageLoadingListener;
import com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener;

import deftsoft.android.iground.utility.ViewConseqDetail;
import deftsoft.iground.android.R;

public class MyLazyAdapter extends BaseAdapter {

  private ArrayList<ViewConseqDetail> myviewConseqList;
  private Context current;
  private LayoutInflater inflater;
  private ImageLoader imageLoader;
  private DisplayImageOptions options;
  private ImageLoadingListener animateFirstListener = new AnimateFirstDisplayListener();

  public MyLazyAdapter(Context con,
      ArrayList<ViewConseqDetail> myviewConseqList,
      ImageLoader imageLoader, DisplayImageOptions options) {
    // TODO Auto-generated constructor stub

    this.current = con;
    this.myviewConseqList = myviewConseqList;
    this.imageLoader = imageLoader;
    this.options = options;

    inflater = (LayoutInflater) current
        .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  }

  @Override
  public int getCount() {
    // TODO Auto-generated method stub
    return myviewConseqList.size();
  }

  @Override
  public Object getItem(int position) {
    // TODO Auto-generated method stub
    return myviewConseqList.get(position);
  }

  @Override
  public long getItemId(int position) {
    // TODO Auto-generated method stub
    return position;
  }

  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    // TODO Auto-generated method stub

    ViewHolder holder;

    if (convertView == null) {

      convertView = inflater.inflate(R.layout.listrow_inflate, null);
      holder = new ViewHolder();
      holder.child_nameText = (TextView) convertView
          .findViewById(R.id.child_nameText);

      holder.conseq_nameText = (TextView) convertView
          .findViewById(R.id.conseq_nameText);

      holder.coseq_endtext = (TextView) convertView
          .findViewById(R.id.coseq_endtext);
      holder.list_image = (ImageView) convertView
          .findViewById(R.id.list_image);

      convertView.setTag(holder);
    } else {
      holder = (ViewHolder) convertView.getTag();
    }

    holder.child_nameText.setText(myviewConseqList.get(position)
        .getChild_name());
    holder.conseq_nameText.setText(myviewConseqList.get(position)
        .getConsequence());
    holder.coseq_endtext.setText(myviewConseqList.get(position)
        .getCon_datetime());
    imageLoader.displayImage(myviewConseqList.get(position).getImage(),
        holder.list_image, options, animateFirstListener);

    return convertView;

  }

  private class ViewHolder {

    TextView child_nameText, conseq_nameText, coseq_endtext;
    ImageView list_image;
  }

  private static class AnimateFirstDisplayListener extends
      SimpleImageLoadingListener {

    final List<String> displayedImages = Collections
        .synchronizedList(new LinkedList<String>());

    @Override
    public void onLoadingComplete(String imageUri, View view,
        Bitmap loadedImage) {
      if (loadedImage != null) {
        ImageView imageView = (ImageView) view;
        boolean firstDisplay = !displayedImages.contains(imageUri);
        if (firstDisplay) {
          FadeInBitmapDisplayer.animate(imageView, 500);
          displayedImages.add(imageUri);
        }
      }
    }
  }

}




Java Source Code List

.ConsequenceImageGridActivity.java
custom.adapter.pckg.GridAdapter.java
custom.adapter.pckg.MyAdapter.java
custom.adapter.pckg.MyLazyAdapter.java
custom.adapter.pckg.MySpinnerAdapter.java
deftsoft.android.iground.utility.Base64.java
deftsoft.android.iground.utility.ChildDetail.java
deftsoft.android.iground.utility.DatePickerFragment.java
deftsoft.android.iground.utility.DeleteChildWebResponse.java
deftsoft.android.iground.utility.GetNewCosequence.java
deftsoft.android.iground.utility.HttpUploader.java
deftsoft.android.iground.utility.ImageFilePath.java
deftsoft.android.iground.utility.SetConSeqWebServiceWebResponse.java
deftsoft.android.iground.utility.SignupDetail.java
deftsoft.android.iground.utility.TimePickerFragment.java
deftsoft.android.iground.utility.Utility.java
deftsoft.android.iground.utility.ViewConseqDetail.java
deftsoft.android.iground.utility.WebServiceLinks.java
deftsoft.android.iground.utility.WebServiceResponse.java
deftsoft.android.image.upload.Base64.java
deftsoft.android.image.upload.UploadImageToServer.java
deftsoft.iground.android.AddChildScreen.java
deftsoft.iground.android.AddConsequenceActivity.java
deftsoft.iground.android.BridgeClass.java
deftsoft.iground.android.CopyOfConsequenceImageGridActivity.java
deftsoft.iground.android.DeleteChildScreen.java
deftsoft.iground.android.GrounChild.java
deftsoft.iground.android.HomeScreenActivity.java
deftsoft.iground.android.Home.java
deftsoft.iground.android.LogInScreenActivity.java
deftsoft.iground.android.MyHttpClient.java
deftsoft.iground.android.SignUpScreenActivity.java
deftsoft.iground.android.ThankYouActivity.java
deftsoft.iground.android.UILApplication.java
deftsoft.iground.android.ViewConsequence.java
deftsoft.iground.android.CustomizeListView.AbsListViewBaseActivity.java
deftsoft.iground.android.CustomizeListView.BaseActivity.java
deftsoft.iground.android.CustomizeListView.Constants.java
iground.child.interfaces.Consequnceselected.java