Search in sources :

Example 1 with Accumulator

use of com.facebook.stetho.common.Accumulator in project stetho by facebook.

the class AndroidDocumentProvider method getWindows.

private void getWindows(final Accumulator<Window> accumulator) {
    Descriptor appDescriptor = getDescriptor(mApplication);
    if (appDescriptor != null) {
        Accumulator<Object> elementAccumulator = new Accumulator<Object>() {

            @Override
            public void store(Object element) {
                if (element instanceof Window) {
                    // Store the Window and do not recurse into its children.
                    accumulator.store((Window) element);
                } else {
                    // Recursively scan this element's children in search of more Windows.
                    Descriptor elementDescriptor = getDescriptor(element);
                    if (elementDescriptor != null) {
                        elementDescriptor.getChildren(element, this);
                    }
                }
            }
        };
        appDescriptor.getChildren(mApplication, elementAccumulator);
    }
}
Also used : Accumulator(com.facebook.stetho.common.Accumulator) Window(android.view.Window) NodeDescriptor(com.facebook.stetho.inspector.elements.NodeDescriptor) Descriptor(com.facebook.stetho.inspector.elements.Descriptor) ObjectDescriptor(com.facebook.stetho.inspector.elements.ObjectDescriptor)

Aggregations

Window (android.view.Window)1 Accumulator (com.facebook.stetho.common.Accumulator)1 Descriptor (com.facebook.stetho.inspector.elements.Descriptor)1 NodeDescriptor (com.facebook.stetho.inspector.elements.NodeDescriptor)1 ObjectDescriptor (com.facebook.stetho.inspector.elements.ObjectDescriptor)1