Display spoiler and flair info in posts.

This commit is contained in:
Alex Ning 2019-07-17 21:33:16 +08:00
parent ebf542161e
commit 42497bb247
11 changed files with 223 additions and 65 deletions

View File

@ -32,6 +32,7 @@ import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.request.target.Target;
import com.google.android.material.chip.Chip;
import com.libRG.CustomTextView;
import com.santalu.aspectratioimageview.AspectRatioImageView;
import java.util.ArrayList;
@ -271,6 +272,23 @@ class CommentRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
((PostDetailViewHolder) holder).mGildedNumberTextView.setText(gildedNumber);
}
if(mPost.isSpoiler() || mPost.getFlair() != null) {
((PostDetailViewHolder) holder).spoilerFlairlinearLayout.setVisibility(View.VISIBLE);
}
if(mPost.isSpoiler()) {
((PostDetailViewHolder) holder).spoilerTextView.setVisibility(View.VISIBLE);
((PostDetailViewHolder) holder).spoilerTextView
.setBackgroundColor(mActivity.getResources().getColor(R.color.backgroundColorPrimaryDark));
}
if(mPost.getFlair() != null) {
((PostDetailViewHolder) holder).flairTextView.setVisibility(View.VISIBLE);
((PostDetailViewHolder) holder).flairTextView.setText(mPost.getFlair());
((PostDetailViewHolder) holder).flairTextView
.setBackgroundColor(mActivity.getResources().getColor(R.color.backgroundColorPrimaryDark));
}
if(mPost.isNSFW()) {
((PostDetailViewHolder) holder).mNSFWChip.setVisibility(View.VISIBLE);
} else {
@ -677,6 +695,9 @@ class CommentRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
@BindView(R.id.gilded_number_text_view_item_post_detail) TextView mGildedNumberTextView;
@BindView(R.id.crosspost_image_view_item_post_detail) ImageView mCrosspostImageView;
@BindView(R.id.nsfw_text_view_item_post_detail) Chip mNSFWChip;
@BindView(R.id.spoiler_flair_linear_layout_item_post_detail) LinearLayout spoilerFlairlinearLayout;
@BindView(R.id.spoiler_custom_text_view_item_post_detail) CustomTextView spoilerTextView;
@BindView(R.id.flair_custom_text_view_item_post_detail) CustomTextView flairTextView;
@BindView(R.id.link_text_view_item_post_detail) TextView linkTextView;
@BindView(R.id.image_view_wrapper_item_post_detail) RelativeLayout mRelativeLayout;
@BindView(R.id.load_wrapper_item_post_detail) RelativeLayout mLoadWrapper;

View File

@ -75,4 +75,5 @@ public class JSONUtils {
static final String FIELDS_KEY = "fields";
static final String VALUE_KEY = "value";
static final String TEXT_KEY = "text";
static final String SPOILER_KEY = "spoiler";
}

View File

@ -152,8 +152,13 @@ class ParsePost {
int score = data.getInt(JSONUtils.SCORE_KEY);
int voteType;
int gilded = data.getInt(JSONUtils.GILDED_KEY);
boolean spoiler = data.getBoolean(JSONUtils.SPOILER_KEY);
boolean nsfw = data.getBoolean(JSONUtils.NSFW_KEY);
boolean stickied = data.getBoolean(JSONUtils.STICKIED_KEY);
String flair = null;
if(!data.isNull(JSONUtils.LINK_FLAIR_TEXT_KEY)) {
flair = data.getString(JSONUtils.LINK_FLAIR_TEXT_KEY);
}
if(data.isNull(JSONUtils.LIKES_KEY)) {
voteType = 0;
@ -184,19 +189,19 @@ class ParsePost {
data = data.getJSONArray(JSONUtils.CROSSPOST_PARENT_LIST).getJSONObject(0);
return parseData(data, permalink, id, fullName, subredditNamePrefixed,
author, formattedPostTime, title, previewUrl, previewWidth, previewHeight,
score, voteType, gilded, nsfw, stickied, true, i);
score, voteType, gilded, flair, spoiler, nsfw, stickied, true, i);
} else {
return parseData(data, permalink, id, fullName, subredditNamePrefixed,
author, formattedPostTime, title, previewUrl, previewWidth, previewHeight,
score, voteType, gilded, nsfw, stickied, false, i);
score, voteType, gilded, flair, spoiler, nsfw, stickied, false, i);
}
}
private static Post parseData(JSONObject data, String permalink, String id, String fullName,
String subredditNamePrefixed, String author, String formattedPostTime,
String title, String previewUrl, int previewWidth, int previewHeight,
int score, int voteType, int gilded, boolean nsfw, boolean stickied,
boolean isCrosspost, int i) throws JSONException {
int score, int voteType, int gilded, String flair, boolean spoiler,
boolean nsfw, boolean stickied, boolean isCrosspost, int i) throws JSONException {
Post post;
boolean isVideo = data.getBoolean(JSONUtils.IS_VIDEO_KEY);
@ -208,7 +213,8 @@ class ParsePost {
Log.i("text", Integer.toString(i));
int postType = Post.TEXT_TYPE;
post = new Post(id, fullName, subredditNamePrefixed, author, formattedPostTime,
title, permalink, score, postType, voteType, gilded, nsfw, stickied, isCrosspost);
title, permalink, score, postType, voteType, gilded, flair, spoiler, nsfw,
stickied, isCrosspost);
if(data.isNull(JSONUtils.SELFTEXT_HTML_KEY)) {
post.setSelfText("");
} else {
@ -220,7 +226,7 @@ class ParsePost {
int postType = Post.NO_PREVIEW_LINK_TYPE;
post = new Post(id, fullName, subredditNamePrefixed, author, formattedPostTime,
title, previewUrl, url, permalink, score, postType,
voteType, gilded, nsfw, stickied, isCrosspost);
voteType, gilded, flair, spoiler, nsfw, stickied, isCrosspost);
if(data.isNull(JSONUtils.SELFTEXT_HTML_KEY)) {
post.setSelfText("");
} else {
@ -242,7 +248,7 @@ class ParsePost {
post = new Post(id, fullName, subredditNamePrefixed, author, formattedPostTime,
title, previewUrl, permalink, score, postType, voteType,
gilded, nsfw, stickied, isCrosspost, true);
gilded, flair, spoiler, nsfw, stickied, isCrosspost, true);
post.setPreviewWidth(previewWidth);
post.setPreviewHeight(previewHeight);
@ -259,7 +265,7 @@ class ParsePost {
post = new Post(id, fullName, subredditNamePrefixed, author, formattedPostTime, title,
previewUrl, permalink, score, postType, voteType,
gilded, nsfw, stickied, isCrosspost, false);
gilded, flair, spoiler, nsfw, stickied, isCrosspost, false);
post.setPreviewWidth(previewWidth);
post.setPreviewHeight(previewHeight);
post.setVideoUrl(videoUrl);
@ -274,7 +280,7 @@ class ParsePost {
post = new Post(id, fullName, subredditNamePrefixed, author, formattedPostTime, title,
previewUrl, permalink, score, postType, voteType,
gilded, nsfw, stickied, isCrosspost, true);
gilded, flair, spoiler, nsfw, stickied, isCrosspost, true);
post.setPreviewWidth(previewWidth);
post.setPreviewHeight(previewHeight);
post.setVideoUrl(videoUrl);
@ -287,7 +293,7 @@ class ParsePost {
post = new Post(id, fullName, subredditNamePrefixed, author, formattedPostTime,
title, url, url, permalink, score, postType,
voteType, gilded, nsfw, stickied, isCrosspost);
voteType, gilded, flair, spoiler, nsfw, stickied, isCrosspost);
post.setPreviewWidth(previewWidth);
post.setPreviewHeight(previewHeight);
@ -298,7 +304,8 @@ class ParsePost {
int postType = Post.TEXT_TYPE;
post = new Post(id, fullName, subredditNamePrefixed, author, formattedPostTime,
title, permalink, score, postType, voteType, gilded, nsfw, stickied, isCrosspost);
title, permalink, score, postType, voteType, gilded, flair, spoiler,
nsfw, stickied, isCrosspost);
post.setPreviewWidth(previewWidth);
post.setPreviewHeight(previewHeight);
@ -315,7 +322,7 @@ class ParsePost {
post = new Post(id, fullName, subredditNamePrefixed, author, formattedPostTime,
title, previewUrl, url, permalink, score,
postType, voteType, gilded, nsfw, stickied, isCrosspost);
postType, voteType, gilded, flair, spoiler, nsfw, stickied, isCrosspost);
if(data.isNull(JSONUtils.SELFTEXT_HTML_KEY)) {
post.setSelfText("");
} else {
@ -335,7 +342,7 @@ class ParsePost {
post = new Post(id, fullName, subredditNamePrefixed, author, formattedPostTime,
title, previewUrl, url, permalink, score, postType,
voteType, gilded, nsfw, stickied, isCrosspost);
voteType, gilded, flair, spoiler, nsfw, stickied, isCrosspost);
post.setPreviewWidth(previewWidth);
post.setPreviewHeight(previewHeight);
} else {
@ -345,7 +352,7 @@ class ParsePost {
post = new Post(id, fullName, subredditNamePrefixed, author, formattedPostTime, title,
url, url, permalink, score, postType, voteType,
gilded, nsfw, stickied, isCrosspost);
gilded, flair, spoiler, nsfw, stickied, isCrosspost);
}
}
}

View File

@ -29,12 +29,14 @@ class Post implements Parcelable {
private String videoUrl;
private String gifOrVideoDownloadUrl;
private String permalink;
private String flair;
private int score;
private int postType;
private int voteType;
private int gilded;
private int previewWidth;
private int previewHeight;
private boolean spoiler;
private boolean nsfw;
private boolean stickied;
private boolean isCrosspost;
@ -44,7 +46,7 @@ class Post implements Parcelable {
Post(String id, String fullName, String subredditNamePrefixed, String author, String postTime,
String title, String previewUrl, String permalink, int score, int postType, int voteType,
int gilded, boolean nsfw, boolean stickied, boolean isCrosspost, boolean isDashVideo) {
int gilded, String flair, boolean spoiler, boolean nsfw, boolean stickied, boolean isCrosspost, boolean isDashVideo) {
this.id = id;
this.fullName = fullName;
this.subredditNamePrefixed = subredditNamePrefixed;
@ -57,6 +59,8 @@ class Post implements Parcelable {
this.postType = postType;
this.voteType = voteType;
this.gilded = gilded;
this.flair = flair;
this.spoiler = spoiler;
this.nsfw = nsfw;
this.stickied = stickied;
this.isCrosspost = isCrosspost;
@ -65,7 +69,8 @@ class Post implements Parcelable {
Post(String id, String fullName, String subredditNamePrefixed, String author, String postTime,
String title, String previewUrl, String url, String permalink, int score, int postType,
int voteType, int gilded, boolean nsfw, boolean stickied, boolean isCrosspost) {
int voteType, int gilded, String flair, boolean spoiler, boolean nsfw, boolean stickied,
boolean isCrosspost) {
this.id = id;
this.fullName = fullName;
this.subredditNamePrefixed = subredditNamePrefixed;
@ -79,14 +84,16 @@ class Post implements Parcelable {
this.postType = postType;
this.voteType = voteType;
this.gilded = gilded;
this.flair = flair;
this.spoiler = spoiler;
this.nsfw = nsfw;
this.stickied = stickied;
this.isCrosspost = isCrosspost;
}
Post(String id, String fullName, String subredditNamePrefixed, String author, String postTime,
String title, String permalink, int score, int postType, int voteType, int gilded, boolean nsfw,
boolean stickied, boolean isCrosspost) {
String title, String permalink, int score, int postType, int voteType, int gilded, String flair,
boolean spoiler, boolean nsfw, boolean stickied, boolean isCrosspost) {
this.id = id;
this.fullName = fullName;
this.subredditNamePrefixed = subredditNamePrefixed;
@ -98,6 +105,8 @@ class Post implements Parcelable {
this.postType = postType;
this.voteType = voteType;
this.gilded = gilded;
this.flair = flair;
this.spoiler = spoiler;
this.nsfw = nsfw;
this.stickied = stickied;
this.isCrosspost= isCrosspost;
@ -118,12 +127,14 @@ class Post implements Parcelable {
videoUrl = in.readString();
gifOrVideoDownloadUrl = in.readString();
permalink = in.readString();
flair = in.readString();
score = in.readInt();
postType = in.readInt();
voteType = in.readInt();
gilded = in.readInt();
previewWidth = in.readInt();
previewHeight = in.readInt();
spoiler = in.readByte() != 0;
nsfw = in.readByte() != 0;
stickied = in.readByte() != 0;
isCrosspost = in.readByte() != 0;
@ -147,35 +158,35 @@ class Post implements Parcelable {
return id;
}
public String getFullName() {
String getFullName() {
return fullName;
}
public String getSubredditNamePrefixed() {
String getSubredditNamePrefixed() {
return subredditNamePrefixed;
}
public String getSubredditIconUrl() {
String getSubredditIconUrl() {
return subredditIconUrl;
}
public void setSubredditIconUrl(String subredditIconUrl) {
void setSubredditIconUrl(String subredditIconUrl) {
this.subredditIconUrl = subredditIconUrl;
}
public String getAuthor() {
String getAuthor() {
return author;
}
public String getAuthorIconUrl() {
String getAuthorIconUrl() {
return authorIconUrl;
}
public void setAuthorIconUrl(String authorIconUrl) {
void setAuthorIconUrl(String authorIconUrl) {
this.authorIconUrl = authorIconUrl;
}
public String getPostTime() {
String getPostTime() {
return postTime;
}
@ -187,63 +198,67 @@ class Post implements Parcelable {
return title;
}
public void setSelfText(String selfText) {
void setSelfText(String selfText) {
this.selfText = selfText;
}
public String getSelfText() {
String getSelfText() {
return selfText;
}
public String getPreviewUrl() {
String getPreviewUrl() {
return previewUrl;
}
public String getUrl() {
String getUrl() {
return url;
}
public void setVideoUrl(String videoUrl) {
void setVideoUrl(String videoUrl) {
this.videoUrl = videoUrl;
}
public String getVideoUrl() {
String getVideoUrl() {
return videoUrl;
}
public String getGifOrVideoDownloadUrl() {
String getGifOrVideoDownloadUrl() {
return gifOrVideoDownloadUrl;
}
public void setGifOrVideoDownloadUrl(String gifOrVideoDownloadUrl) {
void setGifOrVideoDownloadUrl(String gifOrVideoDownloadUrl) {
this.gifOrVideoDownloadUrl = gifOrVideoDownloadUrl;
}
public String getPermalink() {
String getPermalink() {
return permalink;
}
public void setScore(int score) {
public String getFlair() {
return flair;
}
void setScore(int score) {
this.score = score;
}
public int getScore() {
int getScore() {
return score;
}
public int getPostType() {
int getPostType() {
return postType;
}
public void setVoteType(int voteType) {
void setVoteType(int voteType) {
this.voteType = voteType;
}
public int getVoteType() {
int getVoteType() {
return voteType;
}
public int getGilded() {
int getGilded() {
return gilded;
}
@ -263,7 +278,11 @@ class Post implements Parcelable {
return previewHeight;
}
public boolean isNSFW() {
boolean isSpoiler() {
return spoiler;
}
boolean isNSFW() {
return nsfw;
}
@ -272,23 +291,23 @@ class Post implements Parcelable {
return 0;
}
public boolean isDashVideo() {
boolean isDashVideo() {
return isDashVideo;
}
public void setDownloadableGifOrVideo(boolean isDownloadableGifOrVideo) {
void setDownloadableGifOrVideo(boolean isDownloadableGifOrVideo) {
this.isDownloadableGifOrVideo = isDownloadableGifOrVideo;
}
public boolean isDownloadableGifOrVideo() {
boolean isDownloadableGifOrVideo() {
return isDownloadableGifOrVideo;
}
public boolean isStickied() {
boolean isStickied() {
return stickied;
}
public boolean isCrosspost() {
boolean isCrosspost() {
return isCrosspost;
}
@ -308,12 +327,14 @@ class Post implements Parcelable {
parcel.writeString(videoUrl);
parcel.writeString(gifOrVideoDownloadUrl);
parcel.writeString(permalink);
parcel.writeString(flair);
parcel.writeInt(score);
parcel.writeInt(postType);
parcel.writeInt(voteType);
parcel.writeInt(gilded);
parcel.writeInt(previewWidth);
parcel.writeInt(previewHeight);
parcel.writeByte((byte) (spoiler ? 1 : 0));
parcel.writeByte((byte) (nsfw ? 1 : 0));
parcel.writeByte((byte) (stickied ? 1 : 0));
parcel.writeByte((byte) (isCrosspost ? 1 : 0));

View File

@ -149,10 +149,10 @@ public class PostImageActivity extends AppCompatActivity implements FlairBottomS
if(flair != null) {
flairTextView.setText(flair);
flairTextView.setBackgroundColor(getResources().getColor(R.color.textColorPrimaryDark));
flairTextView.setBackgroundColor(getResources().getColor(R.color.backgroundColorPrimaryDark));
}
if(isSpoiler) {
spoilerTextView.setBackgroundColor(getResources().getColor(R.color.textColorPrimaryDark));
spoilerTextView.setBackgroundColor(getResources().getColor(R.color.backgroundColorPrimaryDark));
}
if(isNSFW) {
nsfwTextView.setBackgroundColor(getResources().getColor(R.color.colorAccent));
@ -195,7 +195,7 @@ public class PostImageActivity extends AppCompatActivity implements FlairBottomS
spoilerTextView.setOnClickListener(view -> {
if(!isSpoiler) {
spoilerTextView.setBackgroundColor(getResources().getColor(R.color.textColorPrimaryDark));
spoilerTextView.setBackgroundColor(getResources().getColor(R.color.backgroundColorPrimaryDark));
isSpoiler = true;
} else {
spoilerTextView.setBackgroundColor(getResources().getColor(android.R.color.transparent));
@ -428,7 +428,7 @@ public class PostImageActivity extends AppCompatActivity implements FlairBottomS
public void flairSelected(String flair) {
this.flair = flair;
flairTextView.setText(flair);
flairTextView.setBackgroundColor(getResources().getColor(R.color.textColorPrimaryDark));
flairTextView.setBackgroundColor(getResources().getColor(R.color.backgroundColorPrimaryDark));
flairSelectionBottomSheetFragment.dismiss();
}
}

View File

@ -119,10 +119,10 @@ public class PostLinkActivity extends AppCompatActivity implements FlairBottomSh
if(flair != null) {
flairTextView.setText(flair);
flairTextView.setBackgroundColor(getResources().getColor(R.color.textColorPrimaryDark));
flairTextView.setBackgroundColor(getResources().getColor(R.color.backgroundColorPrimaryDark));
}
if(isSpoiler) {
spoilerTextView.setBackgroundColor(getResources().getColor(R.color.textColorPrimaryDark));
spoilerTextView.setBackgroundColor(getResources().getColor(R.color.backgroundColorPrimaryDark));
}
if(isNSFW) {
nsfwTextView.setBackgroundColor(getResources().getColor(R.color.colorAccent));
@ -166,7 +166,7 @@ public class PostLinkActivity extends AppCompatActivity implements FlairBottomSh
spoilerTextView.setOnClickListener(view -> {
if(!isSpoiler) {
spoilerTextView.setBackgroundColor(getResources().getColor(R.color.textColorPrimaryDark));
spoilerTextView.setBackgroundColor(getResources().getColor(R.color.backgroundColorPrimaryDark));
isSpoiler = true;
} else {
spoilerTextView.setBackgroundColor(getResources().getColor(android.R.color.transparent));
@ -306,7 +306,7 @@ public class PostLinkActivity extends AppCompatActivity implements FlairBottomSh
public void flairSelected(String flair) {
this.flair = flair;
flairTextView.setText(flair);
flairTextView.setBackgroundColor(getResources().getColor(R.color.textColorPrimaryDark));
flairTextView.setBackgroundColor(getResources().getColor(R.color.backgroundColorPrimaryDark));
flairSelectionBottomSheetFragment.dismiss();
}
}

View File

@ -37,6 +37,7 @@ import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.request.target.Target;
import com.google.android.material.card.MaterialCardView;
import com.google.android.material.chip.Chip;
import com.libRG.CustomTextView;
import org.greenrobot.eventbus.EventBus;
@ -139,6 +140,8 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo
int voteType = post.getVoteType();
int gilded = post.getGilded();
boolean nsfw = post.isNSFW();
boolean spoiler = post.isSpoiler();
String flair = post.getFlair();
((DataViewHolder) holder).cardView.setOnClickListener(view -> {
if(canStartActivity) {
@ -300,6 +303,21 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo
((DataViewHolder) holder).nsfwChip.setVisibility(View.VISIBLE);
}
if(spoiler || flair != null) {
((DataViewHolder) holder).spoilerFlairLinearLayout.setVisibility(View.VISIBLE);
}
if(spoiler) {
((DataViewHolder) holder).spoilerTextView.setVisibility(View.VISIBLE);
((DataViewHolder) holder).spoilerTextView.setBackgroundColor(mContext.getResources().getColor(R.color.backgroundColorPrimaryDark));
}
if(flair != null) {
((DataViewHolder) holder).flairTextView.setVisibility(View.VISIBLE);
((DataViewHolder) holder).flairTextView.setText(flair);
((DataViewHolder) holder).flairTextView.setBackgroundColor(mContext.getResources().getColor(R.color.backgroundColorPrimaryDark));
}
switch (voteType) {
case 1:
//Upvote
@ -620,6 +638,9 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo
@BindView(R.id.gilded_number_text_view_item_post) TextView gildedNumberTextView;
@BindView(R.id.crosspost_image_view_item_post) ImageView crosspostImageView;
@BindView(R.id.nsfw_text_view_item_post) Chip nsfwChip;
@BindView(R.id.spoiler_flair_linear_layout_item_post) LinearLayout spoilerFlairLinearLayout;
@BindView(R.id.spoiler_custom_text_view_item_post) CustomTextView spoilerTextView;
@BindView(R.id.flair_custom_text_view_item_post) CustomTextView flairTextView;
@BindView(R.id.link_text_view_item_post) TextView linkTextView;
@BindView(R.id.image_view_wrapper_item_post) RelativeLayout relativeLayout;
@BindView(R.id.progress_bar_item_post) ProgressBar progressBar;
@ -670,6 +691,9 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo
((DataViewHolder) holder).gildedNumberTextView.setVisibility(View.GONE);
((DataViewHolder) holder).crosspostImageView.setVisibility(View.GONE);
((DataViewHolder) holder).nsfwChip.setVisibility(View.GONE);
((DataViewHolder) holder).spoilerFlairLinearLayout.setVisibility(View.GONE);
((DataViewHolder) holder).spoilerTextView.setVisibility(View.GONE);
((DataViewHolder) holder).flairTextView.setVisibility(View.GONE);
((DataViewHolder) holder).linkTextView.setVisibility(View.GONE);
((DataViewHolder) holder).progressBar.setVisibility(View.GONE);
((DataViewHolder) holder).imageView.setVisibility(View.GONE);

View File

@ -119,10 +119,10 @@ public class PostTextActivity extends AppCompatActivity implements FlairBottomSh
if(flair != null) {
flairTextView.setText(flair);
flairTextView.setBackgroundColor(getResources().getColor(R.color.textColorPrimaryDark));
flairTextView.setBackgroundColor(getResources().getColor(R.color.backgroundColorPrimaryDark));
}
if(isSpoiler) {
spoilerTextView.setBackgroundColor(getResources().getColor(R.color.textColorPrimaryDark));
spoilerTextView.setBackgroundColor(getResources().getColor(R.color.backgroundColorPrimaryDark));
}
if(isNSFW) {
nsfwTextView.setBackgroundColor(getResources().getColor(R.color.colorAccent));
@ -171,7 +171,7 @@ public class PostTextActivity extends AppCompatActivity implements FlairBottomSh
spoilerTextView.setOnClickListener(view -> {
if(!isSpoiler) {
spoilerTextView.setBackgroundColor(getResources().getColor(R.color.textColorPrimaryDark));
spoilerTextView.setBackgroundColor(getResources().getColor(R.color.backgroundColorPrimaryDark));
isSpoiler = true;
} else {
spoilerTextView.setBackgroundColor(getResources().getColor(android.R.color.transparent));
@ -311,7 +311,7 @@ public class PostTextActivity extends AppCompatActivity implements FlairBottomSh
public void flairSelected(String flair) {
this.flair = flair;
flairTextView.setText(flair);
flairTextView.setBackgroundColor(getResources().getColor(R.color.textColorPrimaryDark));
flairTextView.setBackgroundColor(getResources().getColor(R.color.backgroundColorPrimaryDark));
flairSelectionBottomSheetFragment.dismiss();
}
}

View File

@ -154,10 +154,10 @@ public class PostVideoActivity extends AppCompatActivity implements FlairBottomS
if(flair != null) {
flairTextView.setText(flair);
flairTextView.setBackgroundColor(getResources().getColor(R.color.textColorPrimaryDark));
flairTextView.setBackgroundColor(getResources().getColor(R.color.backgroundColorPrimaryDark));
}
if(isSpoiler) {
spoilerTextView.setBackgroundColor(getResources().getColor(R.color.textColorPrimaryDark));
spoilerTextView.setBackgroundColor(getResources().getColor(R.color.backgroundColorPrimaryDark));
}
if(isNSFW) {
nsfwTextView.setBackgroundColor(getResources().getColor(R.color.colorAccent));
@ -200,7 +200,7 @@ public class PostVideoActivity extends AppCompatActivity implements FlairBottomS
spoilerTextView.setOnClickListener(view -> {
if(!isSpoiler) {
spoilerTextView.setBackgroundColor(getResources().getColor(R.color.textColorPrimaryDark));
spoilerTextView.setBackgroundColor(getResources().getColor(R.color.backgroundColorPrimaryDark));
isSpoiler = true;
} else {
spoilerTextView.setBackgroundColor(getResources().getColor(android.R.color.transparent));
@ -409,7 +409,7 @@ public class PostVideoActivity extends AppCompatActivity implements FlairBottomS
public void flairSelected(String flair) {
this.flair = flair;
flairTextView.setText(flair);
flairTextView.setBackgroundColor(getResources().getColor(R.color.textColorPrimaryDark));
flairTextView.setBackgroundColor(getResources().getColor(R.color.backgroundColorPrimaryDark));
flairSelectionBottomSheetFragment.dismiss();
}
}

View File

@ -142,10 +142,53 @@
</RelativeLayout>
<LinearLayout
android:id="@+id/spoiler_flair_linear_layout_item_post"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:visibility="gone">
<com.libRG.CustomTextView
android:id="@+id/spoiler_custom_text_view_item_post"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="16dp"
android:text="@string/spoiler"
android:textSize="12sp"
android:textColor="@color/primaryTextColor"
android:padding="4dp"
android:background="@color/textColorPrimaryDark"
android:visibility="gone"
app:lib_setRadius="3dp"
app:lib_setRoundedBorderColor="@color/textColorPrimaryDark"
app:lib_setRoundedView="true"
app:lib_setShape="rectangle" />
<com.libRG.CustomTextView
android:id="@+id/flair_custom_text_view_item_post"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="16dp"
android:textSize="12sp"
android:textColor="@color/primaryTextColor"
android:padding="4dp"
android:background="@color/textColorPrimaryDark"
android:visibility="gone"
app:lib_setRadius="3dp"
app:lib_setRoundedBorderColor="@color/textColorPrimaryDark"
app:lib_setRoundedView="true"
app:lib_setShape="rectangle" />
</LinearLayout>
<TextView
android:id="@+id/link_text_view_item_post"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:textSize="12sp"
@ -155,7 +198,6 @@
android:id="@+id/image_view_wrapper_item_post"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:visibility="gone">
<ProgressBar

View File

@ -134,10 +134,53 @@
</RelativeLayout>
<LinearLayout
android:id="@+id/spoiler_flair_linear_layout_item_post_detail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:visibility="gone">
<com.libRG.CustomTextView
android:id="@+id/spoiler_custom_text_view_item_post_detail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="16dp"
android:text="@string/spoiler"
android:textSize="12sp"
android:textColor="@color/primaryTextColor"
android:padding="4dp"
android:background="@color/textColorPrimaryDark"
android:visibility="gone"
app:lib_setRadius="3dp"
app:lib_setRoundedBorderColor="@color/textColorPrimaryDark"
app:lib_setRoundedView="true"
app:lib_setShape="rectangle" />
<com.libRG.CustomTextView
android:id="@+id/flair_custom_text_view_item_post_detail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="16dp"
android:textSize="12sp"
android:textColor="@color/primaryTextColor"
android:padding="4dp"
android:background="@color/textColorPrimaryDark"
android:visibility="gone"
app:lib_setRadius="3dp"
app:lib_setRoundedBorderColor="@color/textColorPrimaryDark"
app:lib_setRoundedView="true"
app:lib_setShape="rectangle" />
</LinearLayout>
<TextView
android:id="@+id/link_text_view_item_post_detail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:textSize="12sp"
@ -147,7 +190,6 @@
android:id="@+id/image_view_wrapper_item_post_detail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:visibility="gone">
<com.santalu.aspectratioimageview.AspectRatioImageView