19648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov/*
29648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov * Copyright (C) 2011 The Android Open Source Project
39648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov *
49648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov * Licensed under the Apache License, Version 2.0 (the "License");
59648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov * you may not use this file except in compliance with the License.
69648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov * You may obtain a copy of the License at
79648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov *
89648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov *      http://www.apache.org/licenses/LICENSE-2.0
99648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov *
109648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov * Unless required by applicable law or agreed to in writing, software
119648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov * distributed under the License is distributed on an "AS IS" BASIS,
129648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
139648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov * See the License for the specific language governing permissions and
149648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov * limitations under the License.
159648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov */
169648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov
179648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganovpackage android.support.v4.view;
189648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov
199648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganovimport android.os.Build;
209648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganovimport android.view.View;
219648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganovimport android.view.ViewGroup;
229648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganovimport android.view.accessibility.AccessibilityEvent;
239648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov
249648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov/**
250574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * Helper for accessing features in {@link ViewGroup}
260574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * introduced after API level 4 in a backwards compatible fashion.
279648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov */
28c5847d13e40f5d52459f5c0dab32dc08f1a9a683Chris Banespublic final class ViewGroupCompat {
299648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov
30b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell    /**
31b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell     * This constant is a {@link #setLayoutMode(ViewGroup, int) layoutMode}.
32b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell     * Clip bounds are the raw values of {@link android.view.View#getLeft() left},
33b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell     * {@link android.view.View#getTop() top},
34b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell     * {@link android.view.View#getRight() right} and {@link android.view.View#getBottom() bottom}.
35b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell     */
36b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell    public static final int LAYOUT_MODE_CLIP_BOUNDS = 0;
37b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell
38b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell    /**
39b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell     * This constant is a {@link #setLayoutMode(ViewGroup, int) layoutMode}.
40b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell     * Optical bounds describe where a widget appears to be. They sit inside the clip
41b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell     * bounds which need to cover a larger area to allow other effects,
42b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell     * such as shadows and glows, to be drawn.
43b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell     */
44b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell    public static final int LAYOUT_MODE_OPTICAL_BOUNDS = 1;
45b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell
469648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    interface ViewGroupCompatImpl {
471fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell        boolean onRequestSendAccessibilityEvent(ViewGroup group, View child,
489648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov                AccessibilityEvent event);
491fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell        void setMotionEventSplittingEnabled(ViewGroup group, boolean split);
501fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell        int getLayoutMode(ViewGroup group);
511fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell        void setLayoutMode(ViewGroup group, int mode);
521fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell        void setTransitionGroup(ViewGroup group, boolean isTransitionGroup);
531fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell        boolean isTransitionGroup(ViewGroup group);
541fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell        int getNestedScrollAxes(ViewGroup group);
559648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    }
569648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov
579648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    static class ViewGroupCompatStubImpl implements ViewGroupCompatImpl {
589648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov        public boolean onRequestSendAccessibilityEvent(
599648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov                ViewGroup group, View child, AccessibilityEvent event) {
609648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov            return true;
619648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov        }
621b8262b87426b2f766b40d6ab4eaeac296d5c2feAdam Powell
631b8262b87426b2f766b40d6ab4eaeac296d5c2feAdam Powell        public void setMotionEventSplittingEnabled(ViewGroup group, boolean split) {
641b8262b87426b2f766b40d6ab4eaeac296d5c2feAdam Powell            // no-op, didn't exist.
651b8262b87426b2f766b40d6ab4eaeac296d5c2feAdam Powell        }
66b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell
67b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell        @Override
68b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell        public int getLayoutMode(ViewGroup group) {
69b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell            return LAYOUT_MODE_CLIP_BOUNDS;
70b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell        }
71b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell
72b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell        @Override
73b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell        public void setLayoutMode(ViewGroup group, int mode) {
74b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell            // no-op, didn't exist. Views only support clip bounds.
75b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell        }
760bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu
770bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu        @Override
780bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu        public void setTransitionGroup(ViewGroup group, boolean isTransitionGroup) {
790bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu        }
800bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu
810bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu        @Override
820bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu        public boolean isTransitionGroup(ViewGroup group) {
830bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu            return false;
840bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu        }
851fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell
861fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell        @Override
871fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell        public int getNestedScrollAxes(ViewGroup group) {
881fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell            if (group instanceof NestedScrollingParent) {
891fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell                return ((NestedScrollingParent) group).getNestedScrollAxes();
901fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell            }
911fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell            return ViewCompat.SCROLL_AXIS_NONE;
921fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell        }
931b8262b87426b2f766b40d6ab4eaeac296d5c2feAdam Powell    }
941b8262b87426b2f766b40d6ab4eaeac296d5c2feAdam Powell
951b8262b87426b2f766b40d6ab4eaeac296d5c2feAdam Powell    static class ViewGroupCompatHCImpl extends ViewGroupCompatStubImpl {
961b8262b87426b2f766b40d6ab4eaeac296d5c2feAdam Powell        @Override
971b8262b87426b2f766b40d6ab4eaeac296d5c2feAdam Powell        public void setMotionEventSplittingEnabled(ViewGroup group, boolean split) {
981b8262b87426b2f766b40d6ab4eaeac296d5c2feAdam Powell            ViewGroupCompatHC.setMotionEventSplittingEnabled(group, split);
991b8262b87426b2f766b40d6ab4eaeac296d5c2feAdam Powell        }
1009648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    }
1019648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov
1021b8262b87426b2f766b40d6ab4eaeac296d5c2feAdam Powell    static class ViewGroupCompatIcsImpl extends ViewGroupCompatHCImpl {
1039648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov        @Override
1049648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov        public boolean onRequestSendAccessibilityEvent(
1059648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov                ViewGroup group, View child, AccessibilityEvent event) {
1069648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov            return ViewGroupCompatIcs.onRequestSendAccessibilityEvent(group, child, event);
1079648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov        }
1089648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    }
1099648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov
110b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell    static class ViewGroupCompatJellybeanMR2Impl extends ViewGroupCompatIcsImpl {
111b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell        @Override
112b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell        public int getLayoutMode(ViewGroup group) {
113b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell            return ViewGroupCompatJellybeanMR2.getLayoutMode(group);
114b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell        }
115b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell
116b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell        @Override
117b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell        public void setLayoutMode(ViewGroup group, int mode) {
118b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell            ViewGroupCompatJellybeanMR2.setLayoutMode(group, mode);
119b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell        }
120b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell    }
121b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell
1221fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell    static class ViewGroupCompatLollipopImpl extends ViewGroupCompatJellybeanMR2Impl {
1230bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu        @Override
1240bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu        public void setTransitionGroup(ViewGroup group, boolean isTransitionGroup) {
1251fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell            ViewGroupCompatLollipop.setTransitionGroup(group, isTransitionGroup);
1260bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu        }
1270bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu
1280bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu        @Override
1290bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu        public boolean isTransitionGroup(ViewGroup group) {
1301fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell            return ViewGroupCompatLollipop.isTransitionGroup(group);
1311fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell        }
1321fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell
1331fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell        @Override
1341fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell        public int getNestedScrollAxes(ViewGroup group) {
1351fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell            return ViewGroupCompatLollipop.getNestedScrollAxes(group);
1360bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu        }
1370bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu    }
1380bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu
1399648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    static final ViewGroupCompatImpl IMPL;
1409648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    static {
1411b8262b87426b2f766b40d6ab4eaeac296d5c2feAdam Powell        final int version = Build.VERSION.SDK_INT;
142a52784195525cdb1f2bb4d8dde1b8b314f480957Chet Haase        if (version >= 21) {
1431fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell            IMPL = new ViewGroupCompatLollipopImpl();
1440bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu        } else if (version >= 18) {
145b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell            IMPL = new ViewGroupCompatJellybeanMR2Impl();
146b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell        } else if (version >= 14) {
1479648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov            IMPL = new ViewGroupCompatIcsImpl();
1481b8262b87426b2f766b40d6ab4eaeac296d5c2feAdam Powell        } else if (version >= 11) {
1491b8262b87426b2f766b40d6ab4eaeac296d5c2feAdam Powell            IMPL = new ViewGroupCompatHCImpl();
1509648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov        } else {
1519648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov            IMPL = new ViewGroupCompatStubImpl();
1529648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov        }
1539648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    }
1549648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov
1559648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    /*
1569648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     * Hide the constructor.
1579648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     */
158c5847d13e40f5d52459f5c0dab32dc08f1a9a683Chris Banes    private ViewGroupCompat() {}
1599648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov
1609648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    /**
1619648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     * Called when a child has requested sending an {@link AccessibilityEvent} and
1629648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     * gives an opportunity to its parent to augment the event.
1639648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     * <p>
1649648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     * If an {@link AccessibilityDelegateCompat} has been specified via calling
1659648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     * {@link ViewCompat#setAccessibilityDelegate(View, AccessibilityDelegateCompat)} its
1669648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     * {@link AccessibilityDelegateCompat#onRequestSendAccessibilityEvent(ViewGroup, View,
1679648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     * AccessibilityEvent)} is responsible for handling this call.
1689648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     * </p>
1699648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     *
1709648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     * @param group The group whose method to invoke.
1719648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     * @param child The child which requests sending the event.
1729648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     * @param event The event to be sent.
1739648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     * @return True if the event should be sent.
1749648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     */
1759648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    public static boolean onRequestSendAccessibilityEvent(ViewGroup group, View child,
1769648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov            AccessibilityEvent event) {
1779648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov        return IMPL.onRequestSendAccessibilityEvent(group, child, event);
1789648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    }
1791b8262b87426b2f766b40d6ab4eaeac296d5c2feAdam Powell
1801b8262b87426b2f766b40d6ab4eaeac296d5c2feAdam Powell    /**
1811b8262b87426b2f766b40d6ab4eaeac296d5c2feAdam Powell     * Enable or disable the splitting of MotionEvents to multiple children during touch event
1821b8262b87426b2f766b40d6ab4eaeac296d5c2feAdam Powell     * dispatch. This behavior is enabled by default for applications that target an
1831b8262b87426b2f766b40d6ab4eaeac296d5c2feAdam Powell     * SDK version of 11 (Honeycomb) or newer. On earlier platform versions this feature
1841b8262b87426b2f766b40d6ab4eaeac296d5c2feAdam Powell     * was not supported and this method is a no-op.
1851b8262b87426b2f766b40d6ab4eaeac296d5c2feAdam Powell     *
1861b8262b87426b2f766b40d6ab4eaeac296d5c2feAdam Powell     * <p>When this option is enabled MotionEvents may be split and dispatched to different child
1871b8262b87426b2f766b40d6ab4eaeac296d5c2feAdam Powell     * views depending on where each pointer initially went down. This allows for user interactions
1881b8262b87426b2f766b40d6ab4eaeac296d5c2feAdam Powell     * such as scrolling two panes of content independently, chording of buttons, and performing
1891b8262b87426b2f766b40d6ab4eaeac296d5c2feAdam Powell     * independent gestures on different pieces of content.
1901b8262b87426b2f766b40d6ab4eaeac296d5c2feAdam Powell     *
1911b8262b87426b2f766b40d6ab4eaeac296d5c2feAdam Powell     * @param group ViewGroup to modify
1921b8262b87426b2f766b40d6ab4eaeac296d5c2feAdam Powell     * @param split <code>true</code> to allow MotionEvents to be split and dispatched to multiple
1931b8262b87426b2f766b40d6ab4eaeac296d5c2feAdam Powell     *              child views. <code>false</code> to only allow one child view to be the target of
1941b8262b87426b2f766b40d6ab4eaeac296d5c2feAdam Powell     *              any MotionEvent received by this ViewGroup.
1951b8262b87426b2f766b40d6ab4eaeac296d5c2feAdam Powell     */
1961b8262b87426b2f766b40d6ab4eaeac296d5c2feAdam Powell    public static void setMotionEventSplittingEnabled(ViewGroup group, boolean split) {
1971b8262b87426b2f766b40d6ab4eaeac296d5c2feAdam Powell        IMPL.setMotionEventSplittingEnabled(group, split);
1981b8262b87426b2f766b40d6ab4eaeac296d5c2feAdam Powell    }
199b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell
200b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell    /**
201b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell     * Returns the basis of alignment during layout operations on this ViewGroup:
202b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell     * either {@link #LAYOUT_MODE_CLIP_BOUNDS} or {@link #LAYOUT_MODE_OPTICAL_BOUNDS}.
203b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell     * <p>
204b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell     * If no layoutMode was explicitly set, either programmatically or in an XML resource,
205b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell     * the method returns the layoutMode of the view's parent ViewGroup if such a parent exists,
206b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell     * otherwise the method returns a default value of {@link #LAYOUT_MODE_CLIP_BOUNDS}.
207b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell     *
208b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell     * @return the layout mode to use during layout operations
209b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell     *
210b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell     * @see #setLayoutMode(ViewGroup, int)
211b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell     */
212b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell    public static int getLayoutMode(ViewGroup group) {
213b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell        return IMPL.getLayoutMode(group);
214b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell    }
215b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell
216b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell    /**
217b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell     * Sets the basis of alignment during the layout of this ViewGroup.
218b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell     * Valid values are either {@link #LAYOUT_MODE_CLIP_BOUNDS} or
219b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell     * {@link #LAYOUT_MODE_OPTICAL_BOUNDS}.
220b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell     *
221b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell     * @param mode the layout mode to use during layout operations
222b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell     *
223b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell     * @see #getLayoutMode(ViewGroup)
224b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell     */
225b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell    public static void setLayoutMode(ViewGroup group, int mode) {
226b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell        IMPL.setLayoutMode(group, mode);
227b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell    }
2280bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu
2290bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu    /**
2300bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu     * Changes whether or not this ViewGroup should be treated as a single entity during
2310bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu     * Activity Transitions.
2320bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu     * @param isTransitionGroup Whether or not the ViewGroup should be treated as a unit
2330bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu     *                          in Activity transitions. If false, the ViewGroup won't transition,
2340bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu     *                          only its children. If true, the entire ViewGroup will transition
2350bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu     *                          together.
2360bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu     */
2370bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu    public static void setTransitionGroup(ViewGroup group, boolean isTransitionGroup) {
2380bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu        IMPL.setTransitionGroup(group, isTransitionGroup);
2390bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu    }
2400bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu
2410bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu    /**
2420bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu     * Returns true if this ViewGroup should be considered as a single entity for removal
2430bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu     * when executing an Activity transition. If this is false, child elements will move
2440bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu     * individually during the transition.
2450bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu     */
2460bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu    public static boolean isTransitionGroup(ViewGroup group) {
2470bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu        return IMPL.isTransitionGroup(group);
2480bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu    }
2491fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell
2501fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell    /**
2511fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell     * Return the current axes of nested scrolling for this ViewGroup.
2521fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell     *
2531fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell     * <p>A ViewGroup returning something other than {@link ViewCompat#SCROLL_AXIS_NONE} is
2541fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell     * currently acting as a nested scrolling parent for one or more descendant views in
2551fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell     * the hierarchy.</p>
2561fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell     *
2571fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell     * @return Flags indicating the current axes of nested scrolling
2581fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell     * @see ViewCompat#SCROLL_AXIS_HORIZONTAL
2591fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell     * @see ViewCompat#SCROLL_AXIS_VERTICAL
2601fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell     * @see ViewCompat#SCROLL_AXIS_NONE
2611fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell     */
2621fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell    public static int getNestedScrollAxes(ViewGroup group) {
2631fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell        return IMPL.getNestedScrollAxes(group);
2641fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell    }
2659648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov}
266