public final class

ScaleGestureDetectorCompat

extends java.lang.Object

 java.lang.Object

↳androidx.core.view.ScaleGestureDetectorCompat

Gradle dependencies

compile group: 'androidx.core', name: 'core', version: '1.9.0-alpha04'

  • groupId: androidx.core
  • artifactId: core
  • version: 1.9.0-alpha04

Artifact androidx.core:core:1.9.0-alpha04 it located at Google repository (https://maven.google.com/)

Androidx artifact mapping:

androidx.core:core com.android.support:support-compat

Androidx class mapping:

androidx.core.view.ScaleGestureDetectorCompat android.support.v4.view.ScaleGestureDetectorCompat

Overview

Helper for accessing features in ScaleGestureDetector.

Summary

Methods
public static booleanisQuickScaleEnabled(java.lang.Object scaleGestureDetector)

Returns whether the quick scale gesture, in which the user performs a double tap followed by a swipe, should perform scaling.

public static booleanisQuickScaleEnabled(ScaleGestureDetector scaleGestureDetector)

Returns whether the quick scale gesture, in which the user performs a double tap followed by a swipe, should perform scaling.

public static voidsetQuickScaleEnabled(java.lang.Object scaleGestureDetector, boolean enabled)

Sets whether the associated should receive onScale callbacks when the user performs a doubleTap followed by a swipe.

public static voidsetQuickScaleEnabled(ScaleGestureDetector scaleGestureDetector, boolean enabled)

Sets whether the associated should receive onScale callbacks when the user performs a doubleTap followed by a swipe.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Methods

public static void setQuickScaleEnabled(java.lang.Object scaleGestureDetector, boolean enabled)

Deprecated: Use ScaleGestureDetectorCompat.setQuickScaleEnabled(ScaleGestureDetector, boolean) that takes ScaleGestureDetector instead of java.lang.Object.

Sets whether the associated should receive onScale callbacks when the user performs a doubleTap followed by a swipe. Note that this is enabled by default if the app targets API 19 and newer.

Parameters:

enabled: true to enable quick scaling, false to disable

public static void setQuickScaleEnabled(ScaleGestureDetector scaleGestureDetector, boolean enabled)

Sets whether the associated should receive onScale callbacks when the user performs a doubleTap followed by a swipe. Note that this is enabled by default if the app targets API 19 and newer.

Parameters:

enabled: true to enable quick scaling, false to disable

public static boolean isQuickScaleEnabled(java.lang.Object scaleGestureDetector)

Deprecated: Use ScaleGestureDetectorCompat.isQuickScaleEnabled(ScaleGestureDetector) that takes ScaleGestureDetector instead of java.lang.Object.

Returns whether the quick scale gesture, in which the user performs a double tap followed by a swipe, should perform scaling. See ScaleGestureDetectorCompat.setQuickScaleEnabled(ScaleGestureDetector, boolean).

public static boolean isQuickScaleEnabled(ScaleGestureDetector scaleGestureDetector)

Returns whether the quick scale gesture, in which the user performs a double tap followed by a swipe, should perform scaling. See ScaleGestureDetectorCompat.setQuickScaleEnabled(ScaleGestureDetector, boolean).

Source

/*
 * Copyright 2018 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 androidx.core.view;

import android.os.Build;
import android.view.ScaleGestureDetector;

import androidx.annotation.DoNotInline;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;

/**
 * Helper for accessing features in {@link ScaleGestureDetector}.
 */
public final class ScaleGestureDetectorCompat {
    private ScaleGestureDetectorCompat() {}

    /**
     * Sets whether the associated {@link ScaleGestureDetector.OnScaleGestureListener} should
     * receive onScale callbacks when the user performs a doubleTap followed by a swipe. Note that
     * this is enabled by default if the app targets API 19 and newer.
     *
     * @param enabled true to enable quick scaling, false to disable
     *
     * @deprecated Use {@link #setQuickScaleEnabled(ScaleGestureDetector, boolean)} that takes
     * {@link ScaleGestureDetector} instead of {@link Object}.
     */
    @Deprecated
    public static void setQuickScaleEnabled(Object scaleGestureDetector, boolean enabled) {
        ScaleGestureDetectorCompat.setQuickScaleEnabled(
                (ScaleGestureDetector) scaleGestureDetector, enabled);
    }

    /**
     * Sets whether the associated {@link ScaleGestureDetector.OnScaleGestureListener} should
     * receive onScale callbacks when the user performs a doubleTap followed by a swipe. Note that
     * this is enabled by default if the app targets API 19 and newer.
     *
     * @param enabled true to enable quick scaling, false to disable
     */
    public static void setQuickScaleEnabled(
            @NonNull ScaleGestureDetector scaleGestureDetector, boolean enabled) {
        if (Build.VERSION.SDK_INT >= 19) {
            Api19Impl.setQuickScaleEnabled(scaleGestureDetector, enabled);
        }
    }

    /**
     * Returns whether the quick scale gesture, in which the user performs a double tap followed by
     * a swipe, should perform scaling. See
     * {@link #setQuickScaleEnabled(ScaleGestureDetector, boolean)}.
     *
     * @deprecated Use {@link #isQuickScaleEnabled(ScaleGestureDetector)} that takes
     * {@link ScaleGestureDetector} instead of {@link Object}.
     */
    @Deprecated
    public static boolean isQuickScaleEnabled(Object scaleGestureDetector) {
        return ScaleGestureDetectorCompat.isQuickScaleEnabled(
                (ScaleGestureDetector) scaleGestureDetector);
    }

    /**
     * Returns whether the quick scale gesture, in which the user performs a double tap followed by
     * a swipe, should perform scaling. See
     * {@link #setQuickScaleEnabled(ScaleGestureDetector, boolean)}.
     */
    public static boolean isQuickScaleEnabled(@NonNull ScaleGestureDetector scaleGestureDetector) {
        if (Build.VERSION.SDK_INT >= 19) {
            return Api19Impl.isQuickScaleEnabled(scaleGestureDetector);
        } else {
            return false;
        }
    }

    @RequiresApi(19)
    static class Api19Impl {
        private Api19Impl() {
            // This class is not instantiable.
        }

        @DoNotInline
        static void setQuickScaleEnabled(ScaleGestureDetector scaleGestureDetector,
                boolean scales) {
            scaleGestureDetector.setQuickScaleEnabled(scales);
        }

        @DoNotInline
        static boolean isQuickScaleEnabled(ScaleGestureDetector scaleGestureDetector) {
            return scaleGestureDetector.isQuickScaleEnabled();
        }
    }
}