egslava

Android list item

Jun 24th, 2015
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.89 KB | None | 0 0
  1. @EViewGroup(R.layout.item_drug)
  2. public class DrugItem extends LinearLayout implements ContentListItem<Void>{
  3.  
  4.     public Drug drug;
  5.  
  6.     public DrugItem(Context context) { super(context); }
  7.     public DrugItem(Context context, AttributeSet attrs) { super(context, attrs); }
  8.  
  9.     @ViewById   TextView    name, description, cost, oldCost;
  10.     @ViewById   ImageView   cartIcon;
  11.  
  12.     @OrmLiteDao(helper = DBHelper.class)
  13.     Dao<Drug, Integer> dao;
  14.  
  15.     @Override public void bind (Cursor cursor, Void obj) {
  16.         bind ( Models.fromCursor(cursor, dao), obj, cursor.getPosition() );
  17.     }
  18.  
  19.     public void bind(Drug drug, Void obj, int position) {
  20.         this.drug = drug;
  21.  
  22.         Picasso.with(getContext()).load(drug.image).into(cartIcon);
  23.         map(name, drug.name);
  24.         mapi(description, drug.company);
  25.         map(cost, drug.cost);
  26.         map(oldCost, drug.oldCost);
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment