diff options
author | Andrew Lee <anwlee@google.com> | 2015-05-04 17:24:01 -0700 |
---|---|---|
committer | Andrew Lee <anwlee@google.com> | 2015-05-04 17:43:36 -0700 |
commit | 69705be50fc4c84b35df88c879dd9a4b4de655b3 (patch) | |
tree | 08967f96cfc5f9070ec287efb1fd5a53cf36a393 /src/com/android/dialer/calllog/CallLogAdapter.java | |
parent | d10eef28fc67aea0e4f4f49813b802ce1df5f7c7 (diff) |
Add "show call history" list item.
+ Add new VIEW_TYPE to the CallLogAdapter.
+ Reintroduce boolean on CallLogAdapter to specify if a call history
list item should be shown.
+ Add new ViewHolder and layout for footer.
+ Some minor styling tweaks and cleanups.
Bug: 20108202
Change-Id: Ie4a86bff9e53cfd69ef8b061af048f40f4358579
Diffstat (limited to 'src/com/android/dialer/calllog/CallLogAdapter.java')
-rw-r--r-- | src/com/android/dialer/calllog/CallLogAdapter.java | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java index f2a84c99f..8e22834e5 100644 --- a/src/com/android/dialer/calllog/CallLogAdapter.java +++ b/src/com/android/dialer/calllog/CallLogAdapter.java @@ -78,6 +78,8 @@ public class CallLogAdapter extends GroupingListAdapter public void onReportButtonClick(String number); } + private static final int VIEW_TYPE_SHOW_CALL_HISTORY_LIST_ITEM = 10; + /** Constant used to indicate no row is expanded. */ private static final long NONE_EXPANDED = -1; @@ -89,6 +91,8 @@ public class CallLogAdapter extends GroupingListAdapter protected ContactInfoCache mContactInfoCache; + private boolean mShowCallHistoryListItem = false; + /** * Tracks the currently expanded call log row. */ @@ -254,6 +258,9 @@ public class CallLogAdapter extends GroupingListAdapter @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { + if (viewType == VIEW_TYPE_SHOW_CALL_HISTORY_LIST_ITEM) { + return ShowCallHistoryViewHolder.create(mContext, parent); + } return createCallLogEntryViewHolder(parent); } @@ -287,6 +294,10 @@ public class CallLogAdapter extends GroupingListAdapter * @param count the number of entries in the current item, greater than 1 if it is a group */ public void onBindViewHolder(ViewHolder viewHolder, int position) { + if (getItemViewType(position) == VIEW_TYPE_SHOW_CALL_HISTORY_LIST_ITEM) { + return; + } + Cursor c = (Cursor) getItem(position); if (c == null) { return; @@ -414,6 +425,23 @@ public class CallLogAdapter extends GroupingListAdapter } } + @Override + public int getItemCount() { + return super.getItemCount() + (mShowCallHistoryListItem ? 1 : 0); + } + + @Override + public int getItemViewType(int position) { + if (position == getItemCount() - 1 && mShowCallHistoryListItem) { + return VIEW_TYPE_SHOW_CALL_HISTORY_LIST_ITEM; + } + return super.getItemViewType(position); + } + + public void setShowCallHistoryListItem(boolean show) { + mShowCallHistoryListItem = show; + } + /** * Retrieves the day group of the previous call in the call log. Used to determine if the day * group has changed and to trigger display of the day group text. |