sdremote - don't let incoming thumbnails crash us if we switched view.
This commit is contained in:
@@ -148,7 +148,8 @@ public class PresentationFragment extends SherlockFragment {
|
|||||||
LocalBroadcastManager
|
LocalBroadcastManager
|
||||||
.getInstance(getActivity().getApplicationContext())
|
.getInstance(getActivity().getApplicationContext())
|
||||||
.unregisterReceiver(mListener);
|
.unregisterReceiver(mListener);
|
||||||
|
mTopView = null;
|
||||||
|
mContext = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateSlideNumberDisplay(int aPosition) {
|
private void updateSlideNumberDisplay(int aPosition) {
|
||||||
@@ -259,6 +260,9 @@ public class PresentationFragment extends SherlockFragment {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context aContext, Intent aIntent) {
|
public void onReceive(Context aContext, Intent aIntent) {
|
||||||
|
|
||||||
|
if (mTopView == null || mTopView.getAdapter() == null)
|
||||||
|
return;
|
||||||
if (aIntent.getAction().equals(
|
if (aIntent.getAction().equals(
|
||||||
CommunicationService.MSG_SLIDE_CHANGED)) {
|
CommunicationService.MSG_SLIDE_CHANGED)) {
|
||||||
int aSlide = aIntent.getExtras().getInt("slide_number");
|
int aSlide = aIntent.getExtras().getInt("slide_number");
|
||||||
@@ -271,10 +275,8 @@ public class PresentationFragment extends SherlockFragment {
|
|||||||
mTopView.setSelection(aSlide, true);
|
mTopView.setSelection(aSlide, true);
|
||||||
} else if (aIntent.getAction().equals(
|
} else if (aIntent.getAction().equals(
|
||||||
CommunicationService.MSG_SLIDE_PREVIEW)) {
|
CommunicationService.MSG_SLIDE_PREVIEW)) {
|
||||||
// int aNSlide = aIntent.getExtras().getInt("slide_number");
|
ThumbnailAdapter aThumbAdaptor = (ThumbnailAdapter) mTopView.getAdapter();
|
||||||
((ThumbnailAdapter) mTopView.getAdapter())
|
aThumbAdaptor.notifyDataSetChanged();
|
||||||
.notifyDataSetChanged();
|
|
||||||
// mTopView.requestLayout();
|
|
||||||
} else if (aIntent.getAction().equals(
|
} else if (aIntent.getAction().equals(
|
||||||
CommunicationService.MSG_SLIDE_NOTES)) {
|
CommunicationService.MSG_SLIDE_NOTES)) {
|
||||||
int aPosition = aIntent.getExtras().getInt("slide_number");
|
int aPosition = aIntent.getExtras().getInt("slide_number");
|
||||||
|
@@ -155,6 +155,8 @@ public class ThumbnailFragment extends SherlockFragment {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context aContext, Intent aIntent) {
|
public void onReceive(Context aContext, Intent aIntent) {
|
||||||
|
if (mGrid == null)
|
||||||
|
return;
|
||||||
if (aIntent.getAction().equals(
|
if (aIntent.getAction().equals(
|
||||||
CommunicationService.MSG_SLIDE_CHANGED)) {
|
CommunicationService.MSG_SLIDE_CHANGED)) {
|
||||||
int aSlide = aIntent.getExtras().getInt("slide_number");
|
int aSlide = aIntent.getExtras().getInt("slide_number");
|
||||||
@@ -234,4 +236,4 @@ public class ThumbnailFragment extends SherlockFragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
Reference in New Issue
Block a user