summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Lee <anwlee@google.com>2015-05-12 14:17:28 -0700
committerAndrew Lee <anwlee@google.com>2015-05-12 16:22:44 -0700
commitbb48628db6fd444460df61be7afa7fb633f47f50 (patch)
treedcba12ac76eadcbee097b6bc57fa993556f700ec /src
parent92e8d005feb26e1444fea59fbba91a42a370b58d (diff)
Indicate whether CallLogAdapter is for Recents.
Bug: 20924950 Change-Id: I6163565ec508d245afd83112927d636a4a50f27e
Diffstat (limited to 'src')
-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
3 files changed, 20 insertions, 12 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) {