summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChiao Cheng <chiaocheng@google.com>2013-09-09 18:34:41 -0700
committerChiao Cheng <chiaocheng@google.com>2013-09-11 11:38:29 -0700
commit704acc087ce359295475a46695c2821c55778344 (patch)
treedc52a3b8b6e0d6ade3d063b9f9b1769d1d8950e6 /src
parente288297636efc10164fc1d928f9cab3d7a07557a (diff)
Add enable reverse number lookup link to call card.
Bug: 10525344 Change-Id: I6f01110e76222a2558374426675e285cfca5801b
Diffstat (limited to 'src')
-rw-r--r--src/com/android/dialer/calllog/CallLogAdapter.java33
-rw-r--r--src/com/android/dialer/calllog/CallLogFragment.java10
-rw-r--r--src/com/android/dialer/calllog/CallLogListItemViews.java11
-rw-r--r--src/com/android/dialer/calllog/ContactInfoHelper.java7
-rw-r--r--src/com/android/dialer/list/PhoneFavoriteFragment.java10
-rw-r--r--src/com/android/dialer/list/RegularSearchFragment.java4
-rw-r--r--src/com/android/dialerbind/ObjectFactory.java (renamed from src/com/android/dialerbind/ServiceFactory.java)16
7 files changed, 42 insertions, 49 deletions
diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java
index 89e8be519..c0054ba79 100644
--- a/src/com/android/dialer/calllog/CallLogAdapter.java
+++ b/src/com/android/dialer/calllog/CallLogAdapter.java
@@ -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. */
diff --git a/src/com/android/dialer/calllog/CallLogFragment.java b/src/com/android/dialer/calllog/CallLogFragment.java
index 9808d073b..d0d34d897 100644
--- a/src/com/android/dialer/calllog/CallLogFragment.java
+++ b/src/com/android/dialer/calllog/CallLogFragment.java
@@ -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);
}
diff --git a/src/com/android/dialer/calllog/CallLogListItemViews.java b/src/com/android/dialer/calllog/CallLogListItemViews.java
index 0dd4f6344..ed6218f86 100644
--- a/src/com/android/dialer/calllog/CallLogListItemViews.java
+++ b/src/com/android/dialer/calllog/CallLogListItemViews.java
@@ -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));
}
}
diff --git a/src/com/android/dialer/calllog/ContactInfoHelper.java b/src/com/android/dialer/calllog/ContactInfoHelper.java
index 5d7aa1bef..64484cbed 100644
--- a/src/com/android/dialer/calllog/ContactInfoHelper.java
+++ b/src/com/android/dialer/calllog/ContactInfoHelper.java
@@ -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;
diff --git a/src/com/android/dialer/list/PhoneFavoriteFragment.java b/src/com/android/dialer/list/PhoneFavoriteFragment.java
index 4ffb0303b..0aae8aada 100644
--- a/src/com/android/dialer/list/PhoneFavoriteFragment.java
+++ b/src/com/android/dialer/list/PhoneFavoriteFragment.java
@@ -19,7 +19,6 @@ import android.app.Activity;
import android.app.Fragment;
import android.app.LoaderManager;
import android.content.CursorLoader;
-import android.content.Intent;
import android.content.Loader;
import android.database.Cursor;
import android.graphics.Rect;
@@ -27,7 +26,6 @@ import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
-import android.view.MotionEvent;
import android.view.View;
import android.view.ViewTreeObserver;
import android.view.View.OnClickListener;
@@ -35,7 +33,6 @@ import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
-import android.widget.FrameLayout;
import android.widget.ListView;
import android.widget.TextView;
@@ -44,13 +41,12 @@ import com.android.contacts.common.ContactTileLoaderFactory;
import com.android.contacts.common.GeoUtil;
import com.android.contacts.common.list.ContactEntry;
import com.android.contacts.common.list.ContactTileView;
-import com.android.contacts.common.list.PhoneNumberListAdapter;
-import com.android.dialer.DialtactsActivity;
import com.android.dialer.R;
import com.android.dialer.calllog.ContactInfoHelper;
import com.android.dialer.calllog.CallLogAdapter;
import com.android.dialer.calllog.CallLogQueryHandler;
import com.android.dialer.list.PhoneFavoritesTileAdapter.ContactTileRow;
+import com.android.dialerbind.ObjectFactory;
import java.util.ArrayList;
import java.util.HashMap;
@@ -191,8 +187,8 @@ public class PhoneFavoriteFragment extends Fragment implements OnItemClickListen
mCallLogQueryHandler = new CallLogQueryHandler(getActivity().getContentResolver(),
this, 1);
final String currentCountryIso = GeoUtil.getCurrentCountryIso(getActivity());
- mCallLogAdapter = new CallLogAdapter(getActivity(), this,
- new ContactInfoHelper(getActivity(), currentCountryIso), true);
+ mCallLogAdapter = ObjectFactory.newCallLogAdapter(getActivity(), this,
+ new ContactInfoHelper(getActivity(), currentCountryIso), true, false);
setHasOptionsMenu(true);
}
diff --git a/src/com/android/dialer/list/RegularSearchFragment.java b/src/com/android/dialer/list/RegularSearchFragment.java
index ccbd3d0dc..2a80b3ebd 100644
--- a/src/com/android/dialer/list/RegularSearchFragment.java
+++ b/src/com/android/dialer/list/RegularSearchFragment.java
@@ -16,7 +16,7 @@
package com.android.dialer.list;
import com.android.contacts.common.list.ContactEntryListAdapter;
-import com.android.dialerbind.ServiceFactory;
+import com.android.dialerbind.ObjectFactory;
import com.android.dialer.service.CachedNumberLookupService;
public class RegularSearchFragment extends SearchFragment {
@@ -24,7 +24,7 @@ public class RegularSearchFragment extends SearchFragment {
private static final int SEARCH_DIRECTORY_RESULT_LIMIT = 5;
private static final CachedNumberLookupService mCachedNumberLookupService =
- ServiceFactory.newCachedNumberLookupService();
+ ObjectFactory.newCachedNumberLookupService();
public RegularSearchFragment() {
configureDirectorySearch();
diff --git a/src/com/android/dialerbind/ServiceFactory.java b/src/com/android/dialerbind/ObjectFactory.java
index e53d2e82a..6286c05ba 100644
--- a/src/com/android/dialerbind/ServiceFactory.java
+++ b/src/com/android/dialerbind/ObjectFactory.java
@@ -16,15 +16,27 @@
package com.android.dialerbind;
+import static com.android.dialer.calllog.CallLogAdapter.CallFetcher;
+
+import android.content.Context;
+
+import com.android.dialer.calllog.CallLogAdapter;
+import com.android.dialer.calllog.ContactInfoHelper;
import com.android.dialer.service.CachedNumberLookupService;
/**
- * Default static binder for services.
+ * Default static binding for various objects.
*/
-public class ServiceFactory {
+public class ObjectFactory {
public static CachedNumberLookupService newCachedNumberLookupService() {
// no-op
return null;
}
+
+ public static CallLogAdapter newCallLogAdapter(Context context, CallFetcher callFetcher,
+ ContactInfoHelper contactInfoHelper, boolean useCallAsPrimaryAction,
+ boolean isCallLog) {
+ return new CallLogAdapter(context, callFetcher, contactInfoHelper, useCallAsPrimaryAction);
+ }
}