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
This commit is contained in:
sallyyuen
2022-07-06 13:35:08 -07:00
committed by Sally Yuen
parent d238f79f92
commit e66341940a

View File

@@ -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);