summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorblong <blong@codeaurora.org>2015-08-14 15:37:40 +0800
committerGerrit - the friendly Code Review server <code-review@localhost>2015-09-05 23:16:29 -0700
commit87db6c17170ff038a65cc7f8c022435e52dd46ac (patch)
tree95a58e1870bd8b529c143199bf8c3223becb76ff /src/com
parent44081c004cc01e4338768581585ffe1702162277 (diff)
downloadpackages_apps_Contacts-87db6c17170ff038a65cc7f8c022435e52dd46ac.tar.gz
packages_apps_Contacts-87db6c17170ff038a65cc7f8c022435e52dd46ac.tar.bz2
packages_apps_Contacts-87db6c17170ff038a65cc7f8c022435e52dd46ac.zip
Support editing the contact phone number before calling it
- Allow user to edit the phone number via long click in the contact detail view before dialing. Change-Id: I4432a562adba8b1e53719205ed7598ec7850db63
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/contacts/quickcontact/ExpandingEntryCardView.java15
-rw-r--r--src/com/android/contacts/quickcontact/QuickContactActivity.java16
2 files changed, 30 insertions, 1 deletions
diff --git a/src/com/android/contacts/quickcontact/ExpandingEntryCardView.java b/src/com/android/contacts/quickcontact/ExpandingEntryCardView.java
index 10b289873..1b537c150 100644
--- a/src/com/android/contacts/quickcontact/ExpandingEntryCardView.java
+++ b/src/com/android/contacts/quickcontact/ExpandingEntryCardView.java
@@ -1016,6 +1016,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) {
@@ -1026,6 +1027,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;
}
@@ -1045,6 +1056,10 @@ public class ExpandingEntryCardView extends CardView {
public boolean isSuperPrimary() {
return mIsSuperPrimary;
}
+
+ public String getData() {
+ return mData;
+ }
}
static final class EntryTag {
diff --git a/src/com/android/contacts/quickcontact/QuickContactActivity.java b/src/com/android/contacts/quickcontact/QuickContactActivity.java
index 8e029c9de..81a98b55f 100644
--- a/src/com/android/contacts/quickcontact/QuickContactActivity.java
+++ b/src/com/android/contacts/quickcontact/QuickContactActivity.java
@@ -446,6 +446,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 =
@@ -485,6 +486,10 @@ public class QuickContactActivity extends ContactsActivity {
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));
+ }
}
};
@@ -513,6 +518,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());
}
@@ -1487,7 +1495,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)) {
final int kindTypeColumn = phone.getKindTypeColumn(kind);
final String label = phone.getLabel();
@@ -2291,6 +2299,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.
*/