Search in sources :

Example 6 with BaseResultBean

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());
            }
        });
}
Also used : BaseResultBean(com.benmu.framework.model.BaseResultBean) NavigatorBarModel(com.benmu.framework.model.NavigatorBarModel) BaseToolBar(com.benmu.widget.view.BaseToolBar) ParseManager(com.benmu.framework.manager.impl.ParseManager) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View)

Example 7 with 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);
            }
        });
    }
}
Also used : BaseResultBean(com.benmu.framework.model.BaseResultBean) NavigatorBarModel(com.benmu.framework.model.NavigatorBarModel) BaseToolBar(com.benmu.widget.view.BaseToolBar) ParseManager(com.benmu.framework.manager.impl.ParseManager) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View)

Example 8 with BaseResultBean

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);
    }
}
Also used : RelayBean(com.benmu.framework.model.RelayBean) BaseResultBean(com.benmu.framework.model.BaseResultBean) ParseManager(com.benmu.framework.manager.impl.ParseManager)

Example 9 with BaseResultBean

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);
}
Also used : RelayBean(com.benmu.framework.model.RelayBean) BaseResultBean(com.benmu.framework.model.BaseResultBean) ParseManager(com.benmu.framework.manager.impl.ParseManager)

Example 10 with BaseResultBean

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);
}
Also used : BaseResultBean(com.benmu.framework.model.BaseResultBean) Handler(android.os.Handler) Intent(android.content.Intent) ComponentName(android.content.ComponentName) URISyntaxException(java.net.URISyntaxException) Uri(android.net.Uri) File(java.io.File) URI(java.net.URI) URISyntaxException(java.net.URISyntaxException)

Aggregations

BaseResultBean (com.benmu.framework.model.BaseResultBean)10 ParseManager (com.benmu.framework.manager.impl.ParseManager)6 View (android.view.View)4 ImageView (android.widget.ImageView)4 TextView (android.widget.TextView)4 NavigatorBarModel (com.benmu.framework.model.NavigatorBarModel)4 BaseToolBar (com.benmu.widget.view.BaseToolBar)4 ComponentName (android.content.ComponentName)3 Intent (android.content.Intent)3 Uri (android.net.Uri)2 RelayBean (com.benmu.framework.model.RelayBean)2 URISyntaxException (java.net.URISyntaxException)2 Handler (android.os.Handler)1 PermissionManager (com.benmu.framework.manager.impl.PermissionManager)1 MultipleFileDownloader (com.benmu.framework.utils.MultipleFileDownloader)1 File (java.io.File)1 URI (java.net.URI)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1