use of com.android.tools.idea.uibuilder.api.ViewGroupHandler in project android by JetBrains.
the class ResizeInteraction method begin.
@Override
public void begin(@SwingCoordinate int x, @SwingCoordinate int y, @InputEventMask int startMask) {
super.begin(x, y, startMask);
NlComponent parent = myComponent.getParent();
if (parent != null) {
ViewGroupHandler viewGroupHandler = ViewHandlerManager.get(myScreenView.getModel().getFacet()).findLayoutHandler(parent, false);
if (viewGroupHandler != null) {
ViewEditor editor = new ViewEditorImpl(myScreenView);
myResizeHandler = viewGroupHandler.createResizeHandler(editor, myComponent, myHorizontalEdge, myVerticalEdge);
if (myResizeHandler != null) {
int androidX = Coordinates.getAndroidX(myScreenView, myStartX);
int androidY = Coordinates.getAndroidY(myScreenView, myStartY);
myResizeHandler.start(androidX, androidY, startMask);
}
}
}
}
use of com.android.tools.idea.uibuilder.api.ViewGroupHandler in project android by JetBrains.
the class SceneDeleteWidgetTest method testDelete.
public void testDelete() {
SceneComponent layout = myScene.getSceneComponent("root");
NlComponent layoutComponent = layout.getNlComponent();
ViewGroupHandler handler = (ViewGroupHandler) layoutComponent.getViewHandler();
ArrayList<NlComponent> deleted = new ArrayList<>();
deleted.add(myScene.getSceneComponent("button2").getNlComponent());
handler.deleteChildren(layoutComponent, deleted);
myScreen.get("@id/button").expectXml("<TextView\n" + " android:id=\"@id/button\"\n" + " android:layout_width=\"100dp\"\n" + " android:layout_height=\"50dp\"\n" + " app:layout_constraintLeft_toLeftOf=\"parent\"\n" + " android:layout_marginLeft=\"8dp\"\n" + " tools:layout_editor_absoluteY=\"185dp\" />");
}
use of com.android.tools.idea.uibuilder.api.ViewGroupHandler in project android by JetBrains.
the class PreferenceScreenDragHandlerTest method newPreferenceScreenDragHandler.
@NotNull
private static PreferenceGroupDragHandler newPreferenceScreenDragHandler(@NotNull NlComponent group) {
ViewEditor editor = PreferenceScreenTestFactory.mockEditor();
List<NlComponent> preferences = Collections.singletonList(Mockito.mock(NlComponent.class));
return new PreferenceScreenDragHandler(editor, new ViewGroupHandler(), group, preferences, DragType.MOVE);
}
use of com.android.tools.idea.uibuilder.api.ViewGroupHandler in project android by JetBrains.
the class PreferenceCategoryDragHandlerTest method newPreferenceCategoryDragHandler.
@NotNull
private static PreferenceGroupDragHandler newPreferenceCategoryDragHandler(@NotNull NlComponent category) {
ViewEditor editor = PreferenceScreenTestFactory.mockEditor();
List<NlComponent> preferences = Collections.singletonList(Mockito.mock(NlComponent.class));
return new PreferenceCategoryDragHandler(editor, new ViewGroupHandler(), category, preferences, DragType.MOVE);
}
Aggregations