diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a1f52385..5e4e013a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# 2016-06-24 - 3.1.2 + +#### Bugs Fixed + +* Fix Message Center composing bar exception thrown when the animation was in play after the fragment was detached + # 2016-06-20 - 3.1.1 #### Improvements diff --git a/README.md b/README.md index e512cad5c..a1bccc44f 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ use your app, to talk to them at the right time, and in the right way. ##### Version history is tracked [here](CHANGELOG.md) -##### Binary releases are hosted for Maven [here](http://search.maven.org/#artifactdetails|com.apptentive|apptentive-android|3.1.1|aar) +##### Binary releases are hosted for Maven [here](http://search.maven.org/#artifactdetails|com.apptentive|apptentive-android|3.1.2|aar) #### Reporting Bugs We encourage you to help us find and fix bugs. If you find a bug, please fill in the contributor agreement, then open a [github issue](https://github.com/apptentive/apptentive-android/issues?direction=desc&sort=created&state=open). diff --git a/apptentive/src/main/java/com/apptentive/android/sdk/module/engagement/interaction/fragment/MessageCenterFragment.java b/apptentive/src/main/java/com/apptentive/android/sdk/module/engagement/interaction/fragment/MessageCenterFragment.java index 00fc17645..6b8c20d89 100644 --- a/apptentive/src/main/java/com/apptentive/android/sdk/module/engagement/interaction/fragment/MessageCenterFragment.java +++ b/apptentive/src/main/java/com/apptentive/android/sdk/module/engagement/interaction/fragment/MessageCenterFragment.java @@ -658,7 +658,9 @@ public void addNewOutGoingMessageItem(ApptentiveMessage message) { unsendMessagesCount++; isPaused = false; - messageCenterListAdapter.setPaused(isPaused); + if (messageCenterListAdapter != null) { + messageCenterListAdapter.setPaused(isPaused); + } } public void displayNewIncomingMessageItem(ApptentiveMessage message) { @@ -771,7 +773,9 @@ public void restoreSavedAttachmentsToComposer(final List images) { messageCenterListAdapter.setForceShowKeyboard(false); } int firstIndex = messageCenterListView.getFirstVisiblePosition(); - messageCenterListAdapter.notifyDataSetChanged(); + if (messageCenterListAdapter != null) { + messageCenterListAdapter.notifyDataSetChanged(); + } messagingActionHandler.sendMessage(messagingActionHandler.obtainMessage(MSG_SCROLL_FROM_TOP, firstIndex, top)); updateComposingBar(); @@ -892,7 +896,7 @@ public void clearComposingUi(Animator.AnimatorListener al, @Override public void updateComposingBar() { - if (!isDetached()) { + if (messageCenterListAdapter != null) { MessageCenterComposingActionBarView barView = messageCenterListAdapter.getComposingActionBarView(); if (barView != null) { barView.showConfirmation = true; @@ -1574,8 +1578,11 @@ public MessagingActionHandler(MessageCenterFragment fragment) { public void handleMessage(Message msg) { MessageCenterFragment fragment = (MessageCenterFragment) messageCenterFragmentWeakReference.get(); - if (fragment == null || fragment.isDetached()) { - // Message can be delayed. If so, make sure fragment is still available or still attached to activity + /* Message can be delayed. If so, make sure fragment is still available and attached to activity + * messageCenterListAdapter will always be set null in onDetach(). it's a good indication if + * fragment is attached. + */ + if (fragment == null || fragment.messageCenterListAdapter == null) { return; } switch (msg.what) { diff --git a/apptentive/src/main/java/com/apptentive/android/sdk/util/Constants.java b/apptentive/src/main/java/com/apptentive/android/sdk/util/Constants.java index ed06dd96e..32f8e9a62 100644 --- a/apptentive/src/main/java/com/apptentive/android/sdk/util/Constants.java +++ b/apptentive/src/main/java/com/apptentive/android/sdk/util/Constants.java @@ -11,7 +11,7 @@ */ public class Constants { - public static final String APPTENTIVE_SDK_VERSION = "3.1.1"; + public static final String APPTENTIVE_SDK_VERSION = "3.1.2"; public static final int REQUEST_CODE_PHOTO_FROM_SYSTEM_PICKER = 10;