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

Commit 704acc08 authored by Chiao Cheng's avatar Chiao Cheng
Browse files

Add enable reverse number lookup link to call card.

Bug: 10525344
Change-Id: I6f01110e76222a2558374426675e285cfca5801b
parent e2882976
Loading
Loading
Loading
Loading
+1 −9
Original line number Diff line number Diff line
@@ -17,9 +17,9 @@
<view
    xmlns:android="http://schemas.android.com/apk/res/android"
    class="com.android.dialer.calllog.CallLogListItemView"
    android:id="@+id/call_log_list_item"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/call_log_list_item"
    android:orientation="vertical"
    android:background="@drawable/bottom_border_background"
>
@@ -140,12 +140,4 @@
        android:paddingTop="@dimen/call_log_inner_margin"
        android:paddingBottom="@dimen/call_log_inner_margin" />

    <View
        android:id="@+id/call_log_divider"
        android:layout_width="match_parent"
        android:layout_height="1px"
        android:layout_marginStart="@dimen/call_log_outer_margin"
        android:layout_marginEnd="@dimen/call_log_outer_margin"
        android:background="#55ffffff"
    />
</view>
+15 −18
Original line number Diff line number Diff line
@@ -90,7 +90,7 @@ public class CallLogAdapter extends GroupingListAdapter
    /** The size of the cache of contact info. */
    private static final int CONTACT_INFO_CACHE_SIZE = 100;

    private final Context mContext;
    protected final Context mContext;
    private final ContactInfoHelper mContactInfoHelper;
    private final CallFetcher mCallFetcher;
    private ViewTreeObserver mViewTreeObserver = null;
@@ -448,39 +448,30 @@ public class CallLogAdapter extends GroupingListAdapter

    @Override
    protected View newStandAloneView(Context context, ViewGroup parent) {
        LayoutInflater inflater =
                (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View view = inflater.inflate(R.layout.call_log_list_item, parent, false);
        findAndCacheViews(view);
        return view;
        return newChildView(context, parent);
    }

    @Override
    protected void bindStandAloneView(View view, Context context, Cursor cursor) {
        bindView(view, cursor, 1);
    protected View newGroupView(Context context, ViewGroup parent) {
        return newChildView(context, parent);
    }

    @Override
    protected View newChildView(Context context, ViewGroup parent) {
        LayoutInflater inflater =
                (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View view = inflater.inflate(R.layout.call_log_list_item, parent, false);
        findAndCacheViews(view);
        return view;
    }

    @Override
    protected void bindChildView(View view, Context context, Cursor cursor) {
    protected void bindStandAloneView(View view, Context context, Cursor cursor) {
        bindView(view, cursor, 1);
    }

    @Override
    protected View newGroupView(Context context, ViewGroup parent) {
        LayoutInflater inflater =
                (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View view = inflater.inflate(R.layout.call_log_list_item, parent, false);
        findAndCacheViews(view);
        return view;
    protected void bindChildView(View view, Context context, Cursor cursor) {
        bindView(view, cursor, 1);
    }

    @Override
@@ -509,7 +500,6 @@ public class CallLogAdapter extends GroupingListAdapter

        // Default case: an item in the call log.
        views.primaryActionView.setVisibility(View.VISIBLE);
        views.bottomDivider.setVisibility(View.VISIBLE);
        views.listHeaderTextView.setVisibility(View.GONE);

        final String number = c.getString(CallLogQuery.NUMBER);
@@ -593,6 +583,7 @@ public class CallLogAdapter extends GroupingListAdapter
        final int[] callTypes = getCallTypes(c, count);
        final String geocode = c.getString(CallLogQuery.GEOCODED_LOCATION);
        final PhoneCallDetails details;

        if (TextUtils.isEmpty(name)) {
            details = new PhoneCallDetails(number, numberPresentation,
                    formattedNumber, countryIso, geocode, callTypes, date,
@@ -623,6 +614,12 @@ public class CallLogAdapter extends GroupingListAdapter
            mViewTreeObserver = view.getViewTreeObserver();
            mViewTreeObserver.addOnPreDrawListener(this);
        }

        postBindView(views, info);
    }

    protected void postBindView(CallLogListItemViews views, ContactInfo info) {
        // no-op
    }

    /** Checks whether the contact info from the call log matches the one from the contacts db. */
+3 −7
Original line number Diff line number Diff line
@@ -30,13 +30,9 @@ import android.provider.CallLog;
import android.provider.CallLog.Calls;
import android.provider.ContactsContract;
import android.telephony.PhoneNumberUtils;
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
@@ -50,8 +46,8 @@ import com.android.dialer.util.EmptyLoader;
import com.android.dialer.voicemail.VoicemailStatusHelper;
import com.android.dialer.voicemail.VoicemailStatusHelper.StatusMessage;
import com.android.dialer.voicemail.VoicemailStatusHelperImpl;
import com.android.dialerbind.ObjectFactory;
import com.android.internal.telephony.ITelephony;
import com.google.common.annotations.VisibleForTesting;

import java.util.List;

@@ -234,8 +230,8 @@ public class CallLogFragment extends ListFragment
        super.onViewCreated(view, savedInstanceState);
        updateEmptyMessage(mCallTypeFilter);
        String currentCountryIso = GeoUtil.getCurrentCountryIso(getActivity());
        mAdapter = new CallLogAdapter(getActivity(), this,
                new ContactInfoHelper(getActivity(), currentCountryIso), false);
        mAdapter = ObjectFactory.newCallLogAdapter(getActivity(), this, new ContactInfoHelper(
                getActivity(), currentCountryIso), false, true);
        setListAdapter(mAdapter);
        getListView().setItemsCanFocus(true);
    }
+3 −8
Original line number Diff line number Diff line
@@ -40,18 +40,15 @@ public final class CallLogListItemViews {
    public final PhoneCallDetailsViews phoneCallDetailsViews;
    /** The text of the header of a section. */
    public final TextView listHeaderTextView;
    /** The divider to be shown below items. */
    public final View bottomDivider;

    private CallLogListItemViews(QuickContactBadge quickContactView, View primaryActionView,
            ImageView secondaryActionView, PhoneCallDetailsViews phoneCallDetailsViews,
            TextView listHeaderTextView, View bottomDivider) {
            TextView listHeaderTextView) {
        this.quickContactView = quickContactView;
        this.primaryActionView = primaryActionView;
        this.secondaryActionView = secondaryActionView;
        this.phoneCallDetailsViews = phoneCallDetailsViews;
        this.listHeaderTextView = listHeaderTextView;
        this.bottomDivider = bottomDivider;
    }

    public static CallLogListItemViews fromView(View view) {
@@ -60,8 +57,7 @@ public final class CallLogListItemViews {
                view.findViewById(R.id.primary_action_view),
                (ImageView) view.findViewById(R.id.secondary_action_icon),
                PhoneCallDetailsViews.fromView(view),
                (TextView) view.findViewById(R.id.call_log_header),
                view.findViewById(R.id.call_log_divider));
                (TextView) view.findViewById(R.id.call_log_header));
    }

    @NeededForTesting
@@ -71,7 +67,6 @@ public final class CallLogListItemViews {
                new View(context),
                new ImageView(context),
                PhoneCallDetailsViews.createForTest(context),
                new TextView(context),
                new View(context));
                new TextView(context));
    }
}
+2 −5
Original line number Diff line number Diff line
@@ -22,18 +22,15 @@ import android.net.Uri;
import android.provider.ContactsContract;
import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.Directory;
import android.provider.ContactsContract.DisplayNameSources;
import android.provider.ContactsContract.PhoneLookup;
import android.telephony.PhoneNumberUtils;
import android.text.TextUtils;
import android.util.Log;

import com.android.contacts.common.util.Constants;
import com.android.contacts.common.util.UriUtils;
import com.android.dialer.service.CachedNumberLookupService;
import com.android.dialer.service.CachedNumberLookupService.CachedContactInfo;
import com.android.dialerbind.ServiceFactory;
import com.android.dialerbind.ObjectFactory;

import org.json.JSONException;
import org.json.JSONObject;
@@ -46,7 +43,7 @@ public class ContactInfoHelper {
    private final String mCurrentCountryIso;

    private static final CachedNumberLookupService mCachedNumberLookupService =
            ServiceFactory.newCachedNumberLookupService();
            ObjectFactory.newCachedNumberLookupService();

    public ContactInfoHelper(Context context, String currentCountryIso) {
        mContext = context;
Loading