diff options
author | Michael Meeks <michael.meeks@suse.com> | 2013-01-30 19:42:32 +1100 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2013-02-06 20:34:36 +0100 |
commit | ad34704ad00f92845f60525dd09abcca8bcd125b (patch) | |
tree | 23e07e5a79aa59247134b72bbeea2a69a5119611 /android | |
parent | e577ebc9403d77fe4847a2e1d55a83d432f214f8 (diff) |
sdremote - don't let incoming thumbnails crash us if we switched view.
Signed-off-by: Jan Holesovsky <kendy@suse.cz>
Diffstat (limited to 'android')
-rw-r--r-- | android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java | 12 | ||||
-rw-r--r-- | android/sdremote/src/org/libreoffice/impressremote/ThumbnailFragment.java | 4 |
2 files changed, 10 insertions, 6 deletions
diff --git a/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java b/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java index 555d3e10cdca..9ad3b794d96b 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java +++ b/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java @@ -148,7 +148,8 @@ public class PresentationFragment extends SherlockFragment { LocalBroadcastManager .getInstance(getActivity().getApplicationContext()) .unregisterReceiver(mListener); - + mTopView = null; + mContext = null; } private void updateSlideNumberDisplay(int aPosition) { @@ -259,6 +260,9 @@ public class PresentationFragment extends SherlockFragment { @Override public void onReceive(Context aContext, Intent aIntent) { + + if (mTopView == null || mTopView.getAdapter() == null) + return; if (aIntent.getAction().equals( CommunicationService.MSG_SLIDE_CHANGED)) { int aSlide = aIntent.getExtras().getInt("slide_number"); @@ -271,10 +275,8 @@ public class PresentationFragment extends SherlockFragment { mTopView.setSelection(aSlide, true); } else if (aIntent.getAction().equals( CommunicationService.MSG_SLIDE_PREVIEW)) { - // int aNSlide = aIntent.getExtras().getInt("slide_number"); - ((ThumbnailAdapter) mTopView.getAdapter()) - .notifyDataSetChanged(); - // mTopView.requestLayout(); + ThumbnailAdapter aThumbAdaptor = (ThumbnailAdapter) mTopView.getAdapter(); + aThumbAdaptor.notifyDataSetChanged(); } else if (aIntent.getAction().equals( CommunicationService.MSG_SLIDE_NOTES)) { int aPosition = aIntent.getExtras().getInt("slide_number"); diff --git a/android/sdremote/src/org/libreoffice/impressremote/ThumbnailFragment.java b/android/sdremote/src/org/libreoffice/impressremote/ThumbnailFragment.java index c7731ee56e6b..dace20159921 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/ThumbnailFragment.java +++ b/android/sdremote/src/org/libreoffice/impressremote/ThumbnailFragment.java @@ -155,6 +155,8 @@ public class ThumbnailFragment extends SherlockFragment { @Override public void onReceive(Context aContext, Intent aIntent) { + if (mGrid == null) + return; if (aIntent.getAction().equals( CommunicationService.MSG_SLIDE_CHANGED)) { int aSlide = aIntent.getExtras().getInt("slide_number"); @@ -234,4 +236,4 @@ public class ThumbnailFragment extends SherlockFragment { } } } -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |