Improving layout of aggregation suggestions
Change-Id: I8690c36d0e80f89ee5043703e3a20bc46357f6e5
diff --git a/res/drawable-hdpi/suggestion_bg.9.png b/res/drawable-hdpi/aggregation_suggestions_bg.9.png
similarity index 100%
rename from res/drawable-hdpi/suggestion_bg.9.png
rename to res/drawable-hdpi/aggregation_suggestions_bg.9.png
Binary files differ
diff --git a/res/drawable-hdpi/aggregation_suggestions_bg_light_holo.9.png b/res/drawable-hdpi/aggregation_suggestions_bg_light_holo.9.png
new file mode 100644
index 0000000..da1fe94
--- /dev/null
+++ b/res/drawable-hdpi/aggregation_suggestions_bg_light_holo.9.png
Binary files differ
diff --git a/res/drawable-mdpi/suggestion_bg.9.png b/res/drawable-mdpi/aggregation_suggestions_bg.9.png
similarity index 100%
rename from res/drawable-mdpi/suggestion_bg.9.png
rename to res/drawable-mdpi/aggregation_suggestions_bg.9.png
Binary files differ
diff --git a/res/drawable-mdpi/aggregation_suggestions_bg_light_holo.9.png b/res/drawable-mdpi/aggregation_suggestions_bg_light_holo.9.png
new file mode 100644
index 0000000..03e24c6
--- /dev/null
+++ b/res/drawable-mdpi/aggregation_suggestions_bg_light_holo.9.png
Binary files differ
diff --git a/res/layout-xlarge/aggregation_suggestions.xml b/res/layout-xlarge/aggregation_suggestions.xml
new file mode 100644
index 0000000..81b4edd
--- /dev/null
+++ b/res/layout-xlarge/aggregation_suggestions.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+ * Copyright 2010, 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.
+ */
+-->
+
+<com.android.contacts.widget.InterpolatingLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:ex="http://schemas.android.com/apk/res/com.android.contacts"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingBottom="20dip">
+
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:background="@drawable/aggregation_suggestions_bg_light_holo"
+ android:minWidth="100dip"
+ android:paddingBottom="10dip"
+ ex:layout_narrowParentWidth="600dip"
+ ex:layout_narrowWidth="400dip"
+ ex:layout_wideParentWidth="300dip"
+ ex:layout_wideWidth="240dip">
+ <TextView
+ android:id="@+id/aggregation_suggestion_title"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_alignParentTop="true"
+ android:layout_alignParentLeft="true"
+ android:layout_marginLeft="5dip"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textColor="?android:attr/textColorTertiary"
+ android:textStyle="bold" />
+
+ <LinearLayout
+ android:id="@+id/aggregation_suggestions"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical" />
+ </LinearLayout>
+</com.android.contacts.widget.InterpolatingLayout>
\ No newline at end of file
diff --git a/res/layout-xlarge/aggregation_suggestions_item.xml b/res/layout-xlarge/aggregation_suggestions_item.xml
new file mode 100644
index 0000000..517c7e4
--- /dev/null
+++ b/res/layout-xlarge/aggregation_suggestions_item.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+ * Copyright 2010, 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.
+ */
+-->
+
+<view xmlns:android="http://schemas.android.com/apk/res/android"
+ class="com.android.contacts.ui.widget.AggregationSuggestionView"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:paddingLeft="5dip"
+ android:paddingRight="15dip"
+>
+ <Button
+ android:id="@+id/aggregation_suggestion_join_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/aggregation_suggestion_join_button"
+ android:layout_centerInParent="true"
+ android:layout_alignParentRight="true"
+ />
+
+ <ImageView
+ android:id="@+id/aggregation_suggestion_photo"
+ android:layout_width="@dimen/aggregation_suggestion_icon_size"
+ android:layout_height="@dimen/aggregation_suggestion_icon_size"
+ android:layout_alignParentLeft="true"
+ android:layout_centerInParent="true"
+ android:layout_marginTop="4dip"
+ android:scaleType="fitCenter"
+ />
+
+ <TextView
+ android:id="@+id/aggregation_suggestion_name"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_toRightOf="@id/aggregation_suggestion_photo"
+ android:layout_toLeftOf="@id/aggregation_suggestion_join_button"
+ android:layout_marginLeft="10dip"
+ android:layout_marginTop="4dip"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textColor="?android:attr/textColorSecondary"
+ />
+
+ <TextView
+ android:id="@+id/aggregation_suggestion_data"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_toRightOf="@id/aggregation_suggestion_photo"
+ android:layout_toLeftOf="@id/aggregation_suggestion_join_button"
+ android:layout_below="@id/aggregation_suggestion_name"
+ android:layout_marginLeft="10dip"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textColor="?android:attr/textColorSecondary"
+ />
+</view>
diff --git a/res/layout/aggregation_suggestions.xml b/res/layout/aggregation_suggestions.xml
index 684fe91..0542daa 100644
--- a/res/layout/aggregation_suggestions.xml
+++ b/res/layout/aggregation_suggestions.xml
@@ -21,7 +21,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
- android:background="@drawable/suggestion_bg">
+ android:background="@drawable/aggregation_suggestions_bg">
<TextView
android:id="@+id/aggregation_suggestion_title"
android:layout_width="match_parent"
@@ -29,7 +29,7 @@
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_marginLeft="5dip"
- android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold"
/>
diff --git a/res/values-xlarge/dimens.xml b/res/values-xlarge/dimens.xml
index 9f3f491..8f81240 100644
--- a/res/values-xlarge/dimens.xml
+++ b/res/values-xlarge/dimens.xml
@@ -19,4 +19,6 @@
<dimen name="aizy_text_size">12sp</dimen>
<dimen name="edit_photo_size">96dip</dimen>
+
+ <dimen name="aggregation_suggestion_icon_size">64dip</dimen>
</resources>
diff --git a/src/com/android/contacts/activities/ActionBarAdapter.java b/src/com/android/contacts/activities/ActionBarAdapter.java
index a5d1114..ae8ef76 100644
--- a/src/com/android/contacts/activities/ActionBarAdapter.java
+++ b/src/com/android/contacts/activities/ActionBarAdapter.java
@@ -138,14 +138,20 @@
mSearchLabel.setVisibility(View.VISIBLE);
mFilterView.setVisibility(View.GONE);
mFilterIndicator.setVisibility(View.INVISIBLE);
+ if (mFilterController != null) {
+ mFilterController.setEnabled(false);
+ }
} else {
mSearchLabel.setVisibility(View.GONE);
mFilterView.setVisibility(View.VISIBLE);
boolean showIndicator = false;
- if (mFilterController != null && mFilterController.isLoaded()) {
- mFilterView.setContactListFilter(mFilterController.getFilter());
- mFilterView.bindView(false);
- showIndicator = mFilterController.getFilterList().size() > 1;
+ if (mFilterController != null){
+ mFilterController.setEnabled(true);
+ if (mFilterController.isLoaded()) {
+ mFilterView.setContactListFilter(mFilterController.getFilter());
+ mFilterView.bindView(false);
+ showIndicator = mFilterController.getFilterList().size() > 1;
+ }
}
mFilterIndicator.setVisibility(showIndicator ? View.VISIBLE : View.INVISIBLE);
}
diff --git a/src/com/android/contacts/list/ContactListFilterController.java b/src/com/android/contacts/list/ContactListFilterController.java
index ea19934..89c4eaa 100644
--- a/src/com/android/contacts/list/ContactListFilterController.java
+++ b/src/com/android/contacts/list/ContactListFilterController.java
@@ -64,6 +64,7 @@
private Context mContext;
private LoaderManager mLoaderManager;
+ private boolean mEnabled = true;
private List<ContactListFilterListener> mListeners = new ArrayList<ContactListFilterListener>();
private ListPopupWindow mPopup;
private int mPopupWidth = -1;
@@ -91,6 +92,10 @@
mLoaderManager = activity.getLoaderManager();
}
+ public void setEnabled(boolean flag) {
+ mEnabled = flag;
+ }
+
public void addListener(ContactListFilterListener listener) {
mListeners.add(listener);
}
@@ -252,7 +257,7 @@
@Override
public void onClick(View v) {
- if (!mFiltersLoaded) {
+ if (!mFiltersLoaded || !mEnabled) {
return;
}
diff --git a/src/com/android/contacts/views/editor/AggregationSuggestionEngine.java b/src/com/android/contacts/views/editor/AggregationSuggestionEngine.java
index 11f10f9..3943816 100644
--- a/src/com/android/contacts/views/editor/AggregationSuggestionEngine.java
+++ b/src/com/android/contacts/views/editor/AggregationSuggestionEngine.java
@@ -148,6 +148,10 @@
appendValue(nameSb, values, StructuredName.FAMILY_NAME);
appendValue(nameSb, values, StructuredName.SUFFIX);
+ if (nameSb.length() == 0) {
+ appendValue(nameSb, values, StructuredName.DISPLAY_NAME);
+ }
+
StringBuilder phoneticNameSb = new StringBuilder();
appendValue(phoneticNameSb, values, StructuredName.PHONETIC_FAMILY_NAME);
appendValue(phoneticNameSb, values, StructuredName.PHONETIC_MIDDLE_NAME);