Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @EViewGroup(R.layout.item_drug)
- public class DrugItem extends LinearLayout implements ContentListItem<Void>{
- // конструкторы просто нужны - без них не скомпилится. Желательно делать два, хотя не уверен
- public DrugItem(Context context) { super(context); }
- public DrugItem(Context context, AttributeSet attrs) { super(context, attrs); }
- // нужные тебе вьюхи - всё как обычно
- @ViewById TextView name, description, cost, oldCost;
- @ViewById ImageView cartIcon;
- @OrmLiteDao(helper = DBHelper.class)
- Dao<Drug, Integer> dao;
- // класс, который биндит вьюху на основе курсора
- @Override public void bind (Cursor cursor, ListView list) {
- bind ( Models.fromCursor(cursor, dao), list, cursor.getPosition() );
- }
- // тут я типа байндю класс на вью
- public void bind(Drug drug, Void params, int position) {
- this.drug = drug;
- map(name, drug.name);
- mapi(description, drug.description);
- map(cost, drug.cost);
- map(oldCost, drug.oldCost);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment