1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-24 08:38:51 -05:00

Add titles to thread display

This commit is contained in:
Jesse Vincent 2012-11-22 15:19:27 -05:00
parent 515c9f736d
commit eacc5e2ffe
2 changed files with 17 additions and 4 deletions

View File

@ -126,7 +126,7 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
if (mMessageListFragment == null) {
FragmentTransaction ft = fragmentManager.beginTransaction();
mMessageListFragment = MessageListFragment.newInstance(mSearch,
mMessageListFragment = MessageListFragment.newInstance(mSearch, false,
(K9.isThreadedViewEnabled() && !mNoThreading));
ft.add(R.id.message_list_container, mMessageListFragment);
ft.commit();
@ -608,7 +608,7 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
tmpSearch.addAccountUuids(mSearch.getAccountUuids());
tmpSearch.and(Searchfield.SENDER, senderAddress, Attribute.CONTAINS);
MessageListFragment fragment = MessageListFragment.newInstance(tmpSearch, false);
MessageListFragment fragment = MessageListFragment.newInstance(tmpSearch, false, false);
addMessageListFragment(fragment, true);
}
@ -690,7 +690,7 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
tmpSearch.and(Searchfield.THREAD_ROOT, String.valueOf(threadRootId), Attribute.EQUALS);
tmpSearch.or(new SearchCondition(Searchfield.ID, Attribute.EQUALS, String.valueOf(threadRootId)));
MessageListFragment fragment = MessageListFragment.newInstance(tmpSearch, false);
MessageListFragment fragment = MessageListFragment.newInstance(tmpSearch, true, false);
addMessageListFragment(fragment, true);
}

View File

@ -142,10 +142,11 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
THREAD_COUNT_COLUMN);
public static MessageListFragment newInstance(LocalSearch search, boolean threadedList) {
public static MessageListFragment newInstance(LocalSearch search, boolean isThreadDisplay, boolean threadedList) {
MessageListFragment fragment = new MessageListFragment();
Bundle args = new Bundle();
args.putParcelable(ARG_SEARCH, search);
args.putBoolean(ARG_IS_THREAD_DISPLAY, isThreadDisplay);
args.putBoolean(ARG_THREADED_LIST, threadedList);
fragment.setArguments(args);
return fragment;
@ -296,6 +297,7 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
private static final String ARG_SEARCH = "searchObject";
private static final String ARG_THREADED_LIST = "threadedList";
private static final String ARG_IS_THREAD_DISPLAY = "isThreadedDisplay";
private static final String STATE_LIST_POSITION = "listPosition";
/**
@ -394,6 +396,7 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
private boolean mThreadedList;
private boolean mIsThreadDisplay;
private Context mContext;
@ -745,6 +748,7 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
Bundle args = getArguments();
mThreadedList = args.getBoolean(ARG_THREADED_LIST, false);
mIsThreadDisplay = args.getBoolean(ARG_IS_THREAD_DISPLAY, false);
mSearch = args.getParcelable(ARG_SEARCH);
mTitle = mSearch.getName();
@ -2875,6 +2879,15 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
mUniqueIdColumn = ID_COLUMN;
}
if (mIsThreadDisplay) {
cursor.moveToFirst();
mTitle = cursor.getString(SUBJECT_COLUMN);
if (StringUtils.isNullOrEmpty(mTitle)) {
mTitle = getString(R.string.general_no_subject);
}
refreshTitle();
}
cleanupSelected(cursor);
mAdapter.swapCursor(cursor);