19066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/*
29066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * Copyright (C) 2006 The Android Open Source Project
39066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project *
49066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * Licensed under the Apache License, Version 2.0 (the "License");
59066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * you may not use this file except in compliance with the License.
69066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * You may obtain a copy of the License at
79066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project *
89066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project *      http://www.apache.org/licenses/LICENSE-2.0
99066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project *
109066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * Unless required by applicable law or agreed to in writing, software
119066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * distributed under the License is distributed on an "AS IS" BASIS,
129066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
139066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * See the License for the specific language governing permissions and
149066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * limitations under the License.
159066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project */
169066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
179066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectpackage android.view;
189066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
199de95db4f28f88c37b1443d20b308ce02407fd74Chris Craikimport android.annotation.NonNull;
209066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectimport android.graphics.Rect;
21b6ab098bad4b126eaaaa3aaa5a512fefc4e0749bAdam Powellimport android.os.Bundle;
22736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganovimport android.view.accessibility.AccessibilityEvent;
239066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
249066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/**
259066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * Defines the responsibilities for a class that will be a parent of a View.
269066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * This is the API that a view sees when it wants to interact with its parent.
279066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project *
289066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project */
299066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectpublic interface ViewParent {
309066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
319066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * Called when something has changed which has invalidated the layout of a
329066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * child of this view parent. This will schedule a layout pass of the view
339066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * tree.
349066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
359066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public void requestLayout();
369066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
379066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
389066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * Indicates whether layout was requested on this view parent.
399066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     *
409066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @return true if layout was requested, false otherwise
419066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
429066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public boolean isLayoutRequested();
439066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
449066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
459066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * Called when a child wants the view hierarchy to gather and report
469066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * transparent regions to the window compositor. Views that "punch" holes in
479066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * the view hierarchy, such as SurfaceView can use this API to improve
489066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * performance of the system. When no such a view is present in the
499066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * hierarchy, this optimization in unnecessary and might slightly reduce the
509066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * view hierarchy performance.
519066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     *
529066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param child the view requesting the transparent region computation
539066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     *
549066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
559066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public void requestTransparentRegion(View child);
569066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
579de95db4f28f88c37b1443d20b308ce02407fd74Chris Craik
589de95db4f28f88c37b1443d20b308ce02407fd74Chris Craik    /**
599de95db4f28f88c37b1443d20b308ce02407fd74Chris Craik     * The target View has been invalidated, or has had a drawing property changed that
609de95db4f28f88c37b1443d20b308ce02407fd74Chris Craik     * requires the hierarchy to re-render.
619de95db4f28f88c37b1443d20b308ce02407fd74Chris Craik     *
629de95db4f28f88c37b1443d20b308ce02407fd74Chris Craik     * This method is called by the View hierarchy to signal ancestors that a View either needs to
639de95db4f28f88c37b1443d20b308ce02407fd74Chris Craik     * re-record its drawing commands, or drawing properties have changed. This is how Views
649de95db4f28f88c37b1443d20b308ce02407fd74Chris Craik     * schedule a drawing traversal.
659de95db4f28f88c37b1443d20b308ce02407fd74Chris Craik     *
669de95db4f28f88c37b1443d20b308ce02407fd74Chris Craik     * This signal is generally only dispatched for attached Views, since only they need to draw.
679de95db4f28f88c37b1443d20b308ce02407fd74Chris Craik     *
689de95db4f28f88c37b1443d20b308ce02407fd74Chris Craik     * @param child Direct child of this ViewParent containing target
699de95db4f28f88c37b1443d20b308ce02407fd74Chris Craik     * @param target The view that needs to redraw
709de95db4f28f88c37b1443d20b308ce02407fd74Chris Craik     */
719de95db4f28f88c37b1443d20b308ce02407fd74Chris Craik    default void onDescendantInvalidated(@NonNull View child, @NonNull View target) {
729de95db4f28f88c37b1443d20b308ce02407fd74Chris Craik        if (getParent() != null) {
739de95db4f28f88c37b1443d20b308ce02407fd74Chris Craik            // Note: should pass 'this' as default, but can't since we may not be a View
749de95db4f28f88c37b1443d20b308ce02407fd74Chris Craik            getParent().onDescendantInvalidated(child, target);
759de95db4f28f88c37b1443d20b308ce02407fd74Chris Craik        }
769de95db4f28f88c37b1443d20b308ce02407fd74Chris Craik    }
779de95db4f28f88c37b1443d20b308ce02407fd74Chris Craik
789066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
799066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * All or part of a child is dirty and needs to be redrawn.
809066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     *
819066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param child The child which is dirty
829066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param r The area within the child that is invalid
839de95db4f28f88c37b1443d20b308ce02407fd74Chris Craik     *
849de95db4f28f88c37b1443d20b308ce02407fd74Chris Craik     * @deprecated Use {@link #onDescendantInvalidated(View, View)} instead.
859066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
869de95db4f28f88c37b1443d20b308ce02407fd74Chris Craik    @Deprecated
879066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public void invalidateChild(View child, Rect r);
889066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
899066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
909066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * All or part of a child is dirty and needs to be redrawn.
919066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     *
92cea45132e3d5d32a6fc737abf10b8893a50f465bGilles Debunne     * <p>The location array is an array of two int values which respectively
93cea45132e3d5d32a6fc737abf10b8893a50f465bGilles Debunne     * define the left and the top position of the dirty child.</p>
949066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     *
95cea45132e3d5d32a6fc737abf10b8893a50f465bGilles Debunne     * <p>This method must return the parent of this ViewParent if the specified
969066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * rectangle must be invalidated in the parent. If the specified rectangle
979066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * does not require invalidation in the parent or if the parent does not
98cea45132e3d5d32a6fc737abf10b8893a50f465bGilles Debunne     * exist, this method must return null.</p>
999066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     *
100cea45132e3d5d32a6fc737abf10b8893a50f465bGilles Debunne     * <p>When this method returns a non-null value, the location array must
101cea45132e3d5d32a6fc737abf10b8893a50f465bGilles Debunne     * have been updated with the left and top coordinates of this ViewParent.</p>
1029066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     *
1039066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param location An array of 2 ints containing the left and top
1049066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     *        coordinates of the child to invalidate
1059066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param r The area within the child that is invalid
1069066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     *
1079066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @return the parent of this ViewParent or null
1089de95db4f28f88c37b1443d20b308ce02407fd74Chris Craik     *
1099de95db4f28f88c37b1443d20b308ce02407fd74Chris Craik     * @deprecated Use {@link #onDescendantInvalidated(View, View)} instead.
1109066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
1119de95db4f28f88c37b1443d20b308ce02407fd74Chris Craik    @Deprecated
1129066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public ViewParent invalidateChildInParent(int[] location, Rect r);
1139066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
1149066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
1159066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * Returns the parent if it exists, or null.
1169066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     *
1179066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @return a ViewParent or null if this ViewParent does not have a parent
1189066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
1199066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public ViewParent getParent();
1209066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
1219066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
1229066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * Called when a child of this parent wants focus
1239066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     *
1249066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param child The child of this ViewParent that wants focus. This view
1259066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     *        will contain the focused view. It is not necessarily the view that
1269066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     *        actually has focus.
1279066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param focused The view that is a descendant of child that actually has
1289066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     *        focus
1299066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
1309066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public void requestChildFocus(View child, View focused);
1319066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
1329066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
1339066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * Tell view hierarchy that the global view attributes need to be
1349066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * re-evaluated.
1359066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     *
1369066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param child View whose attributes have changed.
1379066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
1389066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public void recomputeViewAttributes(View child);
1399066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
1409066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
1419066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * Called when a child of this parent is giving up focus
1429066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     *
1439066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param child The view that is giving up focus
1449066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
1459066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public void clearChildFocus(View child);
1469066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
147cea45132e3d5d32a6fc737abf10b8893a50f465bGilles Debunne    /**
148cea45132e3d5d32a6fc737abf10b8893a50f465bGilles Debunne     * Compute the visible part of a rectangular region defined in terms of a child view's
149cea45132e3d5d32a6fc737abf10b8893a50f465bGilles Debunne     * coordinates.
150cea45132e3d5d32a6fc737abf10b8893a50f465bGilles Debunne     *
151cea45132e3d5d32a6fc737abf10b8893a50f465bGilles Debunne     * <p>Returns the clipped visible part of the rectangle <code>r</code>, defined in the
152cea45132e3d5d32a6fc737abf10b8893a50f465bGilles Debunne     * <code>child</code>'s local coordinate system. <code>r</code> is modified by this method to
153cea45132e3d5d32a6fc737abf10b8893a50f465bGilles Debunne     * contain the result, expressed in the global (root) coordinate system.</p>
154cea45132e3d5d32a6fc737abf10b8893a50f465bGilles Debunne     *
155cea45132e3d5d32a6fc737abf10b8893a50f465bGilles Debunne     * <p>The resulting rectangle is always axis aligned. If a rotation is applied to a node in the
156cea45132e3d5d32a6fc737abf10b8893a50f465bGilles Debunne     * View hierarchy, the result is the axis-aligned bounding box of the visible rectangle.</p>
157cea45132e3d5d32a6fc737abf10b8893a50f465bGilles Debunne     *
158cea45132e3d5d32a6fc737abf10b8893a50f465bGilles Debunne     * @param child A child View, whose rectangular visible region we want to compute
159cea45132e3d5d32a6fc737abf10b8893a50f465bGilles Debunne     * @param r The input rectangle, defined in the child coordinate system. Will be overwritten to
160cea45132e3d5d32a6fc737abf10b8893a50f465bGilles Debunne     * contain the resulting visible rectangle, expressed in global (root) coordinates
161cea45132e3d5d32a6fc737abf10b8893a50f465bGilles Debunne     * @param offset The input coordinates of a point, defined in the child coordinate system.
162cea45132e3d5d32a6fc737abf10b8893a50f465bGilles Debunne     * As with the <code>r</code> parameter, this will be overwritten to contain the global (root)
163cea45132e3d5d32a6fc737abf10b8893a50f465bGilles Debunne     * coordinates of that point.
164cea45132e3d5d32a6fc737abf10b8893a50f465bGilles Debunne     * A <code>null</code> value is valid (in case you are not interested in this result)
165cea45132e3d5d32a6fc737abf10b8893a50f465bGilles Debunne     * @return true if the resulting rectangle is not empty, false otherwise
166cea45132e3d5d32a6fc737abf10b8893a50f465bGilles Debunne     */
1679066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public boolean getChildVisibleRect(View child, Rect r, android.graphics.Point offset);
1689066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
1699066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
1709066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * Find the nearest view in the specified direction that wants to take focus
1719066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     *
1729066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param v The view that currently has focus
1739066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param direction One of FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, and FOCUS_RIGHT
1749066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
1759066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public View focusSearch(View v, int direction);
1769066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
1779066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
178b5ced2200767280026ee57857edaebc02d081216Vadim Tryshev     * Find the nearest keyboard navigation cluster in the specified direction.
179b5ced2200767280026ee57857edaebc02d081216Vadim Tryshev     * This does not actually give focus to that cluster.
18001b0c9ed4e173f0c140a6575049e2964ae1a919fVadim Tryshev     *
181b5ced2200767280026ee57857edaebc02d081216Vadim Tryshev     * @param currentCluster The starting point of the search. Null means the current cluster is not
182b5ced2200767280026ee57857edaebc02d081216Vadim Tryshev     *                       found yet
18301b0c9ed4e173f0c140a6575049e2964ae1a919fVadim Tryshev     * @param direction Direction to look
18401b0c9ed4e173f0c140a6575049e2964ae1a919fVadim Tryshev     *
185b5ced2200767280026ee57857edaebc02d081216Vadim Tryshev     * @return The nearest keyboard navigation cluster in the specified direction, or null if none
18601b0c9ed4e173f0c140a6575049e2964ae1a919fVadim Tryshev     *         can be found
18701b0c9ed4e173f0c140a6575049e2964ae1a919fVadim Tryshev     */
188b5ced2200767280026ee57857edaebc02d081216Vadim Tryshev    View keyboardNavigationClusterSearch(View currentCluster, int direction);
18901b0c9ed4e173f0c140a6575049e2964ae1a919fVadim Tryshev
19001b0c9ed4e173f0c140a6575049e2964ae1a919fVadim Tryshev    /**
1910187a5d424c8618709b8f11dd7200caa0178c40eChet Haase     * Change the z order of the child so it's on top of all other children.
1920187a5d424c8618709b8f11dd7200caa0178c40eChet Haase     * This ordering change may affect layout, if this container
193cb96db8d144a01aa41ec396247c548d8aa496131Chet Haase     * uses an order-dependent layout scheme (e.g., LinearLayout). Prior
194e8222dddaf2e3da14380101e818d4254899e0c0dChet Haase     * to {@link android.os.Build.VERSION_CODES#KITKAT} this
1950187a5d424c8618709b8f11dd7200caa0178c40eChet Haase     * method should be followed by calls to {@link #requestLayout()} and
196cb96db8d144a01aa41ec396247c548d8aa496131Chet Haase     * {@link View#invalidate()} on this parent to force the parent to redraw
197cb96db8d144a01aa41ec396247c548d8aa496131Chet Haase     * with the new child ordering.
1989066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     *
1990187a5d424c8618709b8f11dd7200caa0178c40eChet Haase     * @param child The child to bring to the top of the z order
2009066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
2019066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public void bringChildToFront(View child);
2029066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
2039066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
2049066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * Tells the parent that a new focusable view has become available. This is
2059066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * to handle transitions from the case where there are no focusable views to
2069066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * the case where the first focusable view appears.
2079066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     *
2089066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param v The view that has become newly focusable
2099066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
2109066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public void focusableViewAvailable(View v);
2119066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
2129066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
213021627eb5875372dea57ba91fa782fffbfbbc559Alan Viverette     * Shows the context menu for the specified view or its ancestors.
214021627eb5875372dea57ba91fa782fffbfbbc559Alan Viverette     * <p>
215021627eb5875372dea57ba91fa782fffbfbbc559Alan Viverette     * In most cases, a subclass does not need to override this. However, if
2169066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * the subclass is added directly to the window manager (for example,
2179066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * {@link ViewManager#addView(View, android.view.ViewGroup.LayoutParams)})
218021627eb5875372dea57ba91fa782fffbfbbc559Alan Viverette     * then it should override this and show the context menu.
219021627eb5875372dea57ba91fa782fffbfbbc559Alan Viverette     *
220021627eb5875372dea57ba91fa782fffbfbbc559Alan Viverette     * @param originalView the source view where the context menu was first
221021627eb5875372dea57ba91fa782fffbfbbc559Alan Viverette     *                     invoked
222021627eb5875372dea57ba91fa782fffbfbbc559Alan Viverette     * @return {@code true} if the context menu was shown, {@code false}
223021627eb5875372dea57ba91fa782fffbfbbc559Alan Viverette     *         otherwise
224021627eb5875372dea57ba91fa782fffbfbbc559Alan Viverette     * @see #showContextMenuForChild(View, float, float)
2259066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
2269066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public boolean showContextMenuForChild(View originalView);
2279066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
2289066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
229021627eb5875372dea57ba91fa782fffbfbbc559Alan Viverette     * Shows the context menu for the specified view or its ancestors anchored
230021627eb5875372dea57ba91fa782fffbfbbc559Alan Viverette     * to the specified view-relative coordinate.
231021627eb5875372dea57ba91fa782fffbfbbc559Alan Viverette     * <p>
232021627eb5875372dea57ba91fa782fffbfbbc559Alan Viverette     * In most cases, a subclass does not need to override this. However, if
233021627eb5875372dea57ba91fa782fffbfbbc559Alan Viverette     * the subclass is added directly to the window manager (for example,
234021627eb5875372dea57ba91fa782fffbfbbc559Alan Viverette     * {@link ViewManager#addView(View, android.view.ViewGroup.LayoutParams)})
235021627eb5875372dea57ba91fa782fffbfbbc559Alan Viverette     * then it should override this and show the context menu.
2362af189a0a7962501b808cd50499d978a7cd10d81Adam Powell     * <p>
2372af189a0a7962501b808cd50499d978a7cd10d81Adam Powell     * If a subclass overrides this method it should also override
2382af189a0a7962501b808cd50499d978a7cd10d81Adam Powell     * {@link #showContextMenuForChild(View)}.
239ed3912692f0ba8a647d795462e20fcdb67adbacbOren Blasberg     *
240021627eb5875372dea57ba91fa782fffbfbbc559Alan Viverette     * @param originalView the source view where the context menu was first
241021627eb5875372dea57ba91fa782fffbfbbc559Alan Viverette     *                     invoked
242021627eb5875372dea57ba91fa782fffbfbbc559Alan Viverette     * @param x the X coordinate in pixels relative to the original view to
24323e282d297193655ce5a4b716312f0a985b27d50Oren Blasberg     *          which the menu should be anchored, or {@link Float#NaN} to
24423e282d297193655ce5a4b716312f0a985b27d50Oren Blasberg     *          disable anchoring
245021627eb5875372dea57ba91fa782fffbfbbc559Alan Viverette     * @param y the Y coordinate in pixels relative to the original view to
24623e282d297193655ce5a4b716312f0a985b27d50Oren Blasberg     *          which the menu should be anchored, or {@link Float#NaN} to
24723e282d297193655ce5a4b716312f0a985b27d50Oren Blasberg     *          disable anchoring
248021627eb5875372dea57ba91fa782fffbfbbc559Alan Viverette     * @return {@code true} if the context menu was shown, {@code false}
249021627eb5875372dea57ba91fa782fffbfbbc559Alan Viverette     *         otherwise
250ed3912692f0ba8a647d795462e20fcdb67adbacbOren Blasberg     */
2512af189a0a7962501b808cd50499d978a7cd10d81Adam Powell    boolean showContextMenuForChild(View originalView, float x, float y);
252ed3912692f0ba8a647d795462e20fcdb67adbacbOren Blasberg
253ed3912692f0ba8a647d795462e20fcdb67adbacbOren Blasberg    /**
2549066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * Have the parent populate the specified context menu if it has anything to
2559066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * add (and then recurse on its parent).
2569066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     *
2579066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param menu The menu to populate
2589066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
2599066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public void createContextMenu(ContextMenu menu);
2609066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
2619066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
2624423d91de5300d3fd318bf5bc2d4d7e5bb856abfClara Bayarri     * Start an action mode for the specified view with the default type
2634423d91de5300d3fd318bf5bc2d4d7e5bb856abfClara Bayarri     * {@link ActionMode#TYPE_PRIMARY}.
264cea45132e3d5d32a6fc737abf10b8893a50f465bGilles Debunne     *
265cea45132e3d5d32a6fc737abf10b8893a50f465bGilles Debunne     * <p>In most cases, a subclass does not need to override this. However, if the
2666e34636749217654f43221885afb7a29bb5ca96aAdam Powell     * subclass is added directly to the window manager (for example,
2676e34636749217654f43221885afb7a29bb5ca96aAdam Powell     * {@link ViewManager#addView(View, android.view.ViewGroup.LayoutParams)})
268cea45132e3d5d32a6fc737abf10b8893a50f465bGilles Debunne     * then it should override this and start the action mode.</p>
2696e34636749217654f43221885afb7a29bb5ca96aAdam Powell     *
2706e34636749217654f43221885afb7a29bb5ca96aAdam Powell     * @param originalView The source view where the action mode was first invoked
2716e34636749217654f43221885afb7a29bb5ca96aAdam Powell     * @param callback The callback that will handle lifecycle events for the action mode
2726e34636749217654f43221885afb7a29bb5ca96aAdam Powell     * @return The new action mode if it was started, null otherwise
2734423d91de5300d3fd318bf5bc2d4d7e5bb856abfClara Bayarri     *
2744423d91de5300d3fd318bf5bc2d4d7e5bb856abfClara Bayarri     * @see #startActionModeForChild(View, android.view.ActionMode.Callback, int)
2756e34636749217654f43221885afb7a29bb5ca96aAdam Powell     */
2766e34636749217654f43221885afb7a29bb5ca96aAdam Powell    public ActionMode startActionModeForChild(View originalView, ActionMode.Callback callback);
2776e34636749217654f43221885afb7a29bb5ca96aAdam Powell
2786e34636749217654f43221885afb7a29bb5ca96aAdam Powell    /**
2794423d91de5300d3fd318bf5bc2d4d7e5bb856abfClara Bayarri     * Start an action mode of a specific type for the specified view.
2804423d91de5300d3fd318bf5bc2d4d7e5bb856abfClara Bayarri     *
2814423d91de5300d3fd318bf5bc2d4d7e5bb856abfClara Bayarri     * <p>In most cases, a subclass does not need to override this. However, if the
2824423d91de5300d3fd318bf5bc2d4d7e5bb856abfClara Bayarri     * subclass is added directly to the window manager (for example,
2834423d91de5300d3fd318bf5bc2d4d7e5bb856abfClara Bayarri     * {@link ViewManager#addView(View, android.view.ViewGroup.LayoutParams)})
2844423d91de5300d3fd318bf5bc2d4d7e5bb856abfClara Bayarri     * then it should override this and start the action mode.</p>
2854423d91de5300d3fd318bf5bc2d4d7e5bb856abfClara Bayarri     *
2864423d91de5300d3fd318bf5bc2d4d7e5bb856abfClara Bayarri     * @param originalView The source view where the action mode was first invoked
2874423d91de5300d3fd318bf5bc2d4d7e5bb856abfClara Bayarri     * @param callback The callback that will handle lifecycle events for the action mode
2884423d91de5300d3fd318bf5bc2d4d7e5bb856abfClara Bayarri     * @param type One of {@link ActionMode#TYPE_PRIMARY} or {@link ActionMode#TYPE_FLOATING}.
2894423d91de5300d3fd318bf5bc2d4d7e5bb856abfClara Bayarri     * @return The new action mode if it was started, null otherwise
2904423d91de5300d3fd318bf5bc2d4d7e5bb856abfClara Bayarri     */
2914423d91de5300d3fd318bf5bc2d4d7e5bb856abfClara Bayarri    public ActionMode startActionModeForChild(
2924423d91de5300d3fd318bf5bc2d4d7e5bb856abfClara Bayarri            View originalView, ActionMode.Callback callback, int type);
2934423d91de5300d3fd318bf5bc2d4d7e5bb856abfClara Bayarri
2944423d91de5300d3fd318bf5bc2d4d7e5bb856abfClara Bayarri    /**
2959066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * This method is called on the parent when a child's drawable state
2969066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * has changed.
2979066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     *
2989066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param child The child whose drawable state has changed.
2999066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
3009066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public void childDrawableStateChanged(View child);
3014423d91de5300d3fd318bf5bc2d4d7e5bb856abfClara Bayarri
3029066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
3039066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * Called when a child does not want this parent and its ancestors to
3049066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * intercept touch events with
3059066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * {@link ViewGroup#onInterceptTouchEvent(MotionEvent)}.
306cea45132e3d5d32a6fc737abf10b8893a50f465bGilles Debunne     *
307cea45132e3d5d32a6fc737abf10b8893a50f465bGilles Debunne     * <p>This parent should pass this call onto its parents. This parent must obey
3089066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * this request for the duration of the touch (that is, only clear the flag
309cea45132e3d5d32a6fc737abf10b8893a50f465bGilles Debunne     * after this parent has received an up or a cancel.</p>
3109066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     *
3119066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param disallowIntercept True if the child does not want the parent to
3129066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     *            intercept touch events.
3139066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
3149066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public void requestDisallowInterceptTouchEvent(boolean disallowIntercept);
315d62d5e9accc76952d737f9c58a97f898807713e5Yigit Boyar
3169066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
3179066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * Called when a child of this group wants a particular rectangle to be
3189066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * positioned onto the screen.  {@link ViewGroup}s overriding this can trust
3199066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * that:
3209066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * <ul>
3219066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     *   <li>child will be a direct child of this group</li>
322d62d5e9accc76952d737f9c58a97f898807713e5Yigit Boyar     *   <li>rectangle will be in the child's content coordinates</li>
3239066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * </ul>
3249066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     *
3259066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * <p>{@link ViewGroup}s overriding this should uphold the contract:</p>
3269066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * <ul>
3279066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     *   <li>nothing will change if the rectangle is already visible</li>
3289066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     *   <li>the view port will be scrolled only just enough to make the
3299066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     *       rectangle visible</li>
3309066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * <ul>
3319066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     *
3329066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param child The direct child making the request.
3339066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param rectangle The rectangle in the child's coordinates the child
3349066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     *        wishes to be on the screen.
3359066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param immediate True to forbid animated or delayed scrolling,
3369066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     *        false otherwise
3379066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @return Whether the group scrolled to handle the operation
3389066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
3399066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public boolean requestChildRectangleOnScreen(View child, Rect rectangle,
3409066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            boolean immediate);
341736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov
342736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    /**
343736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     * Called by a child to request from its parent to send an {@link AccessibilityEvent}.
344736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     * The child has already populated a record for itself in the event and is delegating
345736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     * to its parent to send the event. The parent can optionally add a record for itself.
346736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     * <p>
347736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     * Note: An accessibility event is fired by an individual view which populates the
348736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     *       event with a record for its state and requests from its parent to perform
349736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     *       the sending. The parent can optionally add a record for itself before
350736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     *       dispatching the request to its parent. A parent can also choose not to
351736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     *       respect the request for sending the event. The accessibility event is sent
352cea45132e3d5d32a6fc737abf10b8893a50f465bGilles Debunne     *       by the topmost view in the view tree.</p>
353736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     *
354736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     * @param child The child which requests sending the event.
355736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     * @param event The event to be sent.
356736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     * @return True if the event was sent.
357736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     */
358736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    public boolean requestSendAccessibilityEvent(View child, AccessibilityEvent event);
359539ee8716b4f81260bab2e9f3dc5d88d81c99985Adam Powell
360539ee8716b4f81260bab2e9f3dc5d88d81c99985Adam Powell    /**
361539ee8716b4f81260bab2e9f3dc5d88d81c99985Adam Powell     * Called when a child view now has or no longer is tracking transient state.
362539ee8716b4f81260bab2e9f3dc5d88d81c99985Adam Powell     *
3630da4a282eec40364d54f9e658632c5aab85142b7Adam Powell     * <p>"Transient state" is any state that a View might hold that is not expected to
3640da4a282eec40364d54f9e658632c5aab85142b7Adam Powell     * be reflected in the data model that the View currently presents. This state only
3650da4a282eec40364d54f9e658632c5aab85142b7Adam Powell     * affects the presentation to the user within the View itself, such as the current
3660da4a282eec40364d54f9e658632c5aab85142b7Adam Powell     * state of animations in progress or the state of a text selection operation.</p>
3670da4a282eec40364d54f9e658632c5aab85142b7Adam Powell     *
3680da4a282eec40364d54f9e658632c5aab85142b7Adam Powell     * <p>Transient state is useful for hinting to other components of the View system
3690da4a282eec40364d54f9e658632c5aab85142b7Adam Powell     * that a particular view is tracking something complex but encapsulated.
3700da4a282eec40364d54f9e658632c5aab85142b7Adam Powell     * A <code>ListView</code> for example may acknowledge that list item Views
3710da4a282eec40364d54f9e658632c5aab85142b7Adam Powell     * with transient state should be preserved within their position or stable item ID
3720da4a282eec40364d54f9e658632c5aab85142b7Adam Powell     * instead of treating that view as trivially replaceable by the backing adapter.
3730da4a282eec40364d54f9e658632c5aab85142b7Adam Powell     * This allows adapter implementations to be simpler instead of needing to track
3740da4a282eec40364d54f9e658632c5aab85142b7Adam Powell     * the state of item view animations in progress such that they could be restored
3750da4a282eec40364d54f9e658632c5aab85142b7Adam Powell     * in the event of an unexpected recycling and rebinding of attached item views.</p>
3760da4a282eec40364d54f9e658632c5aab85142b7Adam Powell     *
3770da4a282eec40364d54f9e658632c5aab85142b7Adam Powell     * <p>This method is called on a parent view when a child view or a view within
3780da4a282eec40364d54f9e658632c5aab85142b7Adam Powell     * its subtree begins or ends tracking of internal transient state.</p>
3790da4a282eec40364d54f9e658632c5aab85142b7Adam Powell     *
380539ee8716b4f81260bab2e9f3dc5d88d81c99985Adam Powell     * @param child Child view whose state has changed
381539ee8716b4f81260bab2e9f3dc5d88d81c99985Adam Powell     * @param hasTransientState true if this child has transient state
382539ee8716b4f81260bab2e9f3dc5d88d81c99985Adam Powell     */
383539ee8716b4f81260bab2e9f3dc5d88d81c99985Adam Powell    public void childHasTransientStateChanged(View child, boolean hasTransientState);
3843a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn
3853a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn    /**
3863a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn     * Ask that a new dispatch of {@link View#fitSystemWindows(Rect)
3873a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn     * View.fitSystemWindows(Rect)} be performed.
3883a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn     */
3893a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn    public void requestFitSystemWindows();
3904213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov
3914213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov    /**
3924213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov     * Gets the parent of a given View for accessibility. Since some Views are not
3934213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov     * exposed to the accessibility layer the parent for accessibility is not
3944213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov     * necessarily the direct parent of the View, rather it is a predecessor.
3954213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov     *
3964213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov     * @return The parent or <code>null</code> if no such is found.
3974213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov     */
3984213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov    public ViewParent getParentForAccessibility();
3994213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov
4004213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov    /**
40177e9a28e2faa36f127231b842476d47f9823a83aAlan Viverette     * Notifies a view parent that the accessibility state of one of its
40277e9a28e2faa36f127231b842476d47f9823a83aAlan Viverette     * descendants has changed and that the structure of the subtree is
40377e9a28e2faa36f127231b842476d47f9823a83aAlan Viverette     * different.
40477e9a28e2faa36f127231b842476d47f9823a83aAlan Viverette     * @param child The direct child whose subtree has changed.
40563e4503991b52862efb17d42950d986dca90976bPhil Weaver     * @param source The descendant view that changed. May not be {@code null}.
40677e9a28e2faa36f127231b842476d47f9823a83aAlan Viverette     * @param changeType A bit mask of the types of changes that occurred. One
40777e9a28e2faa36f127231b842476d47f9823a83aAlan Viverette     *            or more of:
40877e9a28e2faa36f127231b842476d47f9823a83aAlan Viverette     *            <ul>
40977e9a28e2faa36f127231b842476d47f9823a83aAlan Viverette     *            <li>{@link AccessibilityEvent#CONTENT_CHANGE_TYPE_CONTENT_DESCRIPTION}
41077e9a28e2faa36f127231b842476d47f9823a83aAlan Viverette     *            <li>{@link AccessibilityEvent#CONTENT_CHANGE_TYPE_SUBTREE}
41177e9a28e2faa36f127231b842476d47f9823a83aAlan Viverette     *            <li>{@link AccessibilityEvent#CONTENT_CHANGE_TYPE_TEXT}
41277e9a28e2faa36f127231b842476d47f9823a83aAlan Viverette     *            <li>{@link AccessibilityEvent#CONTENT_CHANGE_TYPE_UNDEFINED}
41377e9a28e2faa36f127231b842476d47f9823a83aAlan Viverette     *            </ul>
4144213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov     */
41563e4503991b52862efb17d42950d986dca90976bPhil Weaver    public void notifySubtreeAccessibilityStateChanged(
41663e4503991b52862efb17d42950d986dca90976bPhil Weaver            View child, @NonNull View source, int changeType);
4179dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio
4189dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio    /**
4199dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     * Tells if this view parent can resolve the layout direction.
4209dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     * See {@link View#setLayoutDirection(int)}
4219dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     *
4229dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     * @return True if this view parent can resolve the layout direction.
4239dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     */
4249dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio    public boolean canResolveLayoutDirection();
4259dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio
4269dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio    /**
4279dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     * Tells if this view parent layout direction is resolved.
4289dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     * See {@link View#setLayoutDirection(int)}
4299dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     *
4309dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     * @return True if this view parent layout direction is resolved.
4319dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     */
4329dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio    public boolean isLayoutDirectionResolved();
4339dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio
4349dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio    /**
4359dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     * Return this view parent layout direction. See {@link View#getLayoutDirection()}
4369dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     *
4379dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     * @return {@link View#LAYOUT_DIRECTION_RTL} if the layout direction is RTL or returns
4389dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     * {@link View#LAYOUT_DIRECTION_LTR} if the layout direction is not RTL.
4399dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     */
4409dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio    public int getLayoutDirection();
4419dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio
4429dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio    /**
4439dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     * Tells if this view parent can resolve the text direction.
4449dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     * See {@link View#setTextDirection(int)}
4459dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     *
4469dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     * @return True if this view parent can resolve the text direction.
4479dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     */
4489dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio    public boolean canResolveTextDirection();
4499dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio
4509dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio    /**
4519dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     * Tells if this view parent text direction is resolved.
4529dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     * See {@link View#setTextDirection(int)}
4539dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     *
4549dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     * @return True if this view parent text direction is resolved.
4559dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     */
4569dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio    public boolean isTextDirectionResolved();
4579dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio
4589dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio    /**
4599dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     * Return this view parent text direction. See {@link View#getTextDirection()}
4609dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     *
4619dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     * @return the resolved text direction. Returns one of:
4629dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     *
4639dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     * {@link View#TEXT_DIRECTION_FIRST_STRONG}
4649dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     * {@link View#TEXT_DIRECTION_ANY_RTL},
4659dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     * {@link View#TEXT_DIRECTION_LTR},
4669dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     * {@link View#TEXT_DIRECTION_RTL},
4679dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     * {@link View#TEXT_DIRECTION_LOCALE}
4689dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     */
4699dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio    public int getTextDirection();
4709dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio
4719dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio    /**
4729dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     * Tells if this view parent can resolve the text alignment.
4739dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     * See {@link View#setTextAlignment(int)}
4749dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     *
4759dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     * @return True if this view parent can resolve the text alignment.
4769dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     */
4779dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio    public boolean canResolveTextAlignment();
4789dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio
4799dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio    /**
4809dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     * Tells if this view parent text alignment is resolved.
4819dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     * See {@link View#setTextAlignment(int)}
4829dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     *
4839dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     * @return True if this view parent text alignment is resolved.
4849dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     */
4859dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio    public boolean isTextAlignmentResolved();
4869dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio
4879dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio    /**
4889dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     * Return this view parent text alignment. See {@link android.view.View#getTextAlignment()}
4899dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     *
4909dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     * @return the resolved text alignment. Returns one of:
4919dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     *
4929dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     * {@link View#TEXT_ALIGNMENT_GRAVITY},
4939dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     * {@link View#TEXT_ALIGNMENT_CENTER},
4949dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     * {@link View#TEXT_ALIGNMENT_TEXT_START},
4959dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     * {@link View#TEXT_ALIGNMENT_TEXT_END},
4969dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     * {@link View#TEXT_ALIGNMENT_VIEW_START},
4979dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     * {@link View#TEXT_ALIGNMENT_VIEW_END}
4989dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio     */
4999dd4c5c6867f8b6de19096d2d68365dccb744c19Fabrice Di Meglio    public int getTextAlignment();
50010ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell
50110ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell    /**
50210ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * React to a descendant view initiating a nestable scroll operation, claiming the
50310ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * nested scroll operation if appropriate.
50410ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     *
50510ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * <p>This method will be called in response to a descendant view invoking
50610ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * {@link View#startNestedScroll(int)}. Each parent up the view hierarchy will be
50710ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * given an opportunity to respond and claim the nested scrolling operation by returning
50810ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * <code>true</code>.</p>
50910ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     *
51010ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * <p>This method may be overridden by ViewParent implementations to indicate when the view
51110ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * is willing to support a nested scrolling operation that is about to begin. If it returns
51210ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * true, this ViewParent will become the target view's nested scrolling parent for the duration
51310ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * of the scroll operation in progress. When the nested scroll is finished this ViewParent
51410ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * will receive a call to {@link #onStopNestedScroll(View)}.
51510ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * </p>
51610ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     *
51710ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * @param child Direct child of this ViewParent containing target
51810ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * @param target View that initiated the nested scroll
51910ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * @param nestedScrollAxes Flags consisting of {@link View#SCROLL_AXIS_HORIZONTAL},
52010ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     *                         {@link View#SCROLL_AXIS_VERTICAL} or both
52110ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * @return true if this ViewParent accepts the nested scroll operation
52210ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     */
52310ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell    public boolean onStartNestedScroll(View child, View target, int nestedScrollAxes);
52410ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell
52510ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell    /**
52610ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * React to the successful claiming of a nested scroll operation.
52710ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     *
52810ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * <p>This method will be called after
52910ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * {@link #onStartNestedScroll(View, View, int) onStartNestedScroll} returns true. It offers
53010ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * an opportunity for the view and its superclasses to perform initial configuration
53110ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * for the nested scroll. Implementations of this method should always call their superclass's
53210ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * implementation of this method if one is present.</p>
53310ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     *
53410ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * @param child Direct child of this ViewParent containing target
53510ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * @param target View that initiated the nested scroll
53610ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * @param nestedScrollAxes Flags consisting of {@link View#SCROLL_AXIS_HORIZONTAL},
53710ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     *                         {@link View#SCROLL_AXIS_VERTICAL} or both
53810ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * @see #onStartNestedScroll(View, View, int)
53910ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * @see #onStopNestedScroll(View)
54010ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     */
54110ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell    public void onNestedScrollAccepted(View child, View target, int nestedScrollAxes);
54210ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell
54310ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell    /**
54410ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * React to a nested scroll operation ending.
54510ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     *
54610ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * <p>Perform cleanup after a nested scrolling operation.
54710ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * This method will be called when a nested scroll stops, for example when a nested touch
54810ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * scroll ends with a {@link MotionEvent#ACTION_UP} or {@link MotionEvent#ACTION_CANCEL} event.
54910ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * Implementations of this method should always call their superclass's implementation of this
55010ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * method if one is present.</p>
55110ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     *
55210ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * @param target View that initiated the nested scroll
55310ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     */
55410ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell    public void onStopNestedScroll(View target);
55510ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell
55610ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell    /**
55710ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * React to a nested scroll in progress.
55810ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     *
55910ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * <p>This method will be called when the ViewParent's current nested scrolling child view
56010ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * dispatches a nested scroll event. To receive calls to this method the ViewParent must have
56110ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * previously returned <code>true</code> for a call to
56210ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * {@link #onStartNestedScroll(View, View, int)}.</p>
56310ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     *
56410ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * <p>Both the consumed and unconsumed portions of the scroll distance are reported to the
56510ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * ViewParent. An implementation may choose to use the consumed portion to match or chase scroll
56610ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * position of multiple child elements, for example. The unconsumed portion may be used to
56710ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * allow continuous dragging of multiple scrolling or draggable elements, such as scrolling
56810ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * a list within a vertical drawer where the drawer begins dragging once the edge of inner
56910ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * scrolling content is reached.</p>
57010ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     *
57110ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * @param target The descendent view controlling the nested scroll
57210ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * @param dxConsumed Horizontal scroll distance in pixels already consumed by target
57310ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * @param dyConsumed Vertical scroll distance in pixels already consumed by target
57410ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * @param dxUnconsumed Horizontal scroll distance in pixels not consumed by target
57510ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * @param dyUnconsumed Vertical scroll distance in pixels not consumed by target
57610ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     */
57710ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell    public void onNestedScroll(View target, int dxConsumed, int dyConsumed,
57810ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell            int dxUnconsumed, int dyUnconsumed);
57910ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell
58010ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell    /**
58110ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * React to a nested scroll in progress before the target view consumes a portion of the scroll.
58210ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     *
58310ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * <p>When working with nested scrolling often the parent view may want an opportunity
58410ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * to consume the scroll before the nested scrolling child does. An example of this is a
58510ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * drawer that contains a scrollable list. The user will want to be able to scroll the list
58610ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * fully into view before the list itself begins scrolling.</p>
58710ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     *
58810ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * <p><code>onNestedPreScroll</code> is called when a nested scrolling child invokes
58910ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * {@link View#dispatchNestedPreScroll(int, int, int[], int[])}. The implementation should
59010ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * report how any pixels of the scroll reported by dx, dy were consumed in the
59110ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * <code>consumed</code> array. Index 0 corresponds to dx and index 1 corresponds to dy.
59210ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * This parameter will never be null. Initial values for consumed[0] and consumed[1]
59310ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * will always be 0.</p>
59410ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     *
59510ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * @param target View that initiated the nested scroll
59610ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * @param dx Horizontal scroll distance in pixels
59710ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * @param dy Vertical scroll distance in pixels
59810ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * @param consumed Output. The horizontal and vertical scroll distance consumed by this parent
59910ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     */
60010ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell    public void onNestedPreScroll(View target, int dx, int dy, int[] consumed);
60110ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell
60210ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell    /**
60310ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * Request a fling from a nested scroll.
60410ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     *
605b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell     * <p>This method signifies that a nested scrolling child has detected suitable conditions
606b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell     * for a fling. Generally this means that a touch scroll has ended with a
607b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell     * {@link VelocityTracker velocity} in the direction of scrolling that meets or exceeds
608b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell     * the {@link ViewConfiguration#getScaledMinimumFlingVelocity() minimum fling velocity}
609b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell     * along a scrollable axis.</p>
610b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell     *
61110ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * <p>If a nested scrolling child view would normally fling but it is at the edge of
612b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell     * its own content, it can use this method to delegate the fling to its nested scrolling
613b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell     * parent instead. The parent may optionally consume the fling or observe a child fling.</p>
61410ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     *
61510ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * @param target View that initiated the nested scroll
616b72be59a6a5ca5fae3ede2470f1662598098b666Adam Powell     * @param velocityX Horizontal velocity in pixels per second
61710ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     * @param velocityY Vertical velocity in pixels per second
618b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell     * @param consumed true if the child consumed the fling, false otherwise
619b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell     * @return true if this parent consumed or otherwise reacted to the fling
62010ba27734ee6274a772be8d6b1faa703ee3a3d6bAdam Powell     */
621b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell    public boolean onNestedFling(View target, float velocityX, float velocityY, boolean consumed);
622b72be59a6a5ca5fae3ede2470f1662598098b666Adam Powell
623b72be59a6a5ca5fae3ede2470f1662598098b666Adam Powell    /**
624b72be59a6a5ca5fae3ede2470f1662598098b666Adam Powell     * React to a nested fling before the target view consumes it.
625b72be59a6a5ca5fae3ede2470f1662598098b666Adam Powell     *
626b72be59a6a5ca5fae3ede2470f1662598098b666Adam Powell     * <p>This method siginfies that a nested scrolling child has detected a fling with the given
627b72be59a6a5ca5fae3ede2470f1662598098b666Adam Powell     * velocity along each axis. Generally this means that a touch scroll has ended with a
628b72be59a6a5ca5fae3ede2470f1662598098b666Adam Powell     * {@link VelocityTracker velocity} in the direction of scrolling that meets or exceeds
629b72be59a6a5ca5fae3ede2470f1662598098b666Adam Powell     * the {@link ViewConfiguration#getScaledMinimumFlingVelocity() minimum fling velocity}
630b72be59a6a5ca5fae3ede2470f1662598098b666Adam Powell     * along a scrollable axis.</p>
631b72be59a6a5ca5fae3ede2470f1662598098b666Adam Powell     *
632b72be59a6a5ca5fae3ede2470f1662598098b666Adam Powell     * <p>If a nested scrolling parent is consuming motion as part of a
633b72be59a6a5ca5fae3ede2470f1662598098b666Adam Powell     * {@link #onNestedPreScroll(View, int, int, int[]) pre-scroll}, it may be appropriate for
634b72be59a6a5ca5fae3ede2470f1662598098b666Adam Powell     * it to also consume the pre-fling to complete that same motion. By returning
635b72be59a6a5ca5fae3ede2470f1662598098b666Adam Powell     * <code>true</code> from this method, the parent indicates that the child should not
636b72be59a6a5ca5fae3ede2470f1662598098b666Adam Powell     * fling its own internal content as well.</p>
637b72be59a6a5ca5fae3ede2470f1662598098b666Adam Powell     *
638b72be59a6a5ca5fae3ede2470f1662598098b666Adam Powell     * @param target View that initiated the nested scroll
639b72be59a6a5ca5fae3ede2470f1662598098b666Adam Powell     * @param velocityX Horizontal velocity in pixels per second
640b72be59a6a5ca5fae3ede2470f1662598098b666Adam Powell     * @param velocityY Vertical velocity in pixels per second
641b72be59a6a5ca5fae3ede2470f1662598098b666Adam Powell     * @return true if this parent consumed the fling ahead of the target view
642b72be59a6a5ca5fae3ede2470f1662598098b666Adam Powell     */
643b72be59a6a5ca5fae3ede2470f1662598098b666Adam Powell    public boolean onNestedPreFling(View target, float velocityX, float velocityY);
644b6ab098bad4b126eaaaa3aaa5a512fefc4e0749bAdam Powell
645b6ab098bad4b126eaaaa3aaa5a512fefc4e0749bAdam Powell    /**
646b6ab098bad4b126eaaaa3aaa5a512fefc4e0749bAdam Powell     * React to an accessibility action delegated by a target descendant view before the target
647b6ab098bad4b126eaaaa3aaa5a512fefc4e0749bAdam Powell     * processes it.
648b6ab098bad4b126eaaaa3aaa5a512fefc4e0749bAdam Powell     *
649b6ab098bad4b126eaaaa3aaa5a512fefc4e0749bAdam Powell     * <p>This method may be called by a target descendant view if the target wishes to give
650b6ab098bad4b126eaaaa3aaa5a512fefc4e0749bAdam Powell     * a view in its parent chain a chance to react to the event before normal processing occurs.
651b6ab098bad4b126eaaaa3aaa5a512fefc4e0749bAdam Powell     * Most commonly this will be a scroll event such as
652b6ab098bad4b126eaaaa3aaa5a512fefc4e0749bAdam Powell     * {@link android.view.accessibility.AccessibilityNodeInfo#ACTION_SCROLL_FORWARD}.
653b6ab098bad4b126eaaaa3aaa5a512fefc4e0749bAdam Powell     * A ViewParent that supports acting as a nested scrolling parent should override this
654b6ab098bad4b126eaaaa3aaa5a512fefc4e0749bAdam Powell     * method and act accordingly to implement scrolling via accesibility systems.</p>
655b6ab098bad4b126eaaaa3aaa5a512fefc4e0749bAdam Powell     *
656b6ab098bad4b126eaaaa3aaa5a512fefc4e0749bAdam Powell     * @param target The target view dispatching this action
657b6ab098bad4b126eaaaa3aaa5a512fefc4e0749bAdam Powell     * @param action Action being performed; see
658b6ab098bad4b126eaaaa3aaa5a512fefc4e0749bAdam Powell     *               {@link android.view.accessibility.AccessibilityNodeInfo}
659b6ab098bad4b126eaaaa3aaa5a512fefc4e0749bAdam Powell     * @param arguments Optional action arguments
660b6ab098bad4b126eaaaa3aaa5a512fefc4e0749bAdam Powell     * @return true if the action was consumed by this ViewParent
661b6ab098bad4b126eaaaa3aaa5a512fefc4e0749bAdam Powell     */
662b6ab098bad4b126eaaaa3aaa5a512fefc4e0749bAdam Powell    public boolean onNestedPrePerformAccessibilityAction(View target, int action, Bundle arguments);
6639066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
664