Merge "Speculative bug fixes" into ub-gmail-ur14-dev
diff --git a/src/com/android/mail/browse/ConversationItemView.java b/src/com/android/mail/browse/ConversationItemView.java
index 223ed8a..afb55cc 100644
--- a/src/com/android/mail/browse/ConversationItemView.java
+++ b/src/com/android/mail/browse/ConversationItemView.java
@@ -741,7 +741,7 @@
mBackgrounds.put(resourceId, drawable);
}
if (getBackground() != drawable) {
- super.setBackground(drawable);
+ super.setBackgroundDrawable(drawable);
}
Utils.traceEndSection();
}
diff --git a/src/com/android/mail/ui/ConversationListFragment.java b/src/com/android/mail/ui/ConversationListFragment.java
index f9badb0..ed82494 100644
--- a/src/com/android/mail/ui/ConversationListFragment.java
+++ b/src/com/android/mail/ui/ConversationListFragment.java
@@ -813,24 +813,22 @@
private void viewConversation(final int position) {
LogUtils.d(LOG_TAG, "ConversationListFragment.viewConversation(%d)", position);
- final ConversationCursor cursor =
- (ConversationCursor) getAnimatedAdapter().getItem(position);
-
- if (cursor == null) {
- LogUtils.e(LOG_TAG,
- "unable to open conv at cursor pos=%s cursor=%s getPositionOffset=%s",
- position, cursor, getAnimatedAdapter().getPositionOffset(position));
- return;
- }
-
- final Conversation conv = cursor.getConversation();
+ final Object item = getAnimatedAdapter().getItem(position);
+ if (item != null && item instanceof ConversationCursor) {
+ final ConversationCursor cursor = (ConversationCursor) item;
+ final Conversation conv = cursor.getConversation();
/*
* The cursor position may be different than the position method parameter because of
* special views in the list.
*/
- conv.position = cursor.getPosition();
- setActivated(conv.position, true);
- mCallbacks.onConversationSelected(conv, false /* inLoaderCallbacks */);
+ conv.position = cursor.getPosition();
+ setActivated(conv.position, true);
+ mCallbacks.onConversationSelected(conv, false /* inLoaderCallbacks */);
+ } else {
+ LogUtils.e(LOG_TAG,
+ "unable to open conv at cursor pos=%s item=%s getPositionOffset=%s",
+ position, item, getAnimatedAdapter().getPositionOffset(position));
+ }
}
/**