Merge change I89190b8b into eclair
* changes:
New photo frame in LARGE QuickCotnact window
diff --git a/res/layout-finger/contact_card_layout.xml b/res/layout-finger/contact_card_layout.xml
index 19ef744..6e70561 100644
--- a/res/layout-finger/contact_card_layout.xml
+++ b/res/layout-finger/contact_card_layout.xml
@@ -25,17 +25,29 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
- <FrameLayout android:id="@android:id/tabcontent"
+ <ListView android:id="@+id/contact_data"
android:layout_width="fill_parent"
- android:layout_height="0dip"
- android:layout_weight="1">
-
- <View
+ android:layout_height="fill_parent"
+ android:background="@drawable/title_bar_shadow"
+ />
+
+ <ScrollView android:id="@android:id/empty"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:fillViewport="true"
+ >
+ <TextView android:id="@+id/emptyText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:background="@drawable/title_bar_shadow"
+ android:text="@string/no_contact_details"
+ android:textSize="20sp"
+ android:textColor="?android:attr/textColorSecondary"
+ android:paddingLeft="10dip"
+ android:paddingRight="10dip"
+ android:paddingTop="10dip"
+ android:lineSpacingMultiplier="0.92"
/>
- </FrameLayout>
+ </ScrollView>
</LinearLayout>
diff --git a/res/layout/item_contact_editor.xml b/res/layout/item_contact_editor.xml
index cea4bdb..21da0aa 100644
--- a/res/layout/item_contact_editor.xml
+++ b/res/layout/item_contact_editor.xml
@@ -25,15 +25,16 @@
<!-- Left side color bar -->
<ImageView
android:id="@+id/color_bar"
- android:layout_width="15dip"
+ android:layout_width="5dip"
android:layout_height="fill_parent"
/>
<!-- The content -->
- <RelativeLayout
+ <LinearLayout
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
+ android:orientation="vertical"
>
<!-- Account info header -->
@@ -42,12 +43,19 @@
android:layout_width="fill_parent"
>
+ <ImageView android:id="@+id/header_color_bar"
+ android:layout_width="fill_parent"
+ android:layout_height="2dip"
+ android:layout_marginBottom="5dip"
+ />
+
<ImageView android:id="@+id/header_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="7dip"
android:layout_marginRight="7dip"
android:layout_centerVertical="true"
+ android:layout_below="@id/header_color_bar"
/>
<TextView android:id="@+id/header_account_type"
@@ -57,8 +65,7 @@
android:layout_alignTop="@id/header_icon"
android:layout_marginTop="-4dip"
- android:textSize="24pt"
- android:textStyle="bold"
+ android:textSize="24sp"
android:textColor="?android:attr/textColorPrimary"
/>
@@ -73,14 +80,20 @@
android:textColor="?android:attr/textColorPrimary"
/>
+ <View
+ android:layout_width="fill_parent"
+ android:layout_height="1px"
+ android:layout_alignParentBottom="true"
+
+ android:background="?android:attr/listDivider"
+ />
+
</RelativeLayout>
<FrameLayout
android:id="@+id/stub_photo"
- android:layout_width="100dip"
- android:layout_height="96dip"
- android:layout_below="@id/header"
- android:layout_alignWithParentIfMissing="true"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
android:paddingLeft="12dip"
android:paddingTop="10dip">
@@ -97,28 +110,34 @@
android:layout_below="@id/stub_photo"
android:layout_marginTop="6dip"
android:layout_marginBottom="4dip"
- android:layout_alignWithParentIfMissing="true"
layout="@layout/item_generic_editor" />
+ <TextView android:id="@+id/read_only_name"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="6dip"
+ android:layout_marginBottom="6dip"
+ android:layout_marginLeft="10dip"
+
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ />
+
<LinearLayout
android:id="@+id/sect_general"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:layout_below="@+id/edit_name"
android:orientation="vertical"
/>
<View android:id="@+id/head_secondary_divider"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:layout_below="@id/sect_general"
android:background="?android:attr/listDivider" />
<TextView
android:id="@+id/head_secondary"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:layout_below="@+id/head_secondary_divider"
android:gravity="center_vertical"
android:minHeight="?android:attr/listPreferredItemHeight"
@@ -136,20 +155,22 @@
android:id="@+id/sect_secondary"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:layout_below="@id/head_secondary"
android:orientation="vertical" />
<TextView
android:id="@+id/edit_read_only"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:layout_below="@id/edit_name"
- android:gravity="center_horizontal"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:paddingTop="5dip"
- android:paddingBottom="5dip"
- android:text="@string/edit_read_only"/>
+ android:layout_marginTop="10dip"
+ android:layout_marginBottom="10dip"
+ android:layout_marginLeft="10dip"
- </RelativeLayout>
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textColor="?android:attr/textColorPrimary"
+ android:drawableLeft="@android:drawable/ic_dialog_alert"
+ android:drawablePadding="10dip"
+ />
+
+ </LinearLayout>
</com.android.contacts.ui.widget.ContactEditorView>
diff --git a/res/values-es-rUS/strings.xml b/res/values-es-rUS/strings.xml
index 3c9a660..0cc1605 100644
--- a/res/values-es-rUS/strings.xml
+++ b/res/values-es-rUS/strings.xml
@@ -46,31 +46,33 @@
<string name="menu_viewAddress" msgid="1814744325763202024">"Dirección del mapa"</string>
<string name="menu_makeDefaultNumber" msgid="4838759253316649534">"Crear número predeterminado"</string>
<string name="menu_makeDefaultEmail" msgid="2599044610375789994">"Crear correo electrónico predeterminado"</string>
- <string name="menu_splitAggregate" msgid="7402548456225901170">"Dividir"</string>
+ <!-- no translation found for menu_splitAggregate (8368636463748691868) -->
+ <skip />
<string name="splitAggregate_title" msgid="2053462872948058798">"Dividir contacto"</string>
- <string name="contactsSplitMessage" msgid="3439008547775199243">"División de contacto"</string>
+ <!-- no translation found for contactsSplitMessage (5253490235863170269) -->
+ <skip />
+ <!-- no translation found for splitConfirmation_title (6716467920283502570) -->
+ <skip />
+ <!-- no translation found for splitConfirmation (1150797297503944823) -->
+ <skip />
<string name="menu_joinAggregate" msgid="5027981918265667970">"Unirse"</string>
<string name="menu_showSources" msgid="885215611438295455">"Mostrar fuentes"</string>
<string name="menu_hideSources" msgid="71367585820555477">"Ocultar fuentes"</string>
<string name="titleJoinAggregate" msgid="6970566008563147202">"Unirse al contacto"</string>
<string name="titleJoinContactDataWith" msgid="7684875775798635354">"Unirse a contactos"</string>
- <!-- no translation found for blurbJoinContactDataWith (995870557595050304) -->
- <skip />
- <!-- no translation found for showAllContactsJoinItem (2189695051430392383) -->
- <skip />
- <!-- no translation found for separatorJoinAggregateSuggestions (2831414448851313345) -->
- <skip />
+ <string name="blurbJoinContactDataWith" msgid="995870557595050304">"Selecciona el contacto al que quieras unirte con <xliff:g id="NAME">%s</xliff:g>."</string>
+ <string name="showAllContactsJoinItem" msgid="2189695051430392383">"Mostrar todos los contactos"</string>
+ <string name="separatorJoinAggregateSuggestions" msgid="2831414448851313345">"Contactos sugeridos"</string>
<string name="separatorJoinAggregateAll" msgid="7939932265026181043">"Todos los contactos"</string>
<string name="contactsJoinedMessage" msgid="7208148163607047389">"Unión de contactos"</string>
<string name="menu_contactOptions" msgid="1957061455705020617">"Opciones"</string>
<string name="contactOptionsTitle" msgid="8259347644090700915">"Opciones"</string>
<string name="deleteConfirmation_title" msgid="6394309508930335204">"Suprimir"</string>
- <!-- no translation found for readOnlyContactWarning (1523906860865526049) -->
+ <!-- no translation found for readOnlyContactWarning (1390849295342594265) -->
<skip />
- <!-- no translation found for readOnlyContactDeleteConfirmation (56308694573221640) -->
+ <!-- no translation found for readOnlyContactDeleteConfirmation (2137170726670196909) -->
<skip />
- <!-- no translation found for multipleContactDeleteConfirmation (938900978442960800) -->
- <skip />
+ <string name="multipleContactDeleteConfirmation" msgid="938900978442960800">"Eliminar este contacto suprimirá la información de mútliples cuentas."</string>
<string name="deleteConfirmation" msgid="811706994761610640">"Este contacto se suprimirá."</string>
<string name="menu_done" msgid="796017761764190697">"Finalizado"</string>
<string name="menu_doNotSave" msgid="2174577548513895144">"Revertir"</string>
@@ -157,6 +159,18 @@
<string name="listSeparatorOtherInformation" msgid="7844959649638482329">"Otra información"</string>
<string name="listSeparatorOtherInformation_edit" msgid="1326921768011367750">"Otras opciones"</string>
<string name="listSeparatorMore_edit" msgid="858454837482243176">"Más"</string>
+ <!-- no translation found for listTotalPhoneContacts:one (8721111084815668845) -->
+ <!-- no translation found for listTotalPhoneContacts:other (6133262880804110289) -->
+ <!-- no translation found for listTotalPhoneContactsZero (2756295259674938869) -->
+ <skip />
+ <!-- no translation found for listTotalAllContacts:one (1096068709488455155) -->
+ <!-- no translation found for listTotalAllContacts:other (2865867557378939630) -->
+ <!-- no translation found for listTotalAllContactsZero (6811347506748072822) -->
+ <skip />
+ <!-- no translation found for listFoundAllContacts:one (2830107332033967280) -->
+ <!-- no translation found for listFoundAllContacts:other (7752927996850263152) -->
+ <!-- no translation found for listFoundAllContactsZero (5554368784319460828) -->
+ <skip />
<string name="socialStreamIconLabel" msgid="4367712449555075376">"Social"</string>
<string name="contactsIconLabel" msgid="7666609097606552806">"Contactos"</string>
<string name="contactsFavoritesLabel" msgid="8417039765586853670">"Favoritos"</string>
@@ -247,13 +261,11 @@
<string name="import_all_vcard_string" msgid="5518136113853448474">"Importar todos los archivos de vCard"</string>
<string name="searching_vcard_message" msgid="6917522333561434546">"Buscando datos de vCard en la tarjeta SD"</string>
<string name="scanning_sdcard_failed_title" msgid="3506782007953167180">"No se ha podido explorar la tarjeta SD"</string>
- <!-- no translation found for scanning_sdcard_failed_message (3761992500690182922) -->
- <skip />
+ <string name="scanning_sdcard_failed_message" msgid="3761992500690182922">"No se ha podido explorar la tarjeta SD. (Motivo: \"<xliff:g id="FAIL_REASON">%s</xliff:g>\")"</string>
<string name="fail_reason_io_error" msgid="5922864781066136340">"Error de E/S"</string>
<string name="fail_reason_vcard_parse_error" msgid="1201233722762680214">"No se ha podido analizar vCard debido a un motivo inesperado"</string>
<string name="fail_reason_vcard_not_supported_error" msgid="655208100451286027">"No se ha podido analizar vCard aunque el formato parece válido, ya que la implementación actual no lo admite"</string>
- <!-- no translation found for fail_reason_no_vcard_file (6376516175882881595) -->
- <skip />
+ <string name="fail_reason_no_vcard_file" msgid="6376516175882881595">"No se ha encontrado un archivo de vCard en la Tarjeta SD."</string>
<string name="fail_reason_no_vcard_entry" msgid="4733290752474073143">"No se ha encontrado ninguna entrada válida de vCard para tu selección"</string>
<string name="fail_reason_failed_to_read_files" msgid="3659521123567134029">"No se pudieron importar uno o más archivos (%s)."</string>
<string name="fail_reason_unknown" msgid="999034019513096768">"Error desconocido"</string>
@@ -294,12 +306,9 @@
<string name="call_disambig_title" msgid="1911302597959335178">"Llamar con"</string>
<string name="sms_disambig_title" msgid="4675399294513152364">"Texto con"</string>
<string name="make_primary" msgid="5829291915305113983">"Recuerda esta opción"</string>
- <!-- no translation found for quickcontact_missing_app (4600366393134289038) -->
- <skip />
- <!-- no translation found for quickcontact_remember_choice (5964536411579749424) -->
- <skip />
- <!-- no translation found for quickcontact_missing_name (5590266114306996632) -->
- <skip />
+ <string name="quickcontact_missing_app" msgid="4600366393134289038">"No se encontró una aplicación para manejar esta acción."</string>
+ <string name="quickcontact_remember_choice" msgid="5964536411579749424">"Recuerda esta opción."</string>
+ <string name="quickcontact_missing_name" msgid="5590266114306996632">"Desconocido"</string>
<string name="menu_accounts" msgid="8499114602017077970">"Cuentas"</string>
<string name="menu_import_export" msgid="3765725645491577190">"Importar/Exportar"</string>
<string name="dialog_import_export" msgid="4771877268244096596">"Importar/Exportar contactos"</string>
@@ -310,25 +319,21 @@
<string name="nicknameLabelsGroup" msgid="2891682101053358010">"Apodo"</string>
<string name="organizationLabelsGroup" msgid="2478611760751832035">"Organización"</string>
<string name="websiteLabelsGroup" msgid="4202998982804009261">"Sitio web"</string>
- <!-- no translation found for eventLabelsGroup (8069912895912714412) -->
- <skip />
+ <string name="eventLabelsGroup" msgid="8069912895912714412">"Evento"</string>
<string name="type_short_home" msgid="7770424864090605384">"H"</string>
<string name="type_short_mobile" msgid="1655473281466676216">"Lun."</string>
<string name="type_short_work" msgid="4925330752504537861">"Mié."</string>
<string name="type_short_pager" msgid="2613818970827594238">"P"</string>
<string name="type_short_other" msgid="5669407180177236769">"Oct."</string>
<string name="edit_read_only" msgid="8158629550655830981">"Este contacto es de sólo lectura"</string>
- <!-- no translation found for edit_secondary_collapse (5371618426594477103) -->
- <skip />
+ <string name="edit_secondary_collapse" msgid="5371618426594477103">"Más"</string>
<string name="dialog_primary_name" msgid="5521591005692614833">"Nombre principal"</string>
<string name="dialog_new_contact_account" msgid="9044704073286262197">"Crear contacto según la cuenta"</string>
<string name="menu_sync_remove" msgid="3266725887008450161">"Eliminar grupo de sincronización"</string>
<string name="dialog_sync_add" msgid="8267045393119375803">"Agregar grupo de sincronización"</string>
<string name="display_more_groups" msgid="2682547080423434170">"Más grupos…"</string>
- <!-- no translation found for display_ungrouped (4602580795576261158) -->
- <skip />
- <!-- no translation found for display_all_contacts (6846131371214707956) -->
- <skip />
+ <string name="display_ungrouped" msgid="4602580795576261158">"Todos los otros contactos"</string>
+ <string name="display_all_contacts" msgid="6846131371214707956">"Todos los contactos"</string>
<string name="display_warn_remove_ungrouped" msgid="2314043155909167610">"Al suprimir \"<xliff:g id="GROUP">%s</xliff:g>\" de sincronización también se suprimirá cualquier contacto no agrupado de la sincronización."</string>
<string name="account_phone" msgid="4025734638492419713">"Sólo telefónicamente (no sincronizado)"</string>
<string name="label_email_display_name" msgid="5537802602754309600">"Mostrar el nombre"</string>
@@ -410,6 +415,5 @@
<string name="name_phonetic_family" msgid="462095502140180305">"Nombre familiar fonético"</string>
<string name="split_label" msgid="8262112659919449087">"Dividir"</string>
<string name="split_explanation" msgid="1824739956426973592">"Transformar a estos datos en el contacto propio."</string>
- <!-- no translation found for account_name_format (4421123930035299208) -->
- <skip />
+ <string name="account_name_format" msgid="4421123930035299208">"De <xliff:g id="SOURCE">%1$s</xliff:g> la cuenta: <xliff:g id="ACCOUNT">%2$s</xliff:g>"</string>
</resources>
diff --git a/src/com/android/contacts/ContactsListActivity.java b/src/com/android/contacts/ContactsListActivity.java
index 0c929ba..d700195 100644
--- a/src/com/android/contacts/ContactsListActivity.java
+++ b/src/com/android/contacts/ContactsListActivity.java
@@ -123,6 +123,7 @@
/**
* Displays a list of contacts. Usually is embedded into the ContactsActivity.
*/
+@SuppressWarnings("deprecation")
public class ContactsListActivity extends ListActivity implements
View.OnCreateContextMenuListener, View.OnClickListener {
diff --git a/src/com/android/contacts/ViewContactActivity.java b/src/com/android/contacts/ViewContactActivity.java
index e6dd623..06296cc 100644
--- a/src/com/android/contacts/ViewContactActivity.java
+++ b/src/com/android/contacts/ViewContactActivity.java
@@ -82,6 +82,7 @@
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.ListView;
+import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.Toast;
@@ -168,7 +169,6 @@
finish();
}
- private FrameLayout mTabContentLayout;
private ListView mListView;
private boolean mShowSmsLinksForAllPhones;
@@ -200,13 +200,11 @@
mHandler = new NotifyingAsyncQueryHandler(this, this);
- mListView = new ListView(this);
+ mListView = (ListView) findViewById(R.id.contact_data);
mListView.setOnCreateContextMenuListener(this);
mListView.setScrollBarStyle(ListView.SCROLLBARS_OUTSIDE_OVERLAY);
mListView.setOnItemClickListener(this);
-
- mTabContentLayout = (FrameLayout) findViewById(android.R.id.tabcontent);
- mTabContentLayout.addView(mListView);
+ mListView.setEmptyView((ScrollView) findViewById(android.R.id.empty));
mResolver = getContentResolver();
@@ -273,13 +271,13 @@
.setPositiveButton(android.R.string.ok, this)
.setCancelable(false)
.create();
- case DIALOG_CONFIRM_READONLY_HIDE: {
+ case DIALOG_CONFIRM_READONLY_HIDE: {
return new AlertDialog.Builder(this)
.setTitle(R.string.deleteConfirmation_title)
.setIcon(android.R.drawable.ic_dialog_alert)
.setMessage(R.string.readOnlyContactWarning)
.setPositiveButton(android.R.string.ok, this)
- .create();
+ .create();
}
}
@@ -509,15 +507,15 @@
}
case R.id.menu_delete: {
// Get confirmation
- if (mReadOnlySourcesCnt > 0 & mWritableSourcesCnt > 0) {
+ if (mReadOnlySourcesCnt > 0 & mWritableSourcesCnt > 0) {
showDialog(DIALOG_CONFIRM_READONLY_DELETE);
- } else if (mReadOnlySourcesCnt > 0 && mWritableSourcesCnt == 0) {
+ } else if (mReadOnlySourcesCnt > 0 && mWritableSourcesCnt == 0) {
showDialog(DIALOG_CONFIRM_READONLY_HIDE);
- } else if (mReadOnlySourcesCnt == 0 && mWritableSourcesCnt > 1) {
- showDialog(DIALOG_CONFIRM_MULTIPLE_DELETE);
- } else {
- showDialog(DIALOG_CONFIRM_DELETE);
- }
+ } else if (mReadOnlySourcesCnt == 0 && mWritableSourcesCnt > 1) {
+ showDialog(DIALOG_CONFIRM_MULTIPLE_DELETE);
+ } else {
+ showDialog(DIALOG_CONFIRM_DELETE);
+ }
return true;
}
case R.id.menu_join: {
@@ -714,15 +712,15 @@
}
case KeyEvent.KEYCODE_DEL: {
- if (mReadOnlySourcesCnt > 0 & mWritableSourcesCnt > 0) {
+ if (mReadOnlySourcesCnt > 0 & mWritableSourcesCnt > 0) {
showDialog(DIALOG_CONFIRM_READONLY_DELETE);
- } else if (mReadOnlySourcesCnt > 0 && mWritableSourcesCnt == 0) {
+ } else if (mReadOnlySourcesCnt > 0 && mWritableSourcesCnt == 0) {
showDialog(DIALOG_CONFIRM_READONLY_HIDE);
- } else if (mReadOnlySourcesCnt == 0 && mWritableSourcesCnt > 1) {
- showDialog(DIALOG_CONFIRM_MULTIPLE_DELETE);
- } else {
- showDialog(DIALOG_CONFIRM_DELETE);
- }
+ } else if (mReadOnlySourcesCnt == 0 && mWritableSourcesCnt > 1) {
+ showDialog(DIALOG_CONFIRM_MULTIPLE_DELETE);
+ } else {
+ showDialog(DIALOG_CONFIRM_DELETE);
+ }
return true;
}
}
@@ -792,8 +790,8 @@
mReadOnlySourcesCnt += 1;
} else {
mWritableSourcesCnt += 1;
- mWritableRawContactIds.add(rawContactId);
- }
+ mWritableRawContactIds.add(rawContactId);
+ }
for (NamedContentValues subValue : entity.getSubValues()) {
diff --git a/src/com/android/contacts/model/ExchangeSource.java b/src/com/android/contacts/model/ExchangeSource.java
index 5161499..b46824c 100644
--- a/src/com/android/contacts/model/ExchangeSource.java
+++ b/src/com/android/contacts/model/ExchangeSource.java
@@ -275,11 +275,11 @@
@Override
public int getHeaderColor(Context context) {
- return 0xff876b47;
+ return 0xffd5ba96;
}
@Override
public int getSideBarColor(Context context) {
- return 0xffc6ab8c;
+ return 0xffb58e59;
}
}
diff --git a/src/com/android/contacts/model/ExternalSource.java b/src/com/android/contacts/model/ExternalSource.java
index d2f14dc..743eb4e 100644
--- a/src/com/android/contacts/model/ExternalSource.java
+++ b/src/com/android/contacts/model/ExternalSource.java
@@ -183,11 +183,11 @@
@Override
public int getHeaderColor(Context context) {
- return 0xff7f93bc;
+ return 0xff6d86b4;
}
@Override
public int getSideBarColor(Context context) {
- return 0xffbdc7d8;
+ return 0xff6d86b4;
}
}
diff --git a/src/com/android/contacts/model/GoogleSource.java b/src/com/android/contacts/model/GoogleSource.java
index e8f7f46..a4b4cb2 100644
--- a/src/com/android/contacts/model/GoogleSource.java
+++ b/src/com/android/contacts/model/GoogleSource.java
@@ -263,11 +263,11 @@
@Override
public int getHeaderColor(Context context) {
- return 0xff000000;
+ return 0xff89c2c2;
}
@Override
public int getSideBarColor(Context context) {
- return 0xffffffff;
+ return 0xff5bb4b4;
}
}
diff --git a/src/com/android/contacts/ui/EditContactActivity.java b/src/com/android/contacts/ui/EditContactActivity.java
index fef6a9f..5d095c6 100644
--- a/src/com/android/contacts/ui/EditContactActivity.java
+++ b/src/com/android/contacts/ui/EditContactActivity.java
@@ -79,12 +79,14 @@
import java.lang.ref.WeakReference;
import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
/**
* Activity for editing or inserting a contact.
*/
public final class EditContactActivity extends Activity
- implements View.OnClickListener {
+ implements View.OnClickListener, Comparator<EntityDelta> {
private static final String TAG = "EditContactActivity";
/** The launch code when picking a photo and the raw data is returned */
@@ -323,8 +325,10 @@
Context.LAYOUT_INFLATER_SERVICE);
final Sources sources = Sources.getInstance(this);
- // Remove any existing editors and rebuild any visible
+ // Sort the editors
+ Collections.sort(mState, this);
+ // Remove any existing editors and rebuild any visible
mContent.removeAllViews();
int size = mState.size();
for (int i = 0; i < size; i++) {
@@ -363,18 +367,6 @@
}
/** {@inheritDoc} */
- public void onDisplayNameClick(View view) {
- if (!hasValidState()) return;
- showAndManageDialog(createNameDialog());
- }
-
- /** {@inheritDoc} */
- public void onPhotoClick(View view) {
- if (!hasValidState()) return;
- showAndManageDialog(createPhotoDialog());
- }
-
- /** {@inheritDoc} */
public void onClick(View view) {
switch (view.getId()) {
case R.id.btn_done:
@@ -791,7 +783,7 @@
/**
* Pick a specific photo to be added under the currently selected tab.
*/
- private boolean doPickPhotoAction(long rawContactId) {
+ boolean doPickPhotoAction(long rawContactId) {
if (!hasValidState()) return false;
try {
@@ -1028,11 +1020,6 @@
return builder.create();
}
- private Dialog createPhotoDialog() {
- // TODO: build dialog for picking primary photo
- return null;
- }
-
/**
* Create dialog for selecting primary display name.
*/
@@ -1085,4 +1072,63 @@
return builder.create();
}
+ /**
+ * Compare EntityDeltas for sorting the stack of editors.
+ */
+ public int compare(EntityDelta one, EntityDelta two) {
+ // Check direct equality
+ if (one.equals(two)) {
+ return 0;
+ }
+
+ final Sources sources = Sources.getInstance(this);
+ String accountType = one.getValues().getAsString(RawContacts.ACCOUNT_TYPE);
+ final ContactsSource oneSource = sources.getInflatedSource(accountType,
+ ContactsSource.LEVEL_SUMMARY);
+ accountType = two.getValues().getAsString(RawContacts.ACCOUNT_TYPE);
+ final ContactsSource twoSource = sources.getInflatedSource(accountType,
+ ContactsSource.LEVEL_SUMMARY);
+
+ // Check read-only
+ if (oneSource.readOnly && !twoSource.readOnly) {
+ return 1;
+ } else if (twoSource.readOnly && !oneSource.readOnly) {
+ return -1;
+ }
+
+ // Check account type
+ boolean skipAccountTypeCheck = false;
+ boolean oneIsGoogle = oneSource instanceof GoogleSource;
+ boolean twoIsGoogle = twoSource instanceof GoogleSource;
+ if (oneIsGoogle && !twoIsGoogle) {
+ return -1;
+ } else if (twoIsGoogle && !oneIsGoogle) {
+ return 1;
+ } else {
+ skipAccountTypeCheck = true;
+ }
+
+ int value;
+ if (!skipAccountTypeCheck) {
+ value = oneSource.accountType.compareTo(twoSource.accountType);
+ if (value != 0) {
+ return value;
+ }
+ }
+
+ // Check account name
+ String oneAccount = one.getValues().getAsString(RawContacts.ACCOUNT_NAME);
+ if (oneAccount == null) oneAccount = "null";
+ String twoAccount = two.getValues().getAsString(RawContacts.ACCOUNT_NAME);
+ if (twoAccount == null) twoAccount = "null";
+ value = oneAccount.compareTo(twoAccount);
+ if (value != 0) {
+ return value;
+ }
+
+ // Both are in the same account, fall back to contact ID
+ int oneId = one.getValues().getAsInteger(RawContacts._ID);
+ int twoId = two.getValues().getAsInteger(RawContacts._ID);
+ return oneId -twoId;
+ }
}
diff --git a/src/com/android/contacts/ui/widget/ContactEditorView.java b/src/com/android/contacts/ui/widget/ContactEditorView.java
index 8e76e7b..bf03052 100644
--- a/src/com/android/contacts/ui/widget/ContactEditorView.java
+++ b/src/com/android/contacts/ui/widget/ContactEditorView.java
@@ -18,7 +18,6 @@
import com.android.contacts.R;
import com.android.contacts.model.ContactsSource;
-import com.android.contacts.model.Editor;
import com.android.contacts.model.EntityDelta;
import com.android.contacts.model.EntityModifier;
import com.android.contacts.model.ContactsSource.DataKind;
@@ -61,6 +60,7 @@
private LayoutInflater mInflater;
private TextView mReadOnly;
+ private TextView mReadOnlyName;
private PhotoEditorView mPhoto;
private GenericEditorView mName;
@@ -75,7 +75,7 @@
private Drawable mSecondaryOpen;
private Drawable mSecondaryClosed;
- private View mHeader;
+ private View mHeaderColorBar;
private View mSideBar;
private ImageView mHeaderIcon;
private TextView mHeaderAccountType;
@@ -109,10 +109,12 @@
mName.setMinimumHeight(photoSize);
mName.setDeletable(false);
+ mReadOnlyName = (TextView) findViewById(R.id.read_only_name);
+
mGeneral = (ViewGroup)findViewById(R.id.sect_general);
mSecondary = (ViewGroup)findViewById(R.id.sect_secondary);
- mHeader = findViewById(R.id.header);
+ mHeaderColorBar = findViewById(R.id.header_color_bar);
mSideBar = findViewById(R.id.color_bar);
mHeaderIcon = (ImageView) findViewById(R.id.header_icon);
mHeaderAccountType = (TextView) findViewById(R.id.header_account_type);
@@ -188,16 +190,18 @@
EntityModifier.ensureKindExists(state, source, StructuredName.CONTENT_ITEM_TYPE);
// Fill in the header info
- mHeader.setBackgroundColor(source.getHeaderColor(mContext));
+ mHeaderColorBar.setBackgroundColor(source.getHeaderColor(mContext));
mSideBar.setBackgroundColor(source.getSideBarColor(mContext));
ValuesDelta values = state.getValues();
String accountName = values.getAsString(RawContacts.ACCOUNT_NAME);
- if (TextUtils.isEmpty(accountName)) {
- // TODO get from resource
- accountName = "Local contact";
+ CharSequence accountType = source.getDisplayLabel(mContext);
+ if (TextUtils.isEmpty(accountType)) {
+ accountType = mContext.getString(R.string.account_phone);
+ } else {
+ mHeaderAccountName.setText(
+ mContext.getString(R.string.from_account_format, accountName));
}
- mHeaderAccountName.setText(accountName);
- mHeaderAccountType.setText(source.getDisplayLabel(mContext));
+ mHeaderAccountType.setText(mContext.getString(R.string.account_type_format, accountType));
mHeaderIcon.setImageDrawable(source.getDisplayIcon(mContext));
mRawContactId = values.getAsLong(RawContacts._ID);
@@ -210,12 +214,22 @@
mName.setEnabled(!source.readOnly);
boolean readOnly = source.readOnly;
+ // Show and hide the appropriate views
if (readOnly) {
mGeneral.setVisibility(View.GONE);
mSecondary.setVisibility(View.GONE);
mSecondaryHeader.setVisibility(View.GONE);
+ mName.setVisibility(View.GONE);
+ mReadOnly.setVisibility(View.VISIBLE);
+ mReadOnly.setText(mContext.getString(R.string.contact_read_only, accountType));
+ mReadOnlyName.setVisibility(View.VISIBLE);
} else {
+ mGeneral.setVisibility(View.VISIBLE);
+ mSecondary.setVisibility(View.VISIBLE);
+ mSecondaryHeader.setVisibility(View.VISIBLE);
+ mName.setVisibility(View.VISIBLE);
mReadOnly.setVisibility(View.GONE);
+ mReadOnlyName.setVisibility(View.GONE);
}
// Create editor sections for each possible data kind
@@ -227,7 +241,12 @@
if (StructuredName.CONTENT_ITEM_TYPE.equals(mimeType)) {
// Handle special case editor for structured name
final ValuesDelta primary = state.getPrimaryEntry(mimeType);
- mName.setValues(kind, primary, state, source.readOnly);
+ if (!readOnly) {
+ mName.setValues(kind, primary, state, source.readOnly);
+ } else {
+ String displayName = primary.getAsString(StructuredName.DISPLAY_NAME);
+ mReadOnlyName.setText(displayName);
+ }
} else if (Photo.CONTENT_ITEM_TYPE.equals(mimeType)) {
// Handle special case editor for photos
final ValuesDelta primary = state.getPrimaryEntry(mimeType);
diff --git a/src/com/android/contacts/ui/widget/GenericEditorView.java b/src/com/android/contacts/ui/widget/GenericEditorView.java
index 6c782f8..26d4aab 100644
--- a/src/com/android/contacts/ui/widget/GenericEditorView.java
+++ b/src/com/android/contacts/ui/widget/GenericEditorView.java
@@ -113,9 +113,10 @@
mDelete.setVisibility(deletable ? View.VISIBLE : View.INVISIBLE);
}
+ @Override
public void setEnabled(boolean enabled) {
mLabel.setEnabled(enabled);
- final int count = mFields.getChildCount();
+ final int count = mFields.getChildCount();
for (int pos = 0; pos < count; pos++) {
final View v = mFields.getChildAt(pos);
v.setEnabled(enabled);
@@ -168,9 +169,9 @@
mKind = kind;
mEntry = entry;
mState = state;
- mReadOnly = readOnly;
+ mReadOnly = readOnly;
- final boolean enabled = !readOnly;
+ final boolean enabled = !readOnly;
if (!entry.isVisible()) {
// Hide ourselves entirely if deleted
@@ -183,7 +184,7 @@
// Display label selector if multiple types available
final boolean hasTypes = EntityModifier.hasEditTypes(kind);
mLabel.setVisibility(hasTypes ? View.VISIBLE : View.GONE);
- mLabel.setEnabled(enabled);
+ mLabel.setEnabled(enabled);
if (hasTypes) {
mType = EntityModifier.getCurrentType(entry, kind);
rebuildLabel();
@@ -224,7 +225,7 @@
final boolean couldHide = (TextUtils.isEmpty(value) && field.optional);
final boolean willHide = (mHideOptional && couldHide);
fieldView.setVisibility(willHide ? View.GONE : View.VISIBLE);
- fieldView.setEnabled(enabled);
+ fieldView.setEnabled(enabled);
hidePossible = hidePossible || couldHide;
mFields.addView(fieldView);
@@ -232,7 +233,7 @@
// When hiding fields, place expandable
mMore.setVisibility(hidePossible ? View.VISIBLE : View.GONE);
- mMore.setEnabled(enabled);
+ mMore.setEnabled(enabled);
}
/**
@@ -304,16 +305,17 @@
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
- if (mType.customColumn != null) {
+ final EditType selected = validTypes.get(which);
+ if (selected.customColumn != null) {
// Show custom label dialog if requested by type.
//
// Only when the custum value input in the next step is correct one.
// this method also set the type value to what the user requested here.
- mPendingType = validTypes.get(which);
+ mPendingType = selected;
createCustomDialog().show();
} else {
// User picked type, and we're sure it's ok to actually write the entry.
- mType = validTypes.get(which);
+ mType = selected;
mEntry.put(mKind.typeColumn, mType.rawValue);
rebuildLabel();
}