Android Open Source - Qachee Character Adapter






From Project

Back to project page Qachee.

License

The source code is released under:

Apache License

If you think the Android project Qachee 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 com.qachee.sample.adapter;
/*w w  w.j a v  a  2  s .co  m*/
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

import com.qachee.QacheeManager;
import com.qachee.sample.domain.Character;
import com.qachee.sample.view.CharacterItemView;

import java.util.List;

/**
 * CharacterAdapter
 */
public class CharacterAdapter extends BaseAdapter {

  private List<com.qachee.sample.domain.Character> list;

  public CharacterAdapter(List<Character> list) {
    super();
    this.list = list;
  }

  @Override
  public int getCount() {
    return this.list.size();
  }

  @Override
  public Character getItem(int i) {
    return this.list.get(i);
  }

  @Override
  public long getItemId(int i) {
    return i;
  }

  @Override
  public View getView(int position, View convertView, ViewGroup parent) {

    CharacterItemView itemView;
    Character character = QacheeManager.getInstance().get(getItem(position), Character.class, false);

    if (convertView != null) {
      itemView = (CharacterItemView) convertView;
    } else {
      itemView = new CharacterItemView(parent.getContext());
    }

    itemView.loadData(character);
    return itemView;
  }
}




Java Source Code List

com.qachee.ExpirationTime.java
com.qachee.QacheeManager.java
com.qachee.QacheeableObject.java
com.qachee.Qacheeable.java
com.qachee.sample.DemoLoader.java
com.qachee.sample.MainActivity.java
com.qachee.sample.adapter.CharacterAdapter.java
com.qachee.sample.domain.Character.java
com.qachee.sample.fragment.CharacterEditFragment.java
com.qachee.sample.fragment.CharacterListFragment.java
com.qachee.sample.task.SafeAsyncTask.java
com.qachee.sample.view.CharacterItemView.java