Search in sources :

Example 6 with ParseManager

use of com.benmu.framework.manager.impl.ParseManager in project WeexErosFramework by bmfe.

the class DefaultRouterAdapter method dialing.

public void dialing(final Context context, String params) {
    ParseManager parseManager = ManagerFactory.getManagerService(ParseManager.class);
    CallPhoneBean callPhone = null;
    callPhone = parseManager.parseObject(params, CallPhoneBean.class);
    if (callPhone == null) {
        callPhone = new CallPhoneBean();
        callPhone.to = "110";
    }
    if (TextUtils.isEmpty(callPhone.to) || context == null)
        return;
    final String finalPhone = callPhone.to;
    if (!callPhone.tip) {
        callPhone(String.valueOf(finalPhone), context);
    } else {
        ModalManager.BmAlert.showAlert(context, null, String.valueOf(finalPhone), "呼叫", new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                callPhone(String.valueOf(finalPhone), context);
                dialog.dismiss();
            }
        }, "取消", null, null, null);
    }
}
Also used : CallPhoneBean(com.benmu.framework.model.CallPhoneBean) DialogInterface(android.content.DialogInterface) ParseManager(com.benmu.framework.manager.impl.ParseManager)

Example 7 with ParseManager

use of com.benmu.framework.manager.impl.ParseManager in project WeexErosFramework by bmfe.

the class DefaultRouterAdapter method toWebView.

public void toWebView(Context context, String params) {
    if (TextUtils.isEmpty(params))
        return;
    ParseManager parseManager = ManagerFactory.getManagerService(ParseManager.class);
    WebViewParamBean webViewParamBean = parseManager.parseObject(params, WebViewParamBean.class);
    String title = webViewParamBean.getTitle();
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.addCategory(Constant.BMWEBVIEW_CATEGORY);
    String type = webViewParamBean.getType() == null ? Constant.ACTIVITIES_ANIMATION.ANIMATION_PUSH : webViewParamBean.getType();
    RouterModel routerModel = new RouterModel(null, type, null, title, webViewParamBean.isNavShow(), null);
    intent.putExtra(Constant.ROUTERPARAMS, routerModel);
    intent.putExtra(Constant.WEBVIEW_PARAMS, webViewParamBean);
    if (context instanceof Activity) {
        Activity activity = (Activity) context;
        activity.startActivity(intent);
        if (Constant.ACTIVITIES_ANIMATION.ANIMATION_PUSH.equals(routerModel.type)) {
            activity.overridePendingTransition(R.anim.right_in, R.anim.view_stay);
        } else if (Constant.ACTIVITIES_ANIMATION.ANIMATION_PRESENT.equals(routerModel.type)) {
            activity.overridePendingTransition(R.anim.bottom_in, R.anim.view_stay);
        } else if (Constant.ACTIVITIES_ANIMATION.ANIMATION_TRANSLATION.equals(routerModel.type)) {
            activity.overridePendingTransition(R.anim.left_in, R.anim.view_stay);
        } else {
            activity.overridePendingTransition(R.anim.right_in, R.anim.view_stay);
        }
    }
}
Also used : RouterModel(com.benmu.framework.model.RouterModel) AbstractWeexActivity(com.benmu.framework.activity.AbstractWeexActivity) Activity(android.app.Activity) Intent(android.content.Intent) ParseManager(com.benmu.framework.manager.impl.ParseManager) WebViewParamBean(com.benmu.framework.model.WebViewParamBean)

Example 8 with ParseManager

use of com.benmu.framework.manager.impl.ParseManager in project WeexErosFramework by bmfe.

the class EventFetch method fetch.

public void fetch(String params, final Context context, final JSCallback jscallback) {
    ParseManager parseManager = ManagerFactory.getManagerService(ParseManager.class);
    AxiosManager axiosManager = ManagerFactory.getManagerService(AxiosManager.class);
    JSONObject object = parseManager.parseObject(params);
    final String mUrl = object.getString("url");
    Boolean noRepeat = object.getBoolean("noRepeat");
    if (noRepeat != null && noRepeat) {
        axiosManager.cancel(mUrl);
    }
    switch(object.getString("method")) {
        case OkHttpUtils.METHOD.GET:
            AxiosGet axiosGet = parseManager.parseObject(params, AxiosGet.class);
            get(context, axiosManager, axiosGet, jscallback);
            break;
        case OkHttpUtils.METHOD.POST:
            AxiosPost axiosPost = parseManager.parseObject(params, AxiosPost.class);
            post(context, axiosManager, axiosPost, jscallback);
            break;
        case OkHttpUtils.METHOD.HEAD:
            AxiosGet axiosHead = parseManager.parseObject(params, AxiosGet.class);
            head(context, axiosManager, axiosHead, jscallback);
            break;
        case OkHttpUtils.METHOD.DELETE:
            AxiosPost axiosDelete = parseManager.parseObject(params, AxiosPost.class);
            delete(context, axiosManager, axiosDelete, jscallback);
            break;
        case OkHttpUtils.METHOD.PUT:
            AxiosPost axiosPut = parseManager.parseObject(params, AxiosPost.class);
            put(context, axiosManager, axiosPut, jscallback);
            break;
        case OkHttpUtils.METHOD.PATCH:
            AxiosPost axiosPatch = parseManager.parseObject(params, AxiosPost.class);
            patch(context, axiosManager, axiosPatch, jscallback);
            break;
    }
}
Also used : AxiosManager(com.benmu.framework.manager.impl.AxiosManager) JSONObject(com.alibaba.fastjson.JSONObject) AxiosGet(com.benmu.framework.model.AxiosGet) AxiosPost(com.benmu.framework.model.AxiosPost) ParseManager(com.benmu.framework.manager.impl.ParseManager)

Example 9 with ParseManager

use of com.benmu.framework.manager.impl.ParseManager in project WeexErosFramework by bmfe.

the class EventConfirm method confirm.

public void confirm(String options, final JSCallback cancel, final JSCallback ok, Context context) {
    ParseManager parseManager = ManagerFactory.getManagerService(ParseManager.class);
    ModalBean bean = parseManager.parseObject(options, ModalBean.class);
    ModalManager.BmAlert.showAlert(context, bean.getTitle(), bean.getMessage(), bean.getOkTitle(), new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            if (ok != null) {
                ok.invoke(null);
            }
        }
    }, bean.getCancelTitle(), new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            if (cancel != null) {
                cancel.invoke(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 10 with ParseManager

use of com.benmu.framework.manager.impl.ParseManager in project WeexErosFramework by bmfe.

the class EventShowLoading method showLoading.

public void showLoading(String options, JSCallback callback, Context Context) {
    ParseManager parseManager = ManagerFactory.getManagerService(ParseManager.class);
    ModalBean bean = parseManager.parseObject(options, ModalBean.class);
    ModalManager.BmLoading.showLoading(Context, bean.getMessage(), false);
    if (callback != null) {
        callback.invoke(null);
    }
}
Also used : ModalBean(com.benmu.framework.model.ModalBean) 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