Merge "Un-hide ViewGroup#onViewAdded/onViewRemoved" into mnc-dev

This commit is contained in:
Adam Powell
2015-06-18 17:20:42 +00:00
committed by Android (Google) Code Review
5 changed files with 33 additions and 23 deletions

View File

@@ -36817,6 +36817,8 @@ package android.view {
method public boolean onRequestSendAccessibilityEvent(android.view.View, android.view.accessibility.AccessibilityEvent);
method public boolean onStartNestedScroll(android.view.View, android.view.View, int);
method public void onStopNestedScroll(android.view.View);
method public void onViewAdded(android.view.View);
method public void onViewRemoved(android.view.View);
method public void recomputeViewAttributes(android.view.View);
method public void removeAllViews();
method public void removeAllViewsInLayout();

View File

@@ -39097,6 +39097,8 @@ package android.view {
method public boolean onRequestSendAccessibilityEvent(android.view.View, android.view.accessibility.AccessibilityEvent);
method public boolean onStartNestedScroll(android.view.View, android.view.View, int);
method public void onStopNestedScroll(android.view.View);
method public void onViewAdded(android.view.View);
method public void onViewRemoved(android.view.View);
method public void recomputeViewAttributes(android.view.View);
method public void removeAllViews();
method public void removeAllViewsInLayout();

View File

@@ -4148,24 +4148,38 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
mOnHierarchyChangeListener = listener;
}
/**
* @hide
*/
protected void onViewAdded(View child) {
void dispatchViewAdded(View child) {
onViewAdded(child);
if (mOnHierarchyChangeListener != null) {
mOnHierarchyChangeListener.onChildViewAdded(this, child);
}
}
/**
* @hide
* Called when a new child is added to this ViewGroup. Overrides should always
* call super.onViewAdded.
*
* @param child the added child view
*/
protected void onViewRemoved(View child) {
public void onViewAdded(View child) {
}
void dispatchViewRemoved(View child) {
onViewRemoved(child);
if (mOnHierarchyChangeListener != null) {
mOnHierarchyChangeListener.onChildViewRemoved(this, child);
}
}
/**
* Called when a child view is removed from this ViewGroup. Overrides should always
* call super.onViewRemoved.
*
* @param child the removed child view
*/
public void onViewRemoved(View child) {
}
private void clearCachedLayoutMode() {
if (!hasBooleanFlag(FLAG_LAYOUT_MODE_WAS_EXPLICITLY_SET)) {
mLayoutMode = LAYOUT_MODE_UNDEFINED;
@@ -4292,7 +4306,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
child.resetRtlProperties();
}
onViewAdded(child);
dispatchViewAdded(child);
if ((child.mViewFlags & DUPLICATE_PARENT_STATE) == DUPLICATE_PARENT_STATE) {
mGroupFlags |= FLAG_NOTIFY_CHILDREN_ON_DRAWABLE_STATE_CHANGE;
@@ -4554,7 +4568,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
}
}
onViewRemoved(view);
dispatchViewRemoved(view);
if (view.getVisibility() != View.GONE) {
notifySubtreeAccessibilityStateChangedIfNeeded();
@@ -4646,7 +4660,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
needGlobalAttributesUpdate(false);
onViewRemoved(view);
dispatchViewRemoved(view);
}
removeFromArray(start, count);
@@ -4729,7 +4743,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
childHasTransientStateChanged(view, false);
}
onViewRemoved(view);
dispatchViewRemoved(view);
view.mParent = null;
children[i] = null;
@@ -4788,7 +4802,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
childHasTransientStateChanged(child, false);
}
onViewRemoved(child);
dispatchViewRemoved(child);
}
/**

View File

@@ -935,22 +935,14 @@ public class GridLayout extends ViewGroup {
super.onDebugDraw(canvas);
}
// Add/remove
/**
* @hide
*/
@Override
protected void onViewAdded(View child) {
public void onViewAdded(View child) {
super.onViewAdded(child);
invalidateStructure();
}
/**
* @hide
*/
@Override
protected void onViewRemoved(View child) {
public void onViewRemoved(View child) {
super.onViewRemoved(child);
invalidateStructure();
}

View File

@@ -1608,7 +1608,7 @@ public class NotificationStackScrollLayout extends ViewGroup
}
@Override
protected void onViewRemoved(View child) {
public void onViewRemoved(View child) {
super.onViewRemoved(child);
// we only call our internal methods if this is actually a removal and not just a
// notification which becomes a child notification
@@ -1745,7 +1745,7 @@ public class NotificationStackScrollLayout extends ViewGroup
}
@Override
protected void onViewAdded(View child) {
public void onViewAdded(View child) {
super.onViewAdded(child);
onViewAddedInternal(child);
}