Skip to content
This repository was archived by the owner on Dec 27, 2024. It is now read-only.

Commit ec1348f

Browse files
authored
fix many issues with link, add pure java version (#484)
* fix many issues with link, add pure java version * small cleanup * resolve comments
1 parent 55567b5 commit ec1348f

File tree

23 files changed

+2107
-431
lines changed

23 files changed

+2107
-431
lines changed

desktop/ConstraintLayoutInspector/.idea/artifacts/ConstraintLayoutInspector_jar2.xml renamed to desktop/ConstraintLayoutInspector/.idea/artifacts/ConstraintLayoutInspector_jar3.xml

Lines changed: 5 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

desktop/ConstraintLayoutInspector/.idea/artifacts/ConstraintLayoutInspector_jar4.xml

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

desktop/ConstraintLayoutInspector/.idea/uiDesigner.xml

Lines changed: 124 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
-4.1 MB
Binary file not shown.

desktop/ConstraintLayoutInspector/app/src/androidx/constraintLayout/desktop/constraintRendering/layout3d/CheckLayout3d.java

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,13 @@
1616
package androidx.constraintLayout.desktop.constraintRendering.layout3d;
1717

1818

19-
import androidx.constraintLayout.desktop.link.LayoutView;
20-
21-
import javax.imageio.ImageIO;
2219
import javax.swing.*;
2320
import java.awt.*;
2421
import java.awt.image.BufferedImage;
2522
import java.awt.image.DataBufferInt;
26-
import java.io.File;
27-
import java.io.IOException;
28-
import java.util.ArrayList;
2923
import java.util.prefs.Preferences;
30-
24+
import java.util.List;
25+
import androidx.constraintLayout.desktop.link.*;
3126

3227
/**
3328
* This is a simple test driver for the 3d engine
@@ -81,6 +76,7 @@ public static Layout.Widget getTestViews(BufferedImage img) {
8176
return v;
8277
}
8378

79+
8480
private void savePref() {
8581
Preferences prefs = Preferences.userNodeForPackage(CheckLayout3d.class);
8682
final String ORIENTATION = "name_of_preference";
@@ -115,10 +111,11 @@ public static void create(Layout.Widget views, BufferedImage img) {
115111
}
116112

117113

118-
public static Layout.Widget get3dWidgets(ArrayList<LayoutView.Widget> widgets) {
114+
public static Layout.Widget get3dWidgets(List<Widget> widgets) {
119115

120116
Layout.Widget rw = null;
121-
for (LayoutView.Widget widget : widgets) {
117+
118+
for (Widget widget : widgets) {
122119
float top = widget.getInterpolated().top;
123120
float bottom = widget.getInterpolated().bottom;
124121
float left = widget.getInterpolated().left;
@@ -133,7 +130,7 @@ public static Layout.Widget get3dWidgets(ArrayList<LayoutView.Widget> widgets) {
133130
return null;
134131
}
135132
float z = 0;
136-
for (LayoutView.Widget widget : widgets) {
133+
for (Widget widget : widgets) {
137134
float top = widget.getInterpolated().top;
138135
float bottom = widget.getInterpolated().bottom;
139136
float left = widget.getInterpolated().left;
@@ -151,12 +148,13 @@ public static Layout.Widget get3dWidgets(ArrayList<LayoutView.Widget> widgets) {
151148
}
152149

153150
BufferedImage img;
154-
public void update(ArrayList<LayoutView.Widget> widgets) {
151+
152+
public void update(List<Widget> widgets) {
155153
myDisplay3D.updateTriData(new Layout(img, get3dWidgets(widgets)));
156154
myDisplay3D.isImageInvalid = true;
157155
myDisplay3D.repaint();
158156
}
159-
public static CheckLayout3d create3d(ArrayList<LayoutView.Widget> widgets) {
157+
public static CheckLayout3d create3d(List<Widget> widgets) {
160158
JFrame f = new JFrame("CheckTriangles");
161159
CheckLayout3d p = new CheckLayout3d();
162160
f.setContentPane(p);
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright 2021 The Android Open Source Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package androidx.constraintLayout.desktop.link;
18+
19+
import androidx.constraintlayout.core.parser.CLElement;
20+
21+
public interface DesignSurfaceModification {
22+
CLElement getElement(String name);
23+
24+
void updateElement(String name, CLElement content);
25+
}

0 commit comments

Comments
 (0)