summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorblong <blong@codeaurora.org>2014-08-21 17:21:01 +0800
committerXiaojing Zhang <zhangx@codeaurora.org>2014-11-04 20:32:07 -0800
commitef2f04ccfa8a9dbcdc852dd043986fef11e5953c (patch)
treee586d1c6999eebd1e2f4498c7d80a9e375423c6b
parente2b1f7c79e1f87467a08dde7154fcb856012c953 (diff)
downloadpackages_apps_Contacts-ef2f04ccfa8a9dbcdc852dd043986fef11e5953c.tar.gz
packages_apps_Contacts-ef2f04ccfa8a9dbcdc852dd043986fef11e5953c.tar.bz2
packages_apps_Contacts-ef2f04ccfa8a9dbcdc852dd043986fef11e5953c.zip
Support editing the contact phone number before calling it
- Allow user to edit the phone number via long click in the contact detailed view before dialing Change-Id: Ic901842fc134470ffcddfd0a10a10f8c3b947a0e
-rw-r--r--src/com/android/contacts/quickcontact/ExpandingEntryCardView.java16
-rw-r--r--src/com/android/contacts/quickcontact/QuickContactActivity.java17
2 files changed, 31 insertions, 2 deletions
diff --git a/src/com/android/contacts/quickcontact/ExpandingEntryCardView.java b/src/com/android/contacts/quickcontact/ExpandingEntryCardView.java
index f40ebe734..ceb62037b 100644
--- a/src/com/android/contacts/quickcontact/ExpandingEntryCardView.java
+++ b/src/com/android/contacts/quickcontact/ExpandingEntryCardView.java
@@ -938,6 +938,7 @@ public class ExpandingEntryCardView extends CardView {
private final String mMimeType;
private final long mId;
private final boolean mIsSuperPrimary;
+ private String mData;
public EntryContextMenuInfo(String copyText, String copyLabel, String mimeType, long id,
boolean isSuperPrimary) {
@@ -948,6 +949,16 @@ public class ExpandingEntryCardView extends CardView {
mIsSuperPrimary = isSuperPrimary;
}
+ public EntryContextMenuInfo(String copyText, String copyLabel,String mimeType, long id,
+ boolean isSuperPrimary, String data) {
+ mCopyText = copyText;
+ mCopyLabel = copyLabel;
+ mMimeType = mimeType;
+ mId = id;
+ mIsSuperPrimary = isSuperPrimary;
+ mData = data;
+ }
+
public String getCopyText() {
return mCopyText;
}
@@ -966,6 +977,11 @@ public class ExpandingEntryCardView extends CardView {
public boolean isSuperPrimary() {
return mIsSuperPrimary;
+
+ }
+
+ public String getData() {
+ return mData;
}
}
diff --git a/src/com/android/contacts/quickcontact/QuickContactActivity.java b/src/com/android/contacts/quickcontact/QuickContactActivity.java
index 7a123b5f2..4b4865796 100644
--- a/src/com/android/contacts/quickcontact/QuickContactActivity.java
+++ b/src/com/android/contacts/quickcontact/QuickContactActivity.java
@@ -302,7 +302,6 @@ public class QuickContactActivity extends ContactsActivity {
private static final int MIN_NUM_COLLAPSED_RECENT_ENTRIES_SHOWN = 3;
private static final int CARD_ENTRY_ID_EDIT_CONTACT = -2;
-
private static final int[] mRecentLoaderIds = new int[]{
LOADER_SMS_ID,
LOADER_CALENDAR_ID,
@@ -396,6 +395,7 @@ public class QuickContactActivity extends ContactsActivity {
static final int COPY_TEXT = 0;
static final int CLEAR_DEFAULT = 1;
static final int SET_DEFAULT = 2;
+ static final int EDIT_BEFORE_CALL = 3;
}
private final OnCreateContextMenuListener mEntryContextMenuListener =
@@ -434,6 +434,10 @@ public class QuickContactActivity extends ContactsActivity {
} else if (!onlyOneOfMimeType) {
menu.add(ContextMenu.NONE, ContextMenuIds.SET_DEFAULT,
ContextMenu.NONE, getString(R.string.set_default));
+
+ if (Phone.CONTENT_ITEM_TYPE.equals(info.getMimeType())) {
+ menu.add(ContextMenu.NONE, ContextMenuIds.EDIT_BEFORE_CALL,
+ ContextMenu.NONE, getString(R.string.edit_before_call));
}
}
};
@@ -463,6 +467,9 @@ public class QuickContactActivity extends ContactsActivity {
menuInfo.getId());
this.startService(clearIntent);
return true;
+ case ContextMenuIds.EDIT_BEFORE_CALL:
+ callByEdit(menuInfo.getData());
+ return true;
default:
throw new IllegalArgumentException("Unknown menu option " + item.getItemId());
}
@@ -1382,7 +1389,7 @@ public class QuickContactActivity extends ContactsActivity {
TextDirectionHeuristics.LTR);
entryContextMenuInfo = new EntryContextMenuInfo(header,
res.getString(R.string.phoneLabelsGroup), dataItem.getMimeType(),
- dataItem.getId(), dataItem.isSuperPrimary());
+ dataItem.getId(), dataItem.isSuperPrimary(), header);
if (phone.hasKindTypeColumn(kind)) {
text = Phone.getTypeLabel(res, phone.getKindTypeColumn(kind),
phone.getLabel()).toString();
@@ -2057,6 +2064,12 @@ public class QuickContactActivity extends ContactsActivity {
}
}
+ private void callByEdit(String data) {
+ Intent intent = new Intent(Intent.ACTION_DIAL, Uri.fromParts(PhoneAccount.SCHEME_TEL,
+ data, null));
+ startActivity(intent);
+ }
+
/**
* Creates a launcher shortcut with the current contact.
*/