Browse Source

Fix for Topic's RecyclerView mixing views

pull/24/head
Apostolos Fanakis 8 years ago
parent
commit
c6afc057bc
  1. 30
      app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java

30
app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java

@ -259,9 +259,26 @@ class TopicAdapter extends RecyclerView.Adapter<TopicAdapter.MyViewHolder> {
holder.postFooter.removeAllViews();
}
String mSpecialRank, mRank, mGender, mNumberOfPosts, mPersonalText;
int mNumberOfStars, mUserColor;
if (!currentPost.isDeleted()) { //Sets user's extra info
String mSpecialRank = currentPost.getSpecialRank(), mRank = currentPost.getRank(), mGender = currentPost.getGender(), mNumberOfPosts = currentPost.getNumberOfPosts(), mPersonalText = currentPost.getPersonalText();
int mNumberOfStars = currentPost.getNumberOfStars(), mUserColor = currentPost.getUserColor();
mSpecialRank = currentPost.getSpecialRank();
mRank = currentPost.getRank();
mGender = currentPost.getGender();
mNumberOfPosts = currentPost.getNumberOfPosts();
mPersonalText = currentPost.getPersonalText();
mNumberOfStars = currentPost.getNumberOfStars();
mUserColor = currentPost.getUserColor();
} else {
mSpecialRank = null;
mRank = null;
mGender = null;
mNumberOfPosts = null;
mPersonalText = null;
mNumberOfStars = 0;
mUserColor = 0;
}
if (!Objects.equals(mSpecialRank, "") && mSpecialRank != null) {
holder.specialRank.setText(mSpecialRank);
@ -313,13 +330,14 @@ class TopicAdapter extends RecyclerView.Adapter<TopicAdapter.MyViewHolder> {
} else holder.cardChildLinear.setBackground(null);
//Avoid's view's visibility recycling
if (viewProperties.get(position)[isUserExtraInfoVisibile]) {
if (!currentPost.isDeleted() && viewProperties.get(position)[isUserExtraInfoVisibile]) {
holder.userExtraInfo.setVisibility(View.VISIBLE);
holder.userExtraInfo.setAlpha(1.0f);
} else {
holder.userExtraInfo.setVisibility(View.GONE);
holder.userExtraInfo.setAlpha(0.0f);
}
if (!currentPost.isDeleted()) {
//Sets graphics behavior
holder.header.setOnClickListener(new View.OnClickListener() {
@Override
@ -356,7 +374,11 @@ class TopicAdapter extends RecyclerView.Adapter<TopicAdapter.MyViewHolder> {
TopicAnimations.animateUserExtraInfoVisibility(v);
}
});
}//End of deleted profiles
} else {
holder.header.setOnClickListener(null);
holder.userExtraInfo.setOnClickListener(null);
}
//Avoid's view's visibility recycling
if (viewProperties.get(position)[isPostDateAndNumberVisibile]) { //Expanded
holder.postDateAndNumberExp.setVisibility(View.VISIBLE);

Loading…
Cancel
Save