Fix various layout issues
- More space for GAL contacts with keyboard open
- Align group membership editor with other fields
- Renamed "Add information" to "Add another field" (Editor)
- Aligned the button "Add another field"
- Fixed regression: "Add another field" showed all-caps items
- Use framework assets for editor-label (DropDown-like control)
- Renamed item_contact_editor to raw_contact_editor_view
- Renamed item_read_only_contact_editor to read_only_raw_contact_editor_view
Change-Id: If71830f132fc5404aebe815a6f14e84f7a1c89fd
diff --git a/res/drawable-hdpi/type_selector_background.9.png b/res/drawable-hdpi/type_selector_background.9.png
deleted file mode 100644
index f4e1753..0000000
--- a/res/drawable-hdpi/type_selector_background.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/type_selector_background.9.png b/res/drawable-mdpi/type_selector_background.9.png
deleted file mode 100644
index 7f4f3fe..0000000
--- a/res/drawable-mdpi/type_selector_background.9.png
+++ /dev/null
Binary files differ
diff --git a/res/layout-xlarge/contact_browser.xml b/res/layout-xlarge/contact_browser.xml
index 6688b56..39828c6 100644
--- a/res/layout-xlarge/contact_browser.xml
+++ b/res/layout-xlarge/contact_browser.xml
@@ -38,7 +38,7 @@
android:id="@+id/detail_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:paddingBottom="11dip"
+ android:paddingBottom="6dip"
ex:layout_narrowParentWidth="800dip"
ex:layout_narrowRightMargin="0dip"
ex:layout_wideParentWidth="1280dip"
diff --git a/res/layout-xlarge/contact_detail_fragment.xml b/res/layout-xlarge/contact_detail_fragment.xml
index 8a3e003..33ee3fa 100644
--- a/res/layout-xlarge/contact_detail_fragment.xml
+++ b/res/layout-xlarge/contact_detail_fragment.xml
@@ -88,6 +88,6 @@
android:visibility="gone"
android:layout_gravity="right"
android:layout_marginRight="40dip"
- android:layout_marginTop="20dip"
- android:layout_marginBottom="20dip" />
+ android:layout_marginTop="10dip"
+ android:layout_marginBottom="10dip" />
</LinearLayout>
\ No newline at end of file
diff --git a/res/layout-xlarge/item_group_membership.xml b/res/layout-xlarge/item_group_membership.xml
index 70068d7..c61cc93 100644
--- a/res/layout-xlarge/item_group_membership.xml
+++ b/res/layout-xlarge/item_group_membership.xml
@@ -42,4 +42,26 @@
android:gravity="left"
android:ellipsize="end"
/>
+
+ <!-- Plus/Minus button only for layout. This makes the editor lay out nicely with the other fields -->
+ <ImageButton
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:paddingLeft="@dimen/editor_round_button_padding_left"
+ android:paddingRight="@dimen/editor_round_button_padding_right"
+ android:paddingTop="@dimen/editor_round_button_padding_top"
+ android:paddingBottom="@dimen/editor_round_button_padding_bottom"
+ android:src="@drawable/btn_plus"
+ android:background="@null"
+ android:visibility="invisible" />
+ <ImageButton
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:paddingLeft="@dimen/editor_round_button_padding_left"
+ android:paddingRight="@dimen/editor_round_button_padding_right"
+ android:paddingTop="@dimen/editor_round_button_padding_top"
+ android:paddingBottom="@dimen/editor_round_button_padding_bottom"
+ android:src="@drawable/btn_minus"
+ android:background="@null"
+ android:visibility="invisible" />
</com.android.contacts.views.editor.GroupMembershipView>
diff --git a/res/layout-xlarge/item_contact_editor.xml b/res/layout-xlarge/raw_contact_editor_view.xml
similarity index 88%
rename from res/layout-xlarge/item_contact_editor.xml
rename to res/layout-xlarge/raw_contact_editor_view.xml
index 93da517..a0b7c00 100644
--- a/res/layout-xlarge/item_contact_editor.xml
+++ b/res/layout-xlarge/raw_contact_editor_view.xml
@@ -147,20 +147,31 @@
/>
</LinearLayout>
</com.android.contacts.widget.InterpolatingLayout>
+
+ <com.android.contacts.widget.InterpolatingLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="10dip"
+ android:layout_marginBottom="10dip">>
+ <Button
+ android:id="@+id/button_add_field"
+ android:text="@string/add_field"
+ ex:layout_wideParentWidth="960dip"
+ ex:layout_wideLeftMargin="240dip"
+ ex:layout_wideRightMargin="190dip"
+ ex:layout_narrowParentWidth="800dip"
+ ex:layout_narrowLeftMargin="160dip"
+ ex:layout_narrowRightMargin="102dip"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ />
+ </com.android.contacts.widget.InterpolatingLayout>
+
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_alignParentBottom="true"
android:background="?android:attr/listDivider"
/>
-
- <Button
- android:id="@+id/button_add_field"
- android:text="@string/add_field"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="right"
- android:layout_marginTop="10dip"
- />
</LinearLayout>
</com.android.contacts.views.editor.RawContactEditorView>
diff --git a/res/layout/item_contact_editor.xml b/res/layout/raw_contact_editor_view.xml
similarity index 100%
rename from res/layout/item_contact_editor.xml
rename to res/layout/raw_contact_editor_view.xml
diff --git a/res/layout/item_read_only_contact_editor.xml b/res/layout/read_only_raw_contact_editor_view.xml
similarity index 100%
rename from res/layout/item_read_only_contact_editor.xml
rename to res/layout/read_only_raw_contact_editor_view.xml
diff --git a/res/values/strings.xml b/res/values/strings.xml
index aa1c91b..8f0ffea 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1260,8 +1260,8 @@
<!-- The text displayed when the contacts list is empty while displaying only selected contacts in multiple picker -->
<string name="no_contacts_selected">"No contacts selected."</string>
- <!-- The add field button shown in the editor under each editable Raw Contact -->
- <string name="add_field">Add information</string>
+ <!-- The add field button shown in the editor under each editable Raw Contact [CHAR LIMIT=30] -->
+ <string name="add_field">Add another field</string>
<!-- Attbution of a contact status update, when the time of update is unknown -->
<string name="contact_status_update_attribution">via <xliff:g id="source" example="Google Talk">%1$s</xliff:g></string>
diff --git a/src/com/android/contacts/views/editor/ContactEditorFragment.java b/src/com/android/contacts/views/editor/ContactEditorFragment.java
index 54c7452..dc622b1 100644
--- a/src/com/android/contacts/views/editor/ContactEditorFragment.java
+++ b/src/com/android/contacts/views/editor/ContactEditorFragment.java
@@ -465,11 +465,11 @@
final BaseRawContactEditorView editor;
if (!source.readOnly) {
- editor = (BaseRawContactEditorView) inflater.inflate(R.layout.item_contact_editor,
- mContent, false);
+ editor = (BaseRawContactEditorView)
+ inflater.inflate(R.layout.raw_contact_editor_view, mContent, false);
} else {
editor = (BaseRawContactEditorView) inflater.inflate(
- R.layout.item_read_only_contact_editor, mContent, false);
+ R.layout.read_only_raw_contact_editor_view, mContent, false);
}
final PhotoEditorView photoEditor = editor.getPhotoEditor();
final boolean sourceReadOnly = source.readOnly;
diff --git a/src/com/android/contacts/views/editor/KindSectionView.java b/src/com/android/contacts/views/editor/KindSectionView.java
index 7aaefdd..da6fbe0 100644
--- a/src/com/android/contacts/views/editor/KindSectionView.java
+++ b/src/com/android/contacts/views/editor/KindSectionView.java
@@ -44,6 +44,7 @@
private ViewGroup mEditors;
private ImageButton mAddPlusButton;
private TextView mTitle;
+ private String mTitleString;
private DataKind mKind;
private EntityDelta mState;
@@ -97,10 +98,10 @@
setId(mViewIdGenerator.getId(state, kind, null, ViewIdGenerator.NO_VIEW_INDEX));
// TODO: handle resources from remote packages
- final String title = (kind.titleRes == -1 || kind.titleRes == 0)
- ? null
+ mTitleString = (kind.titleRes == -1 || kind.titleRes == 0)
+ ? ""
: getResources().getString(kind.titleRes);
- mTitle.setText(title == null ? "" : title.toUpperCase());
+ mTitle.setText(mTitleString.toUpperCase());
// Only show the add button if this is a list
mAddPlusButton.setVisibility(mKind.isList ? View.VISIBLE : View.INVISIBLE);
@@ -110,8 +111,8 @@
updateVisible();
}
- public CharSequence getTitle() {
- return mTitle.getText();
+ public String getTitle() {
+ return mTitleString;
}
/**
diff --git a/src/com/android/contacts/views/editor/LabeledEditorView.java b/src/com/android/contacts/views/editor/LabeledEditorView.java
index 3b9312f..448bd89 100644
--- a/src/com/android/contacts/views/editor/LabeledEditorView.java
+++ b/src/com/android/contacts/views/editor/LabeledEditorView.java
@@ -134,8 +134,7 @@
*/
private void setupLabelButton(boolean shouldExist) {
if (shouldExist && mLabel == null) {
- mLabel = new Button(mContext, null, android.R.attr.textAppearanceSmall);
- mLabel.setBackgroundResource(R.drawable.type_selector_background);
+ mLabel = new Button(mContext, null, android.R.attr.dropDownSpinnerStyle);
final int width =
mContext.getResources().getDimensionPixelSize(R.dimen.editor_type_label_width);
mLabel.setLayoutParams(new LayoutParams(width, LayoutParams.WRAP_CONTENT));