Fix #36 - CW automatically expanded does not work

This commit is contained in:
Thomas 2022-05-08 16:06:22 +02:00
parent d45c71d3b1
commit de744fedfa
2 changed files with 23 additions and 13 deletions

View file

@ -16,6 +16,7 @@ package app.fedilab.android.ui.drawer;
import static app.fedilab.android.activities.ContextActivity.displayCW;
import static app.fedilab.android.activities.ContextActivity.expand;
import android.annotation.SuppressLint;
import android.app.Activity;
@ -681,7 +682,14 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
//---- SPOILER TEXT -----
if (statusToDeal.spoiler_text != null && !statusToDeal.spoiler_text.trim().isEmpty()) {
if (!expand_cw && context instanceof ContextActivity && statusToDeal.sensitive) {
if (expand_cw || expand) {
holder.binding.spoilerExpand.setVisibility(View.VISIBLE);
holder.binding.spoiler.setVisibility(View.VISIBLE);
holder.binding.spoiler.setText(statusToDeal.span_spoiler_text, TextView.BufferType.SPANNABLE);
statusToDeal.isExpended = true;
statusToDeal.isMediaDisplayed = true;
} else {
if (context instanceof ContextActivity && statusToDeal.sensitive) {
statusToDeal.isExpended = displayCW;
status.isMediaDisplayed = displayCW;
}
@ -692,8 +700,9 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
});
holder.binding.spoilerExpand.setVisibility(View.VISIBLE);
holder.binding.spoiler.setVisibility(View.VISIBLE);
holder.binding.spoiler.setText(statusToDeal.span_spoiler_text, TextView.BufferType.SPANNABLE);
}
} else {
holder.binding.spoiler.setVisibility(View.GONE);
holder.binding.spoilerExpand.setVisibility(View.GONE);

View file

@ -201,10 +201,11 @@ public class FragmentMastodonContext extends Fragment {
if (statusAdapter != null && firstStatus != null) {
pullToRefresh = true;
String id;
if (expand)
if (expand) {
id = firstStatus.id;
else
} else {
id = focusedStatus.id;
}
statusesVM.getContext(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, id)
.observe(FragmentMastodonContext.this, this::initializeContextView);
}