From ca4a1d461a7a55505920330c57f4919c8b0a3f7f Mon Sep 17 00:00:00 2001 From: FineFindus Date: Sun, 7 Jul 2024 08:44:20 +0200 Subject: [PATCH] fix(TextStatusDisplayItem): expand non-quoted texts Using the adapter to udpate the TextStatusDisplayItem does not work for non-quoted posts. Ref: https://github.com/sk22/megalodon/pull/956/commits/1832de3aab2cc868851f0add17a5be94700797ab --- .../android/fragments/BaseStatusListFragment.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/BaseStatusListFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/BaseStatusListFragment.java index fa4068edf..a0e4c08d5 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/BaseStatusListFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/BaseStatusListFragment.java @@ -792,9 +792,15 @@ public abstract class BaseStatusListFragment exten public void onToggleExpanded(Status status, boolean isForQuote, String itemID) { status.textExpanded = !status.textExpanded; - List textItems = findAllHoldersOfType(itemID, TextStatusDisplayItem.Holder.class); - TextStatusDisplayItem.Holder text = textItems.size() > 1 && isForQuote ? textItems.get(1) : textItems.get(0); - adapter.notifyItemChanged(text.getAbsoluteAdapterPosition()); + // TODO: simplify this to a single case + if(!isForQuote) + // using the adapter directly to update the item does not work for non-quoted texts + notifyItemChanged(itemID, TextStatusDisplayItem.class); + else{ + List textItems=findAllHoldersOfType(itemID, TextStatusDisplayItem.Holder.class); + TextStatusDisplayItem.Holder text=textItems.size()>1 ? textItems.get(1) : textItems.get(0); + adapter.notifyItemChanged(text.getAbsoluteAdapterPosition()); + } List headers=findAllHoldersOfType(itemID, HeaderStatusDisplayItem.Holder.class); HeaderStatusDisplayItem.Holder header=headers.size() > 1 && isForQuote ? headers.get(1) : headers.get(0); if(header!=null) header.animateExpandToggle();