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());
}
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);
}
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);
}
}
}
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();
}
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));
}
});
}
Aggregations