summaryrefslogtreecommitdiff
path: root/src/com/android/dialer/calllog/CallLogAdapter.java
diff options
context:
space:
mode:
authorChristine Chen <christinech@google.com>2013-08-14 21:44:19 +0200
committerChristine Chen <christinech@google.com>2013-08-15 23:33:49 +0200
commit7030a12a15e565521ffb220c00a0251e47bd3a93 (patch)
tree6e09bf8a541efebdadf6efc3fc959737277f0231 /src/com/android/dialer/calllog/CallLogAdapter.java
parentba6b3366f21c47454b3ba5189e94bb6bf58fd11d (diff)
Change primary actions of the CallLog items.
- When the CallLog item is in the CallLog fragment, the primary action remains to be opening the call detail page. - When the CallLog item is in the Favorite fragment, the primary action changes to be calling the number directly. The secondary action is hidden unless it is to play a voicemail. Bug: 10308694 Change-Id: I28ca7aa783bcca35eb8b41f6e8508d08062dd253
Diffstat (limited to 'src/com/android/dialer/calllog/CallLogAdapter.java')
-rw-r--r--src/com/android/dialer/calllog/CallLogAdapter.java22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java
index 2c81f46fe..15c9b05a6 100644
--- a/src/com/android/dialer/calllog/CallLogAdapter.java
+++ b/src/com/android/dialer/calllog/CallLogAdapter.java
@@ -178,6 +178,10 @@ public class CallLogAdapter extends GroupingListAdapter
/** Can be set to true by tests to disable processing of requests. */
private volatile boolean mRequestProcessingDisabled = false;
+ /** True if CallLogAdapter is created from the PhoneFavoriteFragment, where the primary
+ * action should be set to call a number instead of opening the detail page. */
+ private boolean mUseCallAsPrimaryAction = false;
+
/** Listener for the primary action in the list, opens the call details. */
private final View.OnClickListener mPrimaryActionListener = new View.OnClickListener() {
@Override
@@ -228,12 +232,13 @@ public class CallLogAdapter extends GroupingListAdapter
};
public CallLogAdapter(Context context, CallFetcher callFetcher,
- ContactInfoHelper contactInfoHelper) {
+ ContactInfoHelper contactInfoHelper, boolean useCallAsPrimaryAction) {
super(context);
mContext = context;
mCallFetcher = callFetcher;
mContactInfoHelper = contactInfoHelper;
+ mUseCallAsPrimaryAction = useCallAsPrimaryAction;
mContactInfoCache = ExpirableCache.create(CONTACT_INFO_CACHE_SIZE);
mRequests = new LinkedList<ContactInfoRequest>();
@@ -515,9 +520,15 @@ public class CallLogAdapter extends GroupingListAdapter
final ContactInfo cachedContactInfo = getContactInfoFromCallLog(c);
- views.primaryActionView.setTag(
- IntentProvider.getCallDetailIntentProvider(
- getCursor(), c.getPosition(), c.getLong(CallLogQuery.ID), count));
+ if (!mUseCallAsPrimaryAction) {
+ // Sets the primary action to open call detail page.
+ views.primaryActionView.setTag(
+ IntentProvider.getCallDetailIntentProvider(
+ getCursor(), c.getPosition(), c.getLong(CallLogQuery.ID), count));
+ } else {
+ // Sets the primary action to call the number.
+ views.primaryActionView.setTag(IntentProvider.getReturnCallIntentProvider(number));
+ }
// Store away the voicemail information so we can play it directly.
if (callType == Calls.VOICEMAIL_TYPE) {
@@ -594,7 +605,8 @@ public class CallLogAdapter extends GroupingListAdapter
final boolean isNew = c.getInt(CallLogQuery.IS_READ) == 0;
// New items also use the highlighted version of the text.
final boolean isHighlighted = isNew;
- mCallLogViewsHelper.setPhoneCallDetails(views, details, isHighlighted);
+ mCallLogViewsHelper.setPhoneCallDetails(views, details, isHighlighted,
+ mUseCallAsPrimaryAction);
setPhoto(views, photoId, lookupUri);
// Listen for the first draw