Merge change I6238c621 into eclair
* changes:
Prevents empty focus contacts without photo from being created.
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 9242b1b..5735306 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -267,7 +267,8 @@
android:name=".ui.QuickContactActivity"
android:theme="@style/FullyTranslucent.QuickContact"
android:launchMode="singleTop"
- android:taskAffinity="android.task.fasttrack">
+ android:excludeFromRecents="true"
+ android:taskAffinity="android.task.quickcontact">
<intent-filter>
<action android:name="com.android.contacts.action.QUICK_CONTACT" />
diff --git a/res/drawable-hdpi-finger/divider_dark_opaque.9.png b/res/drawable-hdpi-finger/divider_dark_opaque.9.png
deleted file mode 100644
index 9444f0d..0000000
--- a/res/drawable-hdpi-finger/divider_dark_opaque.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi-finger/infobar_dark.9.png b/res/drawable-hdpi-finger/infobar_dark.9.png
index be0085a..105f6d0 100644
--- a/res/drawable-hdpi-finger/infobar_dark.9.png
+++ b/res/drawable-hdpi-finger/infobar_dark.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/section_dark.9.png b/res/drawable-hdpi-finger/section_dark.9.png
deleted file mode 100644
index 5a865fa..0000000
--- a/res/drawable-hdpi-finger/section_dark.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_launcher_contacts.png b/res/drawable-hdpi/ic_launcher_contacts.png
index be57b4a..69a72c4 100644
--- a/res/drawable-hdpi/ic_launcher_contacts.png
+++ b/res/drawable-hdpi/ic_launcher_contacts.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/divider_dark_opaque.9.png b/res/drawable-mdpi-finger/divider_dark_opaque.9.png
deleted file mode 100644
index 9444f0d..0000000
--- a/res/drawable-mdpi-finger/divider_dark_opaque.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi-finger/infobar_dark.9.png b/res/drawable-mdpi-finger/infobar_dark.9.png
index a3f3b01..45b2dcb 100644
--- a/res/drawable-mdpi-finger/infobar_dark.9.png
+++ b/res/drawable-mdpi-finger/infobar_dark.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/section_dark.9.png b/res/drawable-mdpi-finger/section_dark.9.png
deleted file mode 100644
index dbf6ded..0000000
--- a/res/drawable-mdpi-finger/section_dark.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_launcher_contacts.png b/res/drawable-mdpi/ic_launcher_contacts.png
new file mode 100644
index 0000000..08468fd
--- /dev/null
+++ b/res/drawable-mdpi/ic_launcher_contacts.png
Binary files differ
diff --git a/res/drawable/ic_launcher_contacts.png b/res/drawable/ic_launcher_contacts.png
deleted file mode 100644
index 826656f..0000000
--- a/res/drawable/ic_launcher_contacts.png
+++ /dev/null
Binary files differ
diff --git a/res/layout-finger/contacts_list_item_photo.xml b/res/layout-finger/contacts_list_item_photo.xml
index bd3baf8..b7fcd7a 100644
--- a/res/layout-finger/contacts_list_item_photo.xml
+++ b/res/layout-finger/contacts_list_item_photo.xml
@@ -140,6 +140,6 @@
<View android:id="@+id/list_divider"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:background="@drawable/divider_dark_opaque"
+ android:background="@*android:drawable/divider_horizontal_dark_opaque"
/>
</LinearLayout>
diff --git a/res/layout-finger/list_section.xml b/res/layout-finger/list_section.xml
index b91d213..06a9ffe 100644
--- a/res/layout-finger/list_section.xml
+++ b/res/layout-finger/list_section.xml
@@ -19,7 +19,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="25dip"
- android:background="@drawable/section_dark"
+ android:background="@*android:drawable/dark_header"
>
<TextView
android:id="@+id/header_text"
@@ -28,14 +28,8 @@
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:textStyle="bold"
- android:textColor="#ffbfbfbf"
+ android:textColor="@*android:color/dim_foreground_dark"
android:textSize="14sp"
android:gravity="center"
/>
- <View
- android:layout_width="fill_parent"
- android:layout_height="1dip"
- android:layout_alignParentBottom="true"
- android:background="@drawable/divider_dark_opaque"
- />
</RelativeLayout>
diff --git a/src/com/android/contacts/AttachImage.java b/src/com/android/contacts/AttachImage.java
index c8b6322..6970842 100644
--- a/src/com/android/contacts/AttachImage.java
+++ b/src/com/android/contacts/AttachImage.java
@@ -59,7 +59,7 @@
}
- private Long[] rawContactIds;
+ private Long[] mRawContactIds;
private ContentResolver mContentResolver;
@@ -68,7 +68,7 @@
super.onCreate(icicle);
if (icicle != null) {
- rawContactIds = toClassArray(icicle.getLongArray(RAW_CONTACT_URIS_KEY));
+ mRawContactIds = toClassArray(icicle.getLongArray(RAW_CONTACT_URIS_KEY));
} else {
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType(Contacts.CONTENT_ITEM_TYPE);
@@ -82,12 +82,15 @@
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
- if (rawContactIds != null && rawContactIds.length != 0) {
- outState.putLongArray(RAW_CONTACT_URIS_KEY, toPrimativeArray(rawContactIds));
+ if (mRawContactIds != null && mRawContactIds.length != 0) {
+ outState.putLongArray(RAW_CONTACT_URIS_KEY, toPrimativeArray(mRawContactIds));
}
}
private static long[] toPrimativeArray(Long[] in) {
+ if (in == null) {
+ return null;
+ }
long[] out = new long[in.length];
for (int i = 0; i < in.length; i++) {
out[i] = in[i];
@@ -96,6 +99,9 @@
}
private static Long[] toClassArray(long[] in) {
+ if (in == null) {
+ return null;
+ }
Long[] out = new Long[in.length];
for (int i = 0; i < in.length; i++) {
out[i] = in[i];
@@ -130,15 +136,15 @@
final long contactId = ContentUris.parseId(result.getData());
final ArrayList<Long> rawContactIdsList = ContactsUtils.queryForAllRawContactIds(
mContentResolver, contactId);
- rawContactIds = new Long[rawContactIdsList.size()];
- rawContactIds = rawContactIdsList.toArray(rawContactIds);
+ mRawContactIds = new Long[rawContactIdsList.size()];
+ mRawContactIds = rawContactIdsList.toArray(mRawContactIds);
- if (rawContactIds == null || rawContactIdsList.isEmpty()) {
+ if (mRawContactIds == null || rawContactIdsList.isEmpty()) {
Toast.makeText(this, R.string.contactSavedErrorToast, Toast.LENGTH_LONG).show();
}
} else if (requestCode == REQUEST_CROP_PHOTO) {
final Bundle extras = result.getExtras();
- if (extras != null) {
+ if (extras != null && mRawContactIds != null) {
Bitmap photo = extras.getParcelable("data");
if (photo != null) {
ByteArrayOutputStream stream = new ByteArrayOutputStream();
@@ -149,7 +155,7 @@
imageValues.put(RawContacts.Data.IS_SUPER_PRIMARY, 1);
// attach the photo to every raw contact
- for (Long rawContactId : rawContactIds) {
+ for (Long rawContactId : mRawContactIds) {
// exchange and google only allow one image, so do an update rather than insert
boolean shouldUpdate = false;
diff --git a/src/com/android/contacts/ContactsListActivity.java b/src/com/android/contacts/ContactsListActivity.java
index 4125d7a..c4ef60f 100644
--- a/src/com/android/contacts/ContactsListActivity.java
+++ b/src/com/android/contacts/ContactsListActivity.java
@@ -395,14 +395,8 @@
}
private class DeleteClickListener implements DialogInterface.OnClickListener {
- private Uri mUri;
-
- public DeleteClickListener(Uri uri) {
- mUri = uri;
- }
-
public void onClick(DialogInterface dialog, int which) {
- getContentResolver().delete(mUri, null, null);
+ getContentResolver().delete(mSelectedContactUri, null, null);
}
}
@@ -880,7 +874,7 @@
.setMessage(R.string.deleteConfirmation)
.setNegativeButton(android.R.string.cancel, null)
.setPositiveButton(android.R.string.ok,
- new DeleteClickListener(mSelectedContactUri)).create();
+ new DeleteClickListener()).create();
}
case R.id.dialog_readonly_contact_hide_confirmation: {
return new AlertDialog.Builder(this)
@@ -889,7 +883,7 @@
.setMessage(R.string.readOnlyContactWarning)
.setNegativeButton(android.R.string.cancel, null)
.setPositiveButton(android.R.string.ok,
- new DeleteClickListener(mSelectedContactUri)).create();
+ new DeleteClickListener()).create();
}
case R.id.dialog_readonly_contact_delete_confirmation: {
return new AlertDialog.Builder(this)
@@ -898,7 +892,7 @@
.setMessage(R.string.readOnlyContactDeleteConfirmation)
.setNegativeButton(android.R.string.cancel, null)
.setPositiveButton(android.R.string.ok,
- new DeleteClickListener(mSelectedContactUri)).create();
+ new DeleteClickListener()).create();
}
case R.id.dialog_multiple_contact_delete_confirmation: {
return new AlertDialog.Builder(this)
@@ -907,7 +901,7 @@
.setMessage(R.string.multipleContactDeleteConfirmation)
.setNegativeButton(android.R.string.cancel, null)
.setPositiveButton(android.R.string.ok,
- new DeleteClickListener(mSelectedContactUri)).create();
+ new DeleteClickListener()).create();
}
}
return super.onCreateDialog(id);
@@ -1148,39 +1142,39 @@
*/
protected void doContactDelete() {
mReadOnlySourcesCnt = 0;
- mWritableSourcesCnt = 0;
+ mWritableSourcesCnt = 0;
mWritableRawContactIds.clear();
- if (mSelectedContactUri != null) {
- Cursor c = getContentResolver().query(RawContacts.CONTENT_URI,
- RAW_CONTACTS_PROJECTION, RawContacts.CONTACT_ID + "="
- + ContentUris.parseId(mSelectedContactUri), null, null);
+ if (mSelectedContactUri != null) {
+ Cursor c = getContentResolver().query(RawContacts.CONTENT_URI, RAW_CONTACTS_PROJECTION,
+ RawContacts.CONTACT_ID + "=" + ContentUris.parseId(mSelectedContactUri), null,
+ null);
Sources sources = Sources.getInstance(ContactsListActivity.this);
if (c != null) {
while (c.moveToNext()) {
final String accountType = c.getString(2);
- final long rawContactId = c.getLong(0);
+ final long rawContactId = c.getLong(0);
ContactsSource contactsSource = sources.getInflatedSource(accountType,
ContactsSource.LEVEL_SUMMARY);
if (contactsSource != null && contactsSource.readOnly) {
mReadOnlySourcesCnt += 1;
} else {
mWritableSourcesCnt += 1;
- mWritableRawContactIds.add(rawContactId);
- }
- }
+ mWritableRawContactIds.add(rawContactId);
+ }
+ }
}
c.close();
- if (mReadOnlySourcesCnt > 0 && mWritableSourcesCnt > 0) {
- showDialog(R.id.dialog_readonly_contact_delete_confirmation);
- } else if (mReadOnlySourcesCnt > 0 && mWritableSourcesCnt == 0) {
- showDialog(R.id.dialog_readonly_contact_hide_confirmation);
- } else if (mReadOnlySourcesCnt == 0 && mWritableSourcesCnt > 1) {
- showDialog(R.id.dialog_multiple_contact_delete_confirmation);
+ if (mReadOnlySourcesCnt > 0 && mWritableSourcesCnt > 0) {
+ showDialog(R.id.dialog_readonly_contact_delete_confirmation);
+ } else if (mReadOnlySourcesCnt > 0 && mWritableSourcesCnt == 0) {
+ showDialog(R.id.dialog_readonly_contact_hide_confirmation);
+ } else if (mReadOnlySourcesCnt == 0 && mWritableSourcesCnt > 1) {
+ showDialog(R.id.dialog_multiple_contact_delete_confirmation);
} else {
- showDialog(R.id.dialog_delete_contact_confirmation);
- }
- }
+ showDialog(R.id.dialog_delete_contact_confirmation);
+ }
+ }
}
@Override
diff --git a/src/com/android/contacts/ui/QuickContactActivity.java b/src/com/android/contacts/ui/QuickContactActivity.java
index 86dca28..6445664 100644
--- a/src/com/android/contacts/ui/QuickContactActivity.java
+++ b/src/com/android/contacts/ui/QuickContactActivity.java
@@ -31,7 +31,7 @@
*/
public final class QuickContactActivity extends Activity implements
QuickContactWindow.OnDismissListener {
- private static final String TAG = "FastTrackActivity";
+ private static final String TAG = "QuickContactActivity";
static final boolean LOGV = true;
static final boolean FORCE_CREATE = false;