Backport methods related with QuickContact

- Ignore setters and getters of status bar color on pre-L
- Ignore setters and getters of EdgeEffect color on pre-L
- Use ViewCompat to set elevation
- Use PathInterpolatorCompat to instantiate Interpolator

Bug: 25629359
Change-Id: Ie9409fbdc7f96a9feead95f2e47ca852a735a285
diff --git a/src/com/android/contacts/activities/ActionBarAdapter.java b/src/com/android/contacts/activities/ActionBarAdapter.java
index 0e9591d..e47f60c 100644
--- a/src/com/android/contacts/activities/ActionBarAdapter.java
+++ b/src/com/android/contacts/activities/ActionBarAdapter.java
@@ -43,9 +43,9 @@
 
 import com.android.contacts.R;
 import com.android.contacts.activities.ActionBarAdapter.Listener.Action;
+import com.android.contacts.common.compat.CompatUtils;
 import com.android.contacts.list.ContactsRequest;
 
-
 /**
  * Adapter for the action bar at the top of the Contacts activity.
  */
@@ -503,6 +503,9 @@
     }
 
     private void updateStatusBarColor() {
+        if (!CompatUtils.isLollipopCompatible()) {
+            return; // we can't change the status bar color prior to Lollipop
+        }
         if (mSelectionMode) {
             final int cabStatusBarColor = mActivity.getResources().getColor(
                     R.color.contextual_selection_bar_status_bar_color);
diff --git a/src/com/android/contacts/quickcontact/QuickContactActivity.java b/src/com/android/contacts/quickcontact/QuickContactActivity.java
index a3d92d4..690cd51 100644
--- a/src/com/android/contacts/quickcontact/QuickContactActivity.java
+++ b/src/com/android/contacts/quickcontact/QuickContactActivity.java
@@ -108,6 +108,7 @@
 import com.android.contacts.common.ContactPhotoManager;
 import com.android.contacts.common.ContactsUtils;
 import com.android.contacts.common.activity.RequestPermissionsActivity;
+import com.android.contacts.common.compat.CompatUtils;
 import com.android.contacts.common.dialog.CallSubjectDialog;
 import com.android.contacts.common.editor.SelectAccountDialogFragment;
 import com.android.contacts.common.interactions.TouchPointManager;
@@ -928,7 +929,9 @@
             return;
         }
 
-        getWindow().setStatusBarColor(Color.TRANSPARENT);
+        if (CompatUtils.isLollipopCompatible()) {
+            getWindow().setStatusBarColor(Color.TRANSPARENT);
+        }
 
         processIntent(getIntent());
 
@@ -2309,7 +2312,7 @@
     }
 
     private void updateStatusBarColor() {
-        if (mScroller == null) {
+        if (mScroller == null || !CompatUtils.isLollipopCompatible()) {
             return;
         }
         final int desiredStatusBarColor;
diff --git a/src/com/android/contacts/widget/MultiShrinkScroller.java b/src/com/android/contacts/widget/MultiShrinkScroller.java
index d1cb9f8..e7ca823 100644
--- a/src/com/android/contacts/widget/MultiShrinkScroller.java
+++ b/src/com/android/contacts/widget/MultiShrinkScroller.java
@@ -1,6 +1,7 @@
 package com.android.contacts.widget;
 
 import com.android.contacts.R;
+import com.android.contacts.common.compat.CompatUtils;
 import com.android.contacts.quickcontact.ExpandingEntryCardView;
 import com.android.contacts.test.NeededForReflection;
 import com.android.contacts.util.SchedulingUtils;
@@ -20,6 +21,8 @@
 import android.graphics.drawable.GradientDrawable;
 import android.hardware.display.DisplayManager;
 import android.os.Trace;
+import android.support.v4.view.ViewCompat;
+import android.support.v4.view.animation.PathInterpolatorCompat;
 import android.util.AttributeSet;
 import android.util.TypedValue;
 import android.view.Display;
@@ -31,7 +34,6 @@
 import android.view.ViewConfiguration;
 import android.view.animation.AnimationUtils;
 import android.view.animation.Interpolator;
-import android.view.animation.PathInterpolator;
 import android.widget.EdgeEffect;
 import android.widget.FrameLayout;
 import android.widget.LinearLayout;
@@ -177,8 +179,8 @@
             0, 0, 0, 1, 0
     };
 
-    private final PathInterpolator mTextSizePathInterpolator
-            = new PathInterpolator(0.16f, 0.4f, 0.2f, 1);
+    private final Interpolator mTextSizePathInterpolator =
+            PathInterpolatorCompat.create(0.16f, 0.4f, 0.2f, 1);
 
     private final int[] mGradientColors = new int[] {0,0x88000000};
     private GradientDrawable mTitleGradientDrawable = new GradientDrawable(
@@ -526,10 +528,12 @@
     public void setHeaderTintColor(int color) {
         mHeaderTintColor = color;
         updatePhotoTintAndDropShadow();
-        // We want to use the same amount of alpha on the new tint color as the previous tint color.
-        final int edgeEffectAlpha = Color.alpha(mEdgeGlowBottom.getColor());
-        mEdgeGlowBottom.setColor((color & 0xffffff) | Color.argb(edgeEffectAlpha, 0, 0, 0));
-        mEdgeGlowTop.setColor(mEdgeGlowBottom.getColor());
+        if (CompatUtils.isLollipopCompatible()) {
+            // Use the same amount of alpha on the new tint color as the previous tint color.
+            final int edgeEffectAlpha = Color.alpha(mEdgeGlowBottom.getColor());
+            mEdgeGlowBottom.setColor((color & 0xffffff) | Color.argb(edgeEffectAlpha, 0, 0, 0));
+            mEdgeGlowTop.setColor(mEdgeGlowBottom.getColor());
+        }
     }
 
     /**
@@ -1117,9 +1121,9 @@
         final int toolbarHeight = getToolbarHeight();
 
         if (toolbarHeight <= mMinimumHeaderHeight && !mIsTwoPanel) {
-            mPhotoViewContainer.setElevation(mToolbarElevation);
+            ViewCompat.setElevation(mPhotoViewContainer, mToolbarElevation);
         } else {
-            mPhotoViewContainer.setElevation(0);
+            ViewCompat.setElevation(mPhotoViewContainer, 0);
         }
 
         // Reuse an existing mColorFilter (to avoid GC pauses) to change the photo's tint.