Update attachment ui to look like Gmail attachment ui; fix from padding.

Fixes Bug:5184434 Compose view doesn't match pixel perfects
Change-Id: I7217eb4a63beedfd0bc00dffe9e0f29a5af6214c
This commit is contained in:
Mindy Pereira 2011-08-19 14:10:57 -07:00
parent 7b41b374cc
commit 89dd731a90
9 changed files with 146 additions and 49 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 393 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 B

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2011 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true">
<shape type="rectangle">
<solid android:color="#ffffaf00" />
<corners android:radius="8dp" />
</shape>
<stroke android:width="2dip" android:color="#ff000000" />
</item>
<item android:state_selected="false">
<shape type="rectangle">
<solid android:color="#ff444444" />
<corners android:radius="8dp" />
</shape>
<stroke android:width="2dip" android:color="#ff000000" />
</item>
</selector>

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2011 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/RecipientComposeFieldLayout">
<TextView
android:id="@+id/from"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:background="@null"
android:paddingLeft="8dip"
android:paddingBottom="16dip"
android:paddingTop="16dip"
/>
</RelativeLayout>

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2011 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/from"
style="?android:attr/editTextStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="?android:attr/textColorSecondary"
/>

View File

@ -31,14 +31,7 @@
android:layout_height="wrap_content">
<!-- Not actually editable -->
<TextView
android:id="@+id/from"
style="?android:attr/editTextStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="?android:attr/textColorSecondary"
/>
<include layout="@layout/compose_from"/>
<include layout="@layout/recipients_area"/>

View File

@ -15,46 +15,43 @@
-->
<!-- non-xlarge -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:background="#ffd5d5d5"
style="@style/attachment_container">
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="54dip"
android:paddingRight="6dip"
android:paddingTop="6dip"
android:paddingBottom="6dip">
<ImageButton
android:id="@+id/attachment_delete"
android:src="@drawable/ic_remove_attachment_holo_light"
android:layout_alignParentRight="true"
android:layout_height="42dip"
android:layout_width="42dip" />
<TextView
android:id="@+id/attachment_name"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="?android:attr/textColorSecondaryInverse"
android:layout_width="1dip"
android:layout_height="42dip"
android:background="@drawable/text_box"
android:paddingLeft="36dip"
android:singleLine="true"
android:ellipsize="start"
android:gravity="center_vertical"
android:layout_marginLeft="6dip"
android:layout_marginRight="4dip"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="@id/attachment_delete" />
<ImageView
android:src="@drawable/ic_attachment_holo_light"
android:layout_gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<!-- Attachment name and size -->
<LinearLayout
android:orientation="vertical"
android:layout_weight="1.0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_attachment_holo_light"
android:layout_marginLeft="1dip"
android:layout_centerVertical="true" />
<!-- Dummy view to keep it compatible with xlarge. -->
<TextView
android:id="@+id/attachment_size"
android:layout_width="0dip"
android:layout_height="0dip"
android:visibility="gone"
/>
</RelativeLayout>
android:layout_gravity="center_vertical">
<TextView android:id="@+id/attachment_name"
style="@style/attachment_name" />
<TextView android:id="@+id/attachment_size"
style="@style/attachment_name"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<!-- Remove button -->
<ImageView android:id="@+id/attachment_delete"
android:src="@drawable/ic_cancel_holo_light"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:layout_marginLeft="20dip"
android:layout_gravity="center_vertical|left"
android:clickable="true" />
</LinearLayout>

View File

@ -121,6 +121,29 @@
<item name="android:singleLine">true</item>
</style>
<style name="attachment_container">
<item name="android:background">@drawable/attachment_background</item>
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:orientation">horizontal</item>
</style>
<style name="attachment_name">
<item name="android:id">@id/attachment_name</item>
<item name="android:paddingLeft">5dip</item>
<item name="android:maxLines">1</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textColor">@color/text_primary_color</item>
</style>
<style name="attachment_thumbnail">
<item name="android:layout_gravity">center_vertical</item>
<item name="android:paddingLeft">5dip</item>
<item name="android:layout_width">32dip</item>
<item name="android:layout_height">32dip</item>
</style>
<style name="action_bar_custom_view">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">match_parent</item>

View File

@ -51,7 +51,7 @@ import android.webkit.WebView;
import android.widget.ArrayAdapter;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.MultiAutoCompleteTextView;
import android.widget.TextView;
import android.widget.Toast;
@ -1599,7 +1599,7 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
View view = getLayoutInflater().inflate(R.layout.message_compose_attachment,
mAttachmentContentView, false);
TextView nameView = UiUtilities.getView(view, R.id.attachment_name);
ImageButton delete = UiUtilities.getView(view, R.id.attachment_delete);
ImageView delete = UiUtilities.getView(view, R.id.attachment_delete);
TextView sizeView = UiUtilities.getView(view, R.id.attachment_size);
nameView.setText(attachment.mFileName);