android.view.ViewGroup.OnHierarchyChangeListener Java Examples
The following examples show how to use
android.view.ViewGroup.OnHierarchyChangeListener.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HideFromAccessibilityHelper.java From TurboLauncher with Apache License 2.0 | 6 votes |
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); } } } }
Example #2
Source File: PXHierarchyListener.java From pixate-freestyle-android with Apache License 2.0 | 6 votes |
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); }
Example #3
Source File: PXHierarchyListener.java From pixate-freestyle-android with Apache License 2.0 | 5 votes |
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; } }
Example #4
Source File: PXHierarchyListener.java From pixate-freestyle-android with Apache License 2.0 | 5 votes |
/** * 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()); } }
Example #5
Source File: ChipGroupWidget.java From relight with Apache License 2.0 | 4 votes |
public ChipGroupWidget onHierarchyChange(OnHierarchyChangeListener listener) { view.setOnHierarchyChangeListener(listener); return self(); }
Example #6
Source File: PXHierarchyListener.java From pixate-freestyle-android with Apache License 2.0 | 4 votes |
public PXHierarchyListener(OnHierarchyChangeListener existingListener) { mExistingListener = existingListener; }