Loading AndroidManifest.xml +7 −0 Original line number Diff line number Diff line Loading @@ -490,6 +490,13 @@ </intent-filter> </activity> <activity android:name="com.android.contacts.common.dialog.CallSubjectHistory" android:theme="@style/Theme.CallSubjectSelector"> <intent-filter> <action android:name="android.intent.action.VIEW"/> </intent-filter> </activity> <!-- Service that is exclusively for the Phone application that sends out a view notification. This service might be removed in future versions of the app. Loading src/com/android/contacts/quickcontact/ExpandingEntryCardView.java +44 −4 Original line number Diff line number Diff line Loading @@ -19,12 +19,14 @@ import android.animation.Animator; import android.animation.Animator.AnimatorListener; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.res.Resources; import android.graphics.ColorFilter; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.support.v7.widget.CardView; import android.text.Spannable; import android.text.TextUtils; Loading @@ -50,6 +52,7 @@ import android.widget.RelativeLayout; import android.widget.TextView; import com.android.contacts.R; import com.android.contacts.common.dialog.CallSubjectDialog; import java.util.ArrayList; import java.util.List; Loading Loading @@ -87,6 +90,12 @@ public class ExpandingEntryCardView extends CardView { * Entry data. */ public static final class Entry { // No action when clicking a button is specified. public static final int ACTION_NONE = 1; // Button action is an intent. public static final int ACTION_INTENT = 2; // Button action will open the call with subject dialog. public static final int ACTION_CALL_WITH_SUBJECT = 3; private final int mId; private final Drawable mIcon; Loading @@ -107,6 +116,8 @@ public class ExpandingEntryCardView extends CardView { private final Intent mThirdIntent; private final String mThirdContentDescription; private final int mIconResourceId; private final int mThirdAction; private final Bundle mThirdExtras; public Entry(int id, Drawable mainIcon, String header, String subHeader, Drawable subHeaderIcon, String text, Drawable textIcon, Loading @@ -114,7 +125,8 @@ public class ExpandingEntryCardView extends CardView { Drawable alternateIcon, Intent alternateIntent, String alternateContentDescription, boolean shouldApplyColor, boolean isEditable, EntryContextMenuInfo entryContextMenuInfo, Drawable thirdIcon, Intent thirdIntent, String thirdContentDescription, int iconResourceId) { String thirdContentDescription, int thirdAction, Bundle thirdExtras, int iconResourceId) { mId = id; mIcon = mainIcon; mHeader = header; Loading @@ -133,6 +145,8 @@ public class ExpandingEntryCardView extends CardView { mThirdIcon = thirdIcon; mThirdIntent = thirdIntent; mThirdContentDescription = thirdContentDescription; mThirdAction = thirdAction; mThirdExtras = thirdExtras; mIconResourceId = iconResourceId; } Loading Loading @@ -211,6 +225,14 @@ public class ExpandingEntryCardView extends CardView { int getIconResourceId() { return mIconResourceId; } public int getThirdAction() { return mThirdAction; } public Bundle getThirdExtras() { return mThirdExtras; } } public interface ExpandingEntryCardViewListener { Loading Loading @@ -761,10 +783,28 @@ public class ExpandingEntryCardView extends CardView { alternateIcon.setContentDescription(entry.getAlternateContentDescription()); } if (entry.getThirdIcon() != null && entry.getThirdIntent() != null) { if (entry.getThirdIcon() != null && entry.getThirdAction() != Entry.ACTION_NONE) { thirdIcon.setImageDrawable(entry.getThirdIcon()); if (entry.getThirdAction() == Entry.ACTION_INTENT) { thirdIcon.setOnClickListener(mOnClickListener); thirdIcon.setTag(new EntryTag(entry.getId(), entry.getThirdIntent())); } else if (entry.getThirdAction() == Entry.ACTION_CALL_WITH_SUBJECT) { thirdIcon.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Object tag = v.getTag(); if (!(tag instanceof Bundle)) { return; } Context context = getContext(); if (context instanceof Activity) { CallSubjectDialog.start((Activity) context, entry.getThirdExtras()); } } }); thirdIcon.setTag(entry.getThirdExtras()); } thirdIcon.setVisibility(View.VISIBLE); thirdIcon.setContentDescription(entry.getThirdContentDescription()); } Loading src/com/android/contacts/quickcontact/QuickContactActivity.java +45 −6 Original line number Diff line number Diff line Loading @@ -96,6 +96,7 @@ import com.android.contacts.common.ClipboardUtils; import com.android.contacts.common.Collapser; import com.android.contacts.common.ContactsUtils; import com.android.contacts.common.activity.RequestPermissionsActivity; import com.android.contacts.common.dialog.CallSubjectDialog; import com.android.contacts.common.editor.SelectAccountDialogFragment; import com.android.contacts.common.interactions.TouchPointManager; import com.android.contacts.common.lettertiles.LetterTileDrawable; Loading Loading @@ -125,6 +126,7 @@ import com.android.contacts.common.util.ImplicitIntentsUtil; import com.android.contacts.common.util.DateUtils; import com.android.contacts.common.util.MaterialColorMapUtils; import com.android.contacts.common.util.MaterialColorMapUtils.MaterialPalette; import com.android.contacts.common.util.UriUtils; import com.android.contacts.common.util.ViewUtil; import com.android.contacts.detail.ContactDisplayUtils; import com.android.contacts.editor.ContactEditorFragment; Loading Loading @@ -1135,6 +1137,8 @@ public class QuickContactActivity extends ContactsActivity { /* thirdIcon = */ null, /* thirdIntent = */ null, /* thirdContentDescription = */ null, /* thirdAction = */ Entry.ACTION_NONE, /* thirdExtras = */ null, /* iconResourceId = */ 0); List<Entry> phoneticList = new ArrayList<>(); phoneticList.add(phoneticEntry); Loading Loading @@ -1187,7 +1191,10 @@ public class QuickContactActivity extends ContactsActivity { /* alternateContentDescription = */ null, /* shouldApplyColor = */ true, /* isEditable = */ false, /* EntryContextMenuInfo = */ null, /* thirdIcon = */ null, /* thirdIntent = */ null, /* thirdContentDescription = */ null, R.drawable.ic_phone_24dp); /* thirdContentDescription = */ null, /* thirdAction = */ Entry.ACTION_NONE, /* thirdExtras = */ null, R.drawable.ic_phone_24dp); final Drawable emailIcon = getResources().getDrawable( R.drawable.ic_email_24dp).mutate(); Loading @@ -1200,6 +1207,7 @@ public class QuickContactActivity extends ContactsActivity { /* shouldApplyColor = */ true, /* isEditable = */ false, /* EntryContextMenuInfo = */ null, /* thirdIcon = */ null, /* thirdIntent = */ null, /* thirdContentDescription = */ null, /* thirdAction = */ Entry.ACTION_NONE, /* thirdExtras = */ null, R.drawable.ic_email_24dp); final List<List<Entry>> promptEntries = new ArrayList<>(); Loading Loading @@ -1366,7 +1374,9 @@ public class QuickContactActivity extends ContactsActivity { EntryContextMenuInfo entryContextMenuInfo = null; Drawable thirdIcon = null; Intent thirdIntent = null; int thirdAction = Entry.ACTION_NONE; String thirdContentDescription = null; Bundle thirdExtras = null; int iconResourceId = 0; context = context.getApplicationContext(); Loading Loading @@ -1479,6 +1489,7 @@ public class QuickContactActivity extends ContactsActivity { } } else if (dataItem instanceof PhoneDataItem) { final PhoneDataItem phone = (PhoneDataItem) dataItem; String phoneLabel = null; if (!TextUtils.isEmpty(phone.getNumber())) { primaryContentDescription.append(res.getString(R.string.call_other)).append(" "); header = sBidiFormatter.unicodeWrap(phone.buildDataStringForDisplay(context, kind), Loading @@ -1489,10 +1500,12 @@ public class QuickContactActivity extends ContactsActivity { if (phone.hasKindTypeColumn(kind)) { final int kindTypeColumn = phone.getKindTypeColumn(kind); final String label = phone.getLabel(); phoneLabel = label; if (kindTypeColumn == Phone.TYPE_CUSTOM && TextUtils.isEmpty(label)) { text = ""; } else { text = Phone.getTypeLabel(res, kindTypeColumn, label).toString(); phoneLabel= text; primaryContentDescription.append(text).append(" "); } } Loading @@ -1508,9 +1521,33 @@ public class QuickContactActivity extends ContactsActivity { alternateIcon = res.getDrawable(R.drawable.ic_message_24dp); alternateContentDescription.append(res.getString(R.string.sms_custom, header)); if (CallUtil.isCallWithSubjectSupported(context)) { thirdIcon = res.getDrawable(R.drawable.ic_call_note_white_24dp); thirdAction = Entry.ACTION_CALL_WITH_SUBJECT; thirdContentDescription = res.getString(R.string.call_with_a_note); // Create a bundle containing the data the call subject dialog requires. thirdExtras = new Bundle(); thirdExtras.putLong(CallSubjectDialog.ARG_PHOTO_ID, contactData.getPhotoId()); thirdExtras.putParcelable(CallSubjectDialog.ARG_PHOTO_URI, UriUtils.parseUriOrNull(contactData.getPhotoUri())); thirdExtras.putParcelable(CallSubjectDialog.ARG_CONTACT_URI, contactData.getLookupUri()); thirdExtras.putString(CallSubjectDialog.ARG_NAME_OR_NUMBER, contactData.getDisplayName()); thirdExtras.putBoolean(CallSubjectDialog.ARG_IS_BUSINESS, false); thirdExtras.putString(CallSubjectDialog.ARG_NUMBER, phone.getNumber()); thirdExtras.putString(CallSubjectDialog.ARG_DISPLAY_NUMBER, phone.getFormattedPhoneNumber()); thirdExtras.putString(CallSubjectDialog.ARG_NUMBER_LABEL, phoneLabel); } else if (CallUtil.isVideoEnabled(context)) { // Add video call button if supported if (CallUtil.isVideoEnabled(context)) { thirdIcon = res.getDrawable(R.drawable.ic_videocam); thirdAction = Entry.ACTION_INTENT; thirdIntent = CallUtil.getVideoCallIntent(phone.getNumber(), CALL_ORIGIN_QUICK_CONTACTS_ACTIVITY); thirdContentDescription = Loading Loading @@ -1707,8 +1744,8 @@ public class QuickContactActivity extends ContactsActivity { new SpannableString(primaryContentDescription.toString()), intent, alternateIcon, alternateIntent, alternateContentDescription.toString(), shouldApplyColor, isEditable, entryContextMenuInfo, thirdIcon, thirdIntent, thirdContentDescription, iconResourceId); entryContextMenuInfo, thirdIcon, thirdIntent, thirdContentDescription, thirdAction, thirdExtras, iconResourceId); } private List<Entry> dataItemsToEntries(List<DataItem> dataItems, Loading Loading @@ -1979,6 +2016,8 @@ public class QuickContactActivity extends ContactsActivity { /* thirdIcon = */ null, /* thirdIntent = */ null, /* thirdContentDescription = */ null, /* thirdAction = */ Entry.ACTION_NONE, /* thirdActionExtras = */ null, interaction.getIconResourceId())); } return entries; Loading Loading
AndroidManifest.xml +7 −0 Original line number Diff line number Diff line Loading @@ -490,6 +490,13 @@ </intent-filter> </activity> <activity android:name="com.android.contacts.common.dialog.CallSubjectHistory" android:theme="@style/Theme.CallSubjectSelector"> <intent-filter> <action android:name="android.intent.action.VIEW"/> </intent-filter> </activity> <!-- Service that is exclusively for the Phone application that sends out a view notification. This service might be removed in future versions of the app. Loading
src/com/android/contacts/quickcontact/ExpandingEntryCardView.java +44 −4 Original line number Diff line number Diff line Loading @@ -19,12 +19,14 @@ import android.animation.Animator; import android.animation.Animator.AnimatorListener; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.res.Resources; import android.graphics.ColorFilter; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.support.v7.widget.CardView; import android.text.Spannable; import android.text.TextUtils; Loading @@ -50,6 +52,7 @@ import android.widget.RelativeLayout; import android.widget.TextView; import com.android.contacts.R; import com.android.contacts.common.dialog.CallSubjectDialog; import java.util.ArrayList; import java.util.List; Loading Loading @@ -87,6 +90,12 @@ public class ExpandingEntryCardView extends CardView { * Entry data. */ public static final class Entry { // No action when clicking a button is specified. public static final int ACTION_NONE = 1; // Button action is an intent. public static final int ACTION_INTENT = 2; // Button action will open the call with subject dialog. public static final int ACTION_CALL_WITH_SUBJECT = 3; private final int mId; private final Drawable mIcon; Loading @@ -107,6 +116,8 @@ public class ExpandingEntryCardView extends CardView { private final Intent mThirdIntent; private final String mThirdContentDescription; private final int mIconResourceId; private final int mThirdAction; private final Bundle mThirdExtras; public Entry(int id, Drawable mainIcon, String header, String subHeader, Drawable subHeaderIcon, String text, Drawable textIcon, Loading @@ -114,7 +125,8 @@ public class ExpandingEntryCardView extends CardView { Drawable alternateIcon, Intent alternateIntent, String alternateContentDescription, boolean shouldApplyColor, boolean isEditable, EntryContextMenuInfo entryContextMenuInfo, Drawable thirdIcon, Intent thirdIntent, String thirdContentDescription, int iconResourceId) { String thirdContentDescription, int thirdAction, Bundle thirdExtras, int iconResourceId) { mId = id; mIcon = mainIcon; mHeader = header; Loading @@ -133,6 +145,8 @@ public class ExpandingEntryCardView extends CardView { mThirdIcon = thirdIcon; mThirdIntent = thirdIntent; mThirdContentDescription = thirdContentDescription; mThirdAction = thirdAction; mThirdExtras = thirdExtras; mIconResourceId = iconResourceId; } Loading Loading @@ -211,6 +225,14 @@ public class ExpandingEntryCardView extends CardView { int getIconResourceId() { return mIconResourceId; } public int getThirdAction() { return mThirdAction; } public Bundle getThirdExtras() { return mThirdExtras; } } public interface ExpandingEntryCardViewListener { Loading Loading @@ -761,10 +783,28 @@ public class ExpandingEntryCardView extends CardView { alternateIcon.setContentDescription(entry.getAlternateContentDescription()); } if (entry.getThirdIcon() != null && entry.getThirdIntent() != null) { if (entry.getThirdIcon() != null && entry.getThirdAction() != Entry.ACTION_NONE) { thirdIcon.setImageDrawable(entry.getThirdIcon()); if (entry.getThirdAction() == Entry.ACTION_INTENT) { thirdIcon.setOnClickListener(mOnClickListener); thirdIcon.setTag(new EntryTag(entry.getId(), entry.getThirdIntent())); } else if (entry.getThirdAction() == Entry.ACTION_CALL_WITH_SUBJECT) { thirdIcon.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Object tag = v.getTag(); if (!(tag instanceof Bundle)) { return; } Context context = getContext(); if (context instanceof Activity) { CallSubjectDialog.start((Activity) context, entry.getThirdExtras()); } } }); thirdIcon.setTag(entry.getThirdExtras()); } thirdIcon.setVisibility(View.VISIBLE); thirdIcon.setContentDescription(entry.getThirdContentDescription()); } Loading
src/com/android/contacts/quickcontact/QuickContactActivity.java +45 −6 Original line number Diff line number Diff line Loading @@ -96,6 +96,7 @@ import com.android.contacts.common.ClipboardUtils; import com.android.contacts.common.Collapser; import com.android.contacts.common.ContactsUtils; import com.android.contacts.common.activity.RequestPermissionsActivity; import com.android.contacts.common.dialog.CallSubjectDialog; import com.android.contacts.common.editor.SelectAccountDialogFragment; import com.android.contacts.common.interactions.TouchPointManager; import com.android.contacts.common.lettertiles.LetterTileDrawable; Loading Loading @@ -125,6 +126,7 @@ import com.android.contacts.common.util.ImplicitIntentsUtil; import com.android.contacts.common.util.DateUtils; import com.android.contacts.common.util.MaterialColorMapUtils; import com.android.contacts.common.util.MaterialColorMapUtils.MaterialPalette; import com.android.contacts.common.util.UriUtils; import com.android.contacts.common.util.ViewUtil; import com.android.contacts.detail.ContactDisplayUtils; import com.android.contacts.editor.ContactEditorFragment; Loading Loading @@ -1135,6 +1137,8 @@ public class QuickContactActivity extends ContactsActivity { /* thirdIcon = */ null, /* thirdIntent = */ null, /* thirdContentDescription = */ null, /* thirdAction = */ Entry.ACTION_NONE, /* thirdExtras = */ null, /* iconResourceId = */ 0); List<Entry> phoneticList = new ArrayList<>(); phoneticList.add(phoneticEntry); Loading Loading @@ -1187,7 +1191,10 @@ public class QuickContactActivity extends ContactsActivity { /* alternateContentDescription = */ null, /* shouldApplyColor = */ true, /* isEditable = */ false, /* EntryContextMenuInfo = */ null, /* thirdIcon = */ null, /* thirdIntent = */ null, /* thirdContentDescription = */ null, R.drawable.ic_phone_24dp); /* thirdContentDescription = */ null, /* thirdAction = */ Entry.ACTION_NONE, /* thirdExtras = */ null, R.drawable.ic_phone_24dp); final Drawable emailIcon = getResources().getDrawable( R.drawable.ic_email_24dp).mutate(); Loading @@ -1200,6 +1207,7 @@ public class QuickContactActivity extends ContactsActivity { /* shouldApplyColor = */ true, /* isEditable = */ false, /* EntryContextMenuInfo = */ null, /* thirdIcon = */ null, /* thirdIntent = */ null, /* thirdContentDescription = */ null, /* thirdAction = */ Entry.ACTION_NONE, /* thirdExtras = */ null, R.drawable.ic_email_24dp); final List<List<Entry>> promptEntries = new ArrayList<>(); Loading Loading @@ -1366,7 +1374,9 @@ public class QuickContactActivity extends ContactsActivity { EntryContextMenuInfo entryContextMenuInfo = null; Drawable thirdIcon = null; Intent thirdIntent = null; int thirdAction = Entry.ACTION_NONE; String thirdContentDescription = null; Bundle thirdExtras = null; int iconResourceId = 0; context = context.getApplicationContext(); Loading Loading @@ -1479,6 +1489,7 @@ public class QuickContactActivity extends ContactsActivity { } } else if (dataItem instanceof PhoneDataItem) { final PhoneDataItem phone = (PhoneDataItem) dataItem; String phoneLabel = null; if (!TextUtils.isEmpty(phone.getNumber())) { primaryContentDescription.append(res.getString(R.string.call_other)).append(" "); header = sBidiFormatter.unicodeWrap(phone.buildDataStringForDisplay(context, kind), Loading @@ -1489,10 +1500,12 @@ public class QuickContactActivity extends ContactsActivity { if (phone.hasKindTypeColumn(kind)) { final int kindTypeColumn = phone.getKindTypeColumn(kind); final String label = phone.getLabel(); phoneLabel = label; if (kindTypeColumn == Phone.TYPE_CUSTOM && TextUtils.isEmpty(label)) { text = ""; } else { text = Phone.getTypeLabel(res, kindTypeColumn, label).toString(); phoneLabel= text; primaryContentDescription.append(text).append(" "); } } Loading @@ -1508,9 +1521,33 @@ public class QuickContactActivity extends ContactsActivity { alternateIcon = res.getDrawable(R.drawable.ic_message_24dp); alternateContentDescription.append(res.getString(R.string.sms_custom, header)); if (CallUtil.isCallWithSubjectSupported(context)) { thirdIcon = res.getDrawable(R.drawable.ic_call_note_white_24dp); thirdAction = Entry.ACTION_CALL_WITH_SUBJECT; thirdContentDescription = res.getString(R.string.call_with_a_note); // Create a bundle containing the data the call subject dialog requires. thirdExtras = new Bundle(); thirdExtras.putLong(CallSubjectDialog.ARG_PHOTO_ID, contactData.getPhotoId()); thirdExtras.putParcelable(CallSubjectDialog.ARG_PHOTO_URI, UriUtils.parseUriOrNull(contactData.getPhotoUri())); thirdExtras.putParcelable(CallSubjectDialog.ARG_CONTACT_URI, contactData.getLookupUri()); thirdExtras.putString(CallSubjectDialog.ARG_NAME_OR_NUMBER, contactData.getDisplayName()); thirdExtras.putBoolean(CallSubjectDialog.ARG_IS_BUSINESS, false); thirdExtras.putString(CallSubjectDialog.ARG_NUMBER, phone.getNumber()); thirdExtras.putString(CallSubjectDialog.ARG_DISPLAY_NUMBER, phone.getFormattedPhoneNumber()); thirdExtras.putString(CallSubjectDialog.ARG_NUMBER_LABEL, phoneLabel); } else if (CallUtil.isVideoEnabled(context)) { // Add video call button if supported if (CallUtil.isVideoEnabled(context)) { thirdIcon = res.getDrawable(R.drawable.ic_videocam); thirdAction = Entry.ACTION_INTENT; thirdIntent = CallUtil.getVideoCallIntent(phone.getNumber(), CALL_ORIGIN_QUICK_CONTACTS_ACTIVITY); thirdContentDescription = Loading Loading @@ -1707,8 +1744,8 @@ public class QuickContactActivity extends ContactsActivity { new SpannableString(primaryContentDescription.toString()), intent, alternateIcon, alternateIntent, alternateContentDescription.toString(), shouldApplyColor, isEditable, entryContextMenuInfo, thirdIcon, thirdIntent, thirdContentDescription, iconResourceId); entryContextMenuInfo, thirdIcon, thirdIntent, thirdContentDescription, thirdAction, thirdExtras, iconResourceId); } private List<Entry> dataItemsToEntries(List<DataItem> dataItems, Loading Loading @@ -1979,6 +2016,8 @@ public class QuickContactActivity extends ContactsActivity { /* thirdIcon = */ null, /* thirdIntent = */ null, /* thirdContentDescription = */ null, /* thirdAction = */ Entry.ACTION_NONE, /* thirdActionExtras = */ null, interaction.getIconResourceId())); } return entries; Loading