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

Commit e6634194 authored by sallyyuen's avatar sallyyuen Committed by Sally Yuen
Browse files

Add index info to every event coming from PagedTileLayout

A11y services can now access page number from all events, not just
scrolled events.

Test: build and check a11y events are populated.
Bug: 232046146
Change-Id: I78edaeca5b540211472a4b809b14a65c0d5e958b
parent d238f79f
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@ import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.animation.Interpolator;
import android.view.animation.OvershootInterpolator;
@@ -626,6 +627,16 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
        }
    }

    @Override
    public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
        super.onInitializeAccessibilityEvent(event);
        if (mAdapter != null && mAdapter.getCount() > 0) {
            event.setItemCount(mAdapter.getCount());
            event.setFromIndex(getCurrentPageNumber());
            event.setToIndex(getCurrentPageNumber());
        }
    }

    private static Animator setupBounceAnimator(View view, int ordinal) {
        view.setAlpha(0f);
        view.setScaleX(0f);