merge in jb-release history after reset to jb-dev
diff --git a/res/mipmap-hdpi/ic_launcher_contacts.png b/res/mipmap-hdpi/ic_launcher_contacts.png
index fa60a53..e0136f6 100644
--- a/res/mipmap-hdpi/ic_launcher_contacts.png
+++ b/res/mipmap-hdpi/ic_launcher_contacts.png
Binary files differ
diff --git a/res/mipmap-hdpi/ic_launcher_shortcut_contact.png b/res/mipmap-hdpi/ic_launcher_shortcut_contact.png
index c867181..e132cd0 100644
--- a/res/mipmap-hdpi/ic_launcher_shortcut_contact.png
+++ b/res/mipmap-hdpi/ic_launcher_shortcut_contact.png
Binary files differ
diff --git a/res/mipmap-hdpi/ic_launcher_shortcut_directdial.png b/res/mipmap-hdpi/ic_launcher_shortcut_directdial.png
index c515815..f6ec866 100644
--- a/res/mipmap-hdpi/ic_launcher_shortcut_directdial.png
+++ b/res/mipmap-hdpi/ic_launcher_shortcut_directdial.png
Binary files differ
diff --git a/res/mipmap-hdpi/ic_launcher_shortcut_directmessage.png b/res/mipmap-hdpi/ic_launcher_shortcut_directmessage.png
index a347fa1..c8eb467 100644
--- a/res/mipmap-hdpi/ic_launcher_shortcut_directmessage.png
+++ b/res/mipmap-hdpi/ic_launcher_shortcut_directmessage.png
Binary files differ
diff --git a/res/mipmap-mdpi/ic_launcher_contacts.png b/res/mipmap-mdpi/ic_launcher_contacts.png
index b50d7dd..3d490c3 100644
--- a/res/mipmap-mdpi/ic_launcher_contacts.png
+++ b/res/mipmap-mdpi/ic_launcher_contacts.png
Binary files differ
diff --git a/res/mipmap-mdpi/ic_launcher_shortcut_contact.png b/res/mipmap-mdpi/ic_launcher_shortcut_contact.png
index dd3c8ff..218c915 100644
--- a/res/mipmap-mdpi/ic_launcher_shortcut_contact.png
+++ b/res/mipmap-mdpi/ic_launcher_shortcut_contact.png
Binary files differ
diff --git a/res/mipmap-mdpi/ic_launcher_shortcut_directdial.png b/res/mipmap-mdpi/ic_launcher_shortcut_directdial.png
index 1dfe8cc..50278c3 100644
--- a/res/mipmap-mdpi/ic_launcher_shortcut_directdial.png
+++ b/res/mipmap-mdpi/ic_launcher_shortcut_directdial.png
Binary files differ
diff --git a/res/mipmap-mdpi/ic_launcher_shortcut_directmessage.png b/res/mipmap-mdpi/ic_launcher_shortcut_directmessage.png
index c7dc525..698971b 100644
--- a/res/mipmap-mdpi/ic_launcher_shortcut_directmessage.png
+++ b/res/mipmap-mdpi/ic_launcher_shortcut_directmessage.png
Binary files differ
diff --git a/res/mipmap-xhdpi/ic_launcher_contacts.png b/res/mipmap-xhdpi/ic_launcher_contacts.png
index 4b7eaaa..dde3cbb 100644
--- a/res/mipmap-xhdpi/ic_launcher_contacts.png
+++ b/res/mipmap-xhdpi/ic_launcher_contacts.png
Binary files differ
diff --git a/res/mipmap-xhdpi/ic_launcher_shortcut_contact.png b/res/mipmap-xhdpi/ic_launcher_shortcut_contact.png
index baeb41f..8a5e25a 100644
--- a/res/mipmap-xhdpi/ic_launcher_shortcut_contact.png
+++ b/res/mipmap-xhdpi/ic_launcher_shortcut_contact.png
Binary files differ
diff --git a/res/mipmap-xhdpi/ic_launcher_shortcut_directdial.png b/res/mipmap-xhdpi/ic_launcher_shortcut_directdial.png
index 39d039a..e060bc5 100644
--- a/res/mipmap-xhdpi/ic_launcher_shortcut_directdial.png
+++ b/res/mipmap-xhdpi/ic_launcher_shortcut_directdial.png
Binary files differ
diff --git a/res/mipmap-xhdpi/ic_launcher_shortcut_directmessage.png b/res/mipmap-xhdpi/ic_launcher_shortcut_directmessage.png
index 7dd5d39..3222dc8 100644
--- a/res/mipmap-xhdpi/ic_launcher_shortcut_directmessage.png
+++ b/res/mipmap-xhdpi/ic_launcher_shortcut_directmessage.png
Binary files differ
diff --git a/src/com/android/contacts/editor/ContactEditorFragment.java b/src/com/android/contacts/editor/ContactEditorFragment.java
index 8aae70b..962a46b 100644
--- a/src/com/android/contacts/editor/ContactEditorFragment.java
+++ b/src/com/android/contacts/editor/ContactEditorFragment.java
@@ -23,7 +23,6 @@
import com.android.contacts.activities.ContactEditorAccountsChangedActivity;
import com.android.contacts.activities.ContactEditorActivity;
import com.android.contacts.activities.JoinContactActivity;
-import com.android.contacts.activities.PhotoSelectionActivity;
import com.android.contacts.detail.PhotoSelectionHandler;
import com.android.contacts.editor.AggregationSuggestionEngine.Suggestion;
import com.android.contacts.editor.Editor.EditorListener;
@@ -66,6 +65,7 @@
import android.provider.ContactsContract.CommonDataKinds.Event;
import android.provider.ContactsContract.CommonDataKinds.Organization;
import android.provider.ContactsContract.CommonDataKinds.Phone;
+import android.provider.ContactsContract.CommonDataKinds.Photo;
import android.provider.ContactsContract.CommonDataKinds.StructuredPostal;
import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.Groups;
@@ -104,7 +104,6 @@
private static final String KEY_URI = "uri";
private static final String KEY_ACTION = "action";
private static final String KEY_EDIT_STATE = "state";
- private static final String KEY_RAW_CONTACT_ID_REQUESTING_PHOTO = "photorequester";
private static final String KEY_VIEW_ID_GENERATOR = "viewidgenerator";
private static final String KEY_CURRENT_PHOTO_FILE = "currentphotofile";
private static final String KEY_CONTACT_ID_FOR_JOIN = "contactidforjoin";
@@ -190,8 +189,7 @@
private static final int REQUEST_CODE_JOIN = 0;
private static final int REQUEST_CODE_ACCOUNTS_CHANGED = 1;
- private long mRawContactIdRequestingPhoto = -1;
- private PhotoSelectionHandler mPhotoSelectionHandler;
+ private PhotoHandler mCurrentPhotoHandler;
private final EntityDeltaComparator mComparator = new EntityDeltaComparator();
@@ -409,8 +407,6 @@
} else {
// Read state from savedState. No loading involved here
mState = savedState.<EntityDeltaList> getParcelable(KEY_EDIT_STATE);
- mRawContactIdRequestingPhoto = savedState.getLong(
- KEY_RAW_CONTACT_ID_REQUESTING_PHOTO);
mViewIdGenerator = savedState.getParcelable(KEY_VIEW_ID_GENERATOR);
mCurrentPhotoFile = savedState.getString(KEY_CURRENT_PHOTO_FILE);
mContactIdForJoin = savedState.getLong(KEY_CONTACT_ID_FOR_JOIN);
@@ -806,9 +802,9 @@
return;
}
}
- mPhotoSelectionHandler = new PhotoHandler(mContext, editor, mode, state);
+ final PhotoHandler photoHandler = new PhotoHandler(mContext, editor, mode, state);
editor.getPhotoEditor().setEditorListener(
- (PhotoHandler.PhotoEditorListener) mPhotoSelectionHandler.getListener());
+ (PhotoHandler.PhotoEditorListener) photoHandler.getListener());
}
private void bindGroupMetaData() {
@@ -1087,7 +1083,6 @@
public void onSaveCompleted(boolean hadChanges, int saveMode, boolean saveSucceeded,
Uri contactLookupUri) {
- Log.d(TAG, "onSaveCompleted(" + saveMode + ", " + contactLookupUri);
if (hadChanges) {
if (saveSucceeded) {
if (saveMode != SaveMode.JOIN) {
@@ -1541,7 +1536,6 @@
outState.putParcelable(KEY_EDIT_STATE, mState);
}
- outState.putLong(KEY_RAW_CONTACT_ID_REQUESTING_PHOTO, mRawContactIdRequestingPhoto);
outState.putParcelable(KEY_VIEW_ID_GENERATOR, mViewIdGenerator);
outState.putString(KEY_CURRENT_PHOTO_FILE, mCurrentPhotoFile);
outState.putLong(KEY_CONTACT_ID_FOR_JOIN, mContactIdForJoin);
@@ -1563,7 +1557,7 @@
}
// See if the photo selection handler handles this result.
- if (mPhotoSelectionHandler != null && mPhotoSelectionHandler.handlePhotoActivityResult(
+ if (mCurrentPhotoHandler != null && mCurrentPhotoHandler.handlePhotoActivityResult(
requestCode, resultCode, data)) {
return;
}
@@ -1643,19 +1637,31 @@
* Returns true if there is currently more than one photo on screen.
*/
private boolean hasMoreThanOnePhoto() {
- int count = mContent.getChildCount();
int countWithPicture = 0;
- for (int i = 0; i < count; i++) {
- final View childView = mContent.getChildAt(i);
- if (childView instanceof BaseRawContactEditorView) {
- final BaseRawContactEditorView editor = (BaseRawContactEditorView) childView;
- if (editor.hasSetPhoto()) {
+ final int numEntities = mState.size();
+ for (int i = 0; i < numEntities; i++) {
+ final EntityDelta entity = mState.get(i);
+ final ValuesDelta values = entity.getValues();
+ if (values.isVisible()) {
+ final ValuesDelta primary = entity.getPrimaryEntry(Photo.CONTENT_ITEM_TYPE);
+ if (primary.getAsByteArray(Photo.PHOTO) != null) {
countWithPicture++;
- if (countWithPicture > 1) return true;
+ } else {
+ final long rawContactId = values.getAsLong(RawContacts._ID);
+ final String path = mUpdatedPhotos.getString(String.valueOf(rawContactId));
+ if (path != null) {
+ final File file = new File(path);
+ if (file.exists()) {
+ countWithPicture++;
+ }
+ }
+ }
+
+ if (countWithPicture > 1) {
+ return true;
}
}
}
-
return false;
}
@@ -1758,7 +1764,7 @@
@Override
public void startPhotoActivity(Intent intent, int requestCode, String photoFile) {
- mRawContactIdRequestingPhoto = mEditor.getRawContactId();
+ mCurrentPhotoHandler = this;
mStatus = Status.SUB_ACTIVITY;
mCurrentPhotoFile = photoFile;
ContactEditorFragment.this.startActivityForResult(intent, requestCode);
@@ -1798,6 +1804,7 @@
photoEditor.setSuperPrimary(editor == mEditor);
}
}
+ bindEditors();
}
/**
@@ -1810,12 +1817,14 @@
// Prevent bitmap from being restored if rotate the device.
// (only if we first chose a new photo before removing it)
mUpdatedPhotos.remove(String.valueOf(mRawContactId));
+ bindEditors();
}
@Override
public void onPhotoSelected(Bitmap bitmap) {
- setPhoto(mRawContactIdRequestingPhoto, bitmap, mCurrentPhotoFile);
- mRawContactIdRequestingPhoto = -1;
+ setPhoto(mCurrentPhotoHandler.mRawContactId, bitmap, mCurrentPhotoFile);
+ mCurrentPhotoHandler = null;
+ bindEditors();
}
@Override