Fix sensitive media not hidden whe clicking on the eye icon
This commit is contained in:
parent
84b33751a2
commit
43c6fe4f7b
|
@ -103,8 +103,6 @@ public class Status implements Serializable, Cloneable {
|
||||||
public boolean isTruncated = true;
|
public boolean isTruncated = true;
|
||||||
public boolean isFetchMore = false;
|
public boolean isFetchMore = false;
|
||||||
public PositionFetchMore positionFetchMore = PositionFetchMore.BOTTOM;
|
public PositionFetchMore positionFetchMore = PositionFetchMore.BOTTOM;
|
||||||
public boolean isMediaDisplayed = false;
|
|
||||||
public boolean isMediaObfuscated = true;
|
|
||||||
public boolean isChecked = false;
|
public boolean isChecked = false;
|
||||||
public String translationContent;
|
public String translationContent;
|
||||||
public boolean translationShown;
|
public boolean translationShown;
|
||||||
|
|
|
@ -1021,11 +1021,9 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||||
new WeakReference<>(holder.binding.spoiler), () -> recyclerView.post(() -> adapter.notifyItemChanged(holder.getBindingAdapterPosition()))),
|
new WeakReference<>(holder.binding.spoiler), () -> recyclerView.post(() -> adapter.notifyItemChanged(holder.getBindingAdapterPosition()))),
|
||||||
TextView.BufferType.SPANNABLE);
|
TextView.BufferType.SPANNABLE);
|
||||||
statusToDeal.isExpended = true;
|
statusToDeal.isExpended = true;
|
||||||
statusToDeal.isMediaDisplayed = true;
|
|
||||||
} else {
|
} else {
|
||||||
holder.binding.spoilerExpand.setOnClickListener(v -> {
|
holder.binding.spoilerExpand.setOnClickListener(v -> {
|
||||||
statusToDeal.isExpended = !statusToDeal.isExpended;
|
statusToDeal.isExpended = !statusToDeal.isExpended;
|
||||||
statusToDeal.isMediaDisplayed = !statusToDeal.isMediaDisplayed;
|
|
||||||
adapter.notifyItemChanged(holder.getBindingAdapterPosition());
|
adapter.notifyItemChanged(holder.getBindingAdapterPosition());
|
||||||
});
|
});
|
||||||
holder.binding.spoilerExpand.setVisibility(View.VISIBLE);
|
holder.binding.spoilerExpand.setVisibility(View.VISIBLE);
|
||||||
|
@ -2025,7 +2023,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||||
layoutMediaBinding.viewDescription.setVisibility(View.GONE);
|
layoutMediaBinding.viewDescription.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mediaObfuscated(statusToDeal) || expand_media) {
|
if (!statusToDeal.sensitive || expand_media) {
|
||||||
layoutMediaBinding.viewHide.setImageResource(R.drawable.ic_baseline_visibility_24);
|
layoutMediaBinding.viewHide.setImageResource(R.drawable.ic_baseline_visibility_24);
|
||||||
RequestBuilder<Drawable> requestBuilder = Glide.with(layoutMediaBinding.media.getContext())
|
RequestBuilder<Drawable> requestBuilder = Glide.with(layoutMediaBinding.media.getContext())
|
||||||
.load(attachment.preview_url);
|
.load(attachment.preview_url);
|
||||||
|
@ -2051,8 +2049,8 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||||
}
|
}
|
||||||
|
|
||||||
layoutMediaBinding.media.setOnClickListener(v -> {
|
layoutMediaBinding.media.setOnClickListener(v -> {
|
||||||
if (statusToDeal.isMediaObfuscated && mediaObfuscated(statusToDeal) && !expand_media) {
|
if (statusToDeal.sensitive && !expand_media) {
|
||||||
statusToDeal.isMediaObfuscated = false;
|
statusToDeal.sensitive = false;
|
||||||
int position = holder.getBindingAdapterPosition();
|
int position = holder.getBindingAdapterPosition();
|
||||||
adapter.notifyItemChanged(position);
|
adapter.notifyItemChanged(position);
|
||||||
|
|
||||||
|
@ -2062,7 +2060,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onFinish() {
|
public void onFinish() {
|
||||||
statusToDeal.isMediaObfuscated = true;
|
statusToDeal.sensitive = true;
|
||||||
adapter.notifyItemChanged(position);
|
adapter.notifyItemChanged(position);
|
||||||
}
|
}
|
||||||
}.start();
|
}.start();
|
||||||
|
@ -2099,7 +2097,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||||
mRecyclerView = recyclerView;
|
mRecyclerView = recyclerView;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean mediaObfuscated(Status status) {
|
/* private static boolean mediaObfuscated(Status status) {
|
||||||
//Media is not sensitive and doesn't have a spoiler text
|
//Media is not sensitive and doesn't have a spoiler text
|
||||||
if (!status.isMediaObfuscated) {
|
if (!status.isMediaObfuscated) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -2112,7 +2110,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||||
} else {
|
} else {
|
||||||
return status.sensitive;
|
return status.sensitive;
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a broadcast to other open fragments that content a timeline
|
* Send a broadcast to other open fragments that content a timeline
|
||||||
|
|
Loading…
Reference in New Issue