Merge "Removing search field from postal picker" into honeycomb
diff --git a/res/layout-xlarge/contact_browser.xml b/res/layout-xlarge/contact_browser.xml
index 6f39373..997ed21 100644
--- a/res/layout-xlarge/contact_browser.xml
+++ b/res/layout-xlarge/contact_browser.xml
@@ -39,11 +39,9 @@
android:background="@drawable/list_background_holo">
<View
- android:layout_width="match_parent"
- android:layout_height="2dip"
+ style="@style/SectionDivider"
android:layout_marginLeft="40dip"
- android:layout_marginTop="24dip"
- android:background="#7e7e87" />
+ android:layout_marginTop="24dip" />
<fragment
android:id="@+id/list_fragment"
diff --git a/res/layout/contact_picker.xml b/res/layout/contact_picker.xml
index b226b4f..6b03501 100644
--- a/res/layout/contact_picker.xml
+++ b/res/layout/contact_picker.xml
@@ -37,16 +37,23 @@
android:layout_weight="1"
android:id="@+id/list_container">
</FrameLayout>
+
+ <View
+ android:layout_width="match_parent"
+ android:layout_height="1dip"
+ android:layout_marginLeft="16dip"
+ android:layout_marginRight="16dip"
+ android:background="?android:attr/dividerHorizontal" />
+
<LinearLayout
style="?android:attr/buttonBarStyle"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="10dip">
+ android:layout_height="wrap_content">
<Button
style="?android:attr/buttonBarButtonStyle"
android:id="@+id/cancel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:text="@android:string/cancel"/>
+ android:text="@android:string/cancel" />
</LinearLayout>
</view>
diff --git a/res/layout/contacts_list_content_join.xml b/res/layout/contacts_list_content_join.xml
deleted file mode 100644
index 5ad1cbf..0000000
--- a/res/layout/contacts_list_content_join.xml
+++ /dev/null
@@ -1,77 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2009 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.
--->
-
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical">
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- android:background="@*android:drawable/title_bar_medium"
- android:paddingLeft="5dip"
- android:paddingRight="5dip"
- android:gravity="center_vertical"
- >
-
- <ImageView
- android:layout_width="48dip"
- android:layout_height="48dip"
- android:src="@drawable/ic_join"
- android:gravity="center"
- android:scaleType="fitCenter"
- />
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:paddingLeft="10dip">
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="@string/titleJoinContactDataWith"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:shadowColor="#BB000000"
- android:shadowRadius="2.75"
- />
- <TextView
- android:id="@+id/join_contact_blurb"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="-2dip"
- android:maxLines="2"
- android:textAppearance="?android:attr/textAppearanceSmall"
- />
- </LinearLayout>
- </LinearLayout>
-
- <FrameLayout
- android:id="@+id/pinned_header_list_layout"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <view
- class="com.android.contacts.list.ContactEntryListView"
- android:id="@android:id/list"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:fastScrollEnabled="true" />
- </FrameLayout>
-</LinearLayout>
-
diff --git a/res/layout/contacts_list_show_all_item.xml b/res/layout/contacts_list_show_all_item.xml
deleted file mode 100644
index 4111a8f..0000000
--- a/res/layout/contacts_list_show_all_item.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
- * Copyright 2009, 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.
- */
--->
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
->
- <TextView
- android:layout_width="match_parent"
- android:layout_height="?android:attr/listPreferredItemHeight"
- android:gravity="center_vertical|left"
- android:textAppearance="?android:attr/textAppearanceLarge"
- android:text="@string/showAllContactsJoinItem"
- android:paddingLeft="14dip"
- />
-
- <View android:id="@+id/list_divider"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:background="@*android:drawable/divider_horizontal_dark_opaque"
- />
-</LinearLayout>
diff --git a/res/layout/join_contact_picker.xml b/res/layout/join_contact_picker.xml
index e0a6c2a..20a7740 100644
--- a/res/layout/join_contact_picker.xml
+++ b/res/layout/join_contact_picker.xml
@@ -18,12 +18,31 @@
xmlns:android="http://schemas.android.com/apk/res/android"
class="com.android.contacts.widget.FullHeightLinearLayout"
style="@style/ContactPickerLayout"
- android:paddingLeft="20dip"
- android:paddingRight="20dip"
android:orientation="vertical">
+
<FrameLayout
android:layout_width="match_parent"
- android:layout_height="match_parent"
+ android:layout_height="0dip"
+ android:layout_weight="1"
android:id="@+id/list_container">
</FrameLayout>
+
+ <View
+ android:layout_width="match_parent"
+ android:layout_height="1dip"
+ android:layout_marginLeft="16dip"
+ android:layout_marginRight="16dip"
+ android:background="?android:attr/dividerHorizontal" />
+
+ <LinearLayout
+ style="?android:attr/buttonBarStyle"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+ <Button
+ style="?android:attr/buttonBarButtonStyle"
+ android:id="@+id/cancel"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@android:string/cancel"/>
+ </LinearLayout>
</view>
diff --git a/res/layout/join_contact_picker_list_content.xml b/res/layout/join_contact_picker_list_content.xml
new file mode 100644
index 0000000..0d2a089
--- /dev/null
+++ b/res/layout/join_contact_picker_list_content.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 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.
+-->
+
+
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <TextView
+ android:id="@+id/join_contact_blurb"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingLeft="10dip"
+ android:paddingTop="12dip"
+ android:paddingBottom="12dip"
+ android:layout_marginLeft="12dip"
+ android:layout_marginRight="12dip"
+ android:maxLines="2"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textColor="?android:attr/textColorSecondary" />
+
+ <FrameLayout
+ android:id="@+id/pinned_header_list_layout"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_marginLeft="48dip"
+ android:layout_marginRight="48dip">
+
+ <view
+ class="com.android.contacts.list.ContactEntryListView"
+ android:id="@android:id/list"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:fastScrollEnabled="true" />
+ </FrameLayout>
+</LinearLayout>
diff --git a/res/layout/join_contact_picker_section.xml b/res/layout/join_contact_picker_section.xml
new file mode 100644
index 0000000..95ec107
--- /dev/null
+++ b/res/layout/join_contact_picker_section.xml
@@ -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.
+-->
+
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <TextView
+ android:id="@+id/text"
+ android:layout_height="32dip"
+ android:layout_width="match_parent"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textColor="?android:attr/textColorSecondary"
+ android:gravity="center_vertical" />
+
+ <View
+ style="@style/SectionDivider" />
+</LinearLayout>
diff --git a/res/layout/join_contact_picker_show_all.xml b/res/layout/join_contact_picker_show_all.xml
new file mode 100644
index 0000000..d332649
--- /dev/null
+++ b/res/layout/join_contact_picker_show_all.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+ * Copyright 2009, 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.
+ */
+-->
+
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <View
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="?android:attr/dividerHorizontal" />
+
+ <TextView
+ android:id="@+id/text"
+ android:layout_height="48dip"
+ android:layout_width="match_parent"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textColor="?android:attr/textColorSecondary"
+ android:gravity="center_vertical"
+ android:text="@string/showAllContactsJoinItem" />
+
+ <View
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="?android:attr/dividerHorizontal" />
+</LinearLayout>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index d543a75..bba6e5b 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -149,9 +149,7 @@
<item name="list_item_header_text_size">14sp</item>
</style>
- <style name="JoinContactActivityTheme" parent="ContactPickerTheme">
- <item name="android:windowNoTitle">true</item>
- <item name="android:windowContentOverlay">@null</item>
+ <style name="JoinContactActivityTheme" parent="ContactPickerTheme" >
</style>
<style name="ContactsPreferencesTheme" parent="@android:Theme">
@@ -201,4 +199,10 @@
<style name="NonPhoneActivityTheme" parent="@android:Theme.Dialog">
</style>
+
+ <style name="SectionDivider">
+ <item name="android:background">#7e7e87</item>
+ <item name="android:layout_height">2dip</item>
+ <item name="android:layout_width">match_parent</item>
+ </style>
</resources>
diff --git a/src/com/android/contacts/activities/JoinContactActivity.java b/src/com/android/contacts/activities/JoinContactActivity.java
index 7fa0384..5ee6de2 100644
--- a/src/com/android/contacts/activities/JoinContactActivity.java
+++ b/src/com/android/contacts/activities/JoinContactActivity.java
@@ -32,11 +32,13 @@
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
+import android.view.View;
+import android.view.View.OnClickListener;
/**
* An activity that shows a list of contacts that can be joined with the target contact.
*/
-public class JoinContactActivity extends ContactsActivity {
+public class JoinContactActivity extends ContactsActivity implements OnClickListener {
private static final String TAG = "JoinContactActivity";
@@ -84,12 +86,17 @@
}
setContentView(R.layout.join_contact_picker);
+ setTitle(R.string.titleJoinContactDataWith);
- mListFragment = new JoinContactListFragment();
+ findViewById(R.id.cancel).setOnClickListener(this);
- getFragmentManager().beginTransaction()
- .replace(R.id.list_container, mListFragment)
- .commit();
+ if (mListFragment == null) {
+ mListFragment = new JoinContactListFragment();
+
+ getFragmentManager().beginTransaction()
+ .replace(R.id.list_container, mListFragment)
+ .commit();
+ }
}
public void setupActionListener() {
@@ -163,4 +170,11 @@
mListFragment.onPickerResult(data);
}
}
+
+ @Override
+ public void onClick(View v) {
+ if (v.getId() == R.id.cancel) {
+ finish();
+ }
+ }
}
diff --git a/src/com/android/contacts/list/JoinContactListAdapter.java b/src/com/android/contacts/list/JoinContactListAdapter.java
index c59ac2f..e7a9eb9 100644
--- a/src/com/android/contacts/list/JoinContactListAdapter.java
+++ b/src/com/android/contacts/list/JoinContactListAdapter.java
@@ -164,14 +164,16 @@
ViewGroup parent) {
switch (partition) {
case PARTITION_SUGGESTIONS: {
- TextView view = (TextView) inflate(R.layout.list_separator, parent);
- view.setText(R.string.separatorJoinAggregateSuggestions);
- return view;
+ View view = inflate(R.layout.join_contact_picker_section, parent);
+ ((TextView) view.findViewById(R.id.text)).setText(
+ R.string.separatorJoinAggregateSuggestions);
+ return view;
}
case PARTITION_ALL_CONTACTS: {
- TextView view = (TextView) inflate(R.layout.list_separator, parent);
- view.setText(R.string.separatorJoinAggregateAll);
- return view;
+ View view = inflate(R.layout.join_contact_picker_section, parent);
+ ((TextView) view.findViewById(R.id.text)).setText(
+ R.string.separatorJoinAggregateAll);
+ return view;
}
}
@@ -191,7 +193,7 @@
case PARTITION_ALL_CONTACTS:
return super.newView(context, partition, cursor, position, parent);
case PARTITION_SHOW_ALL_CONTACTS:
- return inflate(R.layout.contacts_list_show_all_item, parent);
+ return inflate(R.layout.join_contact_picker_show_all, parent);
}
return null;
}
@@ -205,6 +207,7 @@
switch (partition) {
case PARTITION_SUGGESTIONS: {
final ContactListItemView view = (ContactListItemView)itemView;
+ view.setSectionHeader(null);
bindPhoto(view, partition, cursor);
bindName(view, cursor);
break;
diff --git a/src/com/android/contacts/list/JoinContactListFragment.java b/src/com/android/contacts/list/JoinContactListFragment.java
index 96bae93..59b29ed 100644
--- a/src/com/android/contacts/list/JoinContactListFragment.java
+++ b/src/com/android/contacts/list/JoinContactListFragment.java
@@ -39,6 +39,8 @@
private static final int DISPLAY_NAME_LOADER = -2;
+ private static final String KEY_ALL_CONTACTS_LIST_SHOWN = "allContactsShown";
+
private OnContactPickerActionListener mListener;
private long mTargetContactId;
private boolean mAllContactsListShown = false;
@@ -76,17 +78,13 @@
break;
}
case JoinContactListAdapter.PARTITION_ALL_CONTACTS: {
- setVisibleScrollbarEnabled(mAllContactsListShown);
-
- JoinContactListAdapter adapter = getAdapter();
Cursor suggestionsCursor = ((JoinContactLoader)loader).getSuggestionsCursor();
- adapter.setSuggestionsCursor(suggestionsCursor);
- onPartitionLoaded(JoinContactListAdapter.PARTITION_ALL_CONTACTS, data);
+ onContactListLoaded(suggestionsCursor, data);
break;
}
}
}
-
+
public void onLoaderReset(Loader<Cursor> loader) {
}
};
@@ -111,6 +109,16 @@
null, mLoaderCallbacks);
}
+ void onContactListLoaded(Cursor suggestionsCursor, Cursor allContacts) {
+ JoinContactListAdapter adapter = getAdapter();
+ adapter.setSuggestionsCursor(suggestionsCursor);
+ if (suggestionsCursor == null || suggestionsCursor.getCount() == 0) {
+ mAllContactsListShown = true;
+ }
+ setVisibleScrollbarEnabled(mAllContactsListShown);
+ onPartitionLoaded(JoinContactListAdapter.PARTITION_ALL_CONTACTS, allContacts);
+ }
+
private void showTargetContactName(String displayName) {
Activity activity = getActivity();
TextView blurbView = (TextView)activity.findViewById(R.id.join_contact_blurb);
@@ -137,7 +145,7 @@
@Override
protected View inflateView(LayoutInflater inflater, ViewGroup container) {
- return inflater.inflate(R.layout.contacts_list_content_join, null);
+ return inflater.inflate(R.layout.join_contact_picker_list_content, null);
}
@Override
@@ -167,4 +175,18 @@
public void onPickerResult(Intent data) {
mListener.onPickContactAction(data.getData());
}
+
+ @Override
+ public void onSaveInstanceState(Bundle outState) {
+ super.onSaveInstanceState(outState);
+ outState.putBoolean(KEY_ALL_CONTACTS_LIST_SHOWN, mAllContactsListShown);
+ }
+
+ @Override
+ public void restoreSavedState(Bundle savedState) {
+ super.restoreSavedState(savedState);
+ if (savedState != null) {
+ mAllContactsListShown = savedState.getBoolean(KEY_ALL_CONTACTS_LIST_SHOWN);
+ }
+ }
}
diff --git a/src/com/android/contacts/list/JoinContactLoader.java b/src/com/android/contacts/list/JoinContactLoader.java
index 25c9ab4..a137961 100644
--- a/src/com/android/contacts/list/JoinContactLoader.java
+++ b/src/com/android/contacts/list/JoinContactLoader.java
@@ -27,7 +27,7 @@
*/
public class JoinContactLoader extends CursorLoader {
- private boolean mLoadSuggestionsAndAllContact;
+ private boolean mLoadSuggestionsAndAllContacts;
private String[] mProjection;
private Uri mSuggestionUri;
private MatrixCursor mSuggestionsCursor;
@@ -37,7 +37,7 @@
}
public void setLoadSuggestionsAndAllContacts(boolean flag) {
- mLoadSuggestionsAndAllContact = flag;
+ mLoadSuggestionsAndAllContacts = flag;
}
public void setSuggestionUri(Uri uri) {
@@ -59,7 +59,7 @@
// First execute the suggestions query, then call super.loadInBackground
// to load the entire list
mSuggestionsCursor = loadSuggestions();
- if (!mLoadSuggestionsAndAllContact && mSuggestionsCursor.getCount() != 0) {
+ if (!mLoadSuggestionsAndAllContacts && mSuggestionsCursor.getCount() != 0) {
// In case we only need suggestions, send "0" as the search query, which
// will always return an empty cursor (but we can still register to
// listen for changes on it).