Search in sources :

Example 16 with ParseManager

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());
            }
        });
    }
}
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 17 with ParseManager

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());
            }
        });
}
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 18 with ParseManager

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);
            }
        });
    }
}
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 19 with ParseManager

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());
}
Also used : ModalBean(com.benmu.framework.model.ModalBean) DialogInterface(android.content.DialogInterface) ParseManager(com.benmu.framework.manager.impl.ParseManager)

Example 20 with ParseManager

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

Aggregations

ParseManager (com.benmu.framework.manager.impl.ParseManager)22 BaseResultBean (com.benmu.framework.model.BaseResultBean)6 View (android.view.View)4 ImageView (android.widget.ImageView)4 TextView (android.widget.TextView)4 ModalBean (com.benmu.framework.model.ModalBean)4 NavigatorBarModel (com.benmu.framework.model.NavigatorBarModel)4 BaseToolBar (com.benmu.widget.view.BaseToolBar)4 Activity (android.app.Activity)3 DialogInterface (android.content.DialogInterface)3 AbstractWeexActivity (com.benmu.framework.activity.AbstractWeexActivity)3 RouterModel (com.benmu.framework.model.RouterModel)3 Intent (android.content.Intent)2 JSONObject (com.alibaba.fastjson.JSONObject)2 AxiosManager (com.benmu.framework.manager.impl.AxiosManager)2 JsVersionInfoBean (com.benmu.framework.model.JsVersionInfoBean)2 RelayBean (com.benmu.framework.model.RelayBean)2 Bitmap (android.graphics.Bitmap)1 Bundle (android.os.Bundle)1 CompoundButton (android.widget.CompoundButton)1