Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4c3d3e24 authored by Wenyi Wang's avatar Wenyi Wang
Browse files

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
parent b6e3ecb7
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -43,9 +43,9 @@ import android.widget.Toolbar;

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 @@ public class ActionBarAdapter implements OnCloseListener {
    }

    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);
+5 −2
Original line number Diff line number Diff line
@@ -108,6 +108,7 @@ import com.android.contacts.common.Collapser;
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 @@ public class QuickContactActivity extends ContactsActivity
            return;
        }

        if (CompatUtils.isLollipopCompatible()) {
            getWindow().setStatusBarColor(Color.TRANSPARENT);
        }

        processIntent(getIntent());

@@ -2309,7 +2312,7 @@ public class QuickContactActivity extends ContactsActivity
    }

    private void updateStatusBarColor() {
        if (mScroller == null) {
        if (mScroller == null || !CompatUtils.isLollipopCompatible()) {
            return;
        }
        final int desiredStatusBarColor;
+13 −9
Original line number Diff line number Diff line
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.ColorMatrixColorFilter;
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.ViewGroup;
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 @@ public class MultiShrinkScroller extends FrameLayout {
            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,11 +528,13 @@ public class MultiShrinkScroller extends FrameLayout {
    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.
        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());
        }
    }

    /**
     * Expand to maximum size.
@@ -1117,9 +1121,9 @@ public class MultiShrinkScroller extends FrameLayout {
        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.