Java 类android.view.ViewGroup.OnHierarchyChangeListener 实例源码

项目:TurboLauncher    文件:HideFromAccessibilityHelper.java   
private void restoreImportantForAccessibilityHelper(View v) {
    Integer important = mPreviousValues.get(v);
    v.setImportantForAccessibility(important);
    mPreviousValues.remove(v);

    // Call method on children recursively
    if (v instanceof ViewGroup) {
        ViewGroup vg = (ViewGroup) v;

        // We assume if a class implements OnHierarchyChangeListener, it listens
        // to changes to any of its children (happens to be the case in Launcher)
        if (vg instanceof OnHierarchyChangeListener) {
            vg.setOnHierarchyChangeListener((OnHierarchyChangeListener) vg);
        } else {
            vg.setOnHierarchyChangeListener(null);
        }
        for (int i = 0; i < vg.getChildCount(); i++) {
            View child = vg.getChildAt(i);
            if (includeView(child)) {
                restoreImportantForAccessibilityHelper(child);
            }
        }
    }
}
项目:pixate-freestyle-android    文件:PXHierarchyListener.java   
public static void setFor(ViewGroup group) {
    if (group == null) {
        return;
    }

    OnHierarchyChangeListener currentListener = getCurrentListener(group);
    if (currentListener instanceof PXHierarchyListener) {
        // We've already added ours to it, so nothing more to do.
        return;
    }

    // RadioGroup check to avoid StackOverflow issues. The RadioGroup uses a
    // similar delegation technique that trigger a StackOverflow, so we
    // should not pass the currentListener to it.
    if (!(group instanceof RadioGroup)) {
        group.setOnHierarchyChangeListener(new PXHierarchyListener(currentListener));
    } else {
        group.setOnHierarchyChangeListener(new PXHierarchyListener(null));
    }
    addGlobalLayoutListener(group);
}
项目:open-gel-plus    文件:HideFromAccessibilityHelper.java   
private void restoreImportantForAccessibilityHelper(View v) {
    Integer important = mPreviousValues.get(v);
    v.setImportantForAccessibility(important);
    mPreviousValues.remove(v);

    // Call method on children recursively
    if (v instanceof ViewGroup) {
        ViewGroup vg = (ViewGroup) v;

        // We assume if a class implements OnHierarchyChangeListener, it listens
        // to changes to any of its children (happens to be the case in Launcher)
        if (vg instanceof OnHierarchyChangeListener) {
            vg.setOnHierarchyChangeListener((OnHierarchyChangeListener) vg);
        } else {
            vg.setOnHierarchyChangeListener(null);
        }
        for (int i = 0; i < vg.getChildCount(); i++) {
            View child = vg.getChildAt(i);
            if (includeView(child)) {
                restoreImportantForAccessibilityHelper(child);
            }
        }
    }
}
项目:Fairphone    文件:HideFromAccessibilityHelper.java   
private void restoreImportantForAccessibilityHelper(View v) {
    v.setImportantForAccessibility(mPreviousValues.get(v));
    mPreviousValues.remove(v);

    // Call method on children recursively
    if (v instanceof ViewGroup) {
        ViewGroup vg = (ViewGroup) v;

        // We assume if a class implements OnHierarchyChangeListener, it listens
        // to changes to any of its children (happens to be the case in Launcher)
        if (vg instanceof OnHierarchyChangeListener) {
            vg.setOnHierarchyChangeListener((OnHierarchyChangeListener) vg);
        } else {
            vg.setOnHierarchyChangeListener(null);
        }
        for (int i = 0; i < vg.getChildCount(); i++) {
            View child = vg.getChildAt(i);
            if (includeView(child)) {
                restoreImportantForAccessibilityHelper(child);
            }
        }
    }
}
项目:Fairphone---DEPRECATED    文件:HideFromAccessibilityHelper.java   
private void restoreImportantForAccessibilityHelper(View v) {
    v.setImportantForAccessibility(mPreviousValues.get(v));
    mPreviousValues.remove(v);

    // Call method on children recursively
    if (v instanceof ViewGroup) {
        ViewGroup vg = (ViewGroup) v;

        // We assume if a class implements OnHierarchyChangeListener, it listens
        // to changes to any of its children (happens to be the case in Launcher)
        if (vg instanceof OnHierarchyChangeListener) {
            vg.setOnHierarchyChangeListener((OnHierarchyChangeListener) vg);
        } else {
            vg.setOnHierarchyChangeListener(null);
        }
        for (int i = 0; i < vg.getChildCount(); i++) {
            View child = vg.getChildAt(i);
            if (includeView(child)) {
                restoreImportantForAccessibilityHelper(child);
            }
        }
    }
}
项目:pixate-freestyle-android    文件:PXHierarchyListener.java   
public static OnHierarchyChangeListener getCurrentListener(ViewGroup viewGroup) {
    if (sHierarchyListenerField == null) {
        initReflection();
    }

    if (sHierarchyListenerField == null) {
        PXLog.w(TAG, "Unable to fetch the ViewGroup's current hierarchy listener. "
                + "Reflection failed.");
        return null;
    }

    Object listener;

    try {
        listener = sHierarchyListenerField.get(viewGroup);
    } catch (Exception e) {
        PXLog.e(TAG, "Unable to fetch the ViewGroup's current hierarchy listener. "
                + "Reflection failed.");
        return null;
    }

    if (listener == null || listener instanceof OnHierarchyChangeListener) {
        return (OnHierarchyChangeListener) listener;
    } else {
        PXLog.w(TAG, "A hierarchy listener was found, but its type is unexpected: %s", listener
                .getClass().getName());
        return null;
    }

}
项目:pixate-freestyle-android    文件:PXHierarchyListener.java   
/**
 * Just used for debug purposes. TODO delete.
 * 
 * @param viewGroup
 */
public static void logCurrentListener(ViewGroup viewGroup) {

    OnHierarchyChangeListener currentListener = getCurrentListener(viewGroup);

    if (currentListener == null) {
        PXLog.d(TAG, "%s has no hierarchy listener.", viewGroup.getClass().getSimpleName());
    } else {
        PXLog.d(TAG, "%s has hierarchy listener {1}", viewGroup.getClass().getSimpleName(),
                currentListener.getClass().getSimpleName());
    }
}
项目:AndroidViewHelper    文件:ViewGroupWrapper.java   
/**
* @see ViewGroup#setOnHierarchyChangeListener(OnHierarchyChangeListener)
*/
 public W setOnHierarchyChangeListener(OnHierarchyChangeListener listener) {
     mView.setOnHierarchyChangeListener(listener);
     return (W) this;
 }
项目:boohee_v5.6    文件:CoordinatorLayout.java   
public void setOnHierarchyChangeListener(OnHierarchyChangeListener onHierarchyChangeListener) {
    this.mOnHierarchyChangeListener = onHierarchyChangeListener;
}
项目:AbacusUtil    文件:Observer.java   
public Disposable onHierarchyChange(final OnHierarchyChangeListener onNext) {
    return onHierarchyChange(onNext, Fu.ON_ERROR_MISSING);
}
项目:AbacusUtil    文件:Observer.java   
public Disposable onHierarchyChange(final OnHierarchyChangeListener onNext, final Consumer<? super Exception> onError) {
    return onHierarchyChange(onNext, onError, Fu.EMPTY_ACTION);
}
项目:FMTech    文件:CoordinatorLayout.java   
public void setOnHierarchyChangeListener(ViewGroup.OnHierarchyChangeListener paramOnHierarchyChangeListener)
{
  this.mOnHierarchyChangeListener = paramOnHierarchyChangeListener;
}
项目:pixate-freestyle-android    文件:PXHierarchyListener.java   
public PXHierarchyListener(OnHierarchyChangeListener existingListener) {
    mExistingListener = existingListener;
}