Search in sources :

Example 1 with ProfileActivity

use of fr.free.nrw.commons.profile.ProfileActivity in project apps-android-commons by commons-app.

the class LeaderboardListAdapter method onBindViewHolder.

/**
 * Overrides the onBindViewHolder Set the view at the specific position with the specific value
 * @param holder
 * @param position
 */
@Override
public void onBindViewHolder(@NonNull LeaderboardListAdapter.ListViewHolder holder, int position) {
    TextView rank = holder.rank;
    SimpleDraweeView avatar = holder.avatar;
    TextView username = holder.username;
    TextView count = holder.count;
    rank.setText(getItem(position).getRank().toString());
    avatar.setImageURI(Uri.parse(getItem(position).getAvatar()));
    username.setText(getItem(position).getUsername());
    count.setText(getItem(position).getCategoryCount().toString());
    /*
          Now that we have our in app profile-section, lets take the user there
         */
    holder.itemView.setOnClickListener(view -> {
        if (view.getContext() instanceof ProfileActivity) {
            ((Activity) (view.getContext())).finish();
        }
        ProfileActivity.startYourself(view.getContext(), getItem(position).getUsername(), true);
    });
}
Also used : SimpleDraweeView(com.facebook.drawee.view.SimpleDraweeView) ProfileActivity(fr.free.nrw.commons.profile.ProfileActivity) ProfileActivity(fr.free.nrw.commons.profile.ProfileActivity) Activity(android.app.Activity) TextView(android.widget.TextView)

Aggregations

Activity (android.app.Activity)1 TextView (android.widget.TextView)1 SimpleDraweeView (com.facebook.drawee.view.SimpleDraweeView)1 ProfileActivity (fr.free.nrw.commons.profile.ProfileActivity)1