summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Lee <anwlee@google.com>2015-05-13 01:35:16 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-05-13 01:35:16 +0000
commit057e5b8348786154dcf2872e2af78e7b9e12535c (patch)
tree9bfb289f3fbe89ffa414d75357c38f9f94169474
parent6923a587e5cf67f5d08c232689a6b2616d2282f6 (diff)
parentc0ae3f075546e62bfc066cc875d5c90bb66940be (diff)
am c0ae3f07: am c5d6cb97: Merge "Indicate whether CallLogAdapter is for Recents." into mnc-dev
* commit 'c0ae3f075546e62bfc066cc875d5c90bb66940be': Indicate whether CallLogAdapter is for Recents.
-rw-r--r--src/com/android/dialer/calllog/CallLogAdapter.java13
-rw-r--r--src/com/android/dialer/calllog/CallLogFragment.java12
-rw-r--r--src/com/android/dialerbind/ObjectFactory.java7
-rw-r--r--tests/src/com/android/dialer/calllog/CallLogAdapterTest.java2
4 files changed, 21 insertions, 13 deletions
diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java
index ee83c2e48..6b24c0a4f 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
protected ContactInfoCache mContactInfoCache;
- private boolean mShowCallHistoryListItem = false;
+ private boolean mIsShowingRecentsTab;
/**
* Tracks the currently expanded call log row.
@@ -184,13 +184,14 @@ public class CallLogAdapter extends GroupingListAdapter
Context context,
CallFetcher callFetcher,
ContactInfoHelper contactInfoHelper,
+ boolean isShowingRecentsTab,
OnReportButtonClickListener onReportButtonClickListener) {
super(context);
mContext = context;
mCallFetcher = callFetcher;
mContactInfoHelper = contactInfoHelper;
-
+ mIsShowingRecentsTab = isShowingRecentsTab;
mOnReportButtonClickListener = onReportButtonClickListener;
mContactInfoCache = new ContactInfoCache(
@@ -425,19 +426,19 @@ public class CallLogAdapter extends GroupingListAdapter
@Override
public int getItemCount() {
- return super.getItemCount() + (mShowCallHistoryListItem ? 1 : 0);
+ return super.getItemCount() + (isShowingRecentsTab() ? 1 : 0);
}
@Override
public int getItemViewType(int position) {
- if (position == getItemCount() - 1 && mShowCallHistoryListItem) {
+ if (position == getItemCount() - 1 && isShowingRecentsTab()) {
return VIEW_TYPE_SHOW_CALL_HISTORY_LIST_ITEM;
}
return super.getItemViewType(position);
}
- public void setShowCallHistoryListItem(boolean show) {
- mShowCallHistoryListItem = show;
+ protected boolean isShowingRecentsTab() {
+ return mIsShowingRecentsTab;
}
/**
diff --git a/src/com/android/dialer/calllog/CallLogFragment.java b/src/com/android/dialer/calllog/CallLogFragment.java
index 02970f66c..4948176c1 100644
--- a/src/com/android/dialer/calllog/CallLogFragment.java
+++ b/src/com/android/dialer/calllog/CallLogFragment.java
@@ -281,11 +281,13 @@ public class CallLogFragment extends Fragment
mRecyclerView.setLayoutManager(mLayoutManager);
String currentCountryIso = GeoUtil.getCurrentCountryIso(getActivity());
- mAdapter = ObjectFactory.newCallLogAdapter(getActivity(), this,
- new ContactInfoHelper(getActivity(), currentCountryIso), this);
- if (mLogLimit != NO_LOG_LIMIT || mDateLimit != NO_DATE_LIMIT) {
- mAdapter.setShowCallHistoryListItem(true);
- }
+ boolean isShowingRecentsTab = mLogLimit != NO_LOG_LIMIT || mDateLimit != NO_DATE_LIMIT;
+ mAdapter = ObjectFactory.newCallLogAdapter(
+ getActivity(),
+ this,
+ new ContactInfoHelper(getActivity(), currentCountryIso),
+ isShowingRecentsTab,
+ this);
mRecyclerView.setAdapter(mAdapter);
mVoicemailStatusHelper = new VoicemailStatusHelperImpl();
diff --git a/src/com/android/dialerbind/ObjectFactory.java b/src/com/android/dialerbind/ObjectFactory.java
index dfacd3f6d..be4eeec42 100644
--- a/src/com/android/dialerbind/ObjectFactory.java
+++ b/src/com/android/dialerbind/ObjectFactory.java
@@ -48,9 +48,14 @@ public class ObjectFactory {
Context context,
CallFetcher callFetcher,
ContactInfoHelper contactInfoHelper,
+ boolean isShowingRecentsTab,
OnReportButtonClickListener onReportButtonClickListener) {
return new CallLogAdapter(
- context, callFetcher, contactInfoHelper, onReportButtonClickListener);
+ context,
+ callFetcher,
+ contactInfoHelper,
+ isShowingRecentsTab,
+ onReportButtonClickListener);
}
public static DialogFragment getReportDialogFragment(String number) {
diff --git a/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java b/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java
index 70d63c9ac..5f09cb74b 100644
--- a/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java
+++ b/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java
@@ -204,7 +204,7 @@ public class CallLogAdapterTest extends AndroidTestCase {
private static final class TestCallLogAdapter extends CallLogAdapter {
public TestCallLogAdapter(Context context, CallFetcher callFetcher,
ContactInfoHelper contactInfoHelper) {
- super(context, callFetcher, contactInfoHelper, null);
+ super(context, callFetcher, contactInfoHelper, false, null);
mContactInfoCache = new TestContactInfoCache(
contactInfoHelper, mOnContactInfoChangedListener);
}