|
@ -259,67 +259,85 @@ class TopicAdapter extends RecyclerView.Adapter<TopicAdapter.MyViewHolder> { |
|
|
holder.postFooter.removeAllViews(); |
|
|
holder.postFooter.removeAllViews(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
String mSpecialRank, mRank, mGender, mNumberOfPosts, mPersonalText; |
|
|
|
|
|
int mNumberOfStars, mUserColor; |
|
|
|
|
|
|
|
|
if (!currentPost.isDeleted()) { //Sets user's extra info
|
|
|
if (!currentPost.isDeleted()) { //Sets user's extra info
|
|
|
String mSpecialRank = currentPost.getSpecialRank(), mRank = currentPost.getRank(), mGender = currentPost.getGender(), mNumberOfPosts = currentPost.getNumberOfPosts(), mPersonalText = currentPost.getPersonalText(); |
|
|
mSpecialRank = currentPost.getSpecialRank(); |
|
|
int mNumberOfStars = currentPost.getNumberOfStars(), mUserColor = currentPost.getUserColor(); |
|
|
mRank = currentPost.getRank(); |
|
|
|
|
|
mGender = currentPost.getGender(); |
|
|
if (!Objects.equals(mSpecialRank, "") && mSpecialRank != null) { |
|
|
mNumberOfPosts = currentPost.getNumberOfPosts(); |
|
|
holder.specialRank.setText(mSpecialRank); |
|
|
mPersonalText = currentPost.getPersonalText(); |
|
|
holder.specialRank.setVisibility(View.VISIBLE); |
|
|
mNumberOfStars = currentPost.getNumberOfStars(); |
|
|
} else |
|
|
mUserColor = currentPost.getUserColor(); |
|
|
holder.specialRank.setVisibility(View.GONE); |
|
|
} else { |
|
|
if (!Objects.equals(mRank, "") && mRank != null) { |
|
|
mSpecialRank = null; |
|
|
holder.rank.setText(mRank); |
|
|
mRank = null; |
|
|
holder.rank.setVisibility(View.VISIBLE); |
|
|
mGender = null; |
|
|
} else |
|
|
mNumberOfPosts = null; |
|
|
holder.rank.setVisibility(View.GONE); |
|
|
mPersonalText = null; |
|
|
if (!Objects.equals(mGender, "") && mGender != null) { |
|
|
mNumberOfStars = 0; |
|
|
holder.gender.setText(mGender); |
|
|
mUserColor = 0; |
|
|
holder.gender.setVisibility(View.VISIBLE); |
|
|
} |
|
|
} else |
|
|
|
|
|
holder.gender.setVisibility(View.GONE); |
|
|
|
|
|
if (!Objects.equals(mNumberOfPosts, "") && mNumberOfPosts != null) { |
|
|
|
|
|
holder.numberOfPosts.setText(mNumberOfPosts); |
|
|
|
|
|
holder.numberOfPosts.setVisibility(View.VISIBLE); |
|
|
|
|
|
} else |
|
|
|
|
|
holder.numberOfPosts.setVisibility(View.GONE); |
|
|
|
|
|
if (!Objects.equals(mPersonalText, "") && mPersonalText != null) { |
|
|
|
|
|
holder.personalText.setText("\"" + mPersonalText + "\""); |
|
|
|
|
|
holder.personalText.setVisibility(View.VISIBLE); |
|
|
|
|
|
} else |
|
|
|
|
|
holder.personalText.setVisibility(View.GONE); |
|
|
|
|
|
if (mNumberOfStars > 0) { |
|
|
|
|
|
holder.stars.setTypeface(Typeface.createFromAsset(context.getAssets() |
|
|
|
|
|
, "fonts/fontawesome-webfont.ttf")); |
|
|
|
|
|
|
|
|
|
|
|
String aStar = context.getResources().getString(R.string.fa_icon_star); |
|
|
if (!Objects.equals(mSpecialRank, "") && mSpecialRank != null) { |
|
|
String usersStars = ""; |
|
|
holder.specialRank.setText(mSpecialRank); |
|
|
for (int i = 0; i < mNumberOfStars; ++i) { |
|
|
holder.specialRank.setVisibility(View.VISIBLE); |
|
|
usersStars += aStar; |
|
|
} else |
|
|
} |
|
|
holder.specialRank.setVisibility(View.GONE); |
|
|
holder.stars.setText(usersStars); |
|
|
if (!Objects.equals(mRank, "") && mRank != null) { |
|
|
holder.stars.setTextColor(mUserColor); |
|
|
holder.rank.setText(mRank); |
|
|
holder.stars.setVisibility(View.VISIBLE); |
|
|
holder.rank.setVisibility(View.VISIBLE); |
|
|
} else |
|
|
} else |
|
|
holder.stars.setVisibility(View.GONE); |
|
|
holder.rank.setVisibility(View.GONE); |
|
|
//Special card for special member of the month!
|
|
|
if (!Objects.equals(mGender, "") && mGender != null) { |
|
|
if (mUserColor == TopicParser.USER_COLOR_PINK) { |
|
|
holder.gender.setText(mGender); |
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { |
|
|
holder.gender.setVisibility(View.VISIBLE); |
|
|
holder.cardChildLinear.setBackground(context.getResources(). |
|
|
} else |
|
|
getDrawable(R.drawable.member_of_the_month_card, null)); |
|
|
holder.gender.setVisibility(View.GONE); |
|
|
} else //noinspection deprecation
|
|
|
if (!Objects.equals(mNumberOfPosts, "") && mNumberOfPosts != null) { |
|
|
holder.cardChildLinear.setBackground(context.getResources(). |
|
|
holder.numberOfPosts.setText(mNumberOfPosts); |
|
|
getDrawable(R.drawable.member_of_the_month_card)); |
|
|
holder.numberOfPosts.setVisibility(View.VISIBLE); |
|
|
} else holder.cardChildLinear.setBackground(null); |
|
|
} else |
|
|
|
|
|
holder.numberOfPosts.setVisibility(View.GONE); |
|
|
//Avoid's view's visibility recycling
|
|
|
if (!Objects.equals(mPersonalText, "") && mPersonalText != null) { |
|
|
if (viewProperties.get(position)[isUserExtraInfoVisibile]) { |
|
|
holder.personalText.setText("\"" + mPersonalText + "\""); |
|
|
holder.userExtraInfo.setVisibility(View.VISIBLE); |
|
|
holder.personalText.setVisibility(View.VISIBLE); |
|
|
holder.userExtraInfo.setAlpha(1.0f); |
|
|
} else |
|
|
} else { |
|
|
holder.personalText.setVisibility(View.GONE); |
|
|
holder.userExtraInfo.setVisibility(View.GONE); |
|
|
if (mNumberOfStars > 0) { |
|
|
holder.userExtraInfo.setAlpha(0.0f); |
|
|
holder.stars.setTypeface(Typeface.createFromAsset(context.getAssets() |
|
|
|
|
|
, "fonts/fontawesome-webfont.ttf")); |
|
|
|
|
|
|
|
|
|
|
|
String aStar = context.getResources().getString(R.string.fa_icon_star); |
|
|
|
|
|
String usersStars = ""; |
|
|
|
|
|
for (int i = 0; i < mNumberOfStars; ++i) { |
|
|
|
|
|
usersStars += aStar; |
|
|
} |
|
|
} |
|
|
|
|
|
holder.stars.setText(usersStars); |
|
|
|
|
|
holder.stars.setTextColor(mUserColor); |
|
|
|
|
|
holder.stars.setVisibility(View.VISIBLE); |
|
|
|
|
|
} else |
|
|
|
|
|
holder.stars.setVisibility(View.GONE); |
|
|
|
|
|
//Special card for special member of the month!
|
|
|
|
|
|
if (mUserColor == TopicParser.USER_COLOR_PINK) { |
|
|
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { |
|
|
|
|
|
holder.cardChildLinear.setBackground(context.getResources(). |
|
|
|
|
|
getDrawable(R.drawable.member_of_the_month_card, null)); |
|
|
|
|
|
} else //noinspection deprecation
|
|
|
|
|
|
holder.cardChildLinear.setBackground(context.getResources(). |
|
|
|
|
|
getDrawable(R.drawable.member_of_the_month_card)); |
|
|
|
|
|
} else holder.cardChildLinear.setBackground(null); |
|
|
|
|
|
|
|
|
|
|
|
//Avoid's view's visibility recycling
|
|
|
|
|
|
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
|
|
|
//Sets graphics behavior
|
|
|
holder.header.setOnClickListener(new View.OnClickListener() { |
|
|
holder.header.setOnClickListener(new View.OnClickListener() { |
|
|
@Override |
|
|
@Override |
|
@ -356,7 +374,11 @@ class TopicAdapter extends RecyclerView.Adapter<TopicAdapter.MyViewHolder> { |
|
|
TopicAnimations.animateUserExtraInfoVisibility(v); |
|
|
TopicAnimations.animateUserExtraInfoVisibility(v); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
}//End of deleted profiles
|
|
|
} else { |
|
|
|
|
|
holder.header.setOnClickListener(null); |
|
|
|
|
|
holder.userExtraInfo.setOnClickListener(null); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
//Avoid's view's visibility recycling
|
|
|
//Avoid's view's visibility recycling
|
|
|
if (viewProperties.get(position)[isPostDateAndNumberVisibile]) { //Expanded
|
|
|
if (viewProperties.get(position)[isPostDateAndNumberVisibile]) { //Expanded
|
|
|
holder.postDateAndNumberExp.setVisibility(View.VISIBLE); |
|
|
holder.postDateAndNumberExp.setVisibility(View.VISIBLE); |
|
|