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);
}
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);
}
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);
}
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);
}
}
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;
}
Aggregations