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