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

Commit 76e81da4 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Adding placeholder method for compat implementations for Accessibility...

Merge "Adding placeholder method for compat implementations for Accessibility manager" into ub-launcher3-master
parents df01b9ee d0030b05
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@
package com.android.launcher3;

import static com.android.launcher3.AlphaUpdateListener.updateVisibility;
import static com.android.launcher3.Utilities.isAccessibilityEnabled;
import static com.android.launcher3.compat.AccessibilityManagerCompat.isAccessibilityEnabled;

import android.animation.TimeInterpolator;
import android.content.Context;
+5 −7
Original line number Diff line number Diff line
@@ -16,6 +16,9 @@

package com.android.launcher3;

import static com.android.launcher3.compat.AccessibilityManagerCompat.isAccessibilityEnabled;
import static com.android.launcher3.compat.AccessibilityManagerCompat.isObservedEventType;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.LayoutTransition;
@@ -41,7 +44,6 @@ import android.view.ViewDebug;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.animation.Interpolator;

@@ -521,9 +523,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
    }

    private void sendScrollAccessibilityEvent() {
        AccessibilityManager am =
                (AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
        if (am.isEnabled()) {
        if (isObservedEventType(getContext(), AccessibilityEvent.TYPE_VIEW_SCROLLED)) {
            if (mCurrentPage != getNextPage()) {
                AccessibilityEvent ev =
                        AccessibilityEvent.obtain(AccessibilityEvent.TYPE_VIEW_SCROLLED);
@@ -572,9 +572,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
            }

            onPostReorderingAnimationCompleted();
            AccessibilityManager am = (AccessibilityManager)
                    getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
            if (am.isEnabled()) {
            if (isAccessibilityEnabled(getContext())) {
                // Notify the user when the page changes
                announceForAccessibility(getCurrentPageDescription());
            }
+0 −19
Original line number Diff line number Diff line
@@ -47,8 +47,6 @@ import android.util.Pair;
import android.util.SparseArray;
import android.util.TypedValue;
import android.view.View;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;

import com.android.launcher3.config.FeatureFlags;

@@ -614,23 +612,6 @@ public final class Utilities {
        return c == null || c.isEmpty();
    }

    public static boolean isAccessibilityEnabled(Context context) {
        AccessibilityManager accessibilityManager = (AccessibilityManager)
                context.getSystemService(Context.ACCESSIBILITY_SERVICE);
        return accessibilityManager.isEnabled();
    }

    public static void sendCustomAccessibilityEvent(View target, int type, String text) {
        AccessibilityManager accessibilityManager = (AccessibilityManager)
                target.getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
        if (accessibilityManager.isEnabled()) {
            AccessibilityEvent event = AccessibilityEvent.obtain(type);
            target.onInitializeAccessibilityEvent(event);
            event.getText().add(text);
            accessibilityManager.sendAccessibilityEvent(event);
        }
    }

    public static boolean isBinderSizeError(Exception e) {
        return e.getCause() instanceof TransactionTooLargeException
                || e.getCause() instanceof DeadObjectException;
+1 −1
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ import static com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_TRANSITION_M
import static com.android.launcher3.LauncherState.ALL_APPS;
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.LauncherState.SPRING_LOADED;
import static com.android.launcher3.Utilities.isAccessibilityEnabled;
import static com.android.launcher3.compat.AccessibilityManagerCompat.isAccessibilityEnabled;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
+4 −10
Original line number Diff line number Diff line
@@ -18,16 +18,15 @@ package com.android.launcher3;

import static com.android.launcher3.LauncherAnimUtils.DRAWABLE_ALPHA;
import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY;
import static com.android.launcher3.compat.AccessibilityManagerCompat.isAccessibilityEnabled;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.animation.TimeInterpolator;
import android.animation.ValueAnimator;
import android.content.Context;
import android.util.Property;
import android.view.View;
import android.view.accessibility.AccessibilityManager;

import com.android.launcher3.LauncherState.PageAlphaProvider;
import com.android.launcher3.LauncherStateManager.AnimationConfig;
@@ -165,7 +164,7 @@ public class WorkspaceStateTransitionAnimation {
                return;
            }
            view.setAlpha(alpha);
            AlphaUpdateListener.updateVisibility(view, isAccessibilityEnabled(view));
            AlphaUpdateListener.updateVisibility(view, isAccessibilityEnabled(view.getContext()));
        }

        public <T> void setFloat(T target, Property<T, Float> property, float value,
@@ -177,12 +176,6 @@ public class WorkspaceStateTransitionAnimation {
                TimeInterpolator interpolator) {
            property.set(target, value);
        }

        protected boolean isAccessibilityEnabled(View v) {
            AccessibilityManager am = (AccessibilityManager)
                    v.getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
            return am.isEnabled();
        }
    }

    public static class AnimatedPropertySetter extends PropertySetter {
@@ -202,7 +195,8 @@ public class WorkspaceStateTransitionAnimation {
                    return;
                }
                anim = ObjectAnimator.ofFloat(view, View.ALPHA, alpha);
                anim.addListener(new AlphaUpdateListener(view, isAccessibilityEnabled(view)));
                anim.addListener(new AlphaUpdateListener(view,
                        isAccessibilityEnabled(view.getContext())));
            }

            anim.setDuration(mDuration).setInterpolator(getFadeInterpolator(alpha));
Loading