Search in sources :

Example 16 with DesignSurface

use of com.android.tools.idea.uibuilder.surface.DesignSurface in project android by JetBrains.

the class Display method draw.

public void draw(@NotNull SceneContext sceneContext, @NotNull Graphics2D g, @NotNull Scene scene) {
    mTime = System.currentTimeMillis();
    if (scene.getNeedsDisplayListRebuilt()) {
        myNeedsDisplayListRebuild = true;
    }
    if (sceneContext.getScale() != myScale) {
        myScale = sceneContext.getScale();
        myNeedsDisplayListRebuild = true;
    }
    myNeedsDisplayListRebuild |= myDisplayList.getCommands().size() == 0;
    if (myNeedsDisplayListRebuild) {
        myDisplayList.clear();
        myNeedsDisplayListRebuild = scene.buildDisplayList(myDisplayList, mTime, sceneContext);
        scene.clearNeedsRebuildList();
    }
    if (ConstraintLayoutHandler.USE_SCENE_INTERACTION) {
        draw(sceneContext, g, myDisplayList);
    }
    if (myNeedsDisplayListRebuild) {
        DesignSurface designSurface = sceneContext.getSurface();
        if (designSurface != null) {
            designSurface.repaint();
        }
    }
}
Also used : DesignSurface(com.android.tools.idea.uibuilder.surface.DesignSurface)

Example 17 with DesignSurface

use of com.android.tools.idea.uibuilder.surface.DesignSurface in project android by JetBrains.

the class NlPalettePanelTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    Configuration configuration = mock(Configuration.class);
    when(configuration.getModule()).thenReturn(myModule);
    DesignSurface surface = mock(DesignSurface.class);
    when(surface.getLayoutType()).thenReturn(NlLayoutType.LAYOUT);
    when(surface.getConfiguration()).thenReturn(configuration);
    myCopyPasteManager = mock(CopyPasteManager.class);
    myPanel = new NlPalettePanel(getProject(), surface, myCopyPasteManager);
}
Also used : DesignSurface(com.android.tools.idea.uibuilder.surface.DesignSurface) Configuration(com.android.tools.idea.configurations.Configuration) CopyPasteManager(com.intellij.openapi.ide.CopyPasteManager)

Aggregations

DesignSurface (com.android.tools.idea.uibuilder.surface.DesignSurface)17 ScreenView (com.android.tools.idea.uibuilder.surface.ScreenView)7 Configuration (com.android.tools.idea.configurations.Configuration)4 KeyEvent (java.awt.event.KeyEvent)4 NlModel (com.android.tools.idea.uibuilder.model.NlModel)3 UsageTracker (com.android.tools.analytics.UsageTracker)2 NlComponent (com.android.tools.idea.uibuilder.model.NlComponent)2 AndroidStudioEvent (com.google.wireless.android.sdk.stats.AndroidStudioEvent)2 LinkedList (java.util.LinkedList)2 Result (com.android.ide.common.rendering.api.Result)1 ViewInfo (com.android.ide.common.rendering.api.ViewInfo)1 HtmlLinkManager (com.android.tools.idea.rendering.HtmlLinkManager)1 RenderLogger (com.android.tools.idea.rendering.RenderLogger)1 RenderResult (com.android.tools.idea.rendering.RenderResult)1 LayoutEditorRenderResult (com.google.wireless.android.sdk.stats.LayoutEditorRenderResult)1 LayoutEditorState (com.google.wireless.android.sdk.stats.LayoutEditorState)1 MockModule (com.intellij.mock.MockModule)1 CopyPasteManager (com.intellij.openapi.ide.CopyPasteManager)1 BufferedImage (java.awt.image.BufferedImage)1 Nullable (org.jetbrains.annotations.Nullable)1