diff options
| author | Brian Attwell <brianattwell@google.com> | 2014-11-11 18:30:05 -0800 |
|---|---|---|
| committer | Brian Attwell <brianattwell@google.com> | 2014-11-12 03:30:18 +0000 |
| commit | da71919dcd16754cb378fc664967f4b278431c70 (patch) | |
| tree | 1b5a6a7b8c40c446c5418000f72dd3a62afd3178 /res/layout | |
| parent | 5daa38f7d4d6ec2f548be0dc45b47a080f5dadd4 (diff) | |
| download | packages_apps_Contacts-da71919dcd16754cb378fc664967f4b278431c70.tar.gz packages_apps_Contacts-da71919dcd16754cb378fc664967f4b278431c70.tar.bz2 packages_apps_Contacts-da71919dcd16754cb378fc664967f4b278431c70.zip | |
Material design readonly editor
The readonly edit screen is a strange beast. At most, it
only shows fields for phones, emails, photos and
names even if more data is available. This CL updates
the appearance of these fields.
Bug: 18004959
Change-Id: I25847483cef36bb4c98f4b169970344b90e63add
Diffstat (limited to 'res/layout')
| -rw-r--r-- | res/layout/item_photo_editor_readonly.xml | 59 | ||||
| -rw-r--r-- | res/layout/item_read_only_field.xml | 62 | ||||
| -rw-r--r-- | res/layout/raw_contact_readonly_editor_view.xml | 51 | ||||
| -rw-r--r-- | res/layout/structured_name_editor_view.xml | 1 |
4 files changed, 115 insertions, 58 deletions
diff --git a/res/layout/item_photo_editor_readonly.xml b/res/layout/item_photo_editor_readonly.xml new file mode 100644 index 000000000..0f9f9354f --- /dev/null +++ b/res/layout/item_photo_editor_readonly.xml @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2014 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. +--> + +<!-- A readonly version of item_photo_editor.xml shown in the readonly raw contact editor. --> +<view class="com.android.contacts.editor.PhotoEditorView" + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:orientation="horizontal" > + + <ImageView + android:id="@+id/kind_icon" + android:src="@drawable/ic_camera_alt_black_24dp" + android:layout_marginTop="8dp" + android:contentDescription="@string/photo_section" + style="@style/EditKindIconStyle" /> + + <!-- Needs 10dp of top padding, in order get a total of 32dp of padding between this view + and the previous DataKindSection. Note that EditTexts in other editor.xml files have this + padding built in. Similarly, we need to add 4dp of start margin to make up for the padding + that an EditText would have in this image's place. --> + <ImageView + android:id="@+id/photo" + android:layout_width="72dip" + android:layout_height="72dip" + android:cropToPadding="true" + android:scaleType="centerCrop" + android:layout_marginTop="10dp" + android:layout_marginStart="4dp" + android:contentDescription="@string/description_contact_photo" + android:layout_marginBottom="@dimen/editor_padding_below_photo" + android:gravity="start" /> + + + <!-- Don't explicitly set the layout_height in case we need to rely on text wrapping. + For one line, we can expect the height to be 32dp with 16dp text size. --> + <RadioButton + android:id="@+id/primary_checkbox" + android:layout_marginStart="12dp" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginEnd="@dimen/editor_delete_button_width" + android:layout_marginTop="10dp" + android:textSize="@dimen/editor_form_text_size" + android:text="@string/primary_photo" /> +</view> diff --git a/res/layout/item_read_only_field.xml b/res/layout/item_read_only_field.xml index d4ae17915..7a7854b8c 100644 --- a/res/layout/item_read_only_field.xml +++ b/res/layout/item_read_only_field.xml @@ -18,50 +18,42 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" - android:orientation="vertical"> + android:layout_marginEnd="@dimen/editor_delete_button_width" + android:layout_marginBottom="@dimen/editor_padding_between_editor_views" + android:orientation="horizontal"> - <include - android:id="@+id/kind_title_layout" - layout="@layout/edit_kind_title" /> - - <!-- Shown only when id/kind_title_layout is hidden, dividing a previous item and this item. --> - <View - android:id="@+id/divider" - android:layout_width="match_parent" - android:layout_height="1px" - android:layout_marginLeft="8dip" - android:layout_marginRight="8dip" - android:layout_marginStart="8dip" - android:layout_marginEnd="8dip" - android:background="@color/secondary_header_separator_color" /> + <ImageView + android:id="@+id/kind_icon" + style="@style/EditKindIconStyle" /> <LinearLayout - android:layout_width="match_parent" + android:layout_width="0dp" + android:layout_weight="1" android:layout_height="wrap_content" - android:minHeight="@dimen/editor_min_line_item_height" - android:layout_marginLeft="16dip" - android:layout_marginRight="16dip" - android:layout_marginStart="16dip" - android:layout_marginEnd="16dip" - android:orientation="horizontal"> - <TextView + android:orientation="vertical"> + + <EditText android:id="@+id/data" - android:layout_width="0px" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_weight="1" - android:layout_gravity="center_vertical" - android:textAppearance="?android:attr/textAppearanceMedium" + android:minHeight="@dimen/editor_min_line_item_height" + android:textSize="@dimen/editor_form_text_size" android:textColor="?android:attr/textColorSecondary" - android:singleLine="true"/> - <TextView + android:singleLine="true" + android:saveEnabled="false" + android:enabled="false"/> + + <EditText android:id="@+id/type" - android:layout_width="wrap_content" + android:layout_width="@dimen/editor_type_label_width" android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:textAppearance="?android:attr/textAppearanceSmall" + android:textSize="@dimen/editor_form_text_size" android:textColor="?android:attr/textColorSecondary" - android:textAllCaps="true" - android:singleLine="true"/> + android:minHeight="@dimen/editor_min_line_item_height" + android:singleLine="true" + android:saveEnabled="false" + android:enabled="false"/> + </LinearLayout> -</LinearLayout> +</LinearLayout>
\ No newline at end of file diff --git a/res/layout/raw_contact_readonly_editor_view.xml b/res/layout/raw_contact_readonly_editor_view.xml index 797162d0c..a1eab9063 100644 --- a/res/layout/raw_contact_readonly_editor_view.xml +++ b/res/layout/raw_contact_readonly_editor_view.xml @@ -19,46 +19,51 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" - android:paddingTop="@dimen/editor_padding_top" - android:paddingBottom="32dip"> + android:paddingTop="@dimen/editor_padding_top"> <include layout="@layout/editor_account_header" /> + <!-- Want 16dp of apparent top padding. Since EditText has 10dp of inset/padding built in, + only set marginTop=6dp. --> <LinearLayout - android:layout_height="wrap_content" android:layout_width="match_parent" - android:orientation="horizontal" - android:paddingTop="8dip" - android:paddingLeft="16dip" - android:paddingStart="16dip"> + android:layout_height="wrap_content" + android:minHeight="@dimen/editor_min_line_item_height" + android:layout_marginBottom="@dimen/editor_padding_between_editor_views" + android:layout_marginTop="6dp" + android:orientation="horizontal"> + + <ImageView + android:id="@+id/kind_icon" + android:src="@drawable/ic_person_black_24dp" + android:contentDescription="@string/header_name_entry" + style="@style/EditKindIconStyle" /> - <TextView android:id="@+id/read_only_name" - android:layout_width="0dip" + <EditText + android:id="@+id/read_only_name" + android:layout_width="match_parent" android:layout_height="match_parent" - android:layout_weight="1" - android:gravity="center_vertical" + android:layout_marginRight="@dimen/editor_delete_button_width" android:singleLine="true" - android:ellipsize="end" - android:textAppearance="?android:attr/textAppearanceMedium" - android:textColor="?android:attr/textColorSecondary" /> - - <include - android:id="@+id/edit_photo" - android:layout_marginRight="8dip" - android:layout_marginEnd="8dip" - layout="@layout/item_photo_editor" /> + android:textSize="@dimen/editor_form_text_size" + android:textColor="?android:attr/textColorSecondary" + android:enabled="false"/> </LinearLayout> + <include + android:id="@+id/edit_photo" + layout="@layout/item_photo_editor_readonly" /> + <Button android:id="@+id/button_edit_externally" android:text="@string/edit_contact" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginTop="13dip" - android:layout_marginBottom="13dip" - android:layout_marginLeft="13dip" + android:layout_marginTop="10dp" + android:layout_marginBottom="@dimen/editor_padding_below_photo" + android:layout_marginEnd="13dip" android:layout_marginStart="13dip"/> <LinearLayout android:id="@+id/sect_general" diff --git a/res/layout/structured_name_editor_view.xml b/res/layout/structured_name_editor_view.xml index b6d6ecaa7..2b0ee7b49 100644 --- a/res/layout/structured_name_editor_view.xml +++ b/res/layout/structured_name_editor_view.xml @@ -32,6 +32,7 @@ <ImageView android:id="@+id/kind_icon" android:src="@drawable/ic_person_black_24dp" + android:contentDescription="@string/header_name_entry" style="@style/EditKindIconStyle" /> <include |
