diff options
author | Nancy Chen <nancychen@google.com> | 2014-06-11 17:56:07 -0700 |
---|---|---|
committer | Nancy Chen <nancychen@google.com> | 2014-06-26 16:21:15 -0700 |
commit | 87ba489564b25d4a64c9faaeafea46e2f72d8933 (patch) | |
tree | 15d3eb5c9865eb1bc4c3244d3277c3ea7ab23a3b /src/com/android/dialer/calllog/CallLogAdapter.java | |
parent | 8a80d19f88d224f1427d7656e361eb77e1f90974 (diff) | |
download | android_packages_apps_Dialer-87ba489564b25d4a64c9faaeafea46e2f72d8933.tar.gz android_packages_apps_Dialer-87ba489564b25d4a64c9faaeafea46e2f72d8933.tar.bz2 android_packages_apps_Dialer-87ba489564b25d4a64c9faaeafea46e2f72d8933.zip |
Add icon indicating subscription in call log/call history
Display an icon in the call details showing which connection provider
(subscription) is responsible for the call.
Bug: 15473965
Change-Id: I0c6755864083799b8bafe20c3692b0d943beeee3
Diffstat (limited to 'src/com/android/dialer/calllog/CallLogAdapter.java')
-rw-r--r-- | src/com/android/dialer/calllog/CallLogAdapter.java | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java index f19b924fe..d08933069 100644 --- a/src/com/android/dialer/calllog/CallLogAdapter.java +++ b/src/com/android/dialer/calllog/CallLogAdapter.java @@ -21,12 +21,15 @@ import android.content.Context; import android.content.Intent; import android.content.res.Resources; import android.database.Cursor; +import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Handler; import android.os.Message; import android.provider.CallLog.Calls; import android.provider.ContactsContract.PhoneLookup; +import android.telecomm.Subscription; import android.text.TextUtils; +import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -51,6 +54,7 @@ import com.google.common.base.Objects; import java.util.HashMap; import java.util.LinkedList; +import java.util.List; /** * Adapter class to fill in data for the Call Log. @@ -630,6 +634,9 @@ public class CallLogAdapter extends GroupingListAdapter final long date = c.getLong(CallLogQuery.DATE); final long duration = c.getLong(CallLogQuery.DURATION); final int callType = c.getInt(CallLogQuery.CALL_TYPE); + final Subscription subscription = getSubscription(c); + final Drawable subscriptionIcon = subscription != null? + subscription.getIcon(mContext) : null; final String countryIso = c.getString(CallLogQuery.COUNTRY_ISO); final long rowId = c.getLong(CallLogQuery.ID); views.rowId = rowId; @@ -654,6 +661,7 @@ public class CallLogAdapter extends GroupingListAdapter views.number = number; views.numberPresentation = numberPresentation; views.callType = callType; + views.subscription = subscription; views.voicemailUri = c.getString(CallLogQuery.VOICEMAIL_URI); // Stash away the Ids of the calls so that we can support deleting a row in the call log. views.callIds = getCallIds(c, count); @@ -671,7 +679,8 @@ public class CallLogAdapter extends GroupingListAdapter // Set return call intent, otherwise null. if (PhoneNumberUtilsWrapper.canPlaceCallsTo(number, numberPresentation)) { // Sets the primary action to call the number. - views.primaryActionView.setTag(IntentProvider.getReturnCallIntentProvider(number)); + views.primaryActionView.setTag(IntentProvider.getReturnCallIntentProvider(number, + subscription)); } else { // Number is not callable, so hide button. views.primaryActionView.setTag(null); @@ -741,11 +750,12 @@ public class CallLogAdapter extends GroupingListAdapter if (TextUtils.isEmpty(name)) { details = new PhoneCallDetails(number, numberPresentation, formattedNumber, countryIso, geocode, callTypes, date, - duration); + duration, subscriptionIcon); } else { details = new PhoneCallDetails(number, numberPresentation, formattedNumber, countryIso, geocode, callTypes, date, - duration, name, ntype, label, lookupUri, photoUri, sourceType); + duration, name, ntype, label, lookupUri, photoUri, sourceType, + subscriptionIcon); } mCallLogViewsHelper.setPhoneCallDetails(views, details); @@ -929,7 +939,7 @@ public class CallLogAdapter extends GroupingListAdapter if (PhoneNumberUtilsWrapper.canPlaceCallsTo(views.number, views.numberPresentation)) { // Sets the primary action to call the number. views.callBackButtonView.setTag( - IntentProvider.getReturnCallIntentProvider(views.number)); + IntentProvider.getReturnCallIntentProvider(views.number, views.subscription)); views.callBackButtonView.setVisibility(View.VISIBLE); views.callBackButtonView.setOnClickListener(mActionListener); } else { @@ -1175,6 +1185,14 @@ public class CallLogAdapter extends GroupingListAdapter return callTypes; } + private Subscription getSubscription(Cursor c) { + final String component_name = c.getString(CallLogQuery.SUBSCRIPTION_COMPONENT_NAME); + final String subscription_id = c.getString(CallLogQuery.SUBSCRIPTION_ID); + + // TODO: actually pull data from the database + return null; + } + private void setPhoto(CallLogListItemViews views, long photoId, Uri contactUri, String displayName, String identifier, int contactType) { views.quickContactView.assignContactUri(contactUri); |