Merge "Code change for new mailbox list layout"
This commit is contained in:
commit
b70772daa5
@ -14,57 +14,44 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<!-- extends LinearLayout -->
|
<!-- extends RelativeLayout -->
|
||||||
<com.android.email.activity.MailboxListItem
|
<com.android.email.activity.MailboxListItem
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?android:attr/listPreferredItemHeight"
|
android:layout_height="?android:attr/listPreferredItemHeight"
|
||||||
android:orientation="horizontal"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:paddingRight="8dip"
|
android:paddingRight="8dip"
|
||||||
android:background="?android:attr/activatedBackgroundIndicator"
|
android:background="?android:attr/activatedBackgroundIndicator"
|
||||||
>
|
>
|
||||||
<View
|
|
||||||
android:id="@+id/chip"
|
|
||||||
android:background="@drawable/appointment_indicator_leftside_1"
|
|
||||||
android:layout_width="4dip"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_centerVertical="true" />
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/folder_icon"
|
android:id="@+id/folder_icon"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="32dip"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="32dip"
|
||||||
android:src="@drawable/ic_list_folder"
|
android:layout_alignParentLeft="true"
|
||||||
android:paddingLeft="2dip" />
|
android:layout_centerVertical="true"
|
||||||
<LinearLayout
|
android:paddingLeft="2dip"
|
||||||
android:layout_width="wrap_content"
|
/>
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:paddingLeft="4dip">
|
|
||||||
<!--
|
|
||||||
STOPSHIP android:textColor="?android:attr/textColorPrimary"
|
|
||||||
which was somehow white in the "move to" dialog.
|
|
||||||
-->
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/mailbox_name"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
|
||||||
android:textColor="#000" />
|
|
||||||
</LinearLayout>
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/new_message_count"
|
android:id="@+id/message_count"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="4dip"
|
android:layout_alignParentRight="true"
|
||||||
android:background="@drawable/ind_unread"
|
android:layout_marginRight="12dip"
|
||||||
style="@style/unreadCount"/>
|
android:layout_centerVertical="true"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:textColor="?android:attr/textColorPrimary"
|
||||||
|
/>
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/all_message_count"
|
android:id="@+id/mailbox_name"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="4dip"
|
android:layout_toRightOf="@id/folder_icon"
|
||||||
android:background="@drawable/ind_sum"
|
android:layout_toLeftOf="@id/message_count"
|
||||||
style="@style/unreadCount"/>
|
android:layout_centerVertical="true"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
|
android:textColor="?android:attr/textColorPrimary"
|
||||||
|
/>
|
||||||
</com.android.email.activity.MailboxListItem>
|
</com.android.email.activity.MailboxListItem>
|
||||||
|
@ -163,9 +163,9 @@
|
|||||||
<!-- TYPE_INBOX = 0 -->
|
<!-- TYPE_INBOX = 0 -->
|
||||||
<item>@drawable/ic_list_inbox</item>
|
<item>@drawable/ic_list_inbox</item>
|
||||||
<!-- TYPE_MAIL = 1 -->
|
<!-- TYPE_MAIL = 1 -->
|
||||||
<item>@drawable/ic_list_folder</item>
|
<item></item>
|
||||||
<!-- TYPE_PARENT = 2 -->
|
<!-- TYPE_PARENT = 2 -->
|
||||||
<item>@drawable/ic_list_folder</item>
|
<item></item>
|
||||||
<!-- TYPE_DRAFTS = 3 -->
|
<!-- TYPE_DRAFTS = 3 -->
|
||||||
<item>@drawable/ic_list_drafts</item>
|
<item>@drawable/ic_list_drafts</item>
|
||||||
<!-- TYPE_OUTBOX = 4 -->
|
<!-- TYPE_OUTBOX = 4 -->
|
||||||
|
@ -366,7 +366,6 @@ public class Utility {
|
|||||||
// Caches for frequently accessed resources.
|
// Caches for frequently accessed resources.
|
||||||
private final String[] mSpecialMailbox;
|
private final String[] mSpecialMailbox;
|
||||||
private final TypedArray mSpecialMailboxDrawable;
|
private final TypedArray mSpecialMailboxDrawable;
|
||||||
private final Drawable mDefaultMailboxDrawable;
|
|
||||||
private final Drawable mSummaryStarredMailboxDrawable;
|
private final Drawable mSummaryStarredMailboxDrawable;
|
||||||
private final Drawable mSummaryCombinedInboxDrawable;
|
private final Drawable mSummaryCombinedInboxDrawable;
|
||||||
|
|
||||||
@ -381,8 +380,6 @@ public class Utility {
|
|||||||
}
|
}
|
||||||
mSpecialMailboxDrawable =
|
mSpecialMailboxDrawable =
|
||||||
context.getResources().obtainTypedArray(R.array.mailbox_display_icons);
|
context.getResources().obtainTypedArray(R.array.mailbox_display_icons);
|
||||||
mDefaultMailboxDrawable =
|
|
||||||
context.getResources().getDrawable(R.drawable.ic_list_folder);
|
|
||||||
mSummaryStarredMailboxDrawable =
|
mSummaryStarredMailboxDrawable =
|
||||||
context.getResources().getDrawable(R.drawable.ic_list_starred);
|
context.getResources().getDrawable(R.drawable.ic_list_starred);
|
||||||
mSummaryCombinedInboxDrawable =
|
mSummaryCombinedInboxDrawable =
|
||||||
@ -447,9 +444,12 @@ public class Utility {
|
|||||||
return mSpecialMailboxDrawable.getDrawable(Mailbox.TYPE_OUTBOX);
|
return mSpecialMailboxDrawable.getDrawable(Mailbox.TYPE_OUTBOX);
|
||||||
}
|
}
|
||||||
if (0 <= type && type < mSpecialMailboxDrawable.length()) {
|
if (0 <= type && type < mSpecialMailboxDrawable.length()) {
|
||||||
return mSpecialMailboxDrawable.getDrawable(type);
|
final int resId = mSpecialMailboxDrawable.getResourceId(type, -1);
|
||||||
|
if (resId != -1) {
|
||||||
|
return mContext.getResources().getDrawable(resId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return mDefaultMailboxDrawable;
|
return null; // No icon
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,9 +22,9 @@ import com.android.internal.util.ArrayUtils;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.RelativeLayout;
|
||||||
|
|
||||||
public class MailboxListItem extends LinearLayout {
|
public class MailboxListItem extends RelativeLayout {
|
||||||
// STOPSHIP Need final color/ui
|
// STOPSHIP Need final color/ui
|
||||||
// Color used for valid drop targets
|
// Color used for valid drop targets
|
||||||
private static final int DROP_AVAILABLE = 0xFFFFFF33;
|
private static final int DROP_AVAILABLE = 0xFFFFFF33;
|
||||||
|
@ -220,41 +220,35 @@ import java.security.InvalidParameterException;
|
|||||||
nameView.setText(getDisplayName(context, cursor));
|
nameView.setText(getDisplayName(context, cursor));
|
||||||
|
|
||||||
// Set count
|
// Set count
|
||||||
|
boolean showCount = true;
|
||||||
boolean useTotalCount = false;
|
boolean useTotalCount = false;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Mailbox.TYPE_DRAFTS:
|
case Mailbox.TYPE_DRAFTS:
|
||||||
case Mailbox.TYPE_OUTBOX:
|
case Mailbox.TYPE_OUTBOX:
|
||||||
case Mailbox.TYPE_SENT:
|
|
||||||
case Mailbox.TYPE_TRASH:
|
|
||||||
useTotalCount = true;
|
useTotalCount = true;
|
||||||
break;
|
break;
|
||||||
|
case Mailbox.TYPE_SENT:
|
||||||
|
case Mailbox.TYPE_TRASH:
|
||||||
|
showCount = false; // Don't show count.
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
final int count = cursor.getInt(useTotalCount ? COLUMN_MESSAGE_COUNT : COLUMN_UNREAD_COUNT);
|
final int count =
|
||||||
final TextView unreadCountView = (TextView) view.findViewById(R.id.new_message_count);
|
showCount ? cursor.getInt(useTotalCount ? COLUMN_MESSAGE_COUNT : COLUMN_UNREAD_COUNT)
|
||||||
final TextView allCountView = (TextView) view.findViewById(R.id.all_message_count);
|
: 0;
|
||||||
|
final TextView countView = (TextView) view.findViewById(R.id.message_count);
|
||||||
|
|
||||||
// If the unread count is zero, not to show countView.
|
// If the unread count is zero, not to show countView.
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
nameView.setTypeface(Typeface.DEFAULT_BOLD);
|
countView.setVisibility(View.VISIBLE);
|
||||||
if (useTotalCount) {
|
countView.setText(Integer.toString(count));
|
||||||
unreadCountView.setVisibility(View.GONE);
|
|
||||||
allCountView.setVisibility(View.VISIBLE);
|
|
||||||
allCountView.setText(Integer.toString(count));
|
|
||||||
} else {
|
|
||||||
allCountView.setVisibility(View.GONE);
|
|
||||||
unreadCountView.setVisibility(View.VISIBLE);
|
|
||||||
unreadCountView.setText(Integer.toString(count));
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
nameView.setTypeface(Typeface.DEFAULT);
|
countView.setVisibility(View.GONE);
|
||||||
allCountView.setVisibility(View.GONE);
|
|
||||||
unreadCountView.setVisibility(View.GONE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set folder icon
|
// Set folder icon
|
||||||
((ImageView) view.findViewById(R.id.folder_icon))
|
((ImageView) view.findViewById(R.id.folder_icon)).setImageDrawable(
|
||||||
.setImageDrawable(Utility.FolderProperties.getInstance(context)
|
Utility.FolderProperties.getInstance(context).getIcon(type, mailboxId));
|
||||||
.getIcon(type, mailboxId));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private View newViewNormalMode(Context context, Cursor cursor, ViewGroup parent) {
|
private View newViewNormalMode(Context context, Cursor cursor, ViewGroup parent) {
|
||||||
@ -401,7 +395,7 @@ import java.security.InvalidParameterException;
|
|||||||
Mailbox.QUERY_ALL_DRAFTS, Mailbox.TYPE_DRAFTS,
|
Mailbox.QUERY_ALL_DRAFTS, Mailbox.TYPE_DRAFTS,
|
||||||
Mailbox.getMessageCountByMailboxType(context, Mailbox.TYPE_DRAFTS), false);
|
Mailbox.getMessageCountByMailboxType(context, Mailbox.TYPE_DRAFTS), false);
|
||||||
|
|
||||||
// Outbox -- # of sent messages
|
// Outbox -- # of outstanding messages
|
||||||
addSummaryMailboxRow(context, cursor,
|
addSummaryMailboxRow(context, cursor,
|
||||||
Mailbox.QUERY_ALL_OUTBOX, Mailbox.TYPE_OUTBOX,
|
Mailbox.QUERY_ALL_OUTBOX, Mailbox.TYPE_OUTBOX,
|
||||||
Mailbox.getMessageCountByMailboxType(context, Mailbox.TYPE_OUTBOX), false);
|
Mailbox.getMessageCountByMailboxType(context, Mailbox.TYPE_OUTBOX), false);
|
||||||
|
Loading…
Reference in New Issue
Block a user