use of com.benmu.framework.manager.impl.ParseManager in project WeexErosFramework by bmfe.
the class DefaultNavigationAdapter method setRightItem.
public static void setRightItem(String params, final JSCallback jscallback) {
ParseManager parseManager = ManagerFactory.getManagerService(ParseManager.class);
NavigatorBarModel navigatorBarModel = parseManager.parseObject(params, NavigatorBarModel.class);
BaseToolBar navigationBar = getToolBar();
if (navigationBar == null)
return;
setTextView(navigationBar.getRightText(), navigatorBarModel);
if (!TextUtils.isEmpty(navigatorBarModel.getImage())) {
setImage(BMWXEnvironment.mApplicationContext, navigatorBarModel.getImage(), navigationBar.getRightIcon());
}
if (jscallback != null) {
navigationBar.setOnRightListenner(new BaseToolBar.OnRightIconClick() {
@Override
public void onClick(View v) {
jscallback.invokeAndKeepAlive(new BaseResultBean());
}
});
}
}
use of com.benmu.framework.manager.impl.ParseManager in project WeexErosFramework by bmfe.
the class DefaultNavigationAdapter method setNavigationInfo.
public static void setNavigationInfo(String params, final JSCallback jscallback) {
ParseManager parseManager = ManagerFactory.getManagerService(ParseManager.class);
NavigatorBarModel navigatorBarModel = parseManager.parseObject(params, NavigatorBarModel.class);
BaseToolBar navigationBar = getToolBar();
if (navigationBar == null)
return;
navigationBar.setVisibility(navigatorBarModel.isNavShow() ? View.VISIBLE : View.GONE);
if (navigationBar.getVisibility() == View.GONE)
return;
if (jscallback != null)
navigationBar.setOnTitleListenner(new BaseToolBar.OnTitleClick() {
@Override
public void onClick(View v) {
jscallback.invokeAndKeepAlive(new BaseResultBean());
}
});
}
use of com.benmu.framework.manager.impl.ParseManager in project WeexErosFramework by bmfe.
the class DefaultNavigationAdapter method setLeftItem.
public static void setLeftItem(String params, final JSCallback jscallback) {
ParseManager parseManager = ManagerFactory.getManagerService(ParseManager.class);
NavigatorBarModel navigatorBarModel = parseManager.parseObject(params, NavigatorBarModel.class);
BaseToolBar navigationBar = getToolBar();
if (navigationBar == null)
return;
setTextView(navigationBar.getLeftTextView(), navigatorBarModel);
if (!TextUtils.isEmpty(navigatorBarModel.getImage())) {
setImage(BMWXEnvironment.mApplicationContext, navigatorBarModel.getImage(), navigationBar.getLeftIcon());
}
if (jscallback != null) {
navigationBar.setOnWebClosedListenner(new BaseToolBar.OnWebViewClosed() {
@Override
public void onClick(View v) {
jscallback.invokeAndKeepAlive(new BaseResultBean());
}
});
navigationBar.setOnLeftListenner(new BaseToolBar.OnLeftIconClick() {
@Override
public void onClick(View v) {
jscallback.invokeAndKeepAlive(null);
}
});
}
}
use of com.benmu.framework.manager.impl.ParseManager in project WeexErosFramework by bmfe.
the class EventAlert method alert.
public void alert(String options, final JSCallback callback, Context Context) {
ParseManager parseManager = ManagerFactory.getManagerService(ParseManager.class);
ModalBean bean = parseManager.parseObject(options, ModalBean.class);
String okTitle = bean.getOkTitle();
if (TextUtils.isEmpty(okTitle)) {
okTitle = Context.getResources().getString(R.string.str_ensure);
}
ModalManager.BmAlert.showAlert(Context, bean.getTitle(), bean.getMessage(), okTitle, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (callback != null) {
callback.invoke(null);
}
}
}, null, null, bean.getTitleAlign(), bean.getMessageAlign());
}
use of com.benmu.framework.manager.impl.ParseManager in project WeexErosFramework by bmfe.
the class EventShare method relayToFriend.
public void relayToFriend(Context context, String params, ArrayList<JSCallback> callbacks) {
mSuccessCallback = callbacks.get(0);
mFailedCallback = callbacks.get(1);
if (context == null || TextUtils.isEmpty(params)) {
if (mFailedCallback != null) {
mFailedCallback.invoke(new BaseResultBean(WeChatRelayUtil.ERROR_ILLEGALARGUMENT, "参数有误"));
}
return;
}
// 参数有误
ParseManager parseManager = ManagerFactory.getManagerService(ParseManager.class);
RelayBean object = parseManager.parseObject(params, RelayBean.class);
if (object == null) {
if (mFailedCallback != null) {
mFailedCallback.invoke(new BaseResultBean(WeChatRelayUtil.ERROR_ILLEGALARGUMENT, "参数有误"));
}
return;
}
// 参数有误
if (!WeChatRelayUtil.PLATFORM_WECHAT.equals(object.getPlatform())) {
if (mFailedCallback != null) {
mFailedCallback.invoke(new BaseResultBean(WeChatRelayUtil.ERROR_UNSUPPORT_PLATFORM, "不支持的平台"));
}
return;
}
// 不支持的平台
// 粘贴描述到剪切板
String description = object.getDescription();
if (!TextUtils.isEmpty(description) && !WeChatRelayUtil.MEDIA_TEXT.equals(object.getMediaType())) {
BaseCommonUtil.copyString(context, object.getDescription());
if (!TextUtils.isEmpty(object.getClipboardNotice())) {
ModalManager.BmToast.toast(context, object.getClipboardNotice(), Toast.LENGTH_SHORT);
}
}
if (WeChatRelayUtil.MEDIA_TEXT.equals(object.getMediaType())) {
WeChatRelayUtil.relayToFriend(context, object.getDescription(), null, object.getMediaType(), mSuccessCallback, mFailedCallback);
} else {
downLoadResource(context, object, ACTION_FRIEND);
}
}
Aggregations