List of usage examples for android.view ViewGroup setOnHierarchyChangeListener
public void setOnHierarchyChangeListener(OnHierarchyChangeListener listener)
From source file:com.android.launcher2.HideFromAccessibilityHelper.java
private void setImportantForAccessibilityToNoHelper(View v) { mPreviousValues.put(v, ViewCompat.getImportantForAccessibility(v)); ViewCompat.setImportantForAccessibility(v, View.IMPORTANT_FOR_ACCESSIBILITY_NO); // Call method on children recursively if (v instanceof ViewGroup) { ViewGroup vg = (ViewGroup) v; vg.setOnHierarchyChangeListener(this); for (int i = 0; i < vg.getChildCount(); i++) { View child = vg.getChildAt(i); if (includeView(child)) { setImportantForAccessibilityToNoHelper(child); }/* ww w . ja v a2 s. c o m*/ } } }
From source file:com.android.launcher2.HideFromAccessibilityHelper.java
private void restoreImportantForAccessibilityHelper(View v) { ViewCompat.setImportantForAccessibility(v, mPreviousValues.get(v)); mPreviousValues.remove(v);/* w ww.ja v a 2 s. co m*/ // 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); } } } }