Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 240523d3 authored by Victor Chang's avatar Victor Chang
Browse files

Show work badge icon/description in InCallUI/Dialer

Add work badge icon in calllog for work contacts

To see this feature
1. Receive/Make a call from work contact
   (a contact in work profile has the phone number)
2. Drop/miss the call. See a badge icon next to phone label in calllog
BUG=26082618

Change-Id: I7371795e3c3ef925739096f39a70f03722dd430b
parent 90a13e94
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -101,6 +101,14 @@
                            android:layout_marginEnd="@dimen/call_log_icon_margin"
                            android:layout_gravity="center_vertical" />

                        <ImageView android:id="@+id/work_profile_icon"
                            android:src="@drawable/ic_work_profile"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginEnd="@dimen/call_log_icon_margin"
                            android:scaleType="center"
                            android:visibility="gone" />

                        <TextView
                            android:id="@+id/call_location_and_date"
                            android:layout_width="wrap_content"
+4 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.dialer;

import com.android.contacts.common.ContactsUtils.UserType;
import com.android.contacts.common.preference.ContactsPreferences;
import com.android.dialer.calllog.PhoneNumberDisplayUtil;

@@ -101,6 +102,9 @@ public class PhoneCallDetails {
    // Whether the contact number is a voicemail number.
    public boolean isVoicemail;

    /** The {@link UserType} of the contact */
    public @UserType long contactUserType;

    /**
     * If this is a voicemail, whether the message is read. For other types of calls, this defaults
     * to {@code true}.
+6 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ import android.view.View.AccessibilityDelegate;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityEvent;

import com.android.contacts.common.ContactsUtils;
import com.android.contacts.common.compat.PhoneNumberUtilsCompat;
import com.android.contacts.common.preference.ContactsPreferences;
import com.android.contacts.common.util.PermissionsUtil;
@@ -55,6 +56,7 @@ import com.android.dialer.logging.InteractionEvent;
import com.android.dialer.logging.Logger;
import com.android.dialer.util.PhoneNumberUtil;
import com.android.dialer.voicemail.VoicemailPlaybackPresenter;
import com.android.incallui.CallerInfo;

import java.util.HashMap;

@@ -400,6 +402,7 @@ public class CallLogAdapter extends GroupingListAdapter
     * @param viewHolder The view corresponding to this entry.
     * @param position The position of the entry.
     */
    @Override
    public void onBindViewHolder(ViewHolder viewHolder, int position) {
        Trace.beginSection("onBindViewHolder: " + position);

@@ -497,6 +500,7 @@ public class CallLogAdapter extends GroupingListAdapter
            details.photoUri = info.photoUri;
            details.sourceType = info.sourceType;
            details.objectId = info.objectId;
            details.contactUserType = info.userType;
        }

        final CallLogListItemViewHolder views = (CallLogListItemViewHolder) viewHolder;
@@ -517,6 +521,8 @@ public class CallLogAdapter extends GroupingListAdapter
                details.numberLabel);
        // Default case: an item in the call log.
        views.primaryActionView.setVisibility(View.VISIBLE);
        views.workIconView.setVisibility(
                details.contactUserType == ContactsUtils.USER_TYPE_WORK ? View.VISIBLE : View.GONE);

        // Check if the day group has changed and display a header if necessary.
        int currentGroup = getDayGroupForCall(views.rowId);
+2 −0
Original line number Diff line number Diff line
@@ -96,6 +96,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
    public View sendMessageView;
    public View detailsButtonView;
    public View callWithNoteButtonView;
    public ImageView workIconView;

    /**
     * The row Id for the first call associated with the call log entry.  Used as a key for the
@@ -233,6 +234,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
        this.callLogEntryView = callLogEntryView;
        this.dayGroupHeader = dayGroupHeader;
        this.primaryActionButtonView = primaryActionButtonView;
        this.workIconView = (ImageView) rootView.findViewById(R.id.work_profile_icon);

        Resources resources = mContext.getResources();
        mPhotoSize = mContext.getResources().getDimensionPixelSize(R.dimen.contact_photo_size);
+3 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.dialer.calllog;
import android.net.Uri;
import android.text.TextUtils;

import com.android.contacts.common.ContactsUtils.UserType;
import com.android.contacts.common.util.UriUtils;
import com.google.common.base.Objects;

@@ -46,6 +47,7 @@ public class ContactInfo {
    public Uri photoUri;
    public boolean isBadData;
    public String objectId;
    public @UserType long userType;

    public static ContactInfo EMPTY = new ContactInfo();

@@ -80,6 +82,7 @@ public class ContactInfo {
        if (photoId != other.photoId) return false;
        if (!UriUtils.areEqual(photoUri, other.photoUri)) return false;
        if (!TextUtils.equals(objectId, other.objectId)) return false;
        if (userType != other.userType) return false;
        return true;
    }

Loading