app/src/main/java/com/kevinrei/chronotrack/GameAdapter.java
// Replace the contents of a view (invoked by LayoutManager)
Replace the contents of a view (invoked by LayoutManager)
Replace the contents of a view ( invoked by LayoutManager )
@Override
    public void onBindViewHolder(final ViewHolder viewHolder, final int position) {
        final Game game = games.get(position);
        Picasso.with(viewHolder.mGameImage.getContext())
                .load(Uri.parse(game.getImage()))
                .into(viewHolder.mGameImage);
        viewHolder.mGameTitle.setText(game.getTitle());
        viewHolder.mGameCategory.setText(game.getCategory());
        viewHolder.mGameDetail.setOnClickListener(new CardClickListener(game, position));
        viewHolder.mGameCreate.setOnClickListener(new CardClickListener(game, position));
        viewHolder.mGameEdit.setOnClickListener(new CardClickListener(game, position));
        viewHolder.mGameDelete.setOnClickListener(new CardClickListener(game, position));
        viewHolder.mGameReorder.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                v.setSelected(false);
                if (MotionEventCompat.getActionMasked(event) == MotionEvent.ACTION_DOWN) {
                    mStartDragListener.onStartDrag(viewHolder);
                }
                return false;
            }
        });
    }
@ Override public void onBindViewHolder ( final ViewHolder viewHolder , final int position ) { final Game game = games . get ( position ) ; Picasso . with ( viewHolder . mGameImage . getContext ( ) ) . load ( Uri . parse ( game . getImage ( ) ) ) . into ( viewHolder . mGameImage ) ; viewHolder . mGameTitle . setText ( game . getTitle ( ) ) ; viewHolder . mGameCategory . setText ( game . getCategory ( ) ) ; viewHolder . mGameDetail . setOnClickListener ( new CardClickListener ( game , position ) ) ; viewHolder . mGameCreate . setOnClickListener ( new CardClickListener ( game , position ) ) ; viewHolder . mGameEdit . setOnClickListener ( new CardClickListener ( game , position ) ) ; viewHolder . mGameDelete . setOnClickListener ( new CardClickListener ( game , position ) ) ; viewHolder . mGameReorder . setOnTouchListener ( new View . OnTouchListener ( ) { @ Override public boolean onTouch ( View v , MotionEvent event ) { v . setSelected ( false ) ; if ( MotionEventCompat . getActionMasked ( event ) == MotionEvent . ACTION_DOWN ) { mStartDragListener . onStartDrag ( viewHolder ) ; } return false ; } } ) ; }
Replace the contents of a view (invoked by LayoutManager)
Replace the contents of a view ( invoked by LayoutManager )
// Set listeners to card items