Search in sources :

Example 1 with Descriptor

use of com.facebook.stetho.inspector.elements.Descriptor 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)

Example 2 with Descriptor

use of com.facebook.stetho.inspector.elements.Descriptor in project stetho by facebook.

the class DialogDescriptor method getViewAndBoundsForHighlighting.

@Nullable
@Override
public View getViewAndBoundsForHighlighting(Dialog element, Rect bounds) {
    final Descriptor.Host host = getHost();
    Window window = null;
    HighlightableDescriptor descriptor = null;
    if (host instanceof AndroidDescriptorHost) {
        window = element.getWindow();
        descriptor = ((AndroidDescriptorHost) host).getHighlightableDescriptor(window);
    }
    return descriptor == null ? null : descriptor.getViewAndBoundsForHighlighting(window, bounds);
}
Also used : Window(android.view.Window) AbstractChainedDescriptor(com.facebook.stetho.inspector.elements.AbstractChainedDescriptor) Descriptor(com.facebook.stetho.inspector.elements.Descriptor) Nullable(javax.annotation.Nullable)

Example 3 with Descriptor

use of com.facebook.stetho.inspector.elements.Descriptor in project stetho by facebook.

the class DialogDescriptor method getElementToHighlightAtPosition.

@Nullable
@Override
public Object getElementToHighlightAtPosition(Dialog element, int x, int y, Rect bounds) {
    final Descriptor.Host host = getHost();
    Window window = null;
    HighlightableDescriptor descriptor = null;
    if (host instanceof AndroidDescriptorHost) {
        window = element.getWindow();
        descriptor = ((AndroidDescriptorHost) host).getHighlightableDescriptor(window);
    }
    return descriptor == null ? null : descriptor.getElementToHighlightAtPosition(window, x, y, bounds);
}
Also used : Window(android.view.Window) AbstractChainedDescriptor(com.facebook.stetho.inspector.elements.AbstractChainedDescriptor) Descriptor(com.facebook.stetho.inspector.elements.Descriptor) Nullable(javax.annotation.Nullable)

Example 4 with Descriptor

use of com.facebook.stetho.inspector.elements.Descriptor in project stetho by facebook.

the class DialogFragmentDescriptor method getViewAndBoundsForHighlighting.

@Nullable
@Override
public View getViewAndBoundsForHighlighting(Object element, Rect bounds) {
    final Descriptor.Host host = getHost();
    Dialog dialog = null;
    HighlightableDescriptor descriptor = null;
    if (host instanceof AndroidDescriptorHost) {
        dialog = mAccessor.getDialog(element);
        descriptor = ((AndroidDescriptorHost) host).getHighlightableDescriptor(dialog);
    }
    return descriptor == null ? null : descriptor.getViewAndBoundsForHighlighting(dialog, bounds);
}
Also used : Dialog(android.app.Dialog) ChainedDescriptor(com.facebook.stetho.inspector.elements.ChainedDescriptor) AbstractChainedDescriptor(com.facebook.stetho.inspector.elements.AbstractChainedDescriptor) Descriptor(com.facebook.stetho.inspector.elements.Descriptor) Nullable(javax.annotation.Nullable)

Example 5 with Descriptor

use of com.facebook.stetho.inspector.elements.Descriptor in project stetho by facebook.

the class FragmentDescriptor method getElementToHighlightAtPosition.

@Nullable
@Override
public Object getElementToHighlightAtPosition(Object element, int x, int y, Rect bounds) {
    final Descriptor.Host host = getHost();
    View view = null;
    HighlightableDescriptor descriptor = null;
    if (host instanceof AndroidDescriptorHost) {
        view = mAccessor.getView(element);
        descriptor = ((AndroidDescriptorHost) host).getHighlightableDescriptor(view);
    }
    return descriptor == null ? null : descriptor.getElementToHighlightAtPosition(view, x, y, bounds);
}
Also used : AbstractChainedDescriptor(com.facebook.stetho.inspector.elements.AbstractChainedDescriptor) Descriptor(com.facebook.stetho.inspector.elements.Descriptor) View(android.view.View) Nullable(javax.annotation.Nullable)

Aggregations

Descriptor (com.facebook.stetho.inspector.elements.Descriptor)11 Nullable (javax.annotation.Nullable)9 AbstractChainedDescriptor (com.facebook.stetho.inspector.elements.AbstractChainedDescriptor)8 Window (android.view.Window)5 NodeDescriptor (com.facebook.stetho.inspector.elements.NodeDescriptor)3 ObjectDescriptor (com.facebook.stetho.inspector.elements.ObjectDescriptor)3 Dialog (android.app.Dialog)2 View (android.view.View)2 ChainedDescriptor (com.facebook.stetho.inspector.elements.ChainedDescriptor)2 Accumulator (com.facebook.stetho.common.Accumulator)1