use of com.benmu.framework.model.BaseResultBean 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.model.BaseResultBean 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.model.BaseResultBean 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);
}
}
use of com.benmu.framework.model.BaseResultBean in project WeexErosFramework by bmfe.
the class EventShare method relayToCricle.
public void relayToCricle(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;
}
// 不支持的平台
if (WeChatRelayUtil.MEDIA_VIDEO.equals(object.getMediaType())) {
// 粘贴描述到剪切板
String description = object.getDescription();
if (!TextUtils.isEmpty(description)) {
BaseCommonUtil.copyString(context, object.getDescription());
if (!TextUtils.isEmpty(object.getClipboardNotice())) {
ModalManager.BmToast.toast(context, object.getClipboardNotice(), Toast.LENGTH_SHORT);
}
}
}
// 下载视频或图片
downLoadResource(context, object, ACTION_CRICLE);
}
use of com.benmu.framework.model.BaseResultBean in project WeexErosFramework by bmfe.
the class WeChatRelayUtil method execute.
private static void execute(final Context context, String content, ArrayList<Uri> uris, String type, final JSCallback success, final JSCallback failed) {
Uri uri = uris.get(0);
File video = null;
try {
video = new File(new URI(uri.toString()));
} catch (URISyntaxException e) {
e.printStackTrace();
}
if (video == null || !video.exists()) {
return;
}
BaseCommonUtil.updateVideoToGallery(context, video.getAbsolutePath());
final Intent localIntent = new Intent();
localIntent.setComponent(new ComponentName("com.tencent.mm", "com.tencent.mm.ui" + ".LauncherUI"));
localIntent.setAction(Intent.ACTION_MAIN);
localIntent.addCategory(Intent.CATEGORY_LAUNCHER);
localIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
ModalManager.BmToast.toast(context, "文案已复制,视频请到相册中选取", Toast.LENGTH_SHORT);
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
@Override
public void run() {
try {
context.startActivity(localIntent);
if (success != null) {
success.invoke(new BaseResultBean(WeChatRelayUtil.RELAY_SUCCESS, "分享成功"));
}
} catch (Exception e) {
e.printStackTrace();
if (failed != null) {
failed.invoke(new BaseResultBean(ERROR_UNKOWN, "未知错误"));
}
}
}
}, 500);
}
Aggregations