app/src/main/java/com/codepath/apps/restclienttemplate/TweetsAdapter.java
// bind goes through every tweet and attaches all the correct info (username, profile picture, tweet content, etc)
bind goes through every tweet and attaches all the correct info (username, profile picture, tweet content, etc)
bind goes through every tweet and attaches all the correct info ( username profile picture tweet content etc )
public void bind(Tweet tweet) {
            tweetInteractions = new TweetInteractions(context, ibLike, ibRetweet, ibReply,
                    client, tweet);
            ibLike.setOnClickListener(tweetInteractions);
            ibRetweet.setOnClickListener(tweetInteractions);
            itemView.setOnClickListener(this);
            tvBody.setText(tweet.body);
            tvScreenName.setText(tweet.user.name);
            tvTimePosted.setText(tweet.createdAt);
            tvUserAt.setText(String.format("@%s", tweet.user.screenName));
            if (tweet.likeCount == 0) {
                tvLikeCount.setText("");
            } else {
                tvLikeCount.setText(String.format(Locale.ENGLISH, "%d", tweet.likeCount));
            }
            if (tweet.retweetCount == 0) {
                tvRetweetCount.setText("");
            } else {
                tvRetweetCount.setText(String.format(Locale.ENGLISH, "%d", tweet.retweetCount));
            }
            ibLike.setSelected(tweet.liked);
            ibRetweet.setSelected(tweet.retweeted);
            Glide.with(context)
                    .load(tweet.user.publicImageUrl)
                    .circleCrop()
                    .into(ivProfileImage);
            if (tweet.imageUrls.size() != 0) {
                ivMediaImage.setVisibility(View.VISIBLE);
                Glide.with(context)
                        .load(tweet.imageUrls.get(0))
                        .fitCenter()
                        .transform(new RoundedCorners(10))
                        .placeholder(R.drawable.placeholder_twit)
                        .into(ivMediaImage);
            } else {
                ivMediaImage.setVisibility(View.GONE);
            }
        }
public void bind ( Tweet tweet ) { tweetInteractions = new TweetInteractions ( context , ibLike , ibRetweet , ibReply , client , tweet ) ; ibLike . setOnClickListener ( tweetInteractions ) ; ibRetweet . setOnClickListener ( tweetInteractions ) ; itemView . setOnClickListener ( this ) ; tvBody . setText ( tweet . body ) ; tvScreenName . setText ( tweet . user . name ) ; tvTimePosted . setText ( tweet . createdAt ) ; tvUserAt . setText ( String . format ( "@%s" , tweet . user . screenName ) ) ; if ( tweet . likeCount == 0 ) { tvLikeCount . setText ( "" ) ; } else { tvLikeCount . setText ( String . format ( Locale . ENGLISH , "%d" , tweet . likeCount ) ) ; } if ( tweet . retweetCount == 0 ) { tvRetweetCount . setText ( "" ) ; } else { tvRetweetCount . setText ( String . format ( Locale . ENGLISH , "%d" , tweet . retweetCount ) ) ; } ibLike . setSelected ( tweet . liked ) ; ibRetweet . setSelected ( tweet . retweeted ) ; Glide . with ( context ) . load ( tweet . user . publicImageUrl ) . circleCrop ( ) . into ( ivProfileImage ) ; if ( tweet . imageUrls . size ( ) != 0 ) { ivMediaImage . setVisibility ( View . VISIBLE ) ; Glide . with ( context ) . load ( tweet . imageUrls . get ( 0 ) ) . fitCenter ( ) . transform ( new RoundedCorners ( 10 ) ) . placeholder ( R . drawable . placeholder_twit ) . into ( ivMediaImage ) ; } else { ivMediaImage . setVisibility ( View . GONE ) ; } }
bind goes through every tweet and attaches all the correct info (username, profile picture, tweet content, etc)
bind goes through every tweet and attaches all the correct info ( username profile picture tweet content etc )
// Load profile picture into profile image view // The tweet has an image, show the first image // TODO: make other images show up as well just like in details activity -- this will also be rough