Pixel perfect: mailbox list

Now it should be close enough...

Also fixed the "selected mailbox won't get hilighted" issue.

Bug 3137965

Change-Id: Ifba83783121e62363fac6428534394d2e0a4bee9
This commit is contained in:
Makoto Onuki 2011-01-05 15:31:52 -08:00
parent a7255de196
commit 80a98fd939
8 changed files with 45 additions and 15 deletions

View File

@ -15,14 +15,15 @@
-->
<!-- extends RelativeLayout -->
<!-- STOPSHIP text color pixelperfect. -->
<!--
NOTE: Don't set padding for this.
Background of this view will be changed by code, which resets padding.
-->
<com.android.email.activity.MailboxListItem
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="48dip"
android:background="?android:attr/activatedBackgroundIndicator"
android:paddingLeft="@dimen/mailbox_list_padding_left"
android:paddingRight="@dimen/mailbox_list_padding_right"
>
<ImageView
android:id="@+id/folder_icon"
@ -31,6 +32,7 @@
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginRight="8dip"
android:layout_marginLeft="@dimen/mailbox_list_padding_left"
/>
<TextView
android:id="@+id/message_count"
@ -38,10 +40,12 @@
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/mailbox_list_count_margin_left"
android:layout_marginRight="@dimen/mailbox_list_padding_right"
android:ellipsize="end"
android:singleLine="true"
android:textSize="14dip"
android:textColor="#888"
android:textColor="@color/text_secondary_color"
/>
<TextView
android:id="@+id/mailbox_name"
@ -53,7 +57,7 @@
android:ellipsize="end"
android:singleLine="true"
android:textSize="18dip"
android:textColor="#000"
android:textColor="@color/text_primary_color"
/>
<!-- Color chips are shown only for account rows on combined view. -->
<!-- STOPSHIP dimensions not pixelperfect. -->

View File

@ -14,8 +14,9 @@
limitations under the License.
-->
<!-- landscape -->
<!-- non-xlarge, landscape -->
<resources>
<dimen name="mailbox_list_padding_left">8dip</dimen>
<dimen name="mailbox_list_padding_right">32dip</dimen>
<dimen name="mailbox_list_padding_left">16dip</dimen>
<dimen name="mailbox_list_padding_right">24dip</dimen>
<dimen name="mailbox_list_count_margin_left">16dip</dimen>
</resources>

View File

@ -14,8 +14,9 @@
limitations under the License.
-->
<!-- portrait -->
<!-- non-xlarge, portrait -->
<resources>
<dimen name="mailbox_list_padding_left">16dip</dimen>
<dimen name="mailbox_list_padding_right">32dip</dimen>
<dimen name="mailbox_list_padding_right">16dip</dimen>
<dimen name="mailbox_list_count_margin_left">8dip</dimen>
</resources>

View File

@ -23,7 +23,7 @@
<!-- XL activity dimensions -->
<!-- width of mailbox list -->
<dimen name="mailbox_list_width">216dip</dimen>
<dimen name="mailbox_list_width">206dip</dimen>
<!--
width of the message list, on the message list + message view mode.
(i.e. on portrait, it's the "expanded" message list.)

View File

@ -23,6 +23,10 @@
<color name="message_view_fogged_glass_color">#00000000</color>
<!-- Standard text colors -->
<color name="text_primary_color">#000000</color>
<color name="text_secondary_color">#666666</color>
<!-- Widget colors -->
<color name="widget_label_shadow_color">#0d0d0d</color>
<color name="widget_account_color">#666666</color>

View File

@ -27,6 +27,10 @@
<color name="account_folder_list_item_separator">#303030</color>
<color name="connection_error_banner">#fffff1a8</color>
<!-- Standard text colors -->
<color name="text_primary_color">#ffffff</color>
<color name="text_secondary_color">#666666</color>
<!-- STOPSHIP Use same color as EditText tray? -->
<color name="divider_color">#ff808080</color>

View File

@ -14,6 +14,8 @@
limitations under the License.
-->
<!-- non-xlarge -->
<resources>
<dimen name="button_minWidth">100sp</dimen>
<dimen name="message_list_item_text_size">16dip</dimen>

View File

@ -20,6 +20,7 @@ import com.android.email.provider.EmailContent.Mailbox;
import com.android.internal.util.ArrayUtils;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.RelativeLayout;
@ -34,6 +35,8 @@ public class MailboxListItem extends RelativeLayout {
public Integer mMailboxType;
public MailboxesAdapter mAdapter;
private Drawable mBackground;
public MailboxListItem(Context context) {
super(context);
}
@ -46,6 +49,12 @@ public class MailboxListItem extends RelativeLayout {
super(context, attrs, defStyle);
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
mBackground = getBackground();
}
public boolean isDropTarget(long itemMailbox) {
if ((mMailboxId < 0) || (itemMailbox == mMailboxId)) {
return false;
@ -54,11 +63,16 @@ public class MailboxListItem extends RelativeLayout {
}
public boolean setDropTargetBackground(boolean dragInProgress, long itemMailbox) {
if (dragInProgress && isDropTarget(itemMailbox)) {
setBackgroundColor(DROP_AVAILABLE);
return true;
if (dragInProgress) {
if (isDropTarget(itemMailbox)) {
setBackgroundColor(DROP_AVAILABLE);
return true;
} else {
setBackgroundColor(DROP_UNAVAILABLE);
return false;
}
} else {
setBackgroundColor(DROP_UNAVAILABLE);
setBackgroundDrawable(mBackground);
return false;
}
}