summaryrefslogtreecommitdiffstats
path: root/src/com/android/mail/ui/ConversationListFragment.java
diff options
context:
space:
mode:
authorJin Cao <jinyan@google.com>2014-10-18 00:00:17 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-10-18 00:00:18 +0000
commit366947ac313660e43b49bee1c00f558532240fea (patch)
treee637676eb6fff03e663ad801c02da2d32d7f3983 /src/com/android/mail/ui/ConversationListFragment.java
parent1caa0f28a27814b812679df0693866632e9ba204 (diff)
parentf9b96e244e6c6a19cb1920ff129f424997db2727 (diff)
downloadandroid_packages_apps_UnifiedEmail-366947ac313660e43b49bee1c00f558532240fea.tar.gz
android_packages_apps_UnifiedEmail-366947ac313660e43b49bee1c00f558532240fea.tar.bz2
android_packages_apps_UnifiedEmail-366947ac313660e43b49bee1c00f558532240fea.zip
Merge "Save the focused conversation via id instead of position" into ub-gmail-ur14-dev
Diffstat (limited to 'src/com/android/mail/ui/ConversationListFragment.java')
-rw-r--r--src/com/android/mail/ui/ConversationListFragment.java30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/com/android/mail/ui/ConversationListFragment.java b/src/com/android/mail/ui/ConversationListFragment.java
index d80cdf9ad..439f6b597 100644
--- a/src/com/android/mail/ui/ConversationListFragment.java
+++ b/src/com/android/mail/ui/ConversationListFragment.java
@@ -493,7 +493,7 @@ public final class ConversationListFragment extends Fragment implements
sb.append(mViewContext.folder);
if (mListView != null) {
sb.append(" selectedPos=");
- sb.append(mListView.getSelectedPosition());
+ sb.append(mListView.getSelectedConversationPosDebug());
sb.append(" listSelectedPos=");
sb.append(mListView.getSelectedItemPosition());
sb.append(" isListInTouchMode=");
@@ -858,7 +858,7 @@ public final class ConversationListFragment extends Fragment implements
* special views in the list.
*/
conv.position = cursor.getPosition();
- setActivated(conv.position, true);
+ setActivated(conv, true);
mCallbacks.onConversationSelected(conv, false /* inLoaderCallbacks */);
} else {
LogUtils.e(LOG_TAG,
@@ -869,41 +869,41 @@ public final class ConversationListFragment extends Fragment implements
/**
* Sets the checked conversation to the position given here.
- * @param cursorPosition The position of the conversation in the cursor (as opposed to
- * in the list)
+ * @param conversation the activated conversation.
* @param different if the currently checked conversation is different from the one provided
* here. This is a difference in conversations, not a difference in positions. For example, a
* conversation at position 2 can move to position 4 as a result of new mail.
*/
- public void setActivated(final int cursorPosition, boolean different) {
- if (mListView.getChoiceMode() == ListView.CHOICE_MODE_NONE) {
+ public void setActivated(final Conversation conversation, boolean different) {
+ if (mListView.getChoiceMode() == ListView.CHOICE_MODE_NONE || conversation == null) {
return;
}
+ final int cursorPosition = conversation.position;
final int position = cursorPosition + mListAdapter.getPositionOffset(cursorPosition);
setRawActivated(position, different);
- setRawSelected(position);
+ setRawSelected(conversation, position);
}
/**
* Set the selected conversation (used by the framework to indicate current focus in the list).
- * @param cursorPosition The position of the conversation in the cursor (as opposed to
- * in the list)
+ * @param conversation the selected conversation.
*/
- public void setSelected(final int cursorPosition) {
- if (mListView.getChoiceMode() == ListView.CHOICE_MODE_NONE) {
+ public void setSelected(final Conversation conversation) {
+ if (mListView.getChoiceMode() == ListView.CHOICE_MODE_NONE || conversation == null) {
return;
}
+ final int cursorPosition = conversation.position;
final int position = cursorPosition + mListAdapter.getPositionOffset(cursorPosition);
- setRawSelected(position);
+ setRawSelected(conversation, position);
}
/**
* Set the selected conversation (used by the framework to indicate current focus in the list).
* @param position The position of the item in the list
*/
- private void setRawSelected(final int position) {
+ private void setRawSelected(Conversation conversation, final int position) {
final View selectedView = mListView.getChildAt(
position - mListView.getFirstVisiblePosition());
// Don't do anything if the view is already selected.
@@ -919,7 +919,7 @@ public final class ConversationListFragment extends Fragment implements
// setSelection calls setSelectionFromTop with y = 0.
mListView.setSelectionFromTop(position, selectedView.getTop());
}
- mListView.setSelectedPosition(position);
+ mListView.setSelectedConversation(conversation);
}
}
@@ -1154,7 +1154,7 @@ public final class ConversationListFragment extends Fragment implements
if (conv != null && !currentConvIsPeeking) {
if (mListView.getChoiceMode() != ListView.CHOICE_MODE_NONE
&& mListView.getCheckedItemPosition() == -1) {
- setActivated(conv.position, true);
+ setActivated(conv, true);
}
}
}