mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2024-12-22 16:50:04 +02:00
Fix #36 - CW automatically expanded does not work
This commit is contained in:
parent
d45c71d3b1
commit
de744fedfa
2 changed files with 23 additions and 13 deletions
|
@ -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,19 +682,27 @@ 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) {
|
||||
statusToDeal.isExpended = displayCW;
|
||||
status.isMediaDisplayed = displayCW;
|
||||
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;
|
||||
}
|
||||
holder.binding.spoilerExpand.setOnClickListener(v -> {
|
||||
statusToDeal.isExpended = !status.isExpended;
|
||||
statusToDeal.isMediaDisplayed = !status.isMediaDisplayed;
|
||||
adapter.notifyItemChanged(getPositionAsync(notificationList, statusList, statusToDeal));
|
||||
});
|
||||
holder.binding.spoilerExpand.setVisibility(View.VISIBLE);
|
||||
holder.binding.spoiler.setVisibility(View.VISIBLE);
|
||||
holder.binding.spoiler.setText(statusToDeal.span_spoiler_text, TextView.BufferType.SPANNABLE);
|
||||
}
|
||||
holder.binding.spoilerExpand.setOnClickListener(v -> {
|
||||
statusToDeal.isExpended = !status.isExpended;
|
||||
statusToDeal.isMediaDisplayed = !status.isMediaDisplayed;
|
||||
adapter.notifyItemChanged(getPositionAsync(notificationList, statusList, statusToDeal));
|
||||
});
|
||||
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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue