From 481994f4962ec937ba8775578c2bb9d76141fd7f Mon Sep 17 00:00:00 2001 From: Yorke Lee Date: Tue, 23 Jul 2013 16:53:36 -0700 Subject: Redlines for call history screen, as well as most recent call log * Add and change background and layout for CallLogListItem * Create wrapper view for most recent call log item * Change actionbar background in Call History activity * Hide phone number in call log items * Add tab indicator drawables Change-Id: Ic86c3fac857971aba58ba3ac1d79ddebaf663da6 --- src/com/android/dialer/PhoneCallDetailsHelper.java | 14 ++++++--- .../dialer/list/NewPhoneFavoriteMergedAdapter.java | 34 ++++++++++++++++++++-- 2 files changed, 42 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/com/android/dialer/PhoneCallDetailsHelper.java b/src/com/android/dialer/PhoneCallDetailsHelper.java index 37394c30f..0da0d0c39 100644 --- a/src/com/android/dialer/PhoneCallDetailsHelper.java +++ b/src/com/android/dialer/PhoneCallDetailsHelper.java @@ -115,19 +115,25 @@ public class PhoneCallDetailsHelper { } else { numberText = details.geocode; } - labelText = null; + labelText = numberText; // We have a real phone number as "nameView" so make it always LTR views.nameView.setTextDirection(View.TEXT_DIRECTION_LTR); } else { nameText = details.name; numberText = displayNumber; - labelText = numberFormattedLabel; + labelText = TextUtils.isEmpty(numberFormattedLabel) ? numberText : + numberFormattedLabel; // We have a real phone number as "numberView" so make it always LTR - views.numberView.setTextDirection(View.TEXT_DIRECTION_LTR); + if (views.numberView != null) { + views.numberView.setTextDirection(View.TEXT_DIRECTION_LTR); + } } views.nameView.setText(nameText); - views.numberView.setText(numberText); + if (views.numberView != null) { + views.numberView.setText(numberText); + } + views.labelView.setText(labelText); views.labelView.setVisibility(TextUtils.isEmpty(labelText) ? View.GONE : View.VISIBLE); } diff --git a/src/com/android/dialer/list/NewPhoneFavoriteMergedAdapter.java b/src/com/android/dialer/list/NewPhoneFavoriteMergedAdapter.java index fff5c9f7c..742892b61 100644 --- a/src/com/android/dialer/list/NewPhoneFavoriteMergedAdapter.java +++ b/src/com/android/dialer/list/NewPhoneFavoriteMergedAdapter.java @@ -23,6 +23,7 @@ import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.FrameLayout; +import android.widget.LinearLayout; import android.widget.SectionIndexer; import com.android.contacts.common.list.ContactEntryListAdapter; @@ -60,6 +61,9 @@ public class NewPhoneFavoriteMergedAdapter extends BaseAdapter implements Sectio private final int mItemPaddingLeft; private final int mItemPaddingRight; + private final int mCallLogPadding; + + private final Context mContext; private final DataSetObserver mObserver; @@ -70,8 +74,10 @@ public class NewPhoneFavoriteMergedAdapter extends BaseAdapter implements Sectio NewCallLogAdapter callLogAdapter, View loadingView) { final Resources resources = context.getResources(); + mContext = context; mItemPaddingLeft = resources.getDimensionPixelSize(R.dimen.detail_item_side_margin); mItemPaddingRight = resources.getDimensionPixelSize(R.dimen.list_visible_scrollbar_padding); + mCallLogPadding = resources.getDimensionPixelSize(R.dimen.recent_call_log_item_padding); mContactTileAdapter = contactTileAdapter; mContactEntryListAdapter = contactEntryListAdapter; mCallLogAdapter = callLogAdapter; @@ -237,8 +243,32 @@ public class NewPhoneFavoriteMergedAdapter extends BaseAdapter implements Sectio // TODO krelease: Handle the new callLogAdapterCount and position offsets properly if (callLogAdapterCount > 0) { if (position == 0) { - final View view = mCallLogAdapter.getView(position, convertView, parent); - return view; + final FrameLayout wrapper; + if (convertView == null) { + wrapper = new FrameLayout(mContext); + } else { + wrapper = (FrameLayout) convertView; + } + + // Special case wrapper view for the most recent call log item. This allows + // us to create a card-like effect for the more recent call log item in + // the PhoneFavoriteMergedAdapter, but keep the original look of the item in + // the CallLogAdapter. + final View view = mCallLogAdapter.getView(position, convertView == null ? + null : wrapper.getChildAt(0), parent); + wrapper.removeAllViews(); + view.setBackgroundResource(R.drawable.dialer_recent_card_bg); + + final FrameLayout.LayoutParams params = new FrameLayout.LayoutParams( + FrameLayout.LayoutParams.WRAP_CONTENT, + FrameLayout.LayoutParams.WRAP_CONTENT); + + params.setMarginsRelative(mCallLogPadding, mCallLogPadding, mCallLogPadding, + mCallLogPadding); + view.setLayoutParams(params); + wrapper.addView(view); + + return wrapper; } position -= callLogAdapterCount; } -- cgit v1.2.3