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