Merge "Rewrite vCard importer/exporter."
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 02c378a..b39d3f4 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -307,16 +307,6 @@
</intent-filter>
</activity>
- <!-- An activity for selecting multiple phone numbers -->
- <activity android:name="MultiplePhonePickerActivity"
- android:enabled="false">
- <intent-filter>
- <action android:name="com.android.contacts.action.GET_MULTIPLE_PHONES" />
- <category android:name="android.intent.category.DEFAULT" />
- <data android:mimeType="vnd.android.cursor.dir/phone_v2" android:host="com.android.contacts" />
- </intent-filter>
- </activity>
-
<!-- Used to set options -->
<activity
android:name=".preference.ContactsPreferenceActivity"
diff --git a/res/drawable-hdpi/appointment_indicator_leftside_1.9.png b/res/drawable-hdpi/appointment_indicator_leftside_1.9.png
deleted file mode 100644
index b72652b..0000000
--- a/res/drawable-hdpi/appointment_indicator_leftside_1.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/appointment_indicator_leftside_10.9.png b/res/drawable-hdpi/appointment_indicator_leftside_10.9.png
deleted file mode 100644
index ff09049..0000000
--- a/res/drawable-hdpi/appointment_indicator_leftside_10.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/appointment_indicator_leftside_11.9.png b/res/drawable-hdpi/appointment_indicator_leftside_11.9.png
deleted file mode 100644
index 6a2e4f2..0000000
--- a/res/drawable-hdpi/appointment_indicator_leftside_11.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/appointment_indicator_leftside_12.9.png b/res/drawable-hdpi/appointment_indicator_leftside_12.9.png
deleted file mode 100644
index 0f19c83..0000000
--- a/res/drawable-hdpi/appointment_indicator_leftside_12.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/appointment_indicator_leftside_13.9.png b/res/drawable-hdpi/appointment_indicator_leftside_13.9.png
deleted file mode 100644
index 7501e35..0000000
--- a/res/drawable-hdpi/appointment_indicator_leftside_13.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/appointment_indicator_leftside_14.9.png b/res/drawable-hdpi/appointment_indicator_leftside_14.9.png
deleted file mode 100644
index 53f97a6..0000000
--- a/res/drawable-hdpi/appointment_indicator_leftside_14.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/appointment_indicator_leftside_15.9.png b/res/drawable-hdpi/appointment_indicator_leftside_15.9.png
deleted file mode 100644
index 846f6f8..0000000
--- a/res/drawable-hdpi/appointment_indicator_leftside_15.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/appointment_indicator_leftside_16.9.png b/res/drawable-hdpi/appointment_indicator_leftside_16.9.png
deleted file mode 100644
index 1707540..0000000
--- a/res/drawable-hdpi/appointment_indicator_leftside_16.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/appointment_indicator_leftside_17.9.png b/res/drawable-hdpi/appointment_indicator_leftside_17.9.png
deleted file mode 100644
index 7fd945d..0000000
--- a/res/drawable-hdpi/appointment_indicator_leftside_17.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/appointment_indicator_leftside_18.9.png b/res/drawable-hdpi/appointment_indicator_leftside_18.9.png
deleted file mode 100644
index 8cf47ae..0000000
--- a/res/drawable-hdpi/appointment_indicator_leftside_18.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/appointment_indicator_leftside_19.9.png b/res/drawable-hdpi/appointment_indicator_leftside_19.9.png
deleted file mode 100644
index 6831c01..0000000
--- a/res/drawable-hdpi/appointment_indicator_leftside_19.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/appointment_indicator_leftside_2.9.png b/res/drawable-hdpi/appointment_indicator_leftside_2.9.png
deleted file mode 100644
index b4cee11..0000000
--- a/res/drawable-hdpi/appointment_indicator_leftside_2.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/appointment_indicator_leftside_20.9.png b/res/drawable-hdpi/appointment_indicator_leftside_20.9.png
deleted file mode 100644
index d07d826..0000000
--- a/res/drawable-hdpi/appointment_indicator_leftside_20.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/appointment_indicator_leftside_21.9.png b/res/drawable-hdpi/appointment_indicator_leftside_21.9.png
deleted file mode 100644
index f410269..0000000
--- a/res/drawable-hdpi/appointment_indicator_leftside_21.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/appointment_indicator_leftside_3.9.png b/res/drawable-hdpi/appointment_indicator_leftside_3.9.png
deleted file mode 100644
index 69bd6a9..0000000
--- a/res/drawable-hdpi/appointment_indicator_leftside_3.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/appointment_indicator_leftside_4.9.png b/res/drawable-hdpi/appointment_indicator_leftside_4.9.png
deleted file mode 100644
index d09ea90..0000000
--- a/res/drawable-hdpi/appointment_indicator_leftside_4.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/appointment_indicator_leftside_5.9.png b/res/drawable-hdpi/appointment_indicator_leftside_5.9.png
deleted file mode 100644
index d27fc91..0000000
--- a/res/drawable-hdpi/appointment_indicator_leftside_5.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/appointment_indicator_leftside_6.9.png b/res/drawable-hdpi/appointment_indicator_leftside_6.9.png
deleted file mode 100644
index c014633..0000000
--- a/res/drawable-hdpi/appointment_indicator_leftside_6.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/appointment_indicator_leftside_7.9.png b/res/drawable-hdpi/appointment_indicator_leftside_7.9.png
deleted file mode 100644
index febb514..0000000
--- a/res/drawable-hdpi/appointment_indicator_leftside_7.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/appointment_indicator_leftside_8.9.png b/res/drawable-hdpi/appointment_indicator_leftside_8.9.png
deleted file mode 100644
index 1415e44..0000000
--- a/res/drawable-hdpi/appointment_indicator_leftside_8.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/appointment_indicator_leftside_9.9.png b/res/drawable-hdpi/appointment_indicator_leftside_9.9.png
deleted file mode 100644
index d018fcf..0000000
--- a/res/drawable-hdpi/appointment_indicator_leftside_9.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/appointment_indicator_leftside_1.9.png b/res/drawable-mdpi/appointment_indicator_leftside_1.9.png
deleted file mode 100644
index 5e40235..0000000
--- a/res/drawable-mdpi/appointment_indicator_leftside_1.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/appointment_indicator_leftside_10.9.png b/res/drawable-mdpi/appointment_indicator_leftside_10.9.png
deleted file mode 100644
index d0cb144..0000000
--- a/res/drawable-mdpi/appointment_indicator_leftside_10.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/appointment_indicator_leftside_11.9.png b/res/drawable-mdpi/appointment_indicator_leftside_11.9.png
deleted file mode 100644
index 034f496..0000000
--- a/res/drawable-mdpi/appointment_indicator_leftside_11.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/appointment_indicator_leftside_12.9.png b/res/drawable-mdpi/appointment_indicator_leftside_12.9.png
deleted file mode 100644
index 6371b3a..0000000
--- a/res/drawable-mdpi/appointment_indicator_leftside_12.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/appointment_indicator_leftside_13.9.png b/res/drawable-mdpi/appointment_indicator_leftside_13.9.png
deleted file mode 100644
index a8b42c6..0000000
--- a/res/drawable-mdpi/appointment_indicator_leftside_13.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/appointment_indicator_leftside_14.9.png b/res/drawable-mdpi/appointment_indicator_leftside_14.9.png
deleted file mode 100644
index a69e519..0000000
--- a/res/drawable-mdpi/appointment_indicator_leftside_14.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/appointment_indicator_leftside_15.9.png b/res/drawable-mdpi/appointment_indicator_leftside_15.9.png
deleted file mode 100644
index 5d68470..0000000
--- a/res/drawable-mdpi/appointment_indicator_leftside_15.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/appointment_indicator_leftside_16.9.png b/res/drawable-mdpi/appointment_indicator_leftside_16.9.png
deleted file mode 100644
index d9420c1..0000000
--- a/res/drawable-mdpi/appointment_indicator_leftside_16.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/appointment_indicator_leftside_17.9.png b/res/drawable-mdpi/appointment_indicator_leftside_17.9.png
deleted file mode 100644
index d0875c4..0000000
--- a/res/drawable-mdpi/appointment_indicator_leftside_17.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/appointment_indicator_leftside_18.9.png b/res/drawable-mdpi/appointment_indicator_leftside_18.9.png
deleted file mode 100644
index fc152f7..0000000
--- a/res/drawable-mdpi/appointment_indicator_leftside_18.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/appointment_indicator_leftside_19.9.png b/res/drawable-mdpi/appointment_indicator_leftside_19.9.png
deleted file mode 100644
index 6506a94..0000000
--- a/res/drawable-mdpi/appointment_indicator_leftside_19.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/appointment_indicator_leftside_2.9.png b/res/drawable-mdpi/appointment_indicator_leftside_2.9.png
deleted file mode 100644
index 3baf5cc..0000000
--- a/res/drawable-mdpi/appointment_indicator_leftside_2.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/appointment_indicator_leftside_20.9.png b/res/drawable-mdpi/appointment_indicator_leftside_20.9.png
deleted file mode 100644
index 28340ba..0000000
--- a/res/drawable-mdpi/appointment_indicator_leftside_20.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/appointment_indicator_leftside_21.9.png b/res/drawable-mdpi/appointment_indicator_leftside_21.9.png
deleted file mode 100644
index 5319f07..0000000
--- a/res/drawable-mdpi/appointment_indicator_leftside_21.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/appointment_indicator_leftside_3.9.png b/res/drawable-mdpi/appointment_indicator_leftside_3.9.png
deleted file mode 100644
index 9850791..0000000
--- a/res/drawable-mdpi/appointment_indicator_leftside_3.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/appointment_indicator_leftside_4.9.png b/res/drawable-mdpi/appointment_indicator_leftside_4.9.png
deleted file mode 100644
index e344ccb..0000000
--- a/res/drawable-mdpi/appointment_indicator_leftside_4.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/appointment_indicator_leftside_5.9.png b/res/drawable-mdpi/appointment_indicator_leftside_5.9.png
deleted file mode 100644
index 11b4dfb..0000000
--- a/res/drawable-mdpi/appointment_indicator_leftside_5.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/appointment_indicator_leftside_6.9.png b/res/drawable-mdpi/appointment_indicator_leftside_6.9.png
deleted file mode 100644
index 7419d47..0000000
--- a/res/drawable-mdpi/appointment_indicator_leftside_6.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/appointment_indicator_leftside_7.9.png b/res/drawable-mdpi/appointment_indicator_leftside_7.9.png
deleted file mode 100644
index 0a3a272..0000000
--- a/res/drawable-mdpi/appointment_indicator_leftside_7.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/appointment_indicator_leftside_8.9.png b/res/drawable-mdpi/appointment_indicator_leftside_8.9.png
deleted file mode 100644
index db18d27..0000000
--- a/res/drawable-mdpi/appointment_indicator_leftside_8.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/appointment_indicator_leftside_9.9.png b/res/drawable-mdpi/appointment_indicator_leftside_9.9.png
deleted file mode 100644
index 5037de8..0000000
--- a/res/drawable-mdpi/appointment_indicator_leftside_9.9.png
+++ /dev/null
Binary files differ
diff --git a/res/layout-xlarge/item_group_membership.xml b/res/layout-xlarge/item_group_membership.xml
index d0b393f..196e767 100644
--- a/res/layout-xlarge/item_group_membership.xml
+++ b/res/layout-xlarge/item_group_membership.xml
@@ -41,6 +41,7 @@
android:textAppearance="?android:attr/textAppearanceMedium"
android:gravity="left"
android:ellipsize="end"
+ android:focusable="true"
/>
<!-- Plus/Minus button only for layout. This makes the editor lay out nicely with the other fields -->
diff --git a/res/layout/item_group_membership.xml b/res/layout/item_group_membership.xml
index b349390..3e4db8c 100644
--- a/res/layout/item_group_membership.xml
+++ b/res/layout/item_group_membership.xml
@@ -49,7 +49,8 @@
android:textColor="@color/kind_title"
android:singleLine="true"
android:ellipsize="marquee"
- android:fadingEdge="horizontal" />
+ android:fadingEdge="horizontal"
+ android:focusable="true" />
</LinearLayout>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 2c1d250..914ebcc 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -110,12 +110,6 @@
<attr name="list_item_header_text_size" format="dimension" />
</declare-styleable>
- <declare-styleable name="MultiplePhonePickerItemView">
- <attr name="list_item_header_chip_width" format="dimension"/>
- <attr name="list_item_header_chip_right_margin" format="dimension"/>
- <attr name="list_item_header_checkbox_margin" format="dimension"/>
- </declare-styleable>
-
<style name="ContactBrowserTheme" parent="@android:Theme">
<item name="pressedBackground">@*android:drawable/list_selector_background</item>
<item name="section_header_background">@drawable/section_header</item>
@@ -151,9 +145,6 @@
<item name="list_item_presence_icon_margin">5dip</item>
<item name="list_item_photo_size">56dip</item>
<item name="list_item_prefix_highlight_color">#729a27</item>
- <item name="list_item_header_chip_width">4dip</item>
- <item name="list_item_header_chip_right_margin">4dip</item>
- <item name="list_item_header_checkbox_margin">5dip</item>
<item name="list_item_header_text_indent">56dip</item>
<item name="list_item_header_text_color">?color/section_header_text_color</item>
<item name="list_item_header_text_size">14sp</item>
diff --git a/src/com/android/contacts/ContactsUtils.java b/src/com/android/contacts/ContactsUtils.java
index fd9eb58..4dd9036 100644
--- a/src/com/android/contacts/ContactsUtils.java
+++ b/src/com/android/contacts/ContactsUtils.java
@@ -16,7 +16,7 @@
package com.android.contacts;
-import com.android.contacts.model.BaseAccountType;
+import com.android.contacts.model.AccountType;
import com.android.contacts.util.Constants;
import android.content.ContentResolver;
@@ -459,10 +459,10 @@
* Utility for creating a standard tab indicator view.
*
* @param parent The parent ViewGroup to attach the new view to.
- * @param source The {@link BaseAccountType} to build the tab view from.
+ * @param source The {@link AccountType} to build the tab view from.
* @return The tab indicator View.
*/
- public static View createTabIndicatorView(ViewGroup parent, BaseAccountType source) {
+ public static View createTabIndicatorView(ViewGroup parent, AccountType source) {
Drawable icon = null;
if (source != null) {
icon = source.getDisplayIcon(parent.getContext());
diff --git a/src/com/android/contacts/MultiplePhonePickerActivity.java b/src/com/android/contacts/MultiplePhonePickerActivity.java
deleted file mode 100644
index 572b4de..0000000
--- a/src/com/android/contacts/MultiplePhonePickerActivity.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-package com.android.contacts;
-
-import com.android.contacts.list.MultiplePhonePickerFragment;
-import com.android.contacts.list.OnMultiplePhoneNumberPickerActionListener;
-
-import android.app.Activity;
-import android.app.FragmentTransaction;
-import android.content.Intent;
-import android.net.Uri;
-import android.os.Bundle;
-import android.os.Parcelable;
-import android.provider.ContactsContract.Intents;
-import android.view.Menu;
-import android.view.MenuInflater;
-
-/**
- * Displays of phone numbers and allows selection of multiple numbers.
- */
-public class MultiplePhonePickerActivity extends Activity {
-
- /**
- * Display only selected recipients or not in MODE_PICK_MULTIPLE_PHONES mode
- */
- private boolean mShowSelectedOnly = false;
-
- private MultiplePhonePickerFragment mListFragment;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- mListFragment = new MultiplePhonePickerFragment();
- mListFragment.setOnMultiplePhoneNumberPickerActionListener(
- new OnMultiplePhoneNumberPickerActionListener() {
-
- public void onPhoneNumbersSelectedAction(Uri[] dataUris) {
- returnActivityResult(dataUris);
- }
-
- public void onFinishAction() {
- finish();
- }
- });
-
- Parcelable[] extras = getIntent().getParcelableArrayExtra(Intents.EXTRA_PHONE_URIS);
- mListFragment.setSelectedUris(extras);
- FragmentTransaction transaction = getFragmentManager().openTransaction();
- transaction.add(android.R.id.content, mListFragment);
- transaction.commit();
- }
-
- @Override
- public void onBackPressed() {
- returnActivityResult(mListFragment.getSelectedUris());
- super.onBackPressed();
- }
-
- @Override
- protected void onSaveInstanceState(Bundle icicle) {
- super.onSaveInstanceState(icicle);
- mListFragment.onSaveInstanceState(icicle);
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- super.onCreateOptionsMenu(menu);
-
- final MenuInflater inflater = getMenuInflater();
- inflater.inflate(R.menu.pick, menu);
- return true;
- }
-
- /*
- @Override
- public boolean onPrepareOptionsMenu(Menu menu) {
- if (mShowSelectedOnly) {
- menu.findItem(R.id.menu_display_selected).setVisible(false);
- menu.findItem(R.id.menu_display_all).setVisible(true);
- menu.findItem(R.id.menu_select_all).setVisible(false);
- menu.findItem(R.id.menu_select_none).setVisible(false);
- return true;
- }
- menu.findItem(R.id.menu_display_all).setVisible(false);
- menu.findItem(R.id.menu_display_selected).setVisible(true);
- if (mUserSelection.isAllSelected()) {
- menu.findItem(R.id.menu_select_all).setVisible(false);
- menu.findItem(R.id.menu_select_none).setVisible(true);
- } else {
- menu.findItem(R.id.menu_select_all).setVisible(true);
- menu.findItem(R.id.menu_select_none).setVisible(false);
- }
- return true;
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
- case R.id.menu_select_all: {
- mUserSelection.setAllPhonesSelected(true);
- checkAll(true);
- updateWidgets(true);
- return true;
- }
- case R.id.menu_select_none: {
- mUserSelection.setAllPhonesSelected(false);
- checkAll(false);
- updateWidgets(true);
- return true;
- }
- case R.id.menu_display_selected: {
- mShowSelectedOnly = true;
- startQuery();
- return true;
- }
- case R.id.menu_display_all: {
- mShowSelectedOnly = false;
- startQuery();
- return true;
- }
- }
- return super.onOptionsItemSelected(item);
- }
-*/
- @Override
- public void startSearch(String initialQuery, boolean selectInitialQuery, Bundle appSearchData,
- boolean globalSearch) {
- // TODO
-// if (mProviderStatus != ProviderStatus.STATUS_NORMAL) {
-// return;
-// }
-//
-// if (globalSearch) {
-// super.startSearch(initialQuery, selectInitialQuery, appSearchData, globalSearch);
-// } else {
-// if (!mSearchMode && (mMode & MODE_MASK_NO_FILTER) == 0) {
-// if ((mMode & MODE_MASK_PICKER) != 0) {
-// Bundle extras = getIntent().getExtras();
-// if (extras == null) {
-// extras = new Bundle();
-// }
-// mUserSelection.fillSelectionForSearchMode(extras);
-// ContactsSearchManager.startSearchForResult(this, initialQuery,
-// SUBACTIVITY_FILTER, extras);
-// } else {
-// ContactsSearchManager.startSearch(this, initialQuery);
-// }
-// }
-// }
- }
-
-// @Override
-// protected void startQuery(Uri uri, String[] projection) {
-// // Filter unknown phone numbers first.
-// mPhoneNumberAdapter.doFilter(null, mShowSelectedOnly);
-// if (mShowSelectedOnly) {
-// StringBuilder idSetBuilder = new StringBuilder();
-// Iterator<Long> itr = mUserSelection.getSelectedPhonIds();
-// if (itr.hasNext()) {
-// idSetBuilder.append(Long.toString(itr.next()));
-// }
-// while (itr.hasNext()) {
-// idSetBuilder.append(',');
-// idSetBuilder.append(Long.toString(itr.next()));
-// }
-// String whereClause = Phone._ID + " IN (" + idSetBuilder.toString() + ")";
-// mQueryHandler.startQuery(QUERY_TOKEN, null, uri, projection, whereClause, null,
-// getSortOrder(projection));
-// } else {
-// mQueryHandler.startQuery(QUERY_TOKEN, null, uri,
-// projection, CLAUSE_ONLY_VISIBLE, null, getSortOrder(projection));
-// }
-// }
-
-// @Override
-// public Cursor doFilter(String filter) {
-// String[] projection = getProjectionForQuery();
-// if (mSearchMode && TextUtils.isEmpty(mListFragment.getQueryString())) {
-// return new MatrixCursor(projection);
-// }
-//
-// final ContentResolver resolver = getContentResolver();
-// // Filter phone numbers as well.
-// mPhoneNumberAdapter.doFilter(filter, mShowSelectedOnly);
-//
-// Uri uri = getUriToQuery();
-// if (!TextUtils.isEmpty(filter)) {
-// uri = Uri.withAppendedPath(Phone.CONTENT_FILTER_URI, Uri.encode(filter));
-// }
-// return resolver.query(uri, projection, CLAUSE_ONLY_VISIBLE, null, getSortOrder(projection));
-// }
-
- public void returnActivityResult(Uri[] dataUris) {
- Intent intent = new Intent();
- intent.putExtra(Intents.EXTRA_PHONE_URIS, dataUris);
- setResult(RESULT_OK, intent);
- finish();
- }
-
- private void checkAll(boolean checked) {
- // TODO fix this. It should iterate over the cursor rather than the views in the list.
- /*
- final ListView listView = getListView();
- int childCount = listView.getChildCount();
- for (int i = 0; i < childCount; i++) {
- final ContactListItemView child = (ContactListItemView)listView.getChildAt(i);
- child.getCheckBoxView().setChecked(checked);
- }
- */
- }
-}
diff --git a/src/com/android/contacts/SplitAggregateView.java b/src/com/android/contacts/SplitAggregateView.java
index a7a56b2..833d819 100644
--- a/src/com/android/contacts/SplitAggregateView.java
+++ b/src/com/android/contacts/SplitAggregateView.java
@@ -16,7 +16,7 @@
package com.android.contacts;
-import com.android.contacts.model.BaseAccountType;
+import com.android.contacts.model.AccountType;
import com.android.contacts.model.AccountTypes;
import android.content.Context;
@@ -247,8 +247,8 @@
cache.additionalData.setText(info.getAdditionalData());
Drawable icon = null;
- BaseAccountType source = mSources.getInflatedSource(info.accountType,
- BaseAccountType.LEVEL_SUMMARY);
+ AccountType source = mSources.getInflatedSource(info.accountType,
+ AccountType.LEVEL_SUMMARY);
if (source != null) {
icon = source.getDisplayIcon(getContext());
}
diff --git a/src/com/android/contacts/activities/ActionBarAdapter.java b/src/com/android/contacts/activities/ActionBarAdapter.java
index a01a9d9..b6c7586 100644
--- a/src/com/android/contacts/activities/ActionBarAdapter.java
+++ b/src/com/android/contacts/activities/ActionBarAdapter.java
@@ -48,8 +48,6 @@
private static final String EXTRA_KEY_SEARCH_MODE = "navBar.searchMode";
private static final String EXTRA_KEY_QUERY = "navBar.query";
- private static final String KEY_MODE_DEFAULT = "mode_default";
-
private boolean mSearchMode;
private String mQueryString;
diff --git a/src/com/android/contacts/interactions/ContactDeletionInteraction.java b/src/com/android/contacts/interactions/ContactDeletionInteraction.java
index f9c3918..4022aba 100644
--- a/src/com/android/contacts/interactions/ContactDeletionInteraction.java
+++ b/src/com/android/contacts/interactions/ContactDeletionInteraction.java
@@ -18,7 +18,7 @@
import com.android.contacts.R;
import com.android.contacts.model.AccountTypes;
-import com.android.contacts.model.BaseAccountType;
+import com.android.contacts.model.AccountType;
import com.google.android.collect.Sets;
import android.app.Activity;
@@ -127,8 +127,8 @@
final String accountType = cursor.getString(COLUMN_INDEX_ACCOUNT_TYPE);
contactId = cursor.getLong(COLUMN_INDEX_CONTACT_ID);
lookupKey = cursor.getString(COLUMN_INDEX_LOOKUP_KEY);
- BaseAccountType contactsSource = sources.getInflatedSource(accountType,
- BaseAccountType.LEVEL_SUMMARY);
+ AccountType contactsSource = sources.getInflatedSource(accountType,
+ AccountType.LEVEL_SUMMARY);
boolean readonly = contactsSource != null && contactsSource.readOnly;
if (readonly) {
readOnlyRawContacts.add(rawContactId);
diff --git a/src/com/android/contacts/interactions/PhoneNumberInteraction.java b/src/com/android/contacts/interactions/PhoneNumberInteraction.java
index ac3c3c8..c9fe0c6 100644
--- a/src/com/android/contacts/interactions/PhoneNumberInteraction.java
+++ b/src/com/android/contacts/interactions/PhoneNumberInteraction.java
@@ -19,9 +19,9 @@
import com.android.contacts.Collapser;
import com.android.contacts.Collapser.Collapsible;
import com.android.contacts.R;
-import com.android.contacts.model.BaseAccountType;
-import com.android.contacts.model.BaseAccountType.DataKind;
-import com.android.contacts.model.BaseAccountType.StringInflater;
+import com.android.contacts.model.AccountType;
+import com.android.contacts.model.AccountType.DataKind;
+import com.android.contacts.model.AccountType.StringInflater;
import com.android.contacts.model.AccountTypes;
import android.app.Activity;
@@ -140,8 +140,8 @@
View view = super.getView(position, convertView, parent);
PhoneItem item = getItem(position);
- BaseAccountType source = mSources.getInflatedSource(item.accountType,
- BaseAccountType.LEVEL_SUMMARY);
+ AccountType source = mSources.getInflatedSource(item.accountType,
+ AccountType.LEVEL_SUMMARY);
// Obtain a string representation of the phone type specific to the
// ContactSource associated with that phone number
diff --git a/src/com/android/contacts/list/ContactListFilterLoader.java b/src/com/android/contacts/list/ContactListFilterLoader.java
index 663a6a8..c0c2fac 100644
--- a/src/com/android/contacts/list/ContactListFilterLoader.java
+++ b/src/com/android/contacts/list/ContactListFilterLoader.java
@@ -17,7 +17,7 @@
package com.android.contacts.list;
import com.android.contacts.model.AccountTypes;
-import com.android.contacts.model.BaseAccountType;
+import com.android.contacts.model.AccountType;
import android.accounts.Account;
import android.content.AsyncTaskLoader;
@@ -69,8 +69,8 @@
final AccountTypes sources = AccountTypes.getInstance(context);
ArrayList<Account> accounts = sources.getAccounts(false);
for (Account account : accounts) {
- BaseAccountType source = sources.getInflatedSource(
- account.type, BaseAccountType.LEVEL_SUMMARY);
+ AccountType source = sources.getInflatedSource(
+ account.type, AccountType.LEVEL_SUMMARY);
Drawable icon = source != null ? source.getDisplayIcon(getContext()) : null;
results.add(new ContactListFilter(account.type, account.name, icon, account.name));
}
diff --git a/src/com/android/contacts/list/CustomContactListFilterActivity.java b/src/com/android/contacts/list/CustomContactListFilterActivity.java
index 6221d08..c836640 100644
--- a/src/com/android/contacts/list/CustomContactListFilterActivity.java
+++ b/src/com/android/contacts/list/CustomContactListFilterActivity.java
@@ -18,7 +18,7 @@
import com.android.contacts.ContactsSearchManager;
import com.android.contacts.R;
-import com.android.contacts.model.BaseAccountType;
+import com.android.contacts.model.AccountType;
import com.android.contacts.model.EntityDelta.ValuesDelta;
import com.android.contacts.model.GoogleAccountType;
import com.android.contacts.model.AccountTypes;
@@ -569,8 +569,8 @@
final AccountDisplay account = (AccountDisplay)this.getGroup(groupPosition);
- final BaseAccountType source = mSources.getInflatedSource(account.mType,
- BaseAccountType.LEVEL_SUMMARY);
+ final AccountType source = mSources.getInflatedSource(account.mType,
+ AccountType.LEVEL_SUMMARY);
text1.setText(account.mName);
text2.setText(source.getDisplayLabel(mContext));
diff --git a/src/com/android/contacts/list/MultiplePhonePickerAdapter.java b/src/com/android/contacts/list/MultiplePhonePickerAdapter.java
deleted file mode 100644
index 1eba085..0000000
--- a/src/com/android/contacts/list/MultiplePhonePickerAdapter.java
+++ /dev/null
@@ -1,361 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-package com.android.contacts.list;
-
-import com.android.contacts.R;
-
-import android.content.ContentUris;
-import android.content.Context;
-import android.database.Cursor;
-import android.net.Uri;
-import android.provider.ContactsContract.CommonDataKinds.Phone;
-import android.text.TextUtils;
-import android.util.SparseIntArray;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.CheckBox;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-
-/**
- * List adapter for the multiple phone picker.
- */
-public class MultiplePhonePickerAdapter extends PhoneNumberListAdapter {
-
- public interface OnSelectionChangeListener {
- void onSelectionChange();
- }
-
- private static final int[] CHIP_COLOR_ARRAY = {
- R.drawable.appointment_indicator_leftside_1,
- R.drawable.appointment_indicator_leftside_2,
- R.drawable.appointment_indicator_leftside_3,
- R.drawable.appointment_indicator_leftside_4,
- R.drawable.appointment_indicator_leftside_5,
- R.drawable.appointment_indicator_leftside_6,
- R.drawable.appointment_indicator_leftside_7,
- R.drawable.appointment_indicator_leftside_8,
- R.drawable.appointment_indicator_leftside_9,
- R.drawable.appointment_indicator_leftside_10,
- R.drawable.appointment_indicator_leftside_11,
- R.drawable.appointment_indicator_leftside_12,
- R.drawable.appointment_indicator_leftside_13,
- R.drawable.appointment_indicator_leftside_14,
- R.drawable.appointment_indicator_leftside_15,
- R.drawable.appointment_indicator_leftside_16,
- R.drawable.appointment_indicator_leftside_17,
- R.drawable.appointment_indicator_leftside_18,
- R.drawable.appointment_indicator_leftside_19,
- R.drawable.appointment_indicator_leftside_20,
- R.drawable.appointment_indicator_leftside_21,
- };
-
- public static final long INVALID_PHONE_ID = -1;
-
- /** The phone numbers */
- private ArrayList<String> mPhoneNumbers = new ArrayList<String>();
-
- /** The selected phone numbers in the PhoneNumberAdapter */
- private HashSet<String> mSelectedPhoneNumbers = new HashSet<String>();
-
- /** The phone numbers after the filtering */
- private ArrayList<String> mFilteredPhoneNumbers = new ArrayList<String>();
-
- /** The PHONE_ID of selected number in user contacts*/
- private HashSet<Long> mSelectedPhoneIds = new HashSet<Long>();
-
- private boolean mSelectionChanged;
-
- private OnSelectionChangeListener mSelectionChangeListener;
-
- /**
- * This is a map from contact ID to color index. A colored chip is used to
- * indicate the number of phone numbers belong to one contact
- */
- private SparseIntArray mContactColor = new SparseIntArray();
-
- public MultiplePhonePickerAdapter(Context context) {
- super(context);
- }
-
- public void setOnSelectionChangeListener(OnSelectionChangeListener listener) {
- this.mSelectionChangeListener = listener;
- }
-
- public void setPhoneNumbers(ArrayList<String> phoneNumbers) {
- mPhoneNumbers.clear();
- mPhoneNumbers.addAll(phoneNumbers);
- }
-
- public int getSelectedCount() {
- return mSelectedPhoneNumbers.size() + mSelectedPhoneIds.size();
- }
-
- public Uri[] getSelectedUris() {
- Uri[] uris = new Uri[mSelectedPhoneNumbers.size() + mSelectedPhoneIds.size()];
- int count = mPhoneNumbers.size();
- int index = 0;
- for (int i = 0; i < count; i++) {
- String phoneNumber = mPhoneNumbers.get(i);
- if (isSelected(phoneNumber)) {
- uris[index++] = Uri.parse("tel:" + phoneNumber);
- }
- }
- for (Long contactId : mSelectedPhoneIds) {
- uris[index++] = ContentUris.withAppendedId(Phone.CONTENT_URI, contactId);
- }
- return uris;
- }
-
- public void setSelectedUris(Uri[] uris) {
- mSelectedPhoneNumbers.clear();
- mSelectedPhoneIds.clear();
- if (uris != null) {
- for (Uri uri : uris) {
- String scheme = uri.getScheme();
- if ("tel".equals(scheme)) {
- String phoneNumber = uri.getSchemeSpecificPart();
- if (!mPhoneNumbers.contains(phoneNumber)) {
- mPhoneNumbers.add(phoneNumber);
- }
- mSelectedPhoneNumbers.add(phoneNumber);
- } else if ("content".equals(scheme)) {
- mSelectedPhoneIds.add(ContentUris.parseId(uri));
- }
- }
- }
- mFilteredPhoneNumbers.clear();
- mFilteredPhoneNumbers.addAll(mPhoneNumbers);
- }
-
- public void toggleSelection(int position) {
- if (position < mFilteredPhoneNumbers.size()) {
- String phoneNumber = mPhoneNumbers.get(position);
- setPhoneSelected(phoneNumber, !isSelected(phoneNumber));
- } else {
- Cursor cursor = ((Cursor)getItem(position));
- cursor.moveToPosition(position - mFilteredPhoneNumbers.size());
- long phoneId = cursor.getLong(PHONE_ID_COLUMN_INDEX);
- setPhoneSelected(phoneId, !isSelected(phoneId));
- }
- notifyDataSetChanged();
- }
-
- public boolean isSelectionChanged() {
- return mSelectionChanged;
- }
-
- public void setSelectionChanged(boolean flag) {
- mSelectionChanged = flag;
- if (mSelectionChangeListener != null) {
- mSelectionChangeListener.onSelectionChange();
- }
- }
-
- public void setPhoneSelected(final String phoneNumber, boolean selected) {
- if (!TextUtils.isEmpty(phoneNumber)) {
- if (selected) {
- mSelectedPhoneNumbers.add(phoneNumber);
- } else {
- mSelectedPhoneNumbers.remove(phoneNumber);
- }
- }
- setSelectionChanged(true);
- }
-
- public void setPhoneSelected(long phoneId, boolean selected) {
- if (selected) {
- mSelectedPhoneIds.add(phoneId);
- } else {
- mSelectedPhoneIds.remove(phoneId);
- }
- setSelectionChanged(true);
- }
-
- public boolean isSelected(long phoneId) {
- return mSelectedPhoneIds.contains(phoneId);
- }
-
- public boolean isSelected(final String phoneNumber) {
- return mSelectedPhoneNumbers.contains(phoneNumber);
- }
-
- public void setAllPhonesSelected(boolean selected) {
-// if (selected) {
-// Cursor cursor = this.mMultiplePhoneSelectionActivity.mAdapter.getCursor();
-// if (cursor != null) {
-// int backupPos = cursor.getPosition();
-// cursor.moveToPosition(-1);
-// while (cursor.moveToNext()) {
-// setPhoneSelected(cursor
-// .getLong(MultiplePhonePickerActivity.PHONE_ID_COLUMN_INDEX), true);
-// }
-// cursor.moveToPosition(backupPos);
-// }
-// for (String number : this.mMultiplePhoneSelectionActivity.mPhoneNumberAdapter
-// .getFilteredPhoneNumbers()) {
-// setPhoneSelected(number, true);
-// }
-// } else {
-// mSelectedPhoneIds.clear();
-// mSelectedPhoneNumbers.clear();
-// }
- }
-
- public boolean isAllSelected() {
- return false;
-// return selectedCount() == this.mMultiplePhoneSelectionActivity.mPhoneNumberAdapter
-// .getFilteredPhoneNumbers().size()
-// + this.mMultiplePhoneSelectionActivity.mAdapter.getCount();
- }
-
- public Iterator<Long> getSelectedPhoneIds() {
- return mSelectedPhoneIds.iterator();
- }
-
- @Override
- public int getItemViewTypeCount() {
- return 2;
- }
-
- @Override
- public int getItemViewType(int position) {
- return position < mPhoneNumbers.size() ? 0 : 1;
- }
-
- // TODO redo as two separate partitions
- @Override
- public View getView(int position, View convertView, ViewGroup parent) {
- View view = null;
-// if (convertView == null || convertView.getTag() == null) {
-// view = newView(getContext(), null, parent);
-// } else {
-// view = convertView;
-// }
-//
-// boolean showingSuggestion = false;
-//
-// if (position < mFilteredPhoneNumbers.size()) {
-// bindExtraPhoneView(view, position);
-// } else {
-// Cursor cursor = ((Cursor)getItem(position));
-// cursor.moveToPosition(position - mFilteredPhoneNumbers.size());
-// bindView(view, getContext(), cursor);
-// }
- return view;
- }
-
- @Override
- protected View newView(Context context, int partition, Cursor cursor, int position,
- ViewGroup parent) {
- final MultiplePhonePickerItemView view = new MultiplePhonePickerItemView(context, null);
- view.setUnknownNameText(getUnknownNameText());
- view.setTextWithHighlightingFactory(getTextWithHighlightingFactory());
- return view;
- }
-
- private void bindExtraPhoneView(View itemView, int position) {
- final MultiplePhonePickerItemView view = (MultiplePhonePickerItemView)itemView;
- String phoneNumber = mFilteredPhoneNumbers.get(position);
- view.getNameTextView().setText(phoneNumber);
- CheckBox checkBox = view.getCheckBoxView();
- checkBox.setChecked(isSelected(phoneNumber));
- view.phoneId = INVALID_PHONE_ID;
- view.phoneNumber = phoneNumber;
- }
-
- @Override
- protected void bindView(View itemView, int partition, Cursor cursor, int position) {
- super.bindView(itemView, partition, cursor, position);
-
- final MultiplePhonePickerItemView view = (MultiplePhonePickerItemView)itemView;
- view.phoneId = Long.valueOf(cursor.getLong(PHONE_ID_COLUMN_INDEX));
- CheckBox checkBox = view.getCheckBoxView();
- checkBox.setChecked(isSelected(view.phoneId));
-
- long contactId = cursor.getLong(PHONE_CONTACT_ID_COLUMN_INDEX);
- view.getChipView().setBackgroundResource(getChipColor(contactId));
- }
-
-// @Override
-// protected void prepareEmptyView() {
-// mMultiplePhonePickerActivity.mEmptyView.show(mMultiplePhonePickerActivity.mSearchMode,
-// true, false, false, false, true, mMultiplePhonePickerActivity.mShowSelectedOnly);
-// }
-
- /**
- * Get assigned chip color resource id for a given contact, 0 is returned if there is no mapped
- * resource.
- */
- public int getChipColor(long contactId) {
- return mContactColor.get((int)contactId);
- }
-
- // TODO filtering
-// public void doFilter(final String constraint, boolean selectedOnly) {
-// if (mPhoneNumbers == null) {
-// return;
-// }
-// mFilteredPhoneNumbers.clear();
-// for (String number : mPhoneNumbers) {
-// if (selectedOnly && !mSelection.isSelected(number) ||
-// !TextUtils.isEmpty(constraint) && !number.startsWith(constraint)) {
-// continue;
-// }
-// mFilteredPhoneNumbers.add(number);
-// }
-// }
-
- @Override
- public int getCount() {
- return super.getCount() + mFilteredPhoneNumbers.size();
- }
-
- @Override
- public void changeCursor(Cursor cursor) {
- super.changeCursor(cursor);
- updateChipColor(cursor);
- }
-
- /**
- * Go through the cursor and assign the chip color to contact who has more
- * than one phone numbers. Assume the cursor is clustered by CONTACT_ID.
- */
- public void updateChipColor(Cursor cursor) {
- if (cursor == null || cursor.getCount() == 0) {
- return;
- }
- mContactColor.clear();
- cursor.moveToFirst();
- int colorIndex = 0;
- long prevContactId = cursor.getLong(PHONE_CONTACT_ID_COLUMN_INDEX);
- while (cursor.moveToNext()) {
- long contactId = cursor.getLong(PHONE_CONTACT_ID_COLUMN_INDEX);
- if (prevContactId == contactId) {
- if (mContactColor.indexOfKey((int)contactId) < 0) {
- mContactColor.put((int)contactId, CHIP_COLOR_ARRAY[colorIndex]);
- colorIndex++;
- if (colorIndex >= CHIP_COLOR_ARRAY.length) {
- colorIndex = 0;
- }
- }
- }
- prevContactId = contactId;
- }
- }
-}
diff --git a/src/com/android/contacts/list/MultiplePhonePickerFragment.java b/src/com/android/contacts/list/MultiplePhonePickerFragment.java
deleted file mode 100644
index bf75a9f..0000000
--- a/src/com/android/contacts/list/MultiplePhonePickerFragment.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-package com.android.contacts.list;
-
-import com.android.contacts.R;
-import com.android.contacts.list.MultiplePhonePickerAdapter.OnSelectionChangeListener;
-
-import android.app.Activity;
-import android.net.Uri;
-import android.os.Bundle;
-import android.os.Parcelable;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.ViewStub;
-import android.view.View.OnClickListener;
-import android.view.animation.AnimationUtils;
-import android.widget.Button;
-
-/**
- * Fragment for the multiple phone picker.
- */
-public class MultiplePhonePickerFragment
- extends ContactEntryListFragment<MultiplePhonePickerAdapter>
- implements OnClickListener, OnSelectionChangeListener {
-
- private static final String SELECTION_EXTRA_KEY = "selection";
- private static final String SELECTION_CHANGED_EXTRA_KEY = "selectionChanged";
-
- private OnMultiplePhoneNumberPickerActionListener mListener;
-
- /**
- * UI control of action panel in MODE_PICK_MULTIPLE_PHONES mode.
- */
- private View mFooterView;
-
- private Uri[] mSelectedUris;
- private boolean mSelectionChanged;
-
- public MultiplePhonePickerFragment() {
- setSectionHeaderDisplayEnabled(false);
- setPhotoLoaderEnabled(true);
- }
-
- public void setOnMultiplePhoneNumberPickerActionListener(
- OnMultiplePhoneNumberPickerActionListener listener) {
- mListener = listener;
- }
-
- public Uri[] getSelectedUris() {
- return getAdapter().getSelectedUris();
- }
-
- public void setSelectedUris(Parcelable[] extras) {
- Uri[] uris = new Uri[extras == null ? 0 : extras.length];
- if (extras != null) {
- for (int i = 0; i < extras.length; i++) {
- uris[i] = (Uri)extras[i];
- }
- }
- setSelectedUris(uris);
- }
-
- public void setSelectedUris(Uri[] uris) {
- mSelectedUris = uris;
- MultiplePhonePickerAdapter adapter = getAdapter();
- if (adapter != null) {
- adapter.setSelectedUris(uris);
- }
- }
-
- @Override
- protected MultiplePhonePickerAdapter createListAdapter() {
- return new MultiplePhonePickerAdapter(getActivity());
- }
-
- @Override
- protected void configureAdapter() {
- super.configureAdapter();
- MultiplePhonePickerAdapter adapter = getAdapter();
- adapter.setSelectedUris(mSelectedUris);
- adapter.setSelectionChanged(mSelectionChanged);
- adapter.setOnSelectionChangeListener(this);
- }
-
- @Override
- protected View inflateView(LayoutInflater inflater, ViewGroup container) {
- View view = inflater.inflate(R.layout.contacts_list_content, null);
- ViewStub stub = (ViewStub)view.findViewById(R.id.footer_stub);
- if (stub != null) {
- View stubView = stub.inflate();
- mFooterView = stubView.findViewById(R.id.footer);
- mFooterView.setVisibility(View.GONE);
- Button doneButton = (Button) stubView.findViewById(R.id.done);
- doneButton.setOnClickListener(this);
- Button revertButton = (Button) stubView.findViewById(R.id.revert);
- revertButton.setOnClickListener(this);
- }
- return view;
- }
-
- @Override
- protected void onItemClick(int position, long id) {
- getAdapter().toggleSelection(position);
- }
-
- public void onClick(View v) {
- int id = v.getId();
- switch (id) {
- case R.id.done:
- mListener.onPhoneNumbersSelectedAction(getAdapter().getSelectedUris());
- break;
- case R.id.revert:
- mListener.onFinishAction();
- break;
- }
- }
-
- @Override
- public void onCreate(Bundle savedState) {
- super.onCreate(savedState);
- if (savedState != null) {
- setSelectedUris(savedState.getParcelableArray(SELECTION_EXTRA_KEY));
- mSelectionChanged = savedState.getBoolean(SELECTION_CHANGED_EXTRA_KEY, false);
- if (getAdapter() != null) {
- getAdapter().setSelectionChanged(mSelectionChanged);
- }
- }
- }
-
- @Override
- public void onResume() {
- super.onResume();
- updateWidgets();
- }
-
- public void onSelectionChange() {
- updateWidgets();
- }
-
- private void updateWidgets() {
- int selected = getAdapter().getSelectedCount();
-
- Activity context = getActivity();
- if (selected >= 1) {
- final String format = context.getResources().getQuantityString(
- R.plurals.multiple_picker_title, selected);
-
- // TODO: turn this into a callback
- context.setTitle(String.format(format, selected));
- } else {
- // TODO: turn this into a callback
- context.setTitle(context.getString(R.string.contactsList));
- }
-
- if (getAdapter().isSelectionChanged() && mFooterView.getVisibility() == View.GONE) {
- mFooterView.setVisibility(View.VISIBLE);
- mFooterView.startAnimation(AnimationUtils.loadAnimation(context, R.anim.footer_appear));
- }
- }
-
- @Override
- public void onSaveInstanceState(Bundle icicle) {
- super.onSaveInstanceState(icicle);
- icicle.putParcelableArray(SELECTION_EXTRA_KEY, getAdapter().getSelectedUris());
- icicle.putBoolean(SELECTION_CHANGED_EXTRA_KEY, getAdapter().isSelectionChanged());
- }
-}
diff --git a/src/com/android/contacts/list/MultiplePhonePickerItemView.java b/src/com/android/contacts/list/MultiplePhonePickerItemView.java
deleted file mode 100644
index 87f53bf..0000000
--- a/src/com/android/contacts/list/MultiplePhonePickerItemView.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-package com.android.contacts.list;
-
-import com.android.contacts.R;
-
-import android.content.Context;
-import android.content.res.TypedArray;
-import android.util.AttributeSet;
-import android.view.View;
-import android.widget.CheckBox;
-
-/**
- * A custom view for an item in the phone multi-picker list.
- */
-public class MultiplePhonePickerItemView extends ContactListItemView {
-
- // Used to indicate the sequence of phones belong to the same contact in multi-picker
- private View mChipView;
- // Used to select the phone in multi-picker
- private CheckBox mCheckBox;
-
- private int mChipWidth;
- private int mChipRightMargin;
- private int mCheckBoxMargin;
-
- public long phoneId;
- // phoneNumber only validates when phoneId = INVALID_PHONE_ID
- public String phoneNumber;
-
- public MultiplePhonePickerItemView(Context context, AttributeSet attrs) {
- super(context, attrs);
- TypedArray a = getContext().obtainStyledAttributes(
- attrs, R.styleable.MultiplePhonePickerItemView);
- mChipWidth = a.getDimensionPixelOffset(
- R.styleable.MultiplePhonePickerItemView_list_item_header_chip_width, 0);
- mChipRightMargin = a.getDimensionPixelOffset(
- R.styleable.MultiplePhonePickerItemView_list_item_header_chip_right_margin, 0);
- mCheckBoxMargin = a.getDimensionPixelOffset(
- R.styleable.MultiplePhonePickerItemView_list_item_header_checkbox_margin, 0);
- a.recycle();
- }
-
- @Override
- protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- if (isVisible(mChipView)) {
- mChipView.measure(0, 0);
- }
-
- if (isVisible(mCheckBox)) {
- mCheckBox.measure(0, 0);
- }
-
- super.onMeasure(widthMeasureSpec, heightMeasureSpec);
- }
-
- @Override
- protected int layoutLeftSide(int height, int topBound, int bottomBound, int leftBound) {
- if (mChipView != null) {
- mChipView.layout(leftBound, topBound, leftBound + mChipWidth, height);
- leftBound += mChipWidth + mChipRightMargin;
- }
-
- return super.layoutLeftSide(height, topBound, bottomBound, leftBound);
- }
-
- @Override
- protected int layoutRightSide(int height, int topBound, int rightBound) {
- rightBound = super.layoutRightSide(height, topBound, rightBound);
-
- if (isVisible(mCheckBox)) {
- int checkBoxWidth = mCheckBox.getMeasuredWidth();
- int checkBoxHight = mCheckBox.getMeasuredHeight();
- rightBound -= mCheckBoxMargin + checkBoxWidth;
- int checkBoxTop = topBound + (height - topBound - checkBoxHight) / 2;
- mCheckBox.layout(
- rightBound,
- checkBoxTop,
- rightBound + checkBoxWidth,
- checkBoxTop + checkBoxHight);
- }
-
- return rightBound;
- }
-
- /**
- * Returns the chip view for the multipicker, creating it if necessary.
- */
- public View getChipView() {
- if (mChipView == null) {
- mChipView = new View(mContext);
- addView(mChipView);
- }
- return mChipView;
- }
-
- /**
- * Returns the CheckBox view for the multipicker, creating it if necessary.
- */
- public CheckBox getCheckBoxView() {
- if (mCheckBox == null) {
- mCheckBox = new CheckBox(mContext);
- mCheckBox.setClickable(false);
- mCheckBox.setFocusable(false);
- addView(mCheckBox);
- }
- return mCheckBox;
- }
-}
diff --git a/src/com/android/contacts/model/BaseAccountType.java b/src/com/android/contacts/model/AccountType.java
similarity index 96%
rename from src/com/android/contacts/model/BaseAccountType.java
rename to src/com/android/contacts/model/AccountType.java
index 7ebf3d0..e6d8987 100644
--- a/src/com/android/contacts/model/BaseAccountType.java
+++ b/src/com/android/contacts/model/AccountType.java
@@ -47,7 +47,7 @@
* <p>
* In the future this may be inflated from XML defined by a data source.
*/
-public abstract class BaseAccountType {
+public abstract class AccountType {
/**
* The {@link RawContacts#ACCOUNT_TYPE} these constraints apply to.
*/
@@ -92,7 +92,7 @@
}
/**
- * Ensure that this {@link BaseAccountType} has been inflated to the
+ * Ensure that this {@link AccountType} has been inflated to the
* requested level.
*/
public synchronized void ensureInflated(Context context, int inflateLevel) {
@@ -108,7 +108,7 @@
protected abstract void inflate(Context context, int inflateLevel);
/**
- * Invalidate any cache for this {@link BaseAccountType}, removing all
+ * Invalidate any cache for this {@link AccountType}, removing all
* inflated data. Calling {@link #ensureInflated(Context, int)} will
* populate again from scratch.
*/
@@ -271,6 +271,11 @@
public int specificMax;
public String customColumn;
+ /**
+ * True if this type may be shown as blank.
+ */
+ public boolean unspecifiedType;
+
public EditType(int rawValue, int labelRes) {
this.rawValue = rawValue;
this.labelRes = labelRes;
@@ -292,6 +297,11 @@
return this;
}
+ public EditType setUnspecifiedType(boolean unspecifiedType) {
+ this.unspecifiedType = unspecifiedType;
+ return this;
+ }
+
@Override
public boolean equals(Object object) {
if (object instanceof EditType) {
diff --git a/src/com/android/contacts/model/AccountTypes.java b/src/com/android/contacts/model/AccountTypes.java
index f7a49a4..9b282fb 100644
--- a/src/com/android/contacts/model/AccountTypes.java
+++ b/src/com/android/contacts/model/AccountTypes.java
@@ -16,7 +16,7 @@
package com.android.contacts.model;
-import com.android.contacts.model.BaseAccountType.DataKind;
+import com.android.contacts.model.AccountType.DataKind;
import com.google.android.collect.Lists;
import com.google.android.collect.Maps;
import com.google.android.collect.Sets;
@@ -44,7 +44,7 @@
import java.util.HashSet;
/**
- * Singleton holder for all parsed {@link BaseAccountType} available on the
+ * Singleton holder for all parsed {@link AccountType} available on the
* system, typically filled through {@link PackageManager} queries.
*/
public class AccountTypes extends BroadcastReceiver implements OnAccountsUpdateListener {
@@ -54,9 +54,9 @@
private Context mApplicationContext;
private AccountManager mAccountManager;
- private BaseAccountType mFallbackSource = null;
+ private AccountType mFallbackSource = null;
- private HashMap<String, BaseAccountType> mSources = Maps.newHashMap();
+ private HashMap<String, AccountType> mSources = Maps.newHashMap();
private HashSet<String> mKnownPackages = Sets.newHashSet();
private static SoftReference<AccountTypes> sInstance = null;
@@ -107,13 +107,13 @@
}
/** @hide exposed for unit tests */
- public AccountTypes(BaseAccountType... sources) {
- for (BaseAccountType source : sources) {
+ public AccountTypes(AccountType... sources) {
+ for (AccountType source : sources) {
addSource(source);
}
}
- protected void addSource(BaseAccountType source) {
+ protected void addSource(AccountType source) {
mSources.put(source.accountType, source);
mKnownPackages.add(source.resPackageName);
}
@@ -155,7 +155,7 @@
}
protected void invalidateCache(String packageName) {
- for (BaseAccountType source : mSources.values()) {
+ for (AccountType source : mSources.values()) {
if (TextUtils.equals(packageName, source.resPackageName)) {
// Invalidate any cache for the changed package
source.invalidateCache();
@@ -165,7 +165,7 @@
protected void invalidateAllCache() {
mFallbackSource.invalidateCache();
- for (BaseAccountType source : mSources.values()) {
+ for (AccountType source : mSources.values()) {
source.invalidateCache();
}
}
@@ -201,7 +201,7 @@
final String accountType = sync.accountType;
final AuthenticatorDescription auth = findAuthenticator(auths, accountType);
- BaseAccountType source;
+ AccountType source;
if (GoogleAccountType.ACCOUNT_TYPE.equals(accountType)) {
source = new GoogleAccountType(auth.packageName);
} else if (ExchangeAccountType.ACCOUNT_TYPE.equals(accountType)) {
@@ -240,7 +240,7 @@
}
/**
- * Return list of all known, writable {@link BaseAccountType}. AccountTypes
+ * Return list of all known, writable {@link AccountType}. AccountTypes
* returned may require inflation before they can be used.
*/
public ArrayList<Account> getAccounts(boolean writableOnly) {
@@ -263,8 +263,8 @@
// account.name, account.type, syncable));
if (syncable) {
// Ensure we have details loaded for each account
- final BaseAccountType accountType = getInflatedSource(account.type,
- BaseAccountType.LEVEL_SUMMARY);
+ final AccountType accountType = getInflatedSource(account.type,
+ AccountType.LEVEL_SUMMARY);
final boolean hasContacts = accountType != null;
final boolean matchesWritable =
(!writableOnly || (writableOnly && !accountType.readOnly));
@@ -278,7 +278,7 @@
/**
* Find the best {@link DataKind} matching the requested
- * {@link BaseAccountType#accountType} and {@link DataKind#mimeType}. If no
+ * {@link AccountType#accountType} and {@link DataKind#mimeType}. If no
* direct match found, we try searching {@link #mFallbackSource}.
* When fourceRefresh is set to true, cache is refreshed and inflation of each
* EditField will occur.
@@ -288,7 +288,7 @@
DataKind kind = null;
// Try finding source and kind matching request
- final BaseAccountType source = mSources.get(accountType);
+ final AccountType source = mSources.get(accountType);
if (source != null) {
source.ensureInflated(context, inflateLevel);
kind = source.getKindForMimetype(mimeType);
@@ -308,11 +308,11 @@
}
/**
- * Return {@link BaseAccountType} for the given account type.
+ * Return {@link AccountType} for the given account type.
*/
- public BaseAccountType getInflatedSource(String accountType, int inflateLevel) {
+ public AccountType getInflatedSource(String accountType, int inflateLevel) {
// Try finding specific source, otherwise use fallback
- BaseAccountType source = mSources.get(accountType);
+ AccountType source = mSources.get(accountType);
if (source == null) source = mFallbackSource;
if (source.isInflated(inflateLevel)) {
diff --git a/src/com/android/contacts/model/EntityModifier.java b/src/com/android/contacts/model/EntityModifier.java
index 8765a3f..a990a11 100644
--- a/src/com/android/contacts/model/EntityModifier.java
+++ b/src/com/android/contacts/model/EntityModifier.java
@@ -17,9 +17,9 @@
package com.android.contacts.model;
import com.android.contacts.ContactsUtils;
-import com.android.contacts.model.BaseAccountType.DataKind;
-import com.android.contacts.model.BaseAccountType.EditField;
-import com.android.contacts.model.BaseAccountType.EditType;
+import com.android.contacts.model.AccountType.DataKind;
+import com.android.contacts.model.AccountType.EditField;
+import com.android.contacts.model.AccountType.EditType;
import com.android.contacts.model.EntityDelta.ValuesDelta;
import com.google.android.collect.Lists;
@@ -51,7 +51,7 @@
/**
* Helper methods for modifying an {@link EntityDelta}, such as inserting
- * new rows, or enforcing {@link BaseAccountType}.
+ * new rows, or enforcing {@link AccountType}.
*/
public class EntityModifier {
private static final String TAG = "EntityModifier";
@@ -59,7 +59,7 @@
/**
* For the given {@link EntityDelta}, determine if the given
* {@link DataKind} could be inserted under specific
- * {@link BaseAccountType}.
+ * {@link AccountType}.
*/
public static boolean canInsert(EntityDelta state, DataKind kind) {
// Insert possible when have valid types and under overall maximum
@@ -82,7 +82,7 @@
* Ensure that at least one of the given {@link DataKind} exists in the
* given {@link EntityDelta} state, and try creating one if none exist.
*/
- public static void ensureKindExists(EntityDelta state, BaseAccountType source, String mimeType) {
+ public static void ensureKindExists(EntityDelta state, AccountType source, String mimeType) {
final DataKind kind = source.getKindForMimetype(mimeType);
final boolean hasChild = state.getMimeEntriesCount(mimeType, true) > 0;
@@ -98,7 +98,7 @@
/**
* For the given {@link EntityDelta} and {@link DataKind}, return the
* list possible {@link EditType} options available based on
- * {@link BaseAccountType}.
+ * {@link AccountType}.
*/
public static ArrayList<EditType> getValidTypes(EntityDelta state, DataKind kind) {
return getValidTypes(state, kind, null, true, null);
@@ -107,7 +107,7 @@
/**
* For the given {@link EntityDelta} and {@link DataKind}, return the
* list possible {@link EditType} options available based on
- * {@link BaseAccountType}.
+ * {@link AccountType}.
*
* @param forceInclude Always include this {@link EditType} in the returned
* list, even when an otherwise-invalid choice. This is useful
@@ -121,7 +121,7 @@
/**
* For the given {@link EntityDelta} and {@link DataKind}, return the
* list possible {@link EditType} options available based on
- * {@link BaseAccountType}.
+ * {@link AccountType}.
*
* @param forceInclude Always include this {@link EditType} in the returned
* list, even when an otherwise-invalid choice. This is useful
@@ -351,24 +351,24 @@
* Processing to trim any empty {@link ValuesDelta} and {@link EntityDelta}
* from the given {@link EntityDeltaList}, assuming the given {@link AccountTypes}
* dictates the structure for various fields. This method ignores rows not
- * described by the {@link BaseAccountType}.
+ * described by the {@link AccountType}.
*/
public static void trimEmpty(EntityDeltaList set, AccountTypes sources) {
for (EntityDelta state : set) {
final String accountType = state.getValues().getAsString(RawContacts.ACCOUNT_TYPE);
- final BaseAccountType source = sources.getInflatedSource(accountType,
- BaseAccountType.LEVEL_MIMETYPES);
+ final AccountType source = sources.getInflatedSource(accountType,
+ AccountType.LEVEL_MIMETYPES);
trimEmpty(state, source);
}
}
/**
* Processing to trim any empty {@link ValuesDelta} rows from the given
- * {@link EntityDelta}, assuming the given {@link BaseAccountType} dictates
+ * {@link EntityDelta}, assuming the given {@link AccountType} dictates
* the structure for various fields. This method ignores rows not described
- * by the {@link BaseAccountType}.
+ * by the {@link AccountType}.
*/
- public static void trimEmpty(EntityDelta state, BaseAccountType source) {
+ public static void trimEmpty(EntityDelta state, AccountType source) {
boolean hasValues = false;
// Walk through entries for each well-known kind
@@ -448,7 +448,7 @@
* Parse the given {@link Bundle} into the given {@link EntityDelta} state,
* assuming the extras defined through {@link Intents}.
*/
- public static void parseExtras(Context context, BaseAccountType source, EntityDelta state,
+ public static void parseExtras(Context context, AccountType source, EntityDelta state,
Bundle extras) {
if (extras == null || extras.size() == 0) {
// Bail early if no useful data
@@ -543,7 +543,7 @@
}
private static void parseValues(
- EntityDelta state, BaseAccountType source, ArrayList<ContentValues> dataValueList) {
+ EntityDelta state, AccountType source, ArrayList<ContentValues> dataValueList) {
for (ContentValues values : dataValueList) {
String mimeType = values.getAsString(Data.MIMETYPE);
if (TextUtils.isEmpty(mimeType)) {
diff --git a/src/com/android/contacts/model/ExchangeAccountType.java b/src/com/android/contacts/model/ExchangeAccountType.java
index c3b48c4..cd4b1f9 100644
--- a/src/com/android/contacts/model/ExchangeAccountType.java
+++ b/src/com/android/contacts/model/ExchangeAccountType.java
@@ -68,9 +68,9 @@
@Override
protected DataKind inflateStructuredName(Context context, int inflateLevel) {
- final DataKind kind = super.inflateStructuredName(context, BaseAccountType.LEVEL_MIMETYPES);
+ final DataKind kind = super.inflateStructuredName(context, AccountType.LEVEL_MIMETYPES);
- if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= AccountType.LEVEL_CONSTRAINTS) {
boolean displayOrderPrimary =
context.getResources().getBoolean(R.bool.config_editor_field_order_primary);
kind.typeOverallMax = 1;
@@ -112,9 +112,9 @@
@Override
protected DataKind inflateNickname(Context context, int inflateLevel) {
- final DataKind kind = super.inflateNickname(context, BaseAccountType.LEVEL_MIMETYPES);
+ final DataKind kind = super.inflateNickname(context, AccountType.LEVEL_MIMETYPES);
- if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= AccountType.LEVEL_CONSTRAINTS) {
kind.isList = false;
kind.fieldList = Lists.newArrayList();
@@ -127,9 +127,9 @@
@Override
protected DataKind inflatePhone(Context context, int inflateLevel) {
- final DataKind kind = super.inflatePhone(context, BaseAccountType.LEVEL_MIMETYPES);
+ final DataKind kind = super.inflatePhone(context, AccountType.LEVEL_MIMETYPES);
- if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= AccountType.LEVEL_CONSTRAINTS) {
kind.typeColumn = Phone.TYPE;
kind.typeList = Lists.newArrayList();
kind.typeList.add(buildPhoneType(Phone.TYPE_HOME).setSpecificMax(2));
@@ -159,9 +159,9 @@
@Override
protected DataKind inflateEmail(Context context, int inflateLevel) {
- final DataKind kind = super.inflateEmail(context, BaseAccountType.LEVEL_MIMETYPES);
+ final DataKind kind = super.inflateEmail(context, AccountType.LEVEL_MIMETYPES);
- if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= AccountType.LEVEL_CONSTRAINTS) {
kind.typeOverallMax = 3;
kind.fieldList = Lists.newArrayList();
@@ -173,9 +173,9 @@
@Override
protected DataKind inflateStructuredPostal(Context context, int inflateLevel) {
- final DataKind kind = super.inflateStructuredPostal(context, BaseAccountType.LEVEL_MIMETYPES);
+ final DataKind kind = super.inflateStructuredPostal(context, AccountType.LEVEL_MIMETYPES);
- if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= AccountType.LEVEL_CONSTRAINTS) {
final boolean useJapaneseOrder =
Locale.JAPANESE.getLanguage().equals(Locale.getDefault().getLanguage());
kind.typeColumn = StructuredPostal.TYPE;
@@ -215,30 +215,15 @@
@Override
protected DataKind inflateIm(Context context, int inflateLevel) {
- final DataKind kind = super.inflateIm(context, BaseAccountType.LEVEL_MIMETYPES);
+ final DataKind kind = super.inflateIm(context, AccountType.LEVEL_MIMETYPES);
- if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= AccountType.LEVEL_CONSTRAINTS) {
+ // Types are not supported for IM. There can be 3 IMs, but OWA only shows only the first
kind.typeOverallMax = 3;
- // NOTE: even though a traditional "type" exists, for editing
- // purposes we're using the protocol to pick labels
-
kind.defaultValues = new ContentValues();
kind.defaultValues.put(Im.TYPE, Im.TYPE_OTHER);
- kind.typeColumn = Im.PROTOCOL;
- kind.typeList = Lists.newArrayList();
- kind.typeList.add(buildImType(Im.PROTOCOL_AIM));
- kind.typeList.add(buildImType(Im.PROTOCOL_MSN));
- kind.typeList.add(buildImType(Im.PROTOCOL_YAHOO));
- kind.typeList.add(buildImType(Im.PROTOCOL_SKYPE));
- kind.typeList.add(buildImType(Im.PROTOCOL_QQ));
- kind.typeList.add(buildImType(Im.PROTOCOL_GOOGLE_TALK));
- kind.typeList.add(buildImType(Im.PROTOCOL_ICQ));
- kind.typeList.add(buildImType(Im.PROTOCOL_JABBER));
- kind.typeList.add(buildImType(Im.PROTOCOL_CUSTOM).setSecondary(true).setCustomColumn(
- Im.CUSTOM_PROTOCOL));
-
kind.fieldList = Lists.newArrayList();
kind.fieldList.add(new EditField(Im.DATA, R.string.imLabelsGroup, FLAGS_EMAIL));
}
@@ -248,9 +233,9 @@
@Override
protected DataKind inflateOrganization(Context context, int inflateLevel) {
- final DataKind kind = super.inflateOrganization(context, BaseAccountType.LEVEL_MIMETYPES);
+ final DataKind kind = super.inflateOrganization(context, AccountType.LEVEL_MIMETYPES);
- if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= AccountType.LEVEL_CONSTRAINTS) {
kind.isList = false;
kind.fieldList = Lists.newArrayList();
@@ -265,9 +250,9 @@
@Override
protected DataKind inflatePhoto(Context context, int inflateLevel) {
- final DataKind kind = super.inflatePhoto(context, BaseAccountType.LEVEL_MIMETYPES);
+ final DataKind kind = super.inflatePhoto(context, AccountType.LEVEL_MIMETYPES);
- if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= AccountType.LEVEL_CONSTRAINTS) {
kind.typeOverallMax = 1;
kind.fieldList = Lists.newArrayList();
@@ -279,9 +264,9 @@
@Override
protected DataKind inflateNote(Context context, int inflateLevel) {
- final DataKind kind = super.inflateNote(context, BaseAccountType.LEVEL_MIMETYPES);
+ final DataKind kind = super.inflateNote(context, AccountType.LEVEL_MIMETYPES);
- if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= AccountType.LEVEL_CONSTRAINTS) {
kind.fieldList = Lists.newArrayList();
kind.fieldList.add(new EditField(Note.NOTE, R.string.label_notes, FLAGS_NOTE));
}
@@ -315,9 +300,9 @@
@Override
protected DataKind inflateWebsite(Context context, int inflateLevel) {
- final DataKind kind = super.inflateWebsite(context, BaseAccountType.LEVEL_MIMETYPES);
+ final DataKind kind = super.inflateWebsite(context, AccountType.LEVEL_MIMETYPES);
- if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= AccountType.LEVEL_CONSTRAINTS) {
kind.isList = false;
kind.fieldList = Lists.newArrayList();
diff --git a/src/com/android/contacts/model/ExternalAccountType.java b/src/com/android/contacts/model/ExternalAccountType.java
index ee6f603..5e0d853 100644
--- a/src/com/android/contacts/model/ExternalAccountType.java
+++ b/src/com/android/contacts/model/ExternalAccountType.java
@@ -87,7 +87,7 @@
}
/**
- * Ensure that the constraint rules behind this {@link BaseAccountType} have
+ * Ensure that the constraint rules behind this {@link AccountType} have
* been inflated. Because this may involve parsing meta-data from
* {@link PackageManager}, it shouldn't be called from a UI thread.
*/
@@ -113,7 +113,7 @@
}
/**
- * Inflate this {@link BaseAccountType} from the given parser. This may only
+ * Inflate this {@link AccountType} from the given parser. This may only
* load details matching the publicly-defined schema.
*/
protected void inflate(Context context, XmlPullParser parser) {
diff --git a/src/com/android/contacts/model/FallbackAccountType.java b/src/com/android/contacts/model/FallbackAccountType.java
index 314e1a6..601e77e 100644
--- a/src/com/android/contacts/model/FallbackAccountType.java
+++ b/src/com/android/contacts/model/FallbackAccountType.java
@@ -40,7 +40,7 @@
import android.provider.ContactsContract.CommonDataKinds.Website;
import android.view.inputmethod.EditorInfo;
-public class FallbackAccountType extends BaseAccountType {
+public class FallbackAccountType extends AccountType {
protected static final int FLAGS_PHONE = EditorInfo.TYPE_CLASS_PHONE;
protected static final int FLAGS_EMAIL = EditorInfo.TYPE_CLASS_TEXT
| EditorInfo.TYPE_TEXT_VARIATION_EMAIL_ADDRESS;
@@ -89,23 +89,28 @@
}
protected EditType buildPhoneType(int type) {
- return new EditType(type, Phone.getTypeLabelResource(type));
+ return new EditType(type, Phone.getTypeLabelResource(type))
+ .setUnspecifiedType(type == Phone.TYPE_OTHER);
}
protected EditType buildEmailType(int type) {
- return new EditType(type, Email.getTypeLabelResource(type));
+ return new EditType(type, Email.getTypeLabelResource(type))
+ .setUnspecifiedType(type == Email.TYPE_OTHER);
}
protected EditType buildPostalType(int type) {
- return new EditType(type, StructuredPostal.getTypeLabelResource(type));
+ return new EditType(type, StructuredPostal.getTypeLabelResource(type))
+ .setUnspecifiedType(type == StructuredPostal.TYPE_OTHER);
}
protected EditType buildImType(int type) {
- return new EditType(type, Im.getProtocolLabelResource(type));
+ return new EditType(type, Im.getProtocolLabelResource(type))
+ .setUnspecifiedType(type == Im.TYPE_OTHER);
}
- protected EventEditType buildEventType(int type, boolean yearOptional) {
- return new EventEditType(type, Event.getTypeResource(type)).setYearOptional(yearOptional);
+ protected EditType buildEventType(int type, boolean yearOptional) {
+ return new EventEditType(type, Event.getTypeResource(type)).setYearOptional(yearOptional)
+ .setUnspecifiedType(type == Event.TYPE_OTHER);
}
protected EditType buildRelationType(int type) {
@@ -121,7 +126,7 @@
kind.actionBody = new SimpleInflater(Nickname.NAME);
}
- if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= AccountType.LEVEL_CONSTRAINTS) {
kind.fieldList = Lists.newArrayList();
kind.fieldList.add(new EditField(StructuredName.DISPLAY_NAME,
R.string.full_name, FLAGS_PERSON_NAME).setShortForm(true));
@@ -179,7 +184,7 @@
kind.actionBody = new SimpleInflater(Nickname.NAME);
}
- if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= AccountType.LEVEL_CONSTRAINTS) {
kind.defaultValues = new ContentValues();
kind.defaultValues.put(Nickname.TYPE, Nickname.TYPE_DEFAULT);
@@ -202,7 +207,7 @@
kind.actionBody = new SimpleInflater(Phone.NUMBER);
}
- if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= AccountType.LEVEL_CONSTRAINTS) {
kind.typeColumn = Phone.TYPE;
kind.typeList = Lists.newArrayList();
kind.typeList.add(buildPhoneType(Phone.TYPE_HOME));
@@ -245,7 +250,7 @@
kind.actionBody = new SimpleInflater(Email.DATA);
}
- if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= AccountType.LEVEL_CONSTRAINTS) {
kind.typeColumn = Email.TYPE;
kind.typeList = Lists.newArrayList();
kind.typeList.add(buildEmailType(Email.TYPE_HOME));
@@ -271,7 +276,7 @@
kind.actionBody = new SimpleInflater(StructuredPostal.FORMATTED_ADDRESS);
}
- if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= AccountType.LEVEL_CONSTRAINTS) {
kind.typeColumn = StructuredPostal.TYPE;
kind.typeList = Lists.newArrayList();
kind.typeList.add(buildPostalType(StructuredPostal.TYPE_HOME));
@@ -298,7 +303,7 @@
kind.actionBody = new SimpleInflater(Im.DATA);
}
- if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= AccountType.LEVEL_CONSTRAINTS) {
// NOTE: even though a traditional "type" exists, for editing
// purposes we're using the protocol to pick labels
@@ -334,7 +339,7 @@
kind.actionBody = new SimpleInflater(Organization.TITLE);
}
- if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= AccountType.LEVEL_CONSTRAINTS) {
kind.isList = false;
kind.fieldList = Lists.newArrayList();
@@ -353,7 +358,7 @@
kind = addKind(new DataKind(Photo.CONTENT_ITEM_TYPE, -1, -1, -1, true));
}
- if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= AccountType.LEVEL_CONSTRAINTS) {
kind.fieldList = Lists.newArrayList();
kind.fieldList.add(new EditField(Photo.PHOTO, -1, -1));
}
@@ -371,7 +376,7 @@
kind.actionBody = new SimpleInflater(Note.NOTE);
}
- if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= AccountType.LEVEL_CONSTRAINTS) {
kind.fieldList = Lists.newArrayList();
kind.fieldList.add(new EditField(Note.NOTE, R.string.label_notes, FLAGS_NOTE));
}
@@ -388,7 +393,7 @@
kind.actionBody = new SimpleInflater(Website.URL);
}
- if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= AccountType.LEVEL_CONSTRAINTS) {
kind.defaultValues = new ContentValues();
kind.defaultValues.put(Website.TYPE, Website.TYPE_OTHER);
@@ -419,7 +424,7 @@
kind.actionBody = new SimpleInflater(SipAddress.SIP_ADDRESS);
}
- if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= AccountType.LEVEL_CONSTRAINTS) {
kind.fieldList = Lists.newArrayList();
kind.fieldList.add(new EditField(SipAddress.SIP_ADDRESS,
R.string.label_sip_address, FLAGS_SIP_ADDRESS));
@@ -437,7 +442,7 @@
kind.isList = false;
}
- if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= AccountType.LEVEL_CONSTRAINTS) {
kind.fieldList = Lists.newArrayList();
kind.fieldList.add(new EditField(GroupMembership.GROUP_ROW_ID, -1, -1));
}
diff --git a/src/com/android/contacts/model/GoogleAccountType.java b/src/com/android/contacts/model/GoogleAccountType.java
index 5610147..cd14696 100644
--- a/src/com/android/contacts/model/GoogleAccountType.java
+++ b/src/com/android/contacts/model/GoogleAccountType.java
@@ -50,9 +50,9 @@
@Override
protected DataKind inflatePhone(Context context, int inflateLevel) {
- final DataKind kind = super.inflatePhone(context, BaseAccountType.LEVEL_MIMETYPES);
+ final DataKind kind = super.inflatePhone(context, AccountType.LEVEL_MIMETYPES);
- if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= AccountType.LEVEL_CONSTRAINTS) {
kind.typeColumn = Phone.TYPE;
kind.typeList = Lists.newArrayList();
kind.typeList.add(buildPhoneType(Phone.TYPE_HOME));
@@ -74,9 +74,9 @@
@Override
protected DataKind inflateEmail(Context context, int inflateLevel) {
- final DataKind kind = super.inflateEmail(context, BaseAccountType.LEVEL_MIMETYPES);
+ final DataKind kind = super.inflateEmail(context, AccountType.LEVEL_MIMETYPES);
- if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= AccountType.LEVEL_CONSTRAINTS) {
kind.typeColumn = Email.TYPE;
kind.typeList = Lists.newArrayList();
kind.typeList.add(buildEmailType(Email.TYPE_HOME));
diff --git a/src/com/android/contacts/preference/ContactsPreferenceActivity.java b/src/com/android/contacts/preference/ContactsPreferenceActivity.java
index 3ec2e61..eb65b72 100644
--- a/src/com/android/contacts/preference/ContactsPreferenceActivity.java
+++ b/src/com/android/contacts/preference/ContactsPreferenceActivity.java
@@ -18,7 +18,7 @@
import com.android.contacts.ContactsSearchManager;
import com.android.contacts.R;
-import com.android.contacts.model.BaseAccountType;
+import com.android.contacts.model.AccountType;
import com.android.contacts.model.EntityDelta.ValuesDelta;
import com.android.contacts.model.GoogleAccountType;
import com.android.contacts.model.AccountTypes;
diff --git a/src/com/android/contacts/quickcontact/QuickContactWindow.java b/src/com/android/contacts/quickcontact/QuickContactWindow.java
index cf2e81d..5e2b02f 100644
--- a/src/com/android/contacts/quickcontact/QuickContactWindow.java
+++ b/src/com/android/contacts/quickcontact/QuickContactWindow.java
@@ -20,8 +20,8 @@
import com.android.contacts.ContactPresenceIconUtil;
import com.android.contacts.ContactsUtils;
import com.android.contacts.R;
-import com.android.contacts.model.BaseAccountType;
-import com.android.contacts.model.BaseAccountType.DataKind;
+import com.android.contacts.model.AccountType;
+import com.android.contacts.model.AccountType.DataKind;
import com.android.contacts.model.AccountTypes;
import com.android.contacts.util.Constants;
import com.android.contacts.util.DataStatus;
@@ -1219,7 +1219,7 @@
}
final DataKind kind = sources.getKindOrFallback(accountType, mimeType, mContext,
- BaseAccountType.LEVEL_MIMETYPES);
+ AccountType.LEVEL_MIMETYPES);
if (kind != null) {
// Build an action for this data entry, find a mapping to a UI
@@ -1240,7 +1240,7 @@
final boolean hasPresence = !cursor.isNull(DataQuery.PRESENCE);
if (hasPresence && Email.CONTENT_ITEM_TYPE.equals(mimeType)) {
final DataKind imKind = sources.getKindOrFallback(accountType,
- Im.CONTENT_ITEM_TYPE, mContext, BaseAccountType.LEVEL_MIMETYPES);
+ Im.CONTENT_ITEM_TYPE, mContext, AccountType.LEVEL_MIMETYPES);
if (imKind != null) {
final Action action = new DataAction(mContext, Im.CONTENT_ITEM_TYPE, imKind,
dataId, cursor);
diff --git a/src/com/android/contacts/util/AccountSelectionUtil.java b/src/com/android/contacts/util/AccountSelectionUtil.java
index b27b32c..0035d6d 100644
--- a/src/com/android/contacts/util/AccountSelectionUtil.java
+++ b/src/com/android/contacts/util/AccountSelectionUtil.java
@@ -32,7 +32,7 @@
import android.widget.TextView;
import com.android.contacts.R;
-import com.android.contacts.model.BaseAccountType;
+import com.android.contacts.model.AccountType;
import com.android.contacts.model.AccountTypes;
import java.util.List;
@@ -118,9 +118,9 @@
(TextView)convertView.findViewById(android.R.id.text2);
final Account account = this.getItem(position);
- final BaseAccountType source =
+ final AccountType source =
sources.getInflatedSource(account.type,
- BaseAccountType.LEVEL_SUMMARY);
+ AccountType.LEVEL_SUMMARY);
final Context context = getContext();
text1.setText(account.name);
diff --git a/src/com/android/contacts/util/AccountsListAdapter.java b/src/com/android/contacts/util/AccountsListAdapter.java
index 09189bb..260a1c3 100644
--- a/src/com/android/contacts/util/AccountsListAdapter.java
+++ b/src/com/android/contacts/util/AccountsListAdapter.java
@@ -18,7 +18,7 @@
import com.android.contacts.R;
import com.android.contacts.model.AccountTypes;
-import com.android.contacts.model.BaseAccountType;
+import com.android.contacts.model.AccountType;
import android.accounts.Account;
import android.content.Context;
@@ -57,8 +57,8 @@
final ImageView icon = (ImageView)resultView.findViewById(android.R.id.icon);
final Account account = mAccounts.get(position);
- final BaseAccountType source = mSources.getInflatedSource(account.type,
- BaseAccountType.LEVEL_SUMMARY);
+ final AccountType source = mSources.getInflatedSource(account.type,
+ AccountType.LEVEL_SUMMARY);
text1.setText(account.name);
text2.setText(source.getDisplayLabel(mContext));
diff --git a/src/com/android/contacts/views/detail/ContactDetailFragment.java b/src/com/android/contacts/views/detail/ContactDetailFragment.java
index de00eff..dacc9cb 100644
--- a/src/com/android/contacts/views/detail/ContactDetailFragment.java
+++ b/src/com/android/contacts/views/detail/ContactDetailFragment.java
@@ -25,9 +25,9 @@
import com.android.contacts.R;
import com.android.contacts.TypePrecedence;
import com.android.contacts.model.AccountTypes;
-import com.android.contacts.model.BaseAccountType;
-import com.android.contacts.model.BaseAccountType.DataKind;
-import com.android.contacts.model.BaseAccountType.EditType;
+import com.android.contacts.model.AccountType;
+import com.android.contacts.model.AccountType.DataKind;
+import com.android.contacts.model.AccountType.EditType;
import com.android.contacts.util.Constants;
import com.android.contacts.util.DataStatus;
import com.android.contacts.util.DateUtils;
@@ -378,8 +378,8 @@
if (!mRawContactIds.contains(rawContactId)) {
mRawContactIds.add(rawContactId);
}
- BaseAccountType contactsSource = sources.getInflatedSource(accountType,
- BaseAccountType.LEVEL_SUMMARY);
+ AccountType contactsSource = sources.getInflatedSource(accountType,
+ AccountType.LEVEL_SUMMARY);
if (contactsSource == null || !contactsSource.readOnly) {
mWritableRawContactIds.add(rawContactId);
}
@@ -401,7 +401,7 @@
}
final DataKind kind = sources.getKindOrFallback(accountType, mimeType, mContext,
- BaseAccountType.LEVEL_CONSTRAINTS);
+ AccountType.LEVEL_CONSTRAINTS);
if (kind == null) continue;
final ViewEntry entry = ViewEntry.fromValues(mContext, mimeType, kind, dataId,
@@ -458,7 +458,7 @@
if (status != null) {
final String imMime = Im.CONTENT_ITEM_TYPE;
final DataKind imKind = sources.getKindOrFallback(accountType,
- imMime, mContext, BaseAccountType.LEVEL_MIMETYPES);
+ imMime, mContext, AccountType.LEVEL_MIMETYPES);
final ViewEntry imEntry = ViewEntry.fromValues(mContext,
imMime, imKind, dataId, entryValues);
final ImActions imActions = ContactsUtils.buildImActions(entryValues);
@@ -679,12 +679,14 @@
entry.typeString = "";
for (EditType type : kind.typeList) {
if (type.rawValue == entry.type) {
- if (type.customColumn == null) {
- // Non-custom type. Get its description from the resource
- entry.typeString = context.getString(type.labelRes);
- } else {
- // Custom type. Read it from the database
- entry.typeString = values.getAsString(type.customColumn);
+ if (!type.unspecifiedType) {
+ if (type.customColumn == null) {
+ // Non-custom type. Get its description from the resource
+ entry.typeString = context.getString(type.labelRes);
+ } else {
+ // Custom type. Read it from the database
+ entry.typeString = values.getAsString(type.customColumn);
+ }
}
break;
}
diff --git a/src/com/android/contacts/views/editor/AggregationSuggestionView.java b/src/com/android/contacts/views/editor/AggregationSuggestionView.java
index 3fcc11b..ae703ac 100644
--- a/src/com/android/contacts/views/editor/AggregationSuggestionView.java
+++ b/src/com/android/contacts/views/editor/AggregationSuggestionView.java
@@ -18,7 +18,7 @@
import com.android.contacts.R;
import com.android.contacts.model.AccountTypes;
-import com.android.contacts.model.BaseAccountType;
+import com.android.contacts.model.AccountType;
import com.android.contacts.views.editor.AggregationSuggestionEngine.RawContact;
import com.android.contacts.views.editor.AggregationSuggestionEngine.Suggestion;
import com.google.android.collect.Lists;
@@ -121,8 +121,8 @@
if (accountType == null) {
return true;
}
- BaseAccountType source = sources.getInflatedSource(
- accountType, BaseAccountType.LEVEL_SUMMARY);
+ AccountType source = sources.getInflatedSource(
+ accountType, AccountType.LEVEL_SUMMARY);
if (!source.readOnly) {
return true;
}
diff --git a/src/com/android/contacts/views/editor/BaseRawContactEditorView.java b/src/com/android/contacts/views/editor/BaseRawContactEditorView.java
index 76c37d7..2cc3a81 100644
--- a/src/com/android/contacts/views/editor/BaseRawContactEditorView.java
+++ b/src/com/android/contacts/views/editor/BaseRawContactEditorView.java
@@ -16,8 +16,8 @@
package com.android.contacts.views.editor;
-import com.android.contacts.model.BaseAccountType;
-import com.android.contacts.model.BaseAccountType.EditType;
+import com.android.contacts.model.AccountType;
+import com.android.contacts.model.AccountType.EditType;
import com.android.contacts.model.EntityDelta;
import com.android.contacts.model.EntityDelta.ValuesDelta;
import com.android.contacts.model.EntityModifier;
@@ -37,12 +37,12 @@
* Base view that provides common code for the editor interaction for a specific
* RawContact represented through an {@link EntityDelta}. Callers can
* reuse this view and quickly rebuild its contents through
- * {@link #setState(EntityDelta, BaseAccountType)}.
+ * {@link #setState(EntityDelta, AccountType)}.
* <p>
* Internal updates are performed against {@link ValuesDelta} so that the
* source {@link Entity} can be swapped out. Any state-based changes, such as
* adding {@link Data} rows or changing {@link EditType}, are performed through
- * {@link EntityModifier} to ensure that {@link BaseAccountType} are enforced.
+ * {@link EntityModifier} to ensure that {@link AccountType} are enforced.
*/
public abstract class BaseRawContactEditorView extends LinearLayout {
protected LayoutInflater mInflater;
@@ -95,8 +95,8 @@
/**
* Set the internal state for this view, given a current
- * {@link EntityDelta} state and the {@link BaseAccountType} that
+ * {@link EntityDelta} state and the {@link AccountType} that
* apply to that state.
*/
- public abstract void setState(EntityDelta state, BaseAccountType source, ViewIdGenerator vig);
+ public abstract void setState(EntityDelta state, AccountType source, ViewIdGenerator vig);
}
diff --git a/src/com/android/contacts/views/editor/ContactEditorFragment.java b/src/com/android/contacts/views/editor/ContactEditorFragment.java
index 96158dd..a2679b5 100644
--- a/src/com/android/contacts/views/editor/ContactEditorFragment.java
+++ b/src/com/android/contacts/views/editor/ContactEditorFragment.java
@@ -19,7 +19,7 @@
import com.android.contacts.R;
import com.android.contacts.activities.JoinContactActivity;
import com.android.contacts.model.AccountTypes;
-import com.android.contacts.model.BaseAccountType;
+import com.android.contacts.model.AccountType;
import com.android.contacts.model.EntityDelta;
import com.android.contacts.model.EntityDelta.ValuesDelta;
import com.android.contacts.model.EntityDeltaList;
@@ -372,8 +372,8 @@
final AccountTypes sources = AccountTypes.getInstance(mContext);
for (EntityDelta state : mState) {
final String accountType = state.getValues().getAsString(RawContacts.ACCOUNT_TYPE);
- final BaseAccountType source = sources.getInflatedSource(accountType,
- BaseAccountType.LEVEL_CONSTRAINTS);
+ final AccountType source = sources.getInflatedSource(accountType,
+ AccountType.LEVEL_CONSTRAINTS);
if (!source.readOnly) {
// Apply extras to the first writable raw contact only
EntityModifier.parseExtras(mContext, source, state, mIntentExtras);
@@ -424,9 +424,9 @@
// Parse any values from incoming intent
EntityDelta insert = new EntityDelta(ValuesDelta.fromAfter(values));
- final BaseAccountType source = sources.getInflatedSource(
+ final AccountType source = sources.getInflatedSource(
account != null ? account.type : null,
- BaseAccountType.LEVEL_CONSTRAINTS);
+ AccountType.LEVEL_CONSTRAINTS);
EntityModifier.parseExtras(mContext, source, insert,
prefillFromIntent ? mIntentExtras : null);
@@ -469,8 +469,8 @@
if (!values.isVisible()) continue;
final String accountType = values.getAsString(RawContacts.ACCOUNT_TYPE);
- final BaseAccountType source = sources.getInflatedSource(accountType,
- BaseAccountType.LEVEL_CONSTRAINTS);
+ final AccountType source = sources.getInflatedSource(accountType,
+ AccountType.LEVEL_CONSTRAINTS);
final long rawContactId = values.getAsLong(RawContacts._ID);
final BaseRawContactEditorView editor;
@@ -915,8 +915,8 @@
for (int i = 0; i < size; i++) {
ValuesDelta values = mState.get(i).getValues();
final String accountType = values.getAsString(RawContacts.ACCOUNT_TYPE);
- final BaseAccountType source = sources.getInflatedSource(accountType,
- BaseAccountType.LEVEL_CONSTRAINTS);
+ final AccountType source = sources.getInflatedSource(accountType,
+ AccountType.LEVEL_CONSTRAINTS);
if (!source.readOnly) {
return true;
}
@@ -997,11 +997,11 @@
final AccountTypes sources = AccountTypes.getInstance(mContext);
String accountType = one.getValues().getAsString(RawContacts.ACCOUNT_TYPE);
- final BaseAccountType oneSource = sources.getInflatedSource(accountType,
- BaseAccountType.LEVEL_SUMMARY);
+ final AccountType oneSource = sources.getInflatedSource(accountType,
+ AccountType.LEVEL_SUMMARY);
accountType = two.getValues().getAsString(RawContacts.ACCOUNT_TYPE);
- final BaseAccountType twoSource = sources.getInflatedSource(accountType,
- BaseAccountType.LEVEL_SUMMARY);
+ final AccountType twoSource = sources.getInflatedSource(accountType,
+ AccountType.LEVEL_SUMMARY);
// Check read-only
if (oneSource.readOnly && !twoSource.readOnly) {
diff --git a/src/com/android/contacts/views/editor/Editor.java b/src/com/android/contacts/views/editor/Editor.java
index 00d1d62..1d60e74 100644
--- a/src/com/android/contacts/views/editor/Editor.java
+++ b/src/com/android/contacts/views/editor/Editor.java
@@ -17,7 +17,7 @@
package com.android.contacts.views.editor;
import com.android.contacts.model.EntityDelta;
-import com.android.contacts.model.BaseAccountType.DataKind;
+import com.android.contacts.model.AccountType.DataKind;
import com.android.contacts.model.EntityDelta.ValuesDelta;
import android.provider.ContactsContract.Data;
diff --git a/src/com/android/contacts/views/editor/EventFieldEditorView.java b/src/com/android/contacts/views/editor/EventFieldEditorView.java
index a64fd51..a79b374 100644
--- a/src/com/android/contacts/views/editor/EventFieldEditorView.java
+++ b/src/com/android/contacts/views/editor/EventFieldEditorView.java
@@ -20,9 +20,9 @@
import com.android.contacts.datepicker.DatePicker;
import com.android.contacts.datepicker.DatePickerDialog;
import com.android.contacts.datepicker.DatePickerDialog.OnDateSetListener;
-import com.android.contacts.model.BaseAccountType.DataKind;
-import com.android.contacts.model.BaseAccountType.EditField;
-import com.android.contacts.model.BaseAccountType.EventEditType;
+import com.android.contacts.model.AccountType.DataKind;
+import com.android.contacts.model.AccountType.EditField;
+import com.android.contacts.model.AccountType.EventEditType;
import com.android.contacts.model.EntityDelta;
import com.android.contacts.model.EntityDelta.ValuesDelta;
import com.android.contacts.util.DateUtils;
diff --git a/src/com/android/contacts/views/editor/GroupMembershipView.java b/src/com/android/contacts/views/editor/GroupMembershipView.java
index 60c6962..60d1801 100644
--- a/src/com/android/contacts/views/editor/GroupMembershipView.java
+++ b/src/com/android/contacts/views/editor/GroupMembershipView.java
@@ -17,7 +17,7 @@
package com.android.contacts.views.editor;
import com.android.contacts.R;
-import com.android.contacts.model.BaseAccountType.DataKind;
+import com.android.contacts.model.AccountType.DataKind;
import com.android.contacts.model.EntityDelta;
import com.android.contacts.model.EntityDelta.ValuesDelta;
import com.android.contacts.model.EntityModifier;
diff --git a/src/com/android/contacts/views/editor/KindSectionView.java b/src/com/android/contacts/views/editor/KindSectionView.java
index 814ce8c..75bae24 100644
--- a/src/com/android/contacts/views/editor/KindSectionView.java
+++ b/src/com/android/contacts/views/editor/KindSectionView.java
@@ -17,7 +17,7 @@
package com.android.contacts.views.editor;
import com.android.contacts.R;
-import com.android.contacts.model.BaseAccountType.DataKind;
+import com.android.contacts.model.AccountType.DataKind;
import com.android.contacts.model.EntityDelta;
import com.android.contacts.model.EntityDelta.ValuesDelta;
import com.android.contacts.model.EntityModifier;
@@ -89,7 +89,7 @@
/** {@inheritDoc} */
@Override
public void onDeleted(Editor editor) {
- updateAddEnabled();
+ updateAddVisible();
updateVisible();
}
@@ -113,11 +113,8 @@
: getResources().getString(kind.titleRes);
mTitle.setText(mTitleString.toUpperCase());
- // Only show the add button if this is a list
- mAddPlusButton.setVisibility(mKind.isList ? View.VISIBLE : View.INVISIBLE);
-
rebuildFromState();
- updateAddEnabled();
+ updateAddVisible();
updateVisible();
}
@@ -195,11 +192,16 @@
}
- protected void updateAddEnabled() {
- // Set enabled state on the "add" view
- final boolean canInsert = EntityModifier.canInsert(mState, mKind);
- final boolean isEnabled = !mReadOnly && canInsert;
- mAddPlusButton.setEnabled(isEnabled);
+ protected void updateAddVisible() {
+ final boolean isVisible;
+ if (!mKind.isList) {
+ isVisible = false;
+ } else {
+ // Set enabled state on the "add" view
+ final boolean canInsert = EntityModifier.canInsert(mState, mKind);
+ isVisible = !mReadOnly && canInsert;
+ }
+ mAddPlusButton.setVisibility(isVisible ? View.VISIBLE : View.INVISIBLE);
}
public void addItem() {
@@ -214,7 +216,7 @@
// For non-lists (e.g. Notes we can only have one field. in that case we need to disable
// the add button
- updateAddEnabled();
+ updateAddVisible();
// Ensure we are visible
updateVisible();
diff --git a/src/com/android/contacts/views/editor/LabeledEditorView.java b/src/com/android/contacts/views/editor/LabeledEditorView.java
index 1cedef7..86ed65e 100644
--- a/src/com/android/contacts/views/editor/LabeledEditorView.java
+++ b/src/com/android/contacts/views/editor/LabeledEditorView.java
@@ -18,8 +18,8 @@
import com.android.contacts.ContactsUtils;
import com.android.contacts.R;
-import com.android.contacts.model.BaseAccountType.DataKind;
-import com.android.contacts.model.BaseAccountType.EditType;
+import com.android.contacts.model.AccountType.DataKind;
+import com.android.contacts.model.AccountType.EditType;
import com.android.contacts.model.EntityDelta;
import com.android.contacts.model.EntityDelta.ValuesDelta;
import com.android.contacts.model.EntityModifier;
@@ -142,6 +142,7 @@
mLabel.setLayoutParams(new LayoutParams(width, LayoutParams.WRAP_CONTENT));
mLabel.setGravity(Gravity.RIGHT);
mLabel.setTextColor(getResources().getColor(R.color.editor_label_text_color));
+ mLabel.setFocusable(true);
mLabel.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
diff --git a/src/com/android/contacts/views/editor/PhotoEditorView.java b/src/com/android/contacts/views/editor/PhotoEditorView.java
index 0ab44d2..05cd5fd 100644
--- a/src/com/android/contacts/views/editor/PhotoEditorView.java
+++ b/src/com/android/contacts/views/editor/PhotoEditorView.java
@@ -18,7 +18,7 @@
import com.android.contacts.R;
import com.android.contacts.model.EntityDelta;
-import com.android.contacts.model.BaseAccountType.DataKind;
+import com.android.contacts.model.AccountType.DataKind;
import com.android.contacts.model.EntityDelta.ValuesDelta;
import android.content.Context;
diff --git a/src/com/android/contacts/views/editor/RawContactEditorView.java b/src/com/android/contacts/views/editor/RawContactEditorView.java
index c49f20f..f3ac4fd 100644
--- a/src/com/android/contacts/views/editor/RawContactEditorView.java
+++ b/src/com/android/contacts/views/editor/RawContactEditorView.java
@@ -17,9 +17,9 @@
package com.android.contacts.views.editor;
import com.android.contacts.R;
-import com.android.contacts.model.BaseAccountType;
-import com.android.contacts.model.BaseAccountType.DataKind;
-import com.android.contacts.model.BaseAccountType.EditType;
+import com.android.contacts.model.AccountType;
+import com.android.contacts.model.AccountType.DataKind;
+import com.android.contacts.model.AccountType.EditType;
import com.android.contacts.model.EntityDelta;
import com.android.contacts.model.EntityDelta.ValuesDelta;
import com.android.contacts.model.EntityModifier;
@@ -52,12 +52,12 @@
* Custom view that provides all the editor interaction for a specific
* {@link Contacts} represented through an {@link EntityDelta}. Callers can
* reuse this view and quickly rebuild its contents through
- * {@link #setState(EntityDelta, BaseAccountType, ViewIdGenerator)}.
+ * {@link #setState(EntityDelta, AccountType, ViewIdGenerator)}.
* <p>
* Internal updates are performed against {@link ValuesDelta} so that the
* source {@link Entity} can be swapped out. Any state-based changes, such as
* adding {@link Data} rows or changing {@link EditType}, are performed through
- * {@link EntityModifier} to ensure that {@link BaseAccountType} are enforced.
+ * {@link EntityModifier} to ensure that {@link AccountType} are enforced.
*/
public class RawContactEditorView extends BaseRawContactEditorView {
private View mPhotoStub;
@@ -130,11 +130,11 @@
/**
* Set the internal state for this view, given a current
- * {@link EntityDelta} state and the {@link BaseAccountType} that
+ * {@link EntityDelta} state and the {@link AccountType} that
* apply to that state.
*/
@Override
- public void setState(EntityDelta state, BaseAccountType source, ViewIdGenerator vig) {
+ public void setState(EntityDelta state, AccountType source, ViewIdGenerator vig) {
mState = state;
// Remove any existing sections
diff --git a/src/com/android/contacts/views/editor/ReadOnlyRawContactEditorView.java b/src/com/android/contacts/views/editor/ReadOnlyRawContactEditorView.java
index bf3d811..021f3d6 100644
--- a/src/com/android/contacts/views/editor/ReadOnlyRawContactEditorView.java
+++ b/src/com/android/contacts/views/editor/ReadOnlyRawContactEditorView.java
@@ -18,8 +18,8 @@
import com.android.contacts.ContactsUtils;
import com.android.contacts.R;
-import com.android.contacts.model.BaseAccountType;
-import com.android.contacts.model.BaseAccountType.DataKind;
+import com.android.contacts.model.AccountType;
+import com.android.contacts.model.AccountType.DataKind;
import com.android.contacts.model.EntityDelta;
import com.android.contacts.model.EntityDelta.ValuesDelta;
import com.android.contacts.model.EntityModifier;
@@ -91,13 +91,13 @@
/**
* Set the internal state for this view, given a current
- * {@link EntityDelta} state and the {@link BaseAccountType} that
+ * {@link EntityDelta} state and the {@link AccountType} that
* apply to that state.
*
* TODO: make this more generic using data from the source
*/
@Override
- public void setState(EntityDelta state, BaseAccountType source, ViewIdGenerator vig) {
+ public void setState(EntityDelta state, AccountType source, ViewIdGenerator vig) {
// Remove any existing sections
mGeneral.removeAllViews();
diff --git a/src/com/android/contacts/views/editor/TextFieldsEditorView.java b/src/com/android/contacts/views/editor/TextFieldsEditorView.java
index daade45..95d704f 100644
--- a/src/com/android/contacts/views/editor/TextFieldsEditorView.java
+++ b/src/com/android/contacts/views/editor/TextFieldsEditorView.java
@@ -18,8 +18,8 @@
import com.android.contacts.ContactsUtils;
import com.android.contacts.R;
-import com.android.contacts.model.BaseAccountType.DataKind;
-import com.android.contacts.model.BaseAccountType.EditField;
+import com.android.contacts.model.AccountType.DataKind;
+import com.android.contacts.model.AccountType.EditField;
import com.android.contacts.model.EntityDelta;
import com.android.contacts.model.EntityDelta.ValuesDelta;
import com.android.contacts.util.ThemeUtils;
@@ -28,7 +28,6 @@
import android.content.Entity;
import android.content.res.Resources;
import android.graphics.Rect;
-import android.os.Handler;
import android.os.Parcel;
import android.os.Parcelable;
import android.telephony.PhoneNumberFormattingTextWatcher;
diff --git a/src/com/android/contacts/views/editor/ViewIdGenerator.java b/src/com/android/contacts/views/editor/ViewIdGenerator.java
index dc1bf79..cf21579 100644
--- a/src/com/android/contacts/views/editor/ViewIdGenerator.java
+++ b/src/com/android/contacts/views/editor/ViewIdGenerator.java
@@ -17,7 +17,7 @@
package com.android.contacts.views.editor;
import com.android.contacts.model.EntityDelta;
-import com.android.contacts.model.BaseAccountType.DataKind;
+import com.android.contacts.model.AccountType.DataKind;
import com.android.contacts.model.EntityDelta.ValuesDelta;
import android.os.Bundle;
diff --git a/src/com/android/contacts/widget/TransitionAnimationView.java b/src/com/android/contacts/widget/TransitionAnimationView.java
index 1b86a6f..114e97d 100644
--- a/src/com/android/contacts/widget/TransitionAnimationView.java
+++ b/src/com/android/contacts/widget/TransitionAnimationView.java
@@ -132,6 +132,12 @@
}
private void start(View view, boolean closing) {
+ if (mEnterAnimation.isRunning()) {
+ mEnterAnimation.end();
+ }
+ if (mExitAnimation.isRunning()) {
+ mExitAnimation.end();
+ }
if (view.getVisibility() != View.VISIBLE) {
if (!closing) {
mEnterAnimation.setTarget(view);
diff --git a/tests/res/values/donottranslate_strings.xml b/tests/res/values/donottranslate_strings.xml
index 7530ce7..6891c2f 100644
--- a/tests/res/values/donottranslate_strings.xml
+++ b/tests/res/values/donottranslate_strings.xml
@@ -61,7 +61,6 @@
<item>SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED</item>
<item>SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED</item>
<item>TODO: JOIN_CONTACT</item>
- <item>ACTION_GET_MULTIPLE_PHONES</item>
<!-- Edit Contact -->
<item>EDIT (content uri with only id)</item>
diff --git a/tests/src/com/android/contacts/EntityDeltaListTests.java b/tests/src/com/android/contacts/EntityDeltaListTests.java
index 4904fa8..9369bb0 100644
--- a/tests/src/com/android/contacts/EntityDeltaListTests.java
+++ b/tests/src/com/android/contacts/EntityDeltaListTests.java
@@ -22,7 +22,7 @@
import static android.content.ContentProviderOperation.TYPE_UPDATE;
import com.android.contacts.EntityModifierTests.MockContactsSource;
-import com.android.contacts.model.BaseAccountType;
+import com.android.contacts.model.AccountType;
import com.android.contacts.model.EntityDelta;
import com.android.contacts.model.EntityModifier;
import com.android.contacts.model.EntityDeltaList;
@@ -81,12 +81,12 @@
}
/**
- * Build a {@link BaseAccountType} that has various odd constraints for
+ * Build a {@link AccountType} that has various odd constraints for
* testing purposes.
*/
- protected BaseAccountType getSource() {
- final BaseAccountType source = new MockContactsSource();
- source.ensureInflated(getContext(), BaseAccountType.LEVEL_CONSTRAINTS);
+ protected AccountType getSource() {
+ final AccountType source = new MockContactsSource();
+ source.ensureInflated(getContext(), AccountType.LEVEL_CONSTRAINTS);
return source;
}
@@ -571,7 +571,7 @@
buildEmail(EMAIL_YELLOW)));
// Ensure we have at least one phone
- final BaseAccountType source = getSource();
+ final AccountType source = getSource();
final EntityDelta bobContact = first.getByRawContactId(CONTACT_BOB);
EntityModifier.ensureKindExists(bobContact, source, Phone.CONTENT_ITEM_TYPE);
final ValuesDelta bobPhone = bobContact.getSuperPrimaryEntry(Phone.CONTENT_ITEM_TYPE, true);
diff --git a/tests/src/com/android/contacts/EntityModifierTests.java b/tests/src/com/android/contacts/EntityModifierTests.java
index 1a0fc07..c52959d 100644
--- a/tests/src/com/android/contacts/EntityModifierTests.java
+++ b/tests/src/com/android/contacts/EntityModifierTests.java
@@ -20,13 +20,13 @@
import static android.content.ContentProviderOperation.TYPE_INSERT;
import static android.content.ContentProviderOperation.TYPE_UPDATE;
-import com.android.contacts.model.BaseAccountType;
+import com.android.contacts.model.AccountType;
import com.android.contacts.model.EntityDelta;
import com.android.contacts.model.EntityModifier;
import com.android.contacts.model.EntityDeltaList;
import com.android.contacts.model.AccountTypes;
-import com.android.contacts.model.BaseAccountType.DataKind;
-import com.android.contacts.model.BaseAccountType.EditType;
+import com.android.contacts.model.AccountType.DataKind;
+import com.android.contacts.model.AccountType.EditType;
import com.android.contacts.model.EntityDelta.ValuesDelta;
import com.google.android.collect.Lists;
@@ -51,7 +51,7 @@
import java.util.List;
/**
- * Tests for {@link EntityModifier} to verify that {@link BaseAccountType}
+ * Tests for {@link EntityModifier} to verify that {@link AccountType}
* constraints are being enforced correctly.
*/
@LargeTest
@@ -79,11 +79,11 @@
mContext = getContext();
}
- public static class MockContactsSource extends BaseAccountType {
+ public static class MockContactsSource extends AccountType {
@Override
protected void inflate(Context context, int inflateLevel) {
this.accountType = TEST_ACCOUNT_TYPE;
- this.setInflatedLevel(BaseAccountType.LEVEL_CONSTRAINTS);
+ this.setInflatedLevel(AccountType.LEVEL_CONSTRAINTS);
// Phone allows maximum 2 home, 1 work, and unlimited other, with
// constraint of 5 numbers maximum.
@@ -138,19 +138,19 @@
}
/**
- * Build a {@link BaseAccountType} that has various odd constraints for
+ * Build a {@link AccountType} that has various odd constraints for
* testing purposes.
*/
- protected BaseAccountType getSource() {
- final BaseAccountType source = new MockContactsSource();
- source.ensureInflated(getContext(), BaseAccountType.LEVEL_CONSTRAINTS);
+ protected AccountType getSource() {
+ final AccountType source = new MockContactsSource();
+ source.ensureInflated(getContext(), AccountType.LEVEL_CONSTRAINTS);
return source;
}
/**
* Build {@link AccountTypes} instance.
*/
- protected AccountTypes getSources(BaseAccountType... sources) {
+ protected AccountTypes getSources(AccountType... sources) {
return new AccountTypes(sources);
}
@@ -192,7 +192,7 @@
*/
public void testValidTypes() {
// Build a source and pull specific types
- final BaseAccountType source = getSource();
+ final AccountType source = getSource();
final DataKind kindPhone = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
final EditType typeHome = EntityModifier.getType(kindPhone, Phone.TYPE_HOME);
final EditType typeWork = EntityModifier.getType(kindPhone, Phone.TYPE_WORK);
@@ -237,7 +237,7 @@
*/
public void testCanInsert() {
// Build a source and pull specific types
- final BaseAccountType source = getSource();
+ final AccountType source = getSource();
final DataKind kindPhone = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
final EditType typeHome = EntityModifier.getType(kindPhone, Phone.TYPE_HOME);
final EditType typeWork = EntityModifier.getType(kindPhone, Phone.TYPE_WORK);
@@ -266,7 +266,7 @@
*/
public void testBestValidType() {
// Build a source and pull specific types
- final BaseAccountType source = getSource();
+ final AccountType source = getSource();
final DataKind kindPhone = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
final EditType typeHome = EntityModifier.getType(kindPhone, Phone.TYPE_HOME);
final EditType typeWork = EntityModifier.getType(kindPhone, Phone.TYPE_WORK);
@@ -302,7 +302,7 @@
}
public void testIsEmptyEmpty() {
- final BaseAccountType source = getSource();
+ final AccountType source = getSource();
final DataKind kindPhone = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
// Test entirely empty row
@@ -313,7 +313,7 @@
}
public void testIsEmptyDirectFields() {
- final BaseAccountType source = getSource();
+ final AccountType source = getSource();
final DataKind kindPhone = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
final EditType typeHome = EntityModifier.getType(kindPhone, Phone.TYPE_HOME);
@@ -330,7 +330,7 @@
}
public void testTrimEmptySingle() {
- final BaseAccountType source = getSource();
+ final AccountType source = getSource();
final DataKind kindPhone = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
final EditType typeHome = EntityModifier.getType(kindPhone, Phone.TYPE_HOME);
@@ -371,7 +371,7 @@
}
public void testTrimEmptySpaces() {
- final BaseAccountType source = getSource();
+ final AccountType source = getSource();
final DataKind kindPhone = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
final EditType typeHome = EntityModifier.getType(kindPhone, Phone.TYPE_HOME);
@@ -396,7 +396,7 @@
}
public void testTrimLeaveValid() {
- final BaseAccountType source = getSource();
+ final AccountType source = getSource();
final DataKind kindPhone = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
final EditType typeHome = EntityModifier.getType(kindPhone, Phone.TYPE_HOME);
@@ -424,7 +424,7 @@
}
public void testTrimEmptyUntouched() {
- final BaseAccountType source = getSource();
+ final AccountType source = getSource();
final DataKind kindPhone = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
final EditType typeHome = EntityModifier.getType(kindPhone, Phone.TYPE_HOME);
@@ -448,7 +448,7 @@
}
public void testTrimEmptyAfterUpdate() {
- final BaseAccountType source = getSource();
+ final AccountType source = getSource();
final DataKind kindPhone = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
final EditType typeHome = EntityModifier.getType(kindPhone, Phone.TYPE_HOME);
@@ -500,7 +500,7 @@
}
public void testTrimInsertEmpty() {
- final BaseAccountType source = getSource();
+ final AccountType source = getSource();
final AccountTypes sources = getSources(source);
final DataKind kindPhone = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
final EditType typeHome = EntityModifier.getType(kindPhone, Phone.TYPE_HOME);
@@ -527,7 +527,7 @@
}
public void testTrimInsertInsert() {
- final BaseAccountType source = getSource();
+ final AccountType source = getSource();
final AccountTypes sources = getSources(source);
final DataKind kindPhone = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
final EditType typeHome = EntityModifier.getType(kindPhone, Phone.TYPE_HOME);
@@ -560,7 +560,7 @@
}
public void testTrimUpdateRemain() {
- final BaseAccountType source = getSource();
+ final AccountType source = getSource();
final AccountTypes sources = getSources(source);
final DataKind kindPhone = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
final EditType typeHome = EntityModifier.getType(kindPhone, Phone.TYPE_HOME);
@@ -631,7 +631,7 @@
}
public void testTrimUpdateUpdate() {
- final BaseAccountType source = getSource();
+ final AccountType source = getSource();
final AccountTypes sources = getSources(source);
final DataKind kindPhone = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
final EditType typeHome = EntityModifier.getType(kindPhone, Phone.TYPE_HOME);
@@ -686,7 +686,7 @@
}
public void testParseExtrasExistingName() {
- final BaseAccountType source = getSource();
+ final AccountType source = getSource();
final DataKind kindName = source.getKindForMimetype(StructuredName.CONTENT_ITEM_TYPE);
// Build "before" name
@@ -706,7 +706,7 @@
}
public void testParseExtrasIgnoreLimit() {
- final BaseAccountType source = getSource();
+ final AccountType source = getSource();
final DataKind kindIm = source.getKindForMimetype(Im.CONTENT_ITEM_TYPE);
// Build "before" IM
@@ -730,7 +730,7 @@
}
public void testParseExtrasIgnoreUnhandled() {
- final BaseAccountType source = getSource();
+ final AccountType source = getSource();
final EntityDelta state = getEntity(TEST_ID);
// We should silently ignore types unsupported by source
@@ -742,7 +742,7 @@
}
public void testParseExtrasJobTitle() {
- final BaseAccountType source = getSource();
+ final AccountType source = getSource();
final EntityDelta state = getEntity(TEST_ID);
// Make sure that we create partial Organizations
diff --git a/tests/src/com/android/contacts/interactions/ContactDeletionInteractionTest.java b/tests/src/com/android/contacts/interactions/ContactDeletionInteractionTest.java
index 377fb1b..65be32e 100644
--- a/tests/src/com/android/contacts/interactions/ContactDeletionInteractionTest.java
+++ b/tests/src/com/android/contacts/interactions/ContactDeletionInteractionTest.java
@@ -21,7 +21,7 @@
import com.android.contacts.tests.mocks.ContactsMockContext;
import com.android.contacts.tests.mocks.MockContentProvider;
import com.android.contacts.tests.mocks.MockContentProvider.Query;
-import com.android.contacts.tests.mocks.MockSources;
+import com.android.contacts.tests.mocks.MockAccountTypes;
import android.content.AsyncTaskLoader;
import android.content.ContentUris;
@@ -67,7 +67,7 @@
@Override
AccountTypes getSources() {
- return new MockSources();
+ return new MockAccountTypes();
}
}
@@ -82,26 +82,26 @@
}
public void testSingleWritableRawContact() {
- expectQuery().returnRow(1, MockSources.WRITABLE_ACCOUNT_TYPE);
+ expectQuery().returnRow(1, MockAccountTypes.WRITABLE_ACCOUNT_TYPE);
assertWithMessageId(R.string.deleteConfirmation);
}
public void testReadOnlyRawContacts() {
- expectQuery().returnRow(1, MockSources.READONLY_ACCOUNT_TYPE);
+ expectQuery().returnRow(1, MockAccountTypes.READONLY_ACCOUNT_TYPE);
assertWithMessageId(R.string.readOnlyContactWarning);
}
public void testMixOfWritableAndReadOnlyRawContacts() {
expectQuery()
- .returnRow(1, MockSources.WRITABLE_ACCOUNT_TYPE)
- .returnRow(2, MockSources.READONLY_ACCOUNT_TYPE);
+ .returnRow(1, MockAccountTypes.WRITABLE_ACCOUNT_TYPE)
+ .returnRow(2, MockAccountTypes.READONLY_ACCOUNT_TYPE);
assertWithMessageId(R.string.readOnlyContactDeleteConfirmation);
}
public void testMultipleWritableRawContacts() {
expectQuery()
- .returnRow(1, MockSources.WRITABLE_ACCOUNT_TYPE)
- .returnRow(2, MockSources.WRITABLE_ACCOUNT_TYPE);
+ .returnRow(1, MockAccountTypes.WRITABLE_ACCOUNT_TYPE)
+ .returnRow(2, MockAccountTypes.WRITABLE_ACCOUNT_TYPE);
assertWithMessageId(R.string.multipleContactDeleteConfirmation);
}
diff --git a/tests/src/com/android/contacts/tests/allintents/AllIntentsActivity.java b/tests/src/com/android/contacts/tests/allintents/AllIntentsActivity.java
index 3683a80..66079ad 100644
--- a/tests/src/com/android/contacts/tests/allintents/AllIntentsActivity.java
+++ b/tests/src/com/android/contacts/tests/allintents/AllIntentsActivity.java
@@ -60,8 +60,6 @@
private static final String CONTACT_LIST_ACTIVITY_CLASS_NAME =
"com.android.contacts.activities.ContactBrowserActivity";
- private static final String MULTIPLE_PHONE_PICKER_ACTIVITY_CLASS_NAME =
- "com.android.contacts.MultiplePhonePickerActivity";
private static final int LIST_DEFAULT = 0;
private static final int LIST_ALL_CONTACTS_ACTION = 1;
@@ -104,34 +102,33 @@
private static final int SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED = 38;
private static final int SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED = 39;
private static final int JOIN_CONTACT = 40;
- private static final int ACTION_GET_MULTIPLE_PHONES = 41;
- private static final int EDIT_CONTACT = 42;
- private static final int EDIT_CONTACT_LOOKUP = 43;
- private static final int EDIT_CONTACT_LOOKUP_ID = 44;
- private static final int EDIT_RAW_CONTACT = 45;
- private static final int EDIT_LEGACY = 46;
- private static final int EDIT_NEW_CONTACT = 47;
- private static final int EDIT_NEW_CONTACT_WITH_DATA = 48;
- private static final int EDIT_NEW_CONTACT_FOR_ACCOUNT = 49;
- private static final int EDIT_NEW_CONTACT_FOR_ACCOUNT_WITH_DATA = 50;
- private static final int EDIT_NEW_RAW_CONTACT = 51;
- private static final int EDIT_NEW_LEGACY = 52;
+ private static final int EDIT_CONTACT = 41;
+ private static final int EDIT_CONTACT_LOOKUP = 42;
+ private static final int EDIT_CONTACT_LOOKUP_ID = 43;
+ private static final int EDIT_RAW_CONTACT = 44;
+ private static final int EDIT_LEGACY = 45;
+ private static final int EDIT_NEW_CONTACT = 46;
+ private static final int EDIT_NEW_CONTACT_WITH_DATA = 47;
+ private static final int EDIT_NEW_CONTACT_FOR_ACCOUNT = 48;
+ private static final int EDIT_NEW_CONTACT_FOR_ACCOUNT_WITH_DATA = 49;
+ private static final int EDIT_NEW_RAW_CONTACT = 50;
+ private static final int EDIT_NEW_LEGACY = 51;
- private static final int VIEW_CONTACT = 53;
- private static final int VIEW_CONTACT_LOOKUP = 54;
- private static final int VIEW_CONTACT_LOOKUP_ID = 55;
- private static final int VIEW_RAW_CONTACT = 56;
- private static final int VIEW_LEGACY = 57;
+ private static final int VIEW_CONTACT = 52;
+ private static final int VIEW_CONTACT_LOOKUP = 53;
+ private static final int VIEW_CONTACT_LOOKUP_ID = 54;
+ private static final int VIEW_RAW_CONTACT = 55;
+ private static final int VIEW_LEGACY = 56;
- private static final int DIAL = 58;
- private static final int DIAL_phone = 59;
- private static final int DIAL_person = 60;
- private static final int DIAL_voicemail = 61;
- private static final int CALL_BUTTON = 62;
- private static final int DIAL_tel = 63;
- private static final int VIEW_tel = 64;
- private static final int VIEW_calllog = 65;
+ private static final int DIAL = 57;
+ private static final int DIAL_phone = 58;
+ private static final int DIAL_person = 59;
+ private static final int DIAL_voicemail = 60;
+ private static final int CALL_BUTTON = 61;
+ private static final int DIAL_tel = 62;
+ private static final int VIEW_tel = 63;
+ private static final int VIEW_calllog = 64;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -379,15 +376,6 @@
// TODO
break;
}
- case ACTION_GET_MULTIPLE_PHONES: {
- Intent intent = new Intent(Intents.ACTION_GET_MULTIPLE_PHONES);
- intent.setType(Phone.CONTENT_TYPE);
- intent.putExtra(Intents.EXTRA_PHONE_URIS, new Uri[] {
- Uri.parse("tel:555-1212"), Uri.parse("tel:555-2121")
- });
- startMultiplePhoneSelectionActivityForResult(intent);
- break;
- }
case EDIT_CONTACT: {
final long contactId = findArbitraryContactWithPhoneNumber();
final Uri uri = ContentUris.withAppendedId(Contacts.CONTENT_URI, contactId);
@@ -580,13 +568,6 @@
startActivity(intent);
}
- private void startMultiplePhoneSelectionActivityForResult(Intent intent) {
- intent.setComponent(
- new ComponentName(ANDROID_CONTACTS_PACKAGE,
- MULTIPLE_PHONE_PICKER_ACTIVITY_CLASS_NAME));
- startActivityForResult(intent, 13);
- }
-
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
Intent intent = new Intent(this, ResultActivity.class);
diff --git a/tests/src/com/android/contacts/tests/mocks/MockSources.java b/tests/src/com/android/contacts/tests/mocks/MockAccountTypes.java
similarity index 79%
rename from tests/src/com/android/contacts/tests/mocks/MockSources.java
rename to tests/src/com/android/contacts/tests/mocks/MockAccountTypes.java
index 4c3007a..4936d02 100644
--- a/tests/src/com/android/contacts/tests/mocks/MockSources.java
+++ b/tests/src/com/android/contacts/tests/mocks/MockAccountTypes.java
@@ -15,28 +15,28 @@
*/
package com.android.contacts.tests.mocks;
-import com.android.contacts.model.BaseAccountType;
+import com.android.contacts.model.AccountType;
import com.android.contacts.model.FallbackAccountType;
import com.android.contacts.model.AccountTypes;
/**
* A mock {@link AccountTypes} class.
*/
-public class MockSources extends AccountTypes {
+public class MockAccountTypes extends AccountTypes {
public static final String WRITABLE_ACCOUNT_TYPE = "writable";
public static final String READONLY_ACCOUNT_TYPE = "readonly";
@Override
- public BaseAccountType getInflatedSource(String accountType, int inflateLevel) {
+ public AccountType getInflatedSource(String accountType, int inflateLevel) {
if (accountType.equals(WRITABLE_ACCOUNT_TYPE)) {
- BaseAccountType source = new FallbackAccountType();
+ AccountType source = new FallbackAccountType();
source.readOnly = false;
return source;
}
if (accountType.equals(READONLY_ACCOUNT_TYPE)) {
- BaseAccountType source = new FallbackAccountType();
+ AccountType source = new FallbackAccountType();
source.readOnly = true;
return source;
}