mirror of
https://gitee.com/zhangsken/AndroidIDE.git
synced 2026-10-16 07:49:44 +08:00
fix(tooling-api): FileTypeAdapter is incorrectly implemented
This commit is contained in:
Binary file not shown.
+8
-16
@@ -37,29 +37,21 @@ public class FileTypeAdapter extends TypeAdapter<File> {
|
||||
|
||||
@Override
|
||||
public void write(final JsonWriter out, final File value) throws IOException {
|
||||
out.name("path");
|
||||
if (value == null) {
|
||||
out.nullValue();
|
||||
return;
|
||||
}
|
||||
|
||||
out.value(value.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public File read(final JsonReader in) throws IOException {
|
||||
final var next = in.peek();
|
||||
if (next == JsonToken.NULL) {
|
||||
return null;
|
||||
}
|
||||
in.beginObject();
|
||||
final String name = in.nextName();
|
||||
if (!"path".equals(name)) {
|
||||
throw new JsonParseException("Expected 'path' but was '" + name + "'");
|
||||
}
|
||||
|
||||
final var path = in.nextString();
|
||||
if (path == null) {
|
||||
if (in.peek() == JsonToken.NULL) {
|
||||
in.nextNull();
|
||||
return null;
|
||||
}
|
||||
|
||||
in.endObject();
|
||||
|
||||
return new File(path);
|
||||
return new File(in.nextString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
package com.itsaky.androidide.inflater.internal
|
||||
|
||||
import com.itsaky.androidide.inflater.IAttribute
|
||||
import com.itsaky.androidide.inflater.IViewGroup
|
||||
|
||||
/**
|
||||
* [IView][com.itsaky.androidide.inflater.IView] implementation for `<include>` tags.
|
||||
@@ -37,10 +36,10 @@ class IncludeView(private val embedded: ViewImpl) :
|
||||
override fun applyAttribute(attribute: IAttribute) =
|
||||
// The attributes must be applied to the embedded view
|
||||
embedded.applyAttribute(attribute)
|
||||
|
||||
|
||||
override fun onHighlightStateUpdated(highlight: Boolean) =
|
||||
embedded.onHighlightStateUpdated(highlight)
|
||||
|
||||
|
||||
override fun removeFromParent() = embedded.removeFromParent()
|
||||
|
||||
override fun printHierarchy() = embedded.printHierarchy()
|
||||
|
||||
Reference in New Issue
Block a user