summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Attwell <brianattwell@google.com>2014-08-18 15:14:18 -0700
committerBrian Attwell <brianattwell@google.com>2014-08-19 09:43:59 -0700
commit63176c96f33b5a0bcb25816c80889bb11e5c7152 (patch)
treeca15cb790f61256acabc6890aa664dc0e8e7191a
parent7edfcaf254630330fbc110b4f8e1e063d9ce9876 (diff)
downloadpackages_apps_Contacts-63176c96f33b5a0bcb25816c80889bb11e5c7152.tar.gz
packages_apps_Contacts-63176c96f33b5a0bcb25816c80889bb11e5c7152.tar.bz2
packages_apps_Contacts-63176c96f33b5a0bcb25816c80889bb11e5c7152.zip
Fix crash editing newly saved directory contact
After saving a directory contact via QC, mLookupUri still refers to a directory contact. ContactLoader knows to map the directory URI to a local URI. When editing/starring a contact we should therefore use the URI returned from ContactLoader instead of the URI passed into QuickContactActivity. I also fixed some IntelliJ style nits. Bug: 16670552 Change-Id: I8cb04b645c050e2aa563abaa64125d1ef17e402e
-rw-r--r--src/com/android/contacts/quickcontact/QuickContactActivity.java17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/com/android/contacts/quickcontact/QuickContactActivity.java b/src/com/android/contacts/quickcontact/QuickContactActivity.java
index 1607c7d91..b61985f10 100644
--- a/src/com/android/contacts/quickcontact/QuickContactActivity.java
+++ b/src/com/android/contacts/quickcontact/QuickContactActivity.java
@@ -186,6 +186,10 @@ public class QuickContactActivity extends ContactsActivity {
"vnd.android.cursor.item/vnd.googleplus.profile.comm";
private static final String INTENT_DATA_HANGOUTS_VIDEO = "Start video call";
+ /**
+ * The URI used to load the the Contact. Once the contact is loaded, use Contact#getLookupUri()
+ * instead of referencing this URI.
+ */
private Uri mLookupUri;
private String[] mExcludeMimes;
private int mExtraMode;
@@ -193,7 +197,6 @@ public class QuickContactActivity extends ContactsActivity {
private boolean mHasAlreadyBeenOpened;
private ImageView mPhotoView;
- private View mTransparentView;
private ExpandingEntryCardView mContactCard;
private ExpandingEntryCardView mNoContactDetailsCard;
private ExpandingEntryCardView mRecentCard;
@@ -571,9 +574,9 @@ public class QuickContactActivity extends ContactsActivity {
mAboutCard.setOnCreateContextMenuListener(mEntryContextMenuListener);
mPhotoView = (ImageView) findViewById(R.id.photo);
- mTransparentView = findViewById(R.id.transparent_view);
+ final View transparentView = findViewById(R.id.transparent_view);
if (mScroller != null) {
- mTransparentView.setOnClickListener(new OnClickListener() {
+ transparentView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
mScroller.scrollOffBottom();
@@ -1700,7 +1703,7 @@ public class QuickContactActivity extends ContactsActivity {
}
private Intent getEditContactIntent() {
- final Intent intent = new Intent(Intent.ACTION_EDIT, mLookupUri);
+ final Intent intent = new Intent(Intent.ACTION_EDIT, mContactData.getLookupUri());
mContactLoader.cacheResult();
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
return intent;
@@ -1712,7 +1715,7 @@ public class QuickContactActivity extends ContactsActivity {
private void toggleStar(MenuItem starredMenuItem) {
// Make sure there is a contact
- if (mLookupUri != null) {
+ if (mContactData != null) {
// Read the current starred value from the UI instead of using the last
// loaded state. This allows rapid tapping without writing the same
// value several times
@@ -1725,7 +1728,7 @@ public class QuickContactActivity extends ContactsActivity {
// Now perform the real save
final Intent intent = ContactSaveService.createSetStarredIntent(
- QuickContactActivity.this, mLookupUri, !isStarred);
+ QuickContactActivity.this, mContactData.getLookupUri(), !isStarred);
startService(intent);
final CharSequence accessibilityText = !isStarred
@@ -1803,7 +1806,7 @@ public class QuickContactActivity extends ContactsActivity {
}
});
- builder.createContactShortcutIntent(mLookupUri);
+ builder.createContactShortcutIntent(mContactData.getLookupUri());
}
@Override