Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
liujiuri
engine
提交
b4088b64
E
engine
项目概览
liujiuri
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b4088b64
编写于
4月 06, 2017
作者:
J
Jason Simmons
提交者:
GitHub
4月 06, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Backport JSONObject.wrap in order to support Jellybean (#3566)
上级
9e59a83a
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
72 addition
and
5 deletion
+72
-5
shell/platform/android/BUILD.gn
shell/platform/android/BUILD.gn
+1
-0
shell/platform/android/io/flutter/plugin/common/JSONMessageCodec.java
...rm/android/io/flutter/plugin/common/JSONMessageCodec.java
+1
-1
shell/platform/android/io/flutter/plugin/common/JSONMethodCodec.java
...orm/android/io/flutter/plugin/common/JSONMethodCodec.java
+3
-3
shell/platform/android/io/flutter/plugin/common/JSONUtil.java
...l/platform/android/io/flutter/plugin/common/JSONUtil.java
+64
-0
shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java
...rm/android/io/flutter/plugin/editing/TextInputPlugin.java
+2
-1
travis/licenses_golden/licenses_flutter
travis/licenses_golden/licenses_flutter
+1
-0
未找到文件。
shell/platform/android/BUILD.gn
浏览文件 @
b4088b64
...
...
@@ -80,6 +80,7 @@ java_library("flutter_shell_java") {
"io/flutter/plugin/common/FlutterMethodChannel.java",
"io/flutter/plugin/common/JSONMessageCodec.java",
"io/flutter/plugin/common/JSONMethodCodec.java",
"io/flutter/plugin/common/JSONUtil.java",
"io/flutter/plugin/common/MessageCodec.java",
"io/flutter/plugin/common/MethodCall.java",
"io/flutter/plugin/common/MethodCodec.java",
...
...
shell/platform/android/io/flutter/plugin/common/JSONMessageCodec.java
浏览文件 @
b4088b64
...
...
@@ -26,7 +26,7 @@ public final class JSONMessageCodec implements MessageCodec<Object> {
if
(
message
==
null
)
{
return
null
;
}
return
StringCodec
.
INSTANCE
.
encodeMessage
(
JSON
Object
.
wrap
(
message
).
toString
());
return
StringCodec
.
INSTANCE
.
encodeMessage
(
JSON
Util
.
wrap
(
message
).
toString
());
}
@Override
...
...
shell/platform/android/io/flutter/plugin/common/JSONMethodCodec.java
浏览文件 @
b4088b64
...
...
@@ -21,7 +21,7 @@ public final class JSONMethodCodec implements MethodCodec {
try
{
final
JSONObject
map
=
new
JSONObject
();
map
.
put
(
"method"
,
methodCall
.
method
);
map
.
put
(
"args"
,
JSON
Object
.
wrap
(
methodCall
.
arguments
));
map
.
put
(
"args"
,
JSON
Util
.
wrap
(
methodCall
.
arguments
));
return
JSONMessageCodec
.
INSTANCE
.
encodeMessage
(
map
);
}
catch
(
JSONException
e
)
{
throw
new
IllegalArgumentException
(
"Invalid JSON"
,
e
);
...
...
@@ -49,7 +49,7 @@ public final class JSONMethodCodec implements MethodCodec {
@Override
public
ByteBuffer
encodeSuccessEnvelope
(
Object
result
)
{
return
JSONMessageCodec
.
INSTANCE
.
encodeMessage
(
new
JSONArray
().
put
(
JSON
Object
.
wrap
(
result
)));
.
encodeMessage
(
new
JSONArray
().
put
(
JSON
Util
.
wrap
(
result
)));
}
@Override
...
...
@@ -58,7 +58,7 @@ public final class JSONMethodCodec implements MethodCodec {
return
JSONMessageCodec
.
INSTANCE
.
encodeMessage
(
new
JSONArray
()
.
put
(
errorCode
)
.
put
(
errorMessage
)
.
put
(
JSON
Object
.
wrap
(
errorDetails
)));
.
put
(
JSON
Util
.
wrap
(
errorDetails
)));
}
@Override
...
...
shell/platform/android/io/flutter/plugin/common/JSONUtil.java
0 → 100644
浏览文件 @
b4088b64
package
io.flutter.plugin.common
;
import
java.lang.reflect.Array
;
import
java.util.Collection
;
import
java.util.Map
;
import
org.json.JSONArray
;
import
org.json.JSONObject
;
public
class
JSONUtil
{
private
JSONUtil
()
{
}
/**
* Backport of {@link JSONObject#wrap(Object)} for use on pre-KitKat
* systems.
*/
public
static
Object
wrap
(
Object
o
)
{
if
(
o
==
null
)
{
return
JSONObject
.
NULL
;
}
if
(
o
instanceof
JSONArray
||
o
instanceof
JSONObject
)
{
return
o
;
}
if
(
o
.
equals
(
JSONObject
.
NULL
))
{
return
o
;
}
try
{
if
(
o
instanceof
Collection
)
{
JSONArray
result
=
new
JSONArray
();
for
(
Object
e
:
(
Collection
)
o
)
result
.
put
(
wrap
(
e
));
return
result
;
}
else
if
(
o
.
getClass
().
isArray
())
{
JSONArray
result
=
new
JSONArray
();
int
length
=
Array
.
getLength
(
o
);
for
(
int
i
=
0
;
i
<
length
;
i
++)
result
.
put
(
wrap
(
Array
.
get
(
o
,
i
)));
return
result
;
}
if
(
o
instanceof
Map
)
{
JSONObject
result
=
new
JSONObject
();
for
(
Map
.
Entry
<?,
?>
entry:
((
Map
<?,
?>)
o
).
entrySet
())
result
.
put
((
String
)
entry
.
getKey
(),
wrap
(
entry
.
getValue
()));
return
result
;
}
if
(
o
instanceof
Boolean
||
o
instanceof
Byte
||
o
instanceof
Character
||
o
instanceof
Double
||
o
instanceof
Float
||
o
instanceof
Integer
||
o
instanceof
Long
||
o
instanceof
Short
||
o
instanceof
String
)
{
return
o
;
}
if
(
o
.
getClass
().
getPackage
().
getName
().
startsWith
(
"java."
))
{
return
o
.
toString
();
}
}
catch
(
Exception
ignored
)
{
}
return
null
;
}
}
shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java
浏览文件 @
b4088b64
...
...
@@ -15,6 +15,7 @@ import io.flutter.plugin.common.FlutterMethodChannel;
import
io.flutter.plugin.common.FlutterMethodChannel.MethodCallHandler
;
import
io.flutter.plugin.common.FlutterMethodChannel.Response
;
import
io.flutter.plugin.common.JSONMethodCodec
;
import
io.flutter.plugin.common.JSONUtil
;
import
io.flutter.plugin.common.MethodCall
;
import
io.flutter.view.FlutterView
;
...
...
@@ -137,7 +138,7 @@ public class TextInputPlugin implements MethodCallHandler {
}
void
setLatestEditingState
(
Map
<
String
,
Object
>
state
)
{
mLatestState
=
(
JSONObject
)
JSON
Object
.
wrap
(
state
);
mLatestState
=
(
JSONObject
)
JSON
Util
.
wrap
(
state
);
}
private
void
clearTextInputClient
()
{
...
...
travis/licenses_golden/licenses_flutter
浏览文件 @
b4088b64
...
...
@@ -1073,6 +1073,7 @@ FILE: ../../../flutter/lib/ui/window/window.h
FILE: ../../../flutter/runtime/platform_impl.h
FILE: ../../../flutter/shell/common/skia_event_tracer_impl.cc
FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/common/JSONMethodCodec.java
FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/common/JSONUtil.java
FILE: ../../../flutter/shell/platform/darwin/desktop/Info.plist
FILE: ../../../flutter/shell/platform/darwin/desktop/flutter_mac.xib
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Flutter.podspec
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录