Search in sources :

Example 1 with ParseManager

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

the class DefaultNavigationAdapter method setRightItem.

public static void setRightItem(String params, final JSCallback jscallback) {
    BaseToolBar navigationBar;
    if (TextUtils.isEmpty(params)) {
        navigationBar = getToolBar();
        if (navigationBar == null)
            return;
        navigationBar.getRightText().setVisibility(View.GONE);
        navigationBar.getRightIcon().setVisibility(View.GONE);
        return;
    }
    ParseManager parseManager = ManagerFactory.getManagerService(ParseManager.class);
    NavigatorBarModel navigatorBarModel = parseManager.parseObject(params, NavigatorBarModel.class);
    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.eros.framework.model.BaseResultBean) NavigatorBarModel(com.eros.framework.model.NavigatorBarModel) BaseToolBar(com.eros.widget.view.BaseToolBar) ParseManager(com.eros.framework.manager.impl.ParseManager) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView)

Example 2 with ParseManager

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

the class DefaultNavigationAdapter method setNavigationInfo.

public static void setNavigationInfo(String params, final JSCallback jscallback) {
    BaseToolBar navigationBar;
    if (TextUtils.isEmpty(params)) {
        navigationBar = getToolBar();
        if (navigationBar == null)
            return;
        navigationBar.setVisibility(View.GONE);
        return;
    }
    ParseManager parseManager = ManagerFactory.getManagerService(ParseManager.class);
    // NavigatorBarModel navigatorBarModel = parseManager.parseObject(params, NavigatorBarModel
    // .class);
    NatigatorModel navigatorModel = parseManager.parseObject(params, NatigatorModel.class);
    navigationBar = getToolBar();
    if (navigationBar == null)
        return;
    navigationBar.setVisibility(navigatorModel.isNavShow() ? View.VISIBLE : View.GONE);
    if (navigationBar.getVisibility() == View.GONE)
        return;
    navigationBar.getTitleTextView().setText(navigatorModel.getTitle());
    if (navigatorModel.getStatusBarStyle() == null || "".equals(navigatorModel.getStatusBarStyle()) || "Default".equals(navigatorModel.getStatusBarStyle())) {
        navigationBar.getTitleTextView().setTextColor(ColorUtils.getColor("#000000"));
    } else {
        navigationBar.getTitleTextView().setTextColor(ColorUtils.getColor("#ffffff"));
    }
    if (jscallback != null)
        navigationBar.setOnTitleListenner(new BaseToolBar.OnTitleClick() {

            @Override
            public void onClick(View v) {
                jscallback.invokeAndKeepAlive(new BaseResultBean());
            }
        });
}
Also used : NatigatorModel(com.eros.framework.model.NatigatorModel) BaseResultBean(com.eros.framework.model.BaseResultBean) BaseToolBar(com.eros.widget.view.BaseToolBar) ParseManager(com.eros.framework.manager.impl.ParseManager) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView)

Example 3 with ParseManager

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

the class DefaultNavigationAdapter method setTabbarNavigation.

public static void setTabbarNavigation(Activity activity, NavigatorModel navigatorModel) {
    if (activity instanceof AbstractWeexActivity) {
        RouterModel routerModel = ((AbstractWeexActivity) activity).getRouterParam();
        ParseManager parseManager = ManagerFactory.getManagerService(ParseManager.class);
        NatigatorModel model = parseManager.parseObject(navigatorModel.navigatorModel, NatigatorModel.class);
        routerModel.navShow = model.isNavShow();
        routerModel.navTitle = model.getTitle();
        routerModel.canBack = false;
        ((AbstractWeexActivity) activity).setRouterParam(routerModel);
        ((AbstractWeexActivity) activity).setNavigationBar();
        StatusBarManager.setHeaderBg(routerModel, (AbstractWeexActivity) activity);
    }
}
Also used : NatigatorModel(com.eros.framework.model.NatigatorModel) RouterModel(com.eros.framework.model.RouterModel) AbstractWeexActivity(com.eros.framework.activity.AbstractWeexActivity) ParseManager(com.eros.framework.manager.impl.ParseManager)

Example 4 with ParseManager

use of com.eros.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").toUpperCase()) {
        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.eros.framework.manager.impl.AxiosManager) JSONObject(com.alibaba.fastjson.JSONObject) AxiosGet(com.eros.framework.model.AxiosGet) AxiosPost(com.eros.framework.model.AxiosPost) ParseManager(com.eros.framework.manager.impl.ParseManager)

Example 5 with ParseManager

use of com.eros.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.eros.framework.model.ModalBean) DialogInterface(android.content.DialogInterface) ParseManager(com.eros.framework.manager.impl.ParseManager)

Aggregations

ParseManager (com.eros.framework.manager.impl.ParseManager)20 AbstractWeexActivity (com.eros.framework.activity.AbstractWeexActivity)5 Activity (android.app.Activity)4 View (android.view.View)4 ImageView (android.widget.ImageView)4 TextView (android.widget.TextView)4 BaseResultBean (com.eros.framework.model.BaseResultBean)4 ModalBean (com.eros.framework.model.ModalBean)4 RouterModel (com.eros.framework.model.RouterModel)4 BaseToolBar (com.eros.widget.view.BaseToolBar)4 DialogInterface (android.content.DialogInterface)3 NavigatorBarModel (com.eros.framework.model.NavigatorBarModel)3 Intent (android.content.Intent)2 AxiosManager (com.eros.framework.manager.impl.AxiosManager)2 JsVersionInfoBean (com.eros.framework.model.JsVersionInfoBean)2 NatigatorModel (com.eros.framework.model.NatigatorModel)2 Context (android.content.Context)1 Bitmap (android.graphics.Bitmap)1 CompoundButton (android.widget.CompoundButton)1 JSONObject (com.alibaba.fastjson.JSONObject)1