Search in sources :

Example 11 with ParseManager

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

the class EventToast method toast.

public void toast(String options, Context Context) {
    ParseManager parseManager = ManagerFactory.getManagerService(ParseManager.class);
    ModalBean bean = parseManager.parseObject(options, ModalBean.class);
    ModalManager.BmToast.toast(Context, bean.getMessage(), bean.getDuration() == 0 ? Toast.LENGTH_SHORT : bean.getDuration());
}
Also used : ModalBean(com.benmu.framework.model.ModalBean) ParseManager(com.benmu.framework.manager.impl.ParseManager)

Example 12 with ParseManager

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

the class EventPay method pay.

public void pay(String params, Context context, JSCallback callback) {
    this.mCallback = callback;
    ParseManager parseManager = ManagerFactory.getManagerService(ParseManager.class);
    WeChatPayModel weChatPayModal = parseManager.parseObject(params, WeChatPayModel.class);
    IWXAPI wxapi = WXAPIFactory.createWXAPI(context, weChatPayModal.getAppid(), true);
    if (!wxapi.isWXAppInstalled()) {
        JsPoster.postFailed("请先安装微信客户端", mCallback);
        // }
        return;
    }
    PayReq request = new PayReq();
    request.appId = weChatPayModal.getAppid();
    request.partnerId = weChatPayModal.getPartnerid();
    request.nonceStr = weChatPayModal.getNoncestr();
    request.packageValue = weChatPayModal.getPackageValue();
    request.prepayId = weChatPayModal.getPrepayid();
    request.timeStamp = weChatPayModal.getTimestamp();
    request.sign = weChatPayModal.getSign();
    wxapi.registerApp(weChatPayModal.getAppid());
    ManagerFactory.getManagerService(DispatchEventManager.class).getBus().register(this);
    wxapi.sendReq(request);
}
Also used : WeChatPayModel(com.benmu.framework.model.WeChatPayModel) IWXAPI(com.tencent.mm.opensdk.openapi.IWXAPI) PayReq(com.tencent.mm.opensdk.modelpay.PayReq) ParseManager(com.benmu.framework.manager.impl.ParseManager)

Example 13 with ParseManager

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

the class EventNav method nav.

public void nav(String params, Context context) {
    ParseManager parseManager = ManagerFactory.getManagerService(ParseManager.class);
    NavModule navModule = parseManager.parseObject(params, NavModule.class);
    if (navModule != null) {
        String type = navModule.getType();
        if ("amap".equals(type)) {
            navByAmap(context, navModule);
        } else if ("baidu".equals(type)) {
            navByBaidumap(context, navModule);
        }
    }
}
Also used : NavModule(com.benmu.framework.model.NavModule) ParseManager(com.benmu.framework.manager.impl.ParseManager)

Example 14 with ParseManager

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

the class AppUtils method getJsVersion.

public static String getJsVersion(Context context) {
    String jsVersion = SharePreferenceUtil.getVersion(context);
    if (TextUtils.isEmpty(jsVersion)) {
        AssetsUtil.AssetsJsVersion assetsVersionInfo = AssetsUtil.getAssetsVersionInfo(context);
        if (assetsVersionInfo != null) {
            ParseManager parseManager = ManagerFactory.getManagerService(ParseManager.class);
            SharePreferenceUtil.setVersion(context, parseManager.toJsonString(assetsVersionInfo));
        }
        return assetsVersionInfo == null ? "" : assetsVersionInfo.getJsVersion();
    }
    ParseManager parseManager = ManagerFactory.getManagerService(ParseManager.class);
    JsVersionInfoBean jsVersionInfoBean = parseManager.parseObject(jsVersion, JsVersionInfoBean.class);
    return jsVersionInfoBean == null ? "" : jsVersionInfoBean.getJsVersion();
}
Also used : JsVersionInfoBean(com.benmu.framework.model.JsVersionInfoBean) ParseManager(com.benmu.framework.manager.impl.ParseManager)

Example 15 with ParseManager

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

the class DebugActivity method initView.

private void initView() {
    tv_appversion = (TextView) findViewById(R.id.tv_appversion);
    tv_jsverision = (TextView) findViewById(R.id.tv_jsverision);
    cb_inter = (CheckBox) findViewById(R.id.cb_inter);
    cb_hotrefresh = (CheckBox) findViewById(R.id.cb_hotrefresh);
    tv_appversion.setText(BaseCommonUtil.getVersionName(this));
    String activeState = SharePreferenceUtil.getInterceptorActive(this);
    if (Constant.INTERCEPTOR_ACTIVE.equals(activeState)) {
        ParseManager parseManager = ManagerFactory.getManagerService(ParseManager.class);
        String jsVersion = parseManager.parseObject(SharePreferenceUtil.getVersion(this), JsVersionInfoBean.class).getJsVersion();
        tv_jsverision.setText(jsVersion);
    }
    cb_hotrefresh.setEnabled(!Constant.INTERCEPTOR_ACTIVE.equals(activeState));
    cb_inter.setChecked(Constant.INTERCEPTOR_ACTIVE.equals(activeState));
    cb_inter.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            SharePreferenceUtil.setInterceptorActive(mAct, isChecked ? Constant.INTERCEPTOR_ACTIVE : Constant.INTERCEPTOR_DEACTIVE);
            ManagerFactory.getManagerService(DispatchEventManager.class).getBus().post(new Intent(WXConstant.ACTION_INTERCEPTOR_SWTICH));
            if (isChecked) {
                cb_hotrefresh.setEnabled(false);
                cb_hotrefresh.setChecked(false);
            } else {
                cb_hotrefresh.setEnabled(true);
            }
        }
    });
    cb_hotrefresh.setChecked(SharePreferenceUtil.getHotRefreshSwitch(this));
    cb_hotrefresh.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            Log.e("DebugActivity", "onCheckedChanged -> " + isChecked);
            SharePreferenceUtil.setHotRefreshSwitch(mAct, isChecked);
            ManagerFactory.getManagerService(DispatchEventManager.class).getBus().post(new Intent(WXConstant.ACTION_INTERCEPTOR_SWTICH));
        }
    });
}
Also used : JsVersionInfoBean(com.benmu.framework.model.JsVersionInfoBean) Intent(android.content.Intent) ParseManager(com.benmu.framework.manager.impl.ParseManager) DispatchEventManager(com.benmu.framework.manager.impl.dispatcher.DispatchEventManager) CompoundButton(android.widget.CompoundButton)

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