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

Commit c880b74e authored by Wenyi Wang's avatar Wenyi Wang Committed by Android (Google) Code Review
Browse files

Merge "Backport ContactsContract methods (1/2)" into ub-contactsdialer-b-dev

parents b8e0f409 c85af287
Loading
Loading
Loading
Loading
+39 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2015 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.contacts.compat;

import android.widget.EdgeEffect;
import com.android.contacts.common.compat.CompatUtils;

/**
 * Compatibility class for {@link android.widget.EdgeEffect}
 * The android.support.v4.widget.EdgeEffectCompat doesn't support customized color, so we write
 * our own and keep using EdgeEffect to customize color.
 */
public class EdgeEffectCompat {
    /**
     * Compatibility method for {@link EdgeEffect#onPull(float, float)}, which is only available
     * on Lollipop+.
     */
    public static void onPull(EdgeEffect edgeEffect, float deltaDistance, float displacement) {
        if (CompatUtils.isLollipopCompatible()) {
            edgeEffect.onPull(deltaDistance, displacement);
        } else {
            edgeEffect.onPull(deltaDistance);
        }
    }
}
+2 −1
Original line number Diff line number Diff line
@@ -109,6 +109,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.compat.EventCompat;
import com.android.contacts.common.dialog.CallSubjectDialog;
import com.android.contacts.common.editor.SelectAccountDialogFragment;
import com.android.contacts.common.interactions.TouchPointManager;
@@ -1803,7 +1804,7 @@ public class QuickContactActivity extends ContactsActivity
            }
            header = res.getString(R.string.header_event_entry);
            if (event.hasKindTypeColumn(kind)) {
                subHeader = Event.getTypeLabel(res, event.getKindTypeColumn(kind),
                subHeader = EventCompat.getTypeLabel(res, event.getKindTypeColumn(kind),
                        event.getLabel()).toString();
            }
            text = DateUtils.formatDate(context, dataString);
+3 −1
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@ package com.android.contacts.widget;

import com.android.contacts.R;
import com.android.contacts.common.compat.CompatUtils;
import com.android.contacts.compat.EdgeEffectCompat;
import com.android.contacts.quickcontact.ExpandingEntryCardView;
import com.android.contacts.test.NeededForReflection;
import com.android.contacts.util.SchedulingUtils;
@@ -501,7 +502,8 @@ public class MultiShrinkScroller extends FrameLayout {
                    if (delta > distanceFromMaxScrolling) {
                        // The ScrollView is being pulled upwards while there is no more
                        // content offscreen, and the view port is already fully expanded.
                        mEdgeGlowBottom.onPull(delta / getHeight(), 1 - event.getX() / getWidth());
                        EdgeEffectCompat.onPull(mEdgeGlowBottom, delta / getHeight(),
                                1 - event.getX() / getWidth());
                    }

                    if (!mEdgeGlowBottom.isFinished()) {