android:renanme method

This commit is contained in:
pengfei.zhou 2020-01-11 10:26:15 +08:00 committed by osborn
parent da6afad30d
commit 0aaf105f53
6 changed files with 19 additions and 22 deletions

View File

@ -29,7 +29,6 @@ import pub.doric.async.AsyncCall;
import pub.doric.async.AsyncResult;
import pub.doric.engine.DoricJSEngine;
import pub.doric.utils.DoricConstant;
import pub.doric.utils.DoricLog;
import pub.doric.utils.ThreadMode;
/**
@ -78,7 +77,7 @@ public class DoricNativeDriver implements IDoricDriver {
return doricJSEngine.invokeDoricMethod(method, args);
} catch (Exception e) {
doricJSEngine.onException(e);
doricJSEngine.onLogout(Log.ERROR, String.format("invokeDoricMethod(%s,...),error is %s", method, e.getLocalizedMessage()));
doricJSEngine.onLog(Log.ERROR, String.format("invokeDoricMethod(%s,...),error is %s", method, e.getLocalizedMessage()));
return new JSDecoder(null);
}
}
@ -108,7 +107,7 @@ public class DoricNativeDriver implements IDoricDriver {
return true;
} catch (Exception e) {
doricJSEngine.onException(e);
doricJSEngine.onLogout(Log.ERROR, String.format("createContext %s error is %s", source, e.getLocalizedMessage()));
doricJSEngine.onLog(Log.ERROR, String.format("createContext %s error is %s", source, e.getLocalizedMessage()));
return false;
}
}
@ -125,7 +124,7 @@ public class DoricNativeDriver implements IDoricDriver {
return true;
} catch (Exception e) {
doricJSEngine.onException(e);
doricJSEngine.onLogout(Log.ERROR, String.format("destroyContext %s error is %s", contextId, e.getLocalizedMessage()));
doricJSEngine.onLog(Log.ERROR, String.format("destroyContext %s error is %s", contextId, e.getLocalizedMessage()));
return false;
}
}

View File

@ -159,9 +159,9 @@ public class DoricRegistry {
}
}
public void onLogout(int type, String message) {
public void onLog(int type, String message) {
for (IDoricMonitor monitor : this.monitors) {
monitor.onLogout(type, message);
monitor.onLog(type, message);
}
}
}

View File

@ -36,5 +36,5 @@ public interface IDoricMonitor {
* @see android.util.Log#WARN
* @see android.util.Log#DEBUG
*/
void onLogout(int type, String message);
void onLog(int type, String message);
}

View File

@ -119,13 +119,13 @@ public class DoricJSEngine implements Handler.Callback, DoricTimerExtension.Time
String message = args[1].string();
switch (type) {
case "w":
mDoricRegistry.onLogout(Log.WARN, message);
mDoricRegistry.onLog(Log.WARN, message);
break;
case "e":
mDoricRegistry.onLogout(Log.ERROR, message);
mDoricRegistry.onLog(Log.ERROR, message);
break;
default:
mDoricRegistry.onLogout(Log.INFO, message);
mDoricRegistry.onLog(Log.INFO, message);
break;
}
} catch (Exception e) {
@ -147,7 +147,7 @@ public class DoricJSEngine implements Handler.Callback, DoricTimerExtension.Time
String name = args[0].string();
String content = mDoricRegistry.acquireJSBundle(name);
if (TextUtils.isEmpty(content)) {
mDoricRegistry.onLogout(Log.ERROR, String.format("require js bundle:%s is empty", name));
mDoricRegistry.onLog(Log.ERROR, String.format("require js bundle:%s is empty", name));
return new JavaValue(false);
}
mDoricJSE.loadJS(packageModuleScript(name, content), "Module://" + name);
@ -260,7 +260,7 @@ public class DoricJSEngine implements Handler.Callback, DoricTimerExtension.Time
invokeDoricMethod(DoricConstant.DORIC_TIMER_CALLBACK, timerId);
} catch (Exception e) {
mDoricRegistry.onException(e);
mDoricRegistry.onLogout(
mDoricRegistry.onLog(
Log.ERROR,
String.format("Timer Callback error:%s", e.getLocalizedMessage()));
}
@ -276,7 +276,7 @@ public class DoricJSEngine implements Handler.Callback, DoricTimerExtension.Time
}
@Override
public void onLogout(int type, String message) {
public void onLog(int type, String message) {
switch (type) {
case Log.ERROR:
DoricLog.suffix_e("_js", message);

View File

@ -22,7 +22,6 @@ import pub.doric.DoricContext;
import pub.doric.async.AsyncResult;
import pub.doric.plugin.DoricJavaPlugin;
import pub.doric.DoricContextManager;
import pub.doric.utils.DoricLog;
import pub.doric.utils.DoricMetaInfo;
import pub.doric.utils.DoricUtils;
@ -46,28 +45,28 @@ public class DoricBridgeExtension {
final DoricContext context = DoricContextManager.getContext(contextId);
DoricMetaInfo<DoricJavaPlugin> pluginInfo = context.getDriver().getRegistry().acquirePluginInfo(module);
if (pluginInfo == null) {
context.getDriver().getRegistry().onLogout(
context.getDriver().getRegistry().onLog(
Log.ERROR,
String.format("Cannot find plugin class:%s", module));
return new JavaValue(false);
}
final DoricJavaPlugin doricJavaPlugin = context.obtainPlugin(pluginInfo);
if (doricJavaPlugin == null) {
context.getDriver().getRegistry().onLogout(
context.getDriver().getRegistry().onLog(
Log.ERROR,
String.format("Cannot obtain plugin instance:%s,method:%s", module, methodName));
return new JavaValue(false);
}
final Method method = pluginInfo.getMethod(methodName);
if (method == null) {
context.getDriver().getRegistry().onLogout(
context.getDriver().getRegistry().onLog(
Log.ERROR,
String.format("Cannot find plugin method in class:%s,method:%s", module, methodName));
return new JavaValue(false);
}
DoricMethod doricMethod = method.getAnnotation(DoricMethod.class);
if (doricMethod == null) {
context.getDriver().getRegistry().onLogout(
context.getDriver().getRegistry().onLog(
Log.ERROR,
String.format("Cannot find DoricMethod annotation in class:%s,method:%s", module, methodName));
return new JavaValue(false);
@ -104,7 +103,7 @@ public class DoricBridgeExtension {
return DoricUtils.toJavaObject(clz, jsDecoder);
} catch (Exception e) {
context.getDriver().getRegistry().onException(e);
context.getDriver().getRegistry().onLogout(
context.getDriver().getRegistry().onLog(
Log.ERROR,
String.format("createParam error:%s", e.getLocalizedMessage()));
}

View File

@ -25,7 +25,6 @@ import pub.doric.extension.bridge.DoricPlugin;
import pub.doric.extension.bridge.DoricPromise;
import pub.doric.shader.SuperNode;
import pub.doric.shader.ViewNode;
import pub.doric.utils.DoricLog;
import pub.doric.utils.DoricMetaInfo;
import pub.doric.utils.DoricUtils;
import pub.doric.utils.ThreadMode;
@ -82,7 +81,7 @@ public class ShaderPlugin extends DoricJavaPlugin {
if (t instanceof Exception) {
getDoricContext().getDriver().getRegistry().onException((Exception) t);
}
getDoricContext().getDriver().getRegistry().onLogout(
getDoricContext().getDriver().getRegistry().onLog(
Log.ERROR,
String.format("Shader.render:error%s", t.getLocalizedMessage()));
}
@ -94,7 +93,7 @@ public class ShaderPlugin extends DoricJavaPlugin {
});
} catch (Exception e) {
getDoricContext().getDriver().getRegistry().onException(e);
getDoricContext().getDriver().getRegistry().onLogout(
getDoricContext().getDriver().getRegistry().onLog(
Log.ERROR,
String.format("Shader.render:error%s", e.getLocalizedMessage())
);