Search in sources :

Example 6 with Descriptor

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

the class WindowDescriptor method getElementToHighlightAtPosition.

@Nullable
@Override
public Object getElementToHighlightAtPosition(Window element, int x, int y, Rect bounds) {
    final Descriptor.Host host = getHost();
    View view = null;
    HighlightableDescriptor descriptor = null;
    if (host instanceof AndroidDescriptorHost) {
        view = element.peekDecorView();
        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)

Example 7 with Descriptor

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

the class ActivityDescriptor method getElementToHighlightAtPosition.

@Nullable
@Override
public Object getElementToHighlightAtPosition(Activity 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 8 with Descriptor

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

the class ActivityDescriptor method getViewAndBoundsForHighlighting.

@Nullable
@Override
public View getViewAndBoundsForHighlighting(Activity 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 9 with Descriptor

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

the class AndroidDocumentProvider method setAttributesAsText.

@Override
public void setAttributesAsText(Object element, String text) {
    verifyThreadAccess();
    Descriptor descriptor = mDescriptorMap.get(element.getClass());
    if (descriptor != null) {
        descriptor.setAttributesAsText(element, text);
    }
}
Also used : NodeDescriptor(com.facebook.stetho.inspector.elements.NodeDescriptor) Descriptor(com.facebook.stetho.inspector.elements.Descriptor) ObjectDescriptor(com.facebook.stetho.inspector.elements.ObjectDescriptor)

Example 10 with Descriptor

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

the class AndroidDocumentProvider method getHighlightableDescriptor.

// AndroidDescriptorHost implementation
@Override
@Nullable
public HighlightableDescriptor getHighlightableDescriptor(@Nullable Object element) {
    if (element == null) {
        return null;
    }
    HighlightableDescriptor highlightableDescriptor = null;
    Class<?> theClass = element.getClass();
    Descriptor lastDescriptor = null;
    while (highlightableDescriptor == null && theClass != null) {
        Descriptor descriptor = mDescriptorMap.get(theClass);
        if (descriptor == null) {
            return null;
        }
        if (descriptor != lastDescriptor && descriptor instanceof HighlightableDescriptor) {
            highlightableDescriptor = ((HighlightableDescriptor) descriptor);
        }
        lastDescriptor = descriptor;
        theClass = theClass.getSuperclass();
    }
    return highlightableDescriptor;
}
Also used : NodeDescriptor(com.facebook.stetho.inspector.elements.NodeDescriptor) Descriptor(com.facebook.stetho.inspector.elements.Descriptor) ObjectDescriptor(com.facebook.stetho.inspector.elements.ObjectDescriptor) 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