Fix issue #931
This commit is contained in:
parent
d625837222
commit
0344a2e88f
|
@ -136,6 +136,7 @@ public class Status implements Parcelable{
|
|||
|
||||
private int media_height;
|
||||
private boolean cached = false;
|
||||
private boolean autoHiddenCW = false;
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
|
@ -195,6 +196,7 @@ public class Status implements Parcelable{
|
|||
dest.writeParcelable(this.poll, flags);
|
||||
dest.writeInt(this.media_height);
|
||||
dest.writeByte(this.cached ? (byte) 1 : (byte) 0);
|
||||
dest.writeByte(this.autoHiddenCW ? (byte) 1 : (byte) 0);
|
||||
}
|
||||
|
||||
protected Status(Parcel in) {
|
||||
|
@ -256,6 +258,7 @@ public class Status implements Parcelable{
|
|||
this.poll = in.readParcelable(Poll.class.getClassLoader());
|
||||
this.media_height = in.readInt();
|
||||
this.cached = in.readByte() != 0;
|
||||
this.autoHiddenCW = in.readByte() != 0;
|
||||
}
|
||||
|
||||
public static final Creator<Status> CREATOR = new Creator<Status>() {
|
||||
|
@ -1363,4 +1366,12 @@ public class Status implements Parcelable{
|
|||
public void setcached(boolean cached) {
|
||||
this.cached = cached;
|
||||
}
|
||||
|
||||
public boolean isAutoHiddenCW() {
|
||||
return autoHiddenCW;
|
||||
}
|
||||
|
||||
public void setAutoHiddenCW(boolean autoHiddenCW) {
|
||||
this.autoHiddenCW = autoHiddenCW;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1539,7 +1539,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
|||
if (status.getReblog() == null) {
|
||||
if (status.getSpoiler_text() != null && status.getSpoiler_text().trim().length() > 0) {
|
||||
holder.status_spoiler_container.setVisibility(View.VISIBLE);
|
||||
if (!status.isSpoilerShown() && !expand_cw && !status.isShowSpoiler()) {
|
||||
if (!status.isSpoilerShown() && (!expand_cw || status.isAutoHiddenCW())) {
|
||||
holder.status_content_container.setVisibility(View.GONE);
|
||||
if (status.getMentions().size() > 0)
|
||||
holder.status_spoiler_mention_container.setVisibility(View.VISIBLE);
|
||||
|
@ -1547,9 +1547,18 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
|||
holder.status_spoiler_mention_container.setVisibility(View.GONE);
|
||||
holder.status_spoiler_button.setText(context.getString(R.string.load_attachment_spoiler));
|
||||
} else {
|
||||
holder.status_content_container.setVisibility(View.VISIBLE);
|
||||
holder.status_spoiler_mention_container.setVisibility(View.GONE);
|
||||
holder.status_spoiler_button.setText(context.getString(R.string.load_attachment_spoiler_less));
|
||||
if( !status.isAutoHiddenCW()) {
|
||||
holder.status_content_container.setVisibility(View.VISIBLE);
|
||||
holder.status_spoiler_mention_container.setVisibility(View.GONE);
|
||||
holder.status_spoiler_button.setText(context.getString(R.string.load_attachment_spoiler_less));
|
||||
}else{
|
||||
holder.status_content_container.setVisibility(View.GONE);
|
||||
if (status.getMentions().size() > 0)
|
||||
holder.status_spoiler_mention_container.setVisibility(View.VISIBLE);
|
||||
else
|
||||
holder.status_spoiler_mention_container.setVisibility(View.GONE);
|
||||
holder.status_spoiler_button.setText(context.getString(R.string.load_attachment_spoiler));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
holder.status_spoiler_container.setVisibility(View.GONE);
|
||||
|
@ -1559,7 +1568,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
|||
} else {
|
||||
if (status.getReblog().getSpoiler_text() != null && status.getReblog().getSpoiler_text().trim().length() > 0) {
|
||||
holder.status_spoiler_container.setVisibility(View.VISIBLE);
|
||||
if (!status.isSpoilerShown() && !expand_cw) {
|
||||
if (!status.isSpoilerShown() && (!expand_cw || status.isAutoHiddenCW())) {
|
||||
holder.status_content_container.setVisibility(View.GONE);
|
||||
if (status.getMentions().size() > 0)
|
||||
holder.status_spoiler_mention_container.setVisibility(View.VISIBLE);
|
||||
|
@ -1567,9 +1576,18 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
|||
holder.status_spoiler_mention_container.setVisibility(View.GONE);
|
||||
holder.status_spoiler_button.setText(context.getString(R.string.load_attachment_spoiler));
|
||||
} else {
|
||||
holder.status_content_container.setVisibility(View.VISIBLE);
|
||||
holder.status_spoiler_mention_container.setVisibility(View.GONE);
|
||||
holder.status_spoiler_button.setText(context.getString(R.string.load_attachment_spoiler_less));
|
||||
if( !status.isAutoHiddenCW()) {
|
||||
holder.status_content_container.setVisibility(View.VISIBLE);
|
||||
holder.status_spoiler_mention_container.setVisibility(View.GONE);
|
||||
holder.status_spoiler_button.setText(context.getString(R.string.load_attachment_spoiler_less));
|
||||
}else {
|
||||
holder.status_content_container.setVisibility(View.GONE);
|
||||
if (status.getMentions().size() > 0)
|
||||
holder.status_spoiler_mention_container.setVisibility(View.VISIBLE);
|
||||
else
|
||||
holder.status_spoiler_mention_container.setVisibility(View.GONE);
|
||||
holder.status_spoiler_button.setText(context.getString(R.string.load_attachment_spoiler));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
holder.status_spoiler_container.setVisibility(View.GONE);
|
||||
|
@ -2150,6 +2168,11 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
|||
holder.status_spoiler_button.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if( expand_cw && !status.isSpoilerShown() ){
|
||||
status.setAutoHiddenCW(true);
|
||||
}else{
|
||||
status.setAutoHiddenCW(false);
|
||||
}
|
||||
status.setSpoilerShown(!status.isSpoilerShown());
|
||||
notifyStatusChanged(status);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue