Merge "Make message items aware of the various modes." into ics-mr1
This commit is contained in:
commit
9eeb535f6f
@ -372,6 +372,12 @@ public class MessageListFragment extends ListFragment
|
|||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setLayout(ThreePaneLayout layout) {
|
||||||
|
if (UiUtilities.useTwoPane(mActivity)) {
|
||||||
|
mListAdapter.setLayout(layout);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void initSearchHeader() {
|
private void initSearchHeader() {
|
||||||
if (mSearchHeader == null) {
|
if (mSearchHeader == null) {
|
||||||
ViewGroup root = (ViewGroup) getView();
|
ViewGroup root = (ViewGroup) getView();
|
||||||
|
@ -56,6 +56,7 @@ public class MessageListItem extends View {
|
|||||||
/* package */ long mMailboxId;
|
/* package */ long mMailboxId;
|
||||||
/* package */ long mAccountId;
|
/* package */ long mAccountId;
|
||||||
|
|
||||||
|
private ThreePaneLayout mLayout;
|
||||||
private MessagesAdapter mAdapter;
|
private MessagesAdapter mAdapter;
|
||||||
private MessageListItemCoordinates mCoordinates;
|
private MessageListItemCoordinates mCoordinates;
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
@ -272,8 +273,9 @@ public class MessageListItem extends View {
|
|||||||
|
|
||||||
private void updateBackground() {
|
private void updateBackground() {
|
||||||
final Drawable newBackground;
|
final Drawable newBackground;
|
||||||
|
boolean isMultiPane = MessageListItemCoordinates.isMultiPane(mContext);
|
||||||
if (mRead) {
|
if (mRead) {
|
||||||
if (mMode == MODE_WIDE) {
|
if (isMultiPane && mLayout.isLeftPaneVisible()) {
|
||||||
if (mWideReadSelector == null) {
|
if (mWideReadSelector == null) {
|
||||||
mWideReadSelector = getContext().getResources()
|
mWideReadSelector = getContext().getResources()
|
||||||
.getDrawable(R.drawable.conversation_wide_read_selector);
|
.getDrawable(R.drawable.conversation_wide_read_selector);
|
||||||
@ -287,7 +289,7 @@ public class MessageListItem extends View {
|
|||||||
newBackground = mReadSelector;
|
newBackground = mReadSelector;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (mMode == MODE_WIDE) {
|
if (isMultiPane && mLayout.isLeftPaneVisible()) {
|
||||||
if (mWideUnreadSelector == null) {
|
if (mWideUnreadSelector == null) {
|
||||||
mWideUnreadSelector = getContext().getResources().getDrawable(
|
mWideUnreadSelector = getContext().getResources().getDrawable(
|
||||||
R.drawable.conversation_wide_unread_selector);
|
R.drawable.conversation_wide_unread_selector);
|
||||||
@ -496,13 +498,15 @@ public class MessageListItem extends View {
|
|||||||
* Called by the adapter at bindView() time
|
* Called by the adapter at bindView() time
|
||||||
*
|
*
|
||||||
* @param adapter the adapter that creates this view
|
* @param adapter the adapter that creates this view
|
||||||
|
* @param layout If this is a three pane implementation, the
|
||||||
|
* ThreePaneLayout. Otherwise, null.
|
||||||
*/
|
*/
|
||||||
public void bindViewInit(MessagesAdapter adapter) {
|
public void bindViewInit(MessagesAdapter adapter, ThreePaneLayout layout) {
|
||||||
|
mLayout = layout;
|
||||||
mAdapter = adapter;
|
mAdapter = adapter;
|
||||||
requestLayout();
|
requestLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static final int TOUCH_SLOP = 24;
|
private static final int TOUCH_SLOP = 24;
|
||||||
private static int sScaledTouchSlop = -1;
|
private static int sScaledTouchSlop = -1;
|
||||||
|
|
||||||
|
@ -123,6 +123,10 @@ public class MessageListItemCoordinates {
|
|||||||
return mode;
|
return mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isMultiPane(Context context) {
|
||||||
|
return UiUtilities.useTwoPane(context);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the layout id to be inflated in this mode.
|
* Returns the layout id to be inflated in this mode.
|
||||||
*/
|
*/
|
||||||
|
@ -98,6 +98,8 @@ import java.util.Set;
|
|||||||
|
|
||||||
private final Callback mCallback;
|
private final Callback mCallback;
|
||||||
|
|
||||||
|
private ThreePaneLayout mLayout;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The actual return type from the loader.
|
* The actual return type from the loader.
|
||||||
*/
|
*/
|
||||||
@ -134,6 +136,10 @@ import java.util.Set;
|
|||||||
mCallback = callback;
|
mCallback = callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setLayout(ThreePaneLayout layout) {
|
||||||
|
mLayout = layout;
|
||||||
|
}
|
||||||
|
|
||||||
public void onSaveInstanceState(Bundle outState) {
|
public void onSaveInstanceState(Bundle outState) {
|
||||||
outState.putLongArray(STATE_CHECKED_ITEMS, Utility.toPrimitiveLongArray(getSelectedSet()));
|
outState.putLongArray(STATE_CHECKED_ITEMS, Utility.toPrimitiveLongArray(getSelectedSet()));
|
||||||
}
|
}
|
||||||
@ -182,7 +188,7 @@ import java.util.Set;
|
|||||||
public void bindView(View view, Context context, Cursor cursor) {
|
public void bindView(View view, Context context, Cursor cursor) {
|
||||||
// Reset the view (in case it was recycled) and prepare for binding
|
// Reset the view (in case it was recycled) and prepare for binding
|
||||||
MessageListItem itemView = (MessageListItem) view;
|
MessageListItem itemView = (MessageListItem) view;
|
||||||
itemView.bindViewInit(this);
|
itemView.bindViewInit(this, mLayout);
|
||||||
|
|
||||||
// TODO: just move thise all to a MessageListItem.bindTo(cursor) so that the fields can
|
// TODO: just move thise all to a MessageListItem.bindTo(cursor) so that the fields can
|
||||||
// be private, and their inter-dependence when they change can be abstracted away.
|
// be private, and their inter-dependence when they change can be abstracted away.
|
||||||
|
@ -311,6 +311,7 @@ class UIControllerTwoPane extends UIControllerBase implements ThreePaneLayout.Ca
|
|||||||
if (isMailboxListInstalled()) {
|
if (isMailboxListInstalled()) {
|
||||||
getMailboxListFragment().setHighlightedMailbox(fragment.getMailboxId());
|
getMailboxListFragment().setHighlightedMailbox(fragment.getMailboxId());
|
||||||
}
|
}
|
||||||
|
getMessageListFragment().setLayout(mThreePane);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user