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.displayCW;
|
||||||
|
import static app.fedilab.android.activities.ContextActivity.expand;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
@ -681,19 +682,27 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||||
//---- SPOILER TEXT -----
|
//---- SPOILER TEXT -----
|
||||||
|
|
||||||
if (statusToDeal.spoiler_text != null && !statusToDeal.spoiler_text.trim().isEmpty()) {
|
if (statusToDeal.spoiler_text != null && !statusToDeal.spoiler_text.trim().isEmpty()) {
|
||||||
if (!expand_cw && context instanceof ContextActivity && statusToDeal.sensitive) {
|
if (expand_cw || expand) {
|
||||||
statusToDeal.isExpended = displayCW;
|
holder.binding.spoilerExpand.setVisibility(View.VISIBLE);
|
||||||
status.isMediaDisplayed = displayCW;
|
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 {
|
} else {
|
||||||
holder.binding.spoiler.setVisibility(View.GONE);
|
holder.binding.spoiler.setVisibility(View.GONE);
|
||||||
holder.binding.spoilerExpand.setVisibility(View.GONE);
|
holder.binding.spoilerExpand.setVisibility(View.GONE);
|
||||||
|
|
|
@ -201,10 +201,11 @@ public class FragmentMastodonContext extends Fragment {
|
||||||
if (statusAdapter != null && firstStatus != null) {
|
if (statusAdapter != null && firstStatus != null) {
|
||||||
pullToRefresh = true;
|
pullToRefresh = true;
|
||||||
String id;
|
String id;
|
||||||
if (expand)
|
if (expand) {
|
||||||
id = firstStatus.id;
|
id = firstStatus.id;
|
||||||
else
|
} else {
|
||||||
id = focusedStatus.id;
|
id = focusedStatus.id;
|
||||||
|
}
|
||||||
statusesVM.getContext(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, id)
|
statusesVM.getContext(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, id)
|
||||||
.observe(FragmentMastodonContext.this, this::initializeContextView);
|
.observe(FragmentMastodonContext.this, this::initializeContextView);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue