diff options
author | Andrew Lee <anwlee@google.com> | 2015-05-13 01:13:21 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-05-13 01:13:22 +0000 |
commit | c5d6cb97b11ea577b1feb0cdc2f02ac7857e7934 (patch) | |
tree | 67cb121bb6550fd5b90d9580b90c99df9f93469a /src | |
parent | 4244689ea8d7a89ff41c0a0035047e33451dacf9 (diff) | |
parent | bb48628db6fd444460df61be7afa7fb633f47f50 (diff) |
Merge "Indicate whether CallLogAdapter is for Recents." into mnc-dev
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/dialer/calllog/CallLogAdapter.java | 13 | ||||
-rw-r--r-- | src/com/android/dialer/calllog/CallLogFragment.java | 12 | ||||
-rw-r--r-- | src/com/android/dialerbind/ObjectFactory.java | 7 |
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) { |