-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add android remote method call , refactor webxmlui, fix json,
- Loading branch information
1 parent
ca33f4c
commit 3abe6ad
Showing
42 changed files
with
1,382 additions
and
1,217 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
extlib/xgui/src/main/java/com/ebsee/rmc/RMCDescriptor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.ebsee.rmc; | ||
|
||
/** | ||
* | ||
*/ | ||
public class RMCDescriptor { | ||
String className; // 类名 eg: "org.minijvm.activity.JvmNativeActivity" | ||
String methodDesc; // 方法名 payV2(Ljava/lang/String;)Ljava/util/Map; | ||
String paraJson; // 参数 eg: "[\"abc\"]" | ||
String insJson; // 实例 eg: "{\"uid\":\"123\"}" , or null | ||
|
||
public String getClassName() { | ||
return className; | ||
} | ||
|
||
public void setClassName(String className) { | ||
this.className = className; | ||
} | ||
|
||
public String getMethodDesc() { | ||
return methodDesc; | ||
} | ||
|
||
public void setMethodDesc(String methodDesc) { | ||
this.methodDesc = methodDesc; | ||
} | ||
|
||
public String getParaJson() { | ||
return paraJson; | ||
} | ||
|
||
public void setParaJson(String paraJson) { | ||
this.paraJson = paraJson; | ||
} | ||
|
||
public String getInsJson() { | ||
return insJson; | ||
} | ||
|
||
public void setInsJson(String insJson) { | ||
this.insJson = insJson; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.ebsee.rmc; | ||
|
||
import org.mini.glfm.Glfm; | ||
import org.mini.json.JsonParser; | ||
import org.mini.json.JsonPrinter; | ||
|
||
import java.util.Map; | ||
|
||
public class RMCUtil { | ||
|
||
/** | ||
* 调用glfm模块的 remoteMethodCall,远程调用android 方法 | ||
* | ||
* @param className "org.minijvm.activity.JvmNativeActivity" | ||
* @param methodDesc "playVideo(Ljava/lang/String;Ljava/lang/String;)J" | ||
* @param para new Object[]{"http://abc.com/x.mov","mov"} | ||
* @param instance null or instance of class | ||
* @return | ||
*/ | ||
public static Map<String, String> remoteMethodCall(String className, String methodDesc, Object[] para, Object instance) { | ||
JsonPrinter printer = new JsonPrinter(); | ||
|
||
RMCDescriptor desc = new RMCDescriptor(); | ||
desc.setClassName(className); | ||
desc.setMethodDesc(methodDesc); | ||
desc.setInsJson(printer.serial(instance)); | ||
desc.setParaJson(printer.serial(para)); | ||
|
||
String s = printer.serial(desc); | ||
//JsonParser<RMCDescriptor> jp1 = new JsonParser(); | ||
//RMCDescriptor desc1 = jp1.deserial(s, RMCDescriptor.class); | ||
|
||
String ret = Glfm.glfmRemoteMethodCall(s); | ||
if (ret != null) { | ||
JsonParser<Map> parser = new JsonParser<>(); | ||
Map map = parser.deserial(ret, Map.class); | ||
return map; | ||
} else { | ||
return null; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.