merge in jb-release history after reset to jb-dev
diff --git a/res/values-cs/strings.xml b/res/values-cs/strings.xml
index 2e28e14..609604f 100644
--- a/res/values-cs/strings.xml
+++ b/res/values-cs/strings.xml
@@ -64,8 +64,8 @@
<string name="separatorJoinAggregateSuggestions" msgid="2831414448851313345">"Navrhované kontakty"</string>
<string name="separatorJoinAggregateAll" msgid="7939932265026181043">"Všechny kontakty"</string>
<string name="contactsJoinedMessage" msgid="7208148163607047389">"Kontakty byly spojeny"</string>
- <string name="menu_set_ring_tone" msgid="8728345772068064946">"Nast. vyzvánění"</string>
- <string name="menu_redirect_calls_to_vm" msgid="4181789196416396656">"Všechny hovory do hlas. schr."</string>
+ <string name="menu_set_ring_tone" msgid="8728345772068064946">"Nastavit vyzvánění"</string>
+ <string name="menu_redirect_calls_to_vm" msgid="4181789196416396656">"Hovory do hlas. schránky"</string>
<string name="readOnlyContactWarning" msgid="7808825687289848259">"Z účtů pouze pro čtení není možné kontakty mazat, můžete je však ve svých seznamech kontaktů skrýt."</string>
<string name="readOnlyContactDeleteConfirmation" msgid="2137170726670196909">"Tento kontakt obsahuje informace z několika účtů. Informace z účtů pouze pro čtení budou v seznamech kontaktů skryty, ale nebudou smazány."</string>
<string name="multipleContactDeleteConfirmation" msgid="938900978442960800">"Smazáním tohoto kontaktu smažete informace z více účtů."</string>
diff --git a/src/com/android/contacts/editor/ContactEditorFragment.java b/src/com/android/contacts/editor/ContactEditorFragment.java
index 7159fe5..a4e4db4 100644
--- a/src/com/android/contacts/editor/ContactEditorFragment.java
+++ b/src/com/android/contacts/editor/ContactEditorFragment.java
@@ -104,6 +104,7 @@
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";
@@ -189,6 +190,19 @@
private static final int REQUEST_CODE_JOIN = 0;
private static final int REQUEST_CODE_ACCOUNTS_CHANGED = 1;
+ /**
+ * The raw contact for which we started "take photo" or "choose photo from gallery" most
+ * recently. Used to restore {@link #mCurrentPhotoHandler} after orientation change.
+ */
+ private long mRawContactIdRequestingPhoto;
+ /**
+ * The {@link PhotoHandler} for the photo editor for the {@link #mRawContactIdRequestingPhoto}
+ * raw contact.
+ *
+ * A {@link PhotoHandler} is created for each photo editor in {@link #bindPhotoHandler}, but
+ * the only "active" one should get the activity result. This member represents the active
+ * one.
+ */
private PhotoHandler mCurrentPhotoHandler;
private final EntityDeltaComparator mComparator = new EntityDeltaComparator();
@@ -407,6 +421,8 @@
} 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);
@@ -805,6 +821,12 @@
final PhotoHandler photoHandler = new PhotoHandler(mContext, editor, mode, state);
editor.getPhotoEditor().setEditorListener(
(PhotoHandler.PhotoEditorListener) photoHandler.getListener());
+
+ // Note a newly created raw contact gets some random negative ID, so any value is valid
+ // here. (i.e. don't check against -1 or anything.)
+ if (mRawContactIdRequestingPhoto == editor.getRawContactId()) {
+ mCurrentPhotoHandler = photoHandler;
+ }
}
private void bindGroupMetaData() {
@@ -1535,7 +1557,7 @@
// Store entities with modifications
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);
@@ -1747,7 +1769,7 @@
final long mRawContactId;
private final BaseRawContactEditorView mEditor;
- private PhotoActionListener mPhotoEditorListener;
+ private final PhotoActionListener mPhotoEditorListener;
public PhotoHandler(Context context, BaseRawContactEditorView editor, int photoMode,
EntityDeltaList state) {
@@ -1764,6 +1786,7 @@
@Override
public void startPhotoActivity(Intent intent, int requestCode, String photoFile) {
+ mRawContactIdRequestingPhoto = mEditor.getRawContactId();
mCurrentPhotoHandler = this;
mStatus = Status.SUB_ACTIVITY;
mCurrentPhotoFile = photoFile;
@@ -1822,7 +1845,7 @@
@Override
public void onPhotoSelected(Bitmap bitmap) {
- setPhoto(mCurrentPhotoHandler.mRawContactId, bitmap, mCurrentPhotoFile);
+ setPhoto(mRawContactId, bitmap, mCurrentPhotoFile);
mCurrentPhotoHandler = null;
bindEditors();
}