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

Commit 13cc1207 authored by Chet Haase's avatar Chet Haase
Browse files

Add ability to enable layout transition animations by default from XML

Change-Id: I2b884c83e868f5d22ef85d65ff8ee984633de65e
parent 2cb3e29e
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -2341,6 +2341,17 @@
 visibility="public"
>
</field>
<field name="animateLayoutChanges"
 type="int"
 transient="false"
 volatile="false"
 value="16843570"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="animateOnClick"
 type="int"
 transient="false"
@@ -201053,6 +201064,17 @@
 visibility="public"
>
</method>
<method name="getLayoutTransition"
 return="android.animation.LayoutTransition"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getPersistentDrawingCache"
 return="int"
 abstract="false"
+24 −1
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ import java.util.ArrayList;
 * @attr ref android.R.styleable#ViewGroup_alwaysDrawnWithCache
 * @attr ref android.R.styleable#ViewGroup_addStatesFromChildren
 * @attr ref android.R.styleable#ViewGroup_descendantFocusability
 * @attr ref android.R.styleable#ViewGroup_animateLayoutChanges
 */
public abstract class ViewGroup extends View implements ViewParent, ViewManager {

@@ -382,6 +383,12 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
                case R.styleable.ViewGroup_splitMotionEvents:
                    setMotionEventSplittingEnabled(a.getBoolean(attr, false));
                    break;
                case R.styleable.ViewGroup_animateLayoutChanges:
                    boolean animateLayoutChanges = a.getBoolean(attr, false);
                    if (animateLayoutChanges) {
                        setLayoutTransition(new LayoutTransition());
                    }
                    break;
            }
        }

@@ -2594,11 +2601,27 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
     *
     * @param transition The LayoutTransition object that will animated changes in layout. A value
     * of <code>null</code> means no transition will run on layout changes.
     * @attr ref android.R.styleable#ViewGroup_animateLayoutChanges
     */
    public void setLayoutTransition(LayoutTransition transition) {
        mTransition = transition;
        if (mTransition != null) {
            mTransition.addTransitionListener(mLayoutTransitionListener);
        }
    }

    /**
     * Gets the LayoutTransition object for this ViewGroup. If the LayoutTransition object is
     * not null, changes in layout which occur because of children being added to or removed from
     * the ViewGroup will be animated according to the animations defined in that LayoutTransition
     * object. By default, the transition object is null (so layout changes are not animated).
     *
     * @return LayoutTranstion The LayoutTransition object that will animated changes in layout.
     * A value of <code>null</code> means no transition will run on layout changes.
     */
    public LayoutTransition getLayoutTransition() {
        return mTransition;
    }

    private void removeViewsInternal(int start, int count) {
        final OnHierarchyChangeListener onHierarchyChangeListener = mOnHierarchyChangeListener;
+5 −0
Original line number Diff line number Diff line
@@ -1403,6 +1403,11 @@
         of its subclasses.  Also see {@link #ViewGroup_Layout} for
         attributes that this class processes in its children. -->
    <declare-styleable name="ViewGroup">
        <!-- Defines whether changes in layout (caused by adding and removing items) should
             cause a LayoutTransition to run. When this flag is set to true, a default
             LayoutTransition object will be set on the ViewGroup container and default
             animations will run when these layout changes occur.-->
        <attr name="animateLayoutChanges" format="boolean" />
        <!-- Defines whether a child is limited to draw inside of its bounds or not.
             This is useful with animations that scale the size of the children to more
             than 100% for instance. In such a case, this property should be set to false
+2 −0
Original line number Diff line number Diff line
@@ -1326,6 +1326,7 @@
  <public type="attr" name="splitMotionEvents" />
  <public type="attr" name="listChoiceBackgroundIndicator" />
  <public type="attr" name="spinnerMode" />
  <public type="attr" name="animateLayoutChanges" />

  <public type="anim" name="animator_fade_in" />
  <public type="anim" name="animator_fade_out" />
@@ -1359,4 +1360,5 @@
  <public type="layout" name="simple_selectable_list_item" id="0x01090022" />

  <public type="string" name="selectTextMode" id="0x01040030" />

</resources>