From 501a2715be3b2560989e6324db5e3c1aa3ddcabb Mon Sep 17 00:00:00 2001 From: Grishka Date: Sun, 23 Jun 2024 04:45:56 +0300 Subject: [PATCH] Crash fixes fixes #854 --- mastodon/build.gradle | 2 +- .../joinmastodon/android/fragments/ComposeFragment.java | 1 + .../android/ui/displayitems/HeaderStatusDisplayItem.java | 9 ++++++--- .../ui/viewcontrollers/ComposeMediaViewController.java | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/mastodon/build.gradle b/mastodon/build.gradle index b785c1de..902a95a6 100644 --- a/mastodon/build.gradle +++ b/mastodon/build.gradle @@ -13,7 +13,7 @@ android { applicationId "org.joinmastodon.android" minSdk 23 targetSdk 33 - versionCode 103 + versionCode 104 versionName "2.5.2" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java index 5557b787..b05ecc09 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java @@ -766,6 +766,7 @@ public class ComposeFragment extends MastodonToolbarFragment implements ComposeE sendingOverlay=null; removeBackCallback(sendingBackButtonBlocker); removeBackCallback(discardConfirmationCallback); + removeBackCallback(emojiKeyboardHider); if(editingStatus==null){ E.post(new StatusCreatedEvent(result, accountID)); if(replyTo!=null){ diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/HeaderStatusDisplayItem.java b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/HeaderStatusDisplayItem.java index b5034f57..3dd2825f 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/HeaderStatusDisplayItem.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/HeaderStatusDisplayItem.java @@ -133,7 +133,8 @@ public class HeaderStatusDisplayItem extends StatusDisplayItem{ more=findViewById(R.id.more); extraText=findViewById(R.id.extra_text); clickableThing=findViewById(R.id.clickable_thing); - clickableThing.setOnClickListener(this::onAvaClick); + if(clickableThing!=null) + clickableThing.setOnClickListener(this::onAvaClick); avatar.setOutlineProvider(OutlineProviders.roundedRect(10)); avatar.setClipToOutline(true); more.setOnClickListener(this::onMoreClick); @@ -272,8 +273,10 @@ public class HeaderStatusDisplayItem extends StatusDisplayItem{ extraText.setText(item.extraText); } more.setVisibility(item.inset ? View.GONE : View.VISIBLE); - clickableThing.setClickable(!item.inset); - clickableThing.setContentDescription(item.parentFragment.getString(R.string.avatar_description, item.user.acct)); + if(clickableThing!=null){ + clickableThing.setClickable(!item.inset); + clickableThing.setContentDescription(item.parentFragment.getString(R.string.avatar_description, item.user.acct)); + } } @Override diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/viewcontrollers/ComposeMediaViewController.java b/mastodon/src/main/java/org/joinmastodon/android/ui/viewcontrollers/ComposeMediaViewController.java index e3930971..6e1ba7f5 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/viewcontrollers/ComposeMediaViewController.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/viewcontrollers/ComposeMediaViewController.java @@ -550,7 +550,7 @@ public class ComposeMediaViewController{ } public List getAttachmentIDs(){ - return attachments.stream().map(a->a.serverAttachment.id).collect(Collectors.toList()); + return attachments.stream().filter(a->a.serverAttachment!=null).map(a->a.serverAttachment.id).collect(Collectors.toList()); } public List getAttachmentAttributes(){