diff options
6 files changed, 53 insertions, 9 deletions
diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java index 6afade407..50520bb42 100644 --- a/src/com/android/dialer/calllog/CallLogAdapter.java +++ b/src/com/android/dialer/calllog/CallLogAdapter.java @@ -267,6 +267,7 @@ public class CallLogAdapter extends GroupingListAdapter private int mCallLogBackgroundColor; private int mExpandedBackgroundColor; private float mExpandedTranslationZ; + private int mPhotoSize; /** Listener for the primary or secondary actions in the list. * Primary opens the call details. @@ -365,6 +366,7 @@ public class CallLogAdapter extends GroupingListAdapter mCallLogBackgroundColor = resources.getColor(R.color.background_dialer_list_items); mExpandedBackgroundColor = resources.getColor(R.color.call_log_expanded_background_color); mExpandedTranslationZ = resources.getDimension(R.dimen.call_log_expanded_translation_z); + mPhotoSize = resources.getDimensionPixelSize(R.dimen.contact_photo_size); mContactPhotoManager = ContactPhotoManager.getInstance(mContext); mPhoneNumberHelper = new PhoneNumberDisplayHelper(mContext, resources); @@ -1233,7 +1235,7 @@ public class CallLogAdapter extends GroupingListAdapter views.quickContactView.setOverlay(null); DefaultImageRequest request = new DefaultImageRequest(displayName, identifier, contactType, true /* isCircular */); - mContactPhotoManager.loadDirectoryPhoto(views.quickContactView, photoUri, + mContactPhotoManager.loadPhoto(views.quickContactView, photoUri, mPhotoSize, false /* darkTheme */, true /* isCircular */, request); } diff --git a/src/com/android/dialer/util/DialerUtils.java b/src/com/android/dialer/util/DialerUtils.java index 9cd4d9936..10eadffd5 100644 --- a/src/com/android/dialer/util/DialerUtils.java +++ b/src/com/android/dialer/util/DialerUtils.java @@ -71,7 +71,7 @@ public class DialerUtils { */ public static void startActivityWithErrorToast(Context context, Intent intent, int msgId) { try { - if (Intent.ACTION_CALL.equals(intent.getAction())) { + if (Intent.ACTION_CALL.equals(intent.getAction()) && context instanceof Activity) { // All dialer-initiated calls should pass the touch point to the InCallUI Point touchPoint = TouchPointManager.getInstance().getPoint(); if (touchPoint.x != 0 || touchPoint.y != 0) { diff --git a/tests/src/com/android/dialer/calllog/CallLogFragmentTest.java b/tests/src/com/android/dialer/calllog/CallLogFragmentTest.java index e0e111bcf..b88989d4d 100644 --- a/tests/src/com/android/dialer/calllog/CallLogFragmentTest.java +++ b/tests/src/com/android/dialer/calllog/CallLogFragmentTest.java @@ -42,6 +42,7 @@ import android.widget.FrameLayout; import com.android.contacts.common.test.FragmentTestActivity; import com.android.dialer.CallDetailActivity; import com.android.dialer.R; +import com.android.dialer.util.TestConstants; import java.util.Date; import java.util.Formatter; @@ -323,7 +324,7 @@ public class CallLogFragmentTest extends ActivityInstrumentationTestCase2<Fragme IntentProvider intentProvider = (IntentProvider) views.callBackButtonView.getTag(); Intent intent = intentProvider.getIntent(mActivity); // Starts a call. - assertEquals(Intent.ACTION_CALL_PRIVILEGED, intent.getAction()); + assertEquals(TestConstants.CALL_INTENT_ACTION, intent.getAction()); // To the entry's number. assertEquals(Uri.parse("tel:" + TEST_NUMBER), intent.getData()); } @@ -385,7 +386,7 @@ public class CallLogFragmentTest extends ActivityInstrumentationTestCase2<Fragme Intent callIntent = intentProvider.getIntent(mActivity); //The intent should be to make the call - assertEquals(Intent.ACTION_CALL_PRIVILEGED, callIntent.getAction()); + assertEquals(TestConstants.CALL_INTENT_ACTION, callIntent.getAction()); } } } diff --git a/tests/src/com/android/dialer/interactions/PhoneNumberInteractionTest.java b/tests/src/com/android/dialer/interactions/PhoneNumberInteractionTest.java index 8d4b01f67..6671022ba 100644 --- a/tests/src/com/android/dialer/interactions/PhoneNumberInteractionTest.java +++ b/tests/src/com/android/dialer/interactions/PhoneNumberInteractionTest.java @@ -35,6 +35,7 @@ import com.android.contacts.common.test.mocks.MockContentProvider; import com.android.contacts.common.test.mocks.MockContentProvider.Query; import com.android.contacts.common.util.ContactDisplayUtils; import com.android.dialer.interactions.PhoneNumberInteraction.PhoneItem; +import com.android.dialer.util.TestConstants; import java.util.ArrayList; import java.util.List; @@ -179,7 +180,7 @@ public class PhoneNumberInteractionTest extends InstrumentationTestCase { Intent intent = mContext.getIntentForStartActivity(); assertNotNull(intent); - assertEquals(Intent.ACTION_CALL_PRIVILEGED, intent.getAction()); + assertEquals(TestConstants.CALL_INTENT_ACTION, intent.getAction()); assertEquals("tel:123", intent.getDataString()); } @@ -197,7 +198,7 @@ public class PhoneNumberInteractionTest extends InstrumentationTestCase { Intent intent = mContext.getIntentForStartActivity(); assertNotNull(intent); - assertEquals(Intent.ACTION_CALL_PRIVILEGED, intent.getAction()); + assertEquals(TestConstants.CALL_INTENT_ACTION, intent.getAction()); assertEquals("sip:example%40example.com", intent.getDataString()); } diff --git a/tests/src/com/android/dialer/util/TestConstants.java b/tests/src/com/android/dialer/util/TestConstants.java new file mode 100644 index 000000000..780626a27 --- /dev/null +++ b/tests/src/com/android/dialer/util/TestConstants.java @@ -0,0 +1,7 @@ +package com.android.dialer.util; + +import android.content.Intent; + +public class TestConstants { + public static final String CALL_INTENT_ACTION = Intent.ACTION_CALL; +} diff --git a/tests/src/com/android/dialer/widget/ActionBarControllerTest.java b/tests/src/com/android/dialer/widget/ActionBarControllerTest.java index cafa747f2..2e388380f 100644 --- a/tests/src/com/android/dialer/widget/ActionBarControllerTest.java +++ b/tests/src/com/android/dialer/widget/ActionBarControllerTest.java @@ -17,25 +17,53 @@ package com.android.dialer.widget; import android.app.ActionBar; +import android.app.Activity; import android.content.Context; +import android.test.ActivityInstrumentationTestCase2; +import android.test.AndroidTestCase; import android.test.InstrumentationTestCase; import android.test.suitebuilder.annotation.SmallTest; +import android.view.View; +import com.android.dialer.DialtactsActivity; import com.android.dialer.widget.ActionBarController.ActivityUi; +import com.android.internal.app.WindowDecorActionBar; @SmallTest -public class ActionBarControllerTest extends InstrumentationTestCase { +public class ActionBarControllerTest extends ActivityInstrumentationTestCase2<DialtactsActivity> { private static final int ACTION_BAR_HEIGHT = 100; private ActionBarController mActionBarController; private SearchEditTextLayout mSearchBox; private MockActivityUi mActivityUi; + private class MockActionBar extends WindowDecorActionBar { + private int mHideOffset = 0; + + public MockActionBar(Activity activity) { + super(activity); + } + + @Override + public void setHideOffset(int offset) { + mHideOffset = offset; + } + + @Override + public int getHideOffset() { + return mHideOffset; + } + } + private class MockActivityUi implements ActivityUi { boolean isInSearchUi; boolean hasSearchQuery; boolean shouldShowActionBar; - int actionBarHideOffset; + private ActionBar mActionBar; + + public MockActivityUi() { + mActionBar = new MockActionBar(getActivity()); + } @Override public boolean isInSearchUi() { @@ -59,7 +87,7 @@ public class ActionBarControllerTest extends InstrumentationTestCase { @Override public ActionBar getActionBar() { - return null; + return mActionBar; } } @@ -83,6 +111,11 @@ public class ActionBarControllerTest extends InstrumentationTestCase { } } + public ActionBarControllerTest() { + super(DialtactsActivity.class); + } + + @Override protected void setUp() { mActivityUi = new MockActivityUi(); |