diff options
author | Andrew Lee <anwlee@google.com> | 2015-10-02 23:50:30 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-10-02 23:50:30 +0000 |
commit | ea0742761c5511a713b43af16d4abd1a9059dcd8 (patch) | |
tree | 7f398fbdf18e2669964da286dc7faa5c566a9ec9 /src/com/android/dialer/calllog | |
parent | 6a9fe7f962bafdd3aa68cbf01cb3372fca0514a8 (diff) | |
parent | 73bc910eee877d8f3f7f547e4fce809465f02805 (diff) |
Merge "Revert "Prepatory CallDetailActivity tweaks."" into ub-contactsdialer-a-dev
Diffstat (limited to 'src/com/android/dialer/calllog')
-rw-r--r-- | src/com/android/dialer/calllog/CallDetailHistoryAdapter.java | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/src/com/android/dialer/calllog/CallDetailHistoryAdapter.java b/src/com/android/dialer/calllog/CallDetailHistoryAdapter.java index ac56332ce..3b488a8ae 100644 --- a/src/com/android/dialer/calllog/CallDetailHistoryAdapter.java +++ b/src/com/android/dialer/calllog/CallDetailHistoryAdapter.java @@ -38,6 +38,8 @@ import java.util.ArrayList; * Adapter for a ListView containing history items from the details of a call. */ public class CallDetailHistoryAdapter extends BaseAdapter { + /** The top element is a blank header, which is hidden under the rest of the UI. */ + private static final int VIEW_TYPE_HEADER = 0; /** Each history item shows the detail of a call. */ private static final int VIEW_TYPE_HISTORY_ITEM = 1; @@ -67,37 +69,53 @@ public class CallDetailHistoryAdapter extends BaseAdapter { @Override public int getCount() { - return mPhoneCallDetails.length; + return mPhoneCallDetails.length + 1; } @Override public Object getItem(int position) { - return mPhoneCallDetails[position]; + if (position == 0) { + return null; + } + return mPhoneCallDetails[position - 1]; } @Override public long getItemId(int position) { - return position; + if (position == 0) { + return -1; + } + return position - 1; } @Override public int getViewTypeCount() { - return 1; + return 2; } @Override public int getItemViewType(int position) { + if (position == 0) { + return VIEW_TYPE_HEADER; + } return VIEW_TYPE_HISTORY_ITEM; } @Override public View getView(int position, View convertView, ViewGroup parent) { + if (position == 0) { + final View header = convertView == null + ? mLayoutInflater.inflate(R.layout.call_detail_history_header, parent, false) + : convertView; + return header; + } + // Make sure we have a valid convertView to start with final View result = convertView == null ? mLayoutInflater.inflate(R.layout.call_detail_history_item, parent, false) : convertView; - PhoneCallDetails details = mPhoneCallDetails[position]; + PhoneCallDetails details = mPhoneCallDetails[position - 1]; CallTypeIconsView callTypeIconView = (CallTypeIconsView) result.findViewById(R.id.call_type_icon); TextView callTypeTextView = (TextView) result.findViewById(R.id.call_type_text); |