From c1b7d0ae8cdfc0f0dddb5c2bb45c8239ffc6a264 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Wed, 15 Apr 2015 17:23:27 -0700 Subject: Move call log actions into expandable view. This isn't the prettiest thing ever, but with this the "framework" of all of the changes for the new visual style of the call logs is in place. From here on out, the remainder of tasks should be unblocked and relatively independent. + Rename ...ItemViews to ...ItemViewHolder. This probably wasn't completely necessary, but is more proper given the new architecture. + ViewHolder is now officially where most of the independent UI logic for a single call log list item should live. This changelist moves further in that direction by storing references and helpers in it, to lessen what must be passed in from the adapter. + Split out the call action from the rest of the actions, since it has a special treatment on the card. + Convert text action buttons into a vertical stack. + Consolidate action stylings into a single style, for simplicity. + Miscellaneous style and string changes to put things in a better state. This included tweaking some of the (ripple) backgrounds. + Update tests, according to changes. Bug: 19372817 Change-Id: Ic923c0bcbbc1c153952131d0c772df9e9589fb03 --- .../android/dialer/calllog/CallLogAdapterTest.java | 16 ++- .../dialer/calllog/CallLogFragmentTest.java | 142 +++++++++++---------- .../dialer/calllog/CallLogListItemHelperTest.java | 24 ++-- 3 files changed, 94 insertions(+), 88 deletions(-) (limited to 'tests/src') diff --git a/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java b/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java index bffbe5cf5..70d63c9ac 100644 --- a/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java +++ b/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java @@ -18,6 +18,7 @@ package com.android.dialer.calllog; import android.content.Context; import android.database.MatrixCursor; +import android.support.v7.widget.RecyclerView.ViewHolder; import android.test.AndroidTestCase; import android.test.suitebuilder.annotation.SmallTest; import android.view.View; @@ -45,6 +46,7 @@ public class CallLogAdapterTest extends AndroidTestCase { private MatrixCursor mCursor; private View mView; + private ViewHolder mViewHolder; @Override protected void setUp() throws Exception { @@ -72,7 +74,8 @@ public class CallLogAdapterTest extends AndroidTestCase { mCursor.moveToFirst(); // The views into which to store the data. mView = new LinearLayout(getContext()); - mView.setTag(CallLogListItemViews.createForTest(getContext())); + mViewHolder = CallLogListItemViewHolder.createForTest(getContext()); + mView.setTag(mViewHolder); } @Override @@ -88,7 +91,7 @@ public class CallLogAdapterTest extends AndroidTestCase { // Bind the views of a single row. mAdapter.changeCursor(mCursor); - mAdapter.onBindViewHolder(CallLogListItemViews.fromView(getContext(), mView), 0); + mAdapter.onBindViewHolder(mViewHolder, 0); // There is one request for contact details. assertEquals(1, mAdapter.getContactInfoCache().requests.size()); @@ -107,7 +110,7 @@ public class CallLogAdapterTest extends AndroidTestCase { // Bind the views of a single row. mAdapter.changeCursor(mCursor); - mAdapter.onBindViewHolder(CallLogListItemViews.fromView(getContext(), mView), 0); + mAdapter.onBindViewHolder(mViewHolder, 0); // There is one request for contact details. assertEquals(1, mAdapter.getContactInfoCache().requests.size()); @@ -126,8 +129,7 @@ public class CallLogAdapterTest extends AndroidTestCase { // Bind the views of a single row. mAdapter.changeCursor(mCursor); - mAdapter.onBindViewHolder( - CallLogListItemViews.fromView(getContext(), mView), 0); + mAdapter.onBindViewHolder(mViewHolder, 0); // There is one request for contact details. assertEquals(1, mAdapter.getContactInfoCache().requests.size()); @@ -143,7 +145,7 @@ public class CallLogAdapterTest extends AndroidTestCase { // Bind the views of a single row. mAdapter.changeCursor(mCursor); - mAdapter.onBindViewHolder(CallLogListItemViews.fromView(getContext(), mView), 0); + mAdapter.onBindViewHolder(mViewHolder, 0); // Cache and call log are up-to-date: no need to request update. assertEquals(0, mAdapter.getContactInfoCache().requests.size()); @@ -159,7 +161,7 @@ public class CallLogAdapterTest extends AndroidTestCase { // Bind the views of a single row. mAdapter.changeCursor(mCursor); - mAdapter.onBindViewHolder(CallLogListItemViews.fromView(getContext(), mView), 0); + mAdapter.onBindViewHolder(mViewHolder, 0); // There is one request for contact details. assertEquals(1, mAdapter.getContactInfoCache().requests.size()); diff --git a/tests/src/com/android/dialer/calllog/CallLogFragmentTest.java b/tests/src/com/android/dialer/calllog/CallLogFragmentTest.java index fe14f8709..0c19799cc 100644 --- a/tests/src/com/android/dialer/calllog/CallLogFragmentTest.java +++ b/tests/src/com/android/dialer/calllog/CallLogFragmentTest.java @@ -30,7 +30,6 @@ import android.net.Uri; import android.provider.CallLog.Calls; import android.provider.ContactsContract.CommonDataKinds.Phone; import android.provider.VoicemailContract; -import android.support.v7.widget.RecyclerView.ViewHolder; import android.telephony.PhoneNumberUtils; import android.telephony.TelephonyManager; import android.test.ActivityInstrumentationTestCase2; @@ -94,10 +93,10 @@ public class CallLogFragmentTest extends ActivityInstrumentationTestCase2