Search in sources :

Example 1 with ParseManager

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

the class DefaultImageAdapter method UpMultipleImageData.

public void UpMultipleImageData(Context context, ArrayList<ImageItem> items, UploadImageBean bean) {
    ModalManager.BmLoading.showLoading(context, null, false);
    ArrayList imagesFilrUrl = new ArrayList();
    if (items != null && items.size() > 0) {
        for (ImageItem item : items) {
            Bitmap bitmap = ImageUtil.getBitmap(item.path, context);
            // TODO 图片改为全路径
            String path = new File(FileManager.getTempFilePath(context), String.valueOf(SystemClock.currentThreadTimeMillis())).getAbsolutePath();
            String imageFileUrl = ImageUtil.zoomImage(context, bitmap, bean == null ? 0 : (int) bean.imageWidth, Constant.ImageConstants.BIGGESTWIDTH, path);
            imagesFilrUrl.add(imageFileUrl);
            bitmap.recycle();
        }
    }
    HashMap<String, String> uploadParams = null;
    HashMap<String, String> heads = null;
    if (bean != null) {
        String params = bean.params;
        ParseManager parseManager = ManagerFactory.getManagerService(ParseManager.class);
        uploadParams = parseManager.parseObject(params, HashMap.class);
        heads = parseManager.parseObject(bean.header, HashMap.class);
    }
    AxiosManager axiosManager = ManagerFactory.getManagerService(AxiosManager.class);
    String url = TextUtils.isEmpty(bean.url) ? Api.UPLOAD_URL : bean.url;
    axiosManager.upload(url, imagesFilrUrl, uploadParams, heads);
}
Also used : Bitmap(android.graphics.Bitmap) AxiosManager(com.benmu.framework.manager.impl.AxiosManager) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ImageItem(com.lzy.imagepicker.bean.ImageItem) ParseManager(com.benmu.framework.manager.impl.ParseManager) File(java.io.File)

Example 2 with ParseManager

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

the class DefaultNavigationAdapter method setCenterItem.

public static void setCenterItem(String params, final JSCallback jscallback) {
    ParseManager parseManager = ManagerFactory.getManagerService(ParseManager.class);
    NavigatorBarModel navigatorBarModel = parseManager.parseObject(params, NavigatorBarModel.class);
    BaseToolBar navigationBar = getToolBar();
    if (navigationBar == null)
        return;
    setTextView(navigationBar.getTitleTextView(), navigatorBarModel);
    if (jscallback != null)
        navigationBar.setOnTitleListenner(new BaseToolBar.OnTitleClick() {

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

Example 3 with ParseManager

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

the class DefaultShareAdapter method share.

public void share(Activity activity, String params, JSCallback success, JSCallback fail) {
    if (activity == null || TextUtils.isEmpty(params))
        return;
    this.mAct = activity;
    this.mSuccess = success;
    this.mFailed = fail;
    ParseManager parseManager = ManagerFactory.getManagerService(ParseManager.class);
    ShareInfoBean shareInfo = null;
    try {
        shareInfo = parseManager.parseObject(params, ShareInfoBean.class);
    } catch (Exception e) {
        e.printStackTrace();
    }
    if (shareInfo == null)
        return;
    if (shareInfo.isPopUp()) {
        if (shareInfo.getPlatforms() == null || shareInfo.getPlatforms().size() > 1) {
            JsPoster.postFailed("请确定分享平台", fail);
            return;
        }
        shareDirectly(shareInfo, shareInfo.getPlatforms().get(0));
    } else {
        showShareDialog(shareInfo);
    }
}
Also used : ShareInfoBean(com.benmu.framework.model.ShareInfoBean) ParseManager(com.benmu.framework.manager.impl.ParseManager)

Example 4 with ParseManager

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

the class DefaultRouterAdapter method open.

public boolean open(Context context, String params, JSCallback jsCallback) {
    ParseManager parseManager = ManagerFactory.getManagerService(ParseManager.class);
    RouterModel routerModel = parseManager.parseObject(params, RouterModel.class);
    if (jsCallback != null) {
        routerModel.backCallback = (SimpleJSCallback) jsCallback;
    }
    return !(routerModel == null || !(context instanceof Activity)) && performStartActivity((Activity) context, routerModel, Constant.BMPAGE_CATEGORY);
}
Also used : RouterModel(com.benmu.framework.model.RouterModel) AbstractWeexActivity(com.benmu.framework.activity.AbstractWeexActivity) Activity(android.app.Activity) ParseManager(com.benmu.framework.manager.impl.ParseManager)

Example 5 with ParseManager

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

the class DefaultRouterAdapter method back.

public boolean back(Context context, String params) {
    ParseManager parseManager = ManagerFactory.getManagerService(ParseManager.class);
    RouterModel routerModel = parseManager.parseObject(params, RouterModel.class);
    int backLength = routerModel.length;
    if (backLength >= RouterTracker.length()) {
        RouterTracker.clearActivitySurplus(1);
    } else {
        for (int i = 0; i < backLength; i++) {
            RouterTracker.popActivity();
        }
    }
    Object backParams = routerModel.params;
    if (backParams instanceof Map) {
        if (((Map) backParams).size() > 0) {
            Activity activity = RouterTracker.peekActivity();
            if (activity instanceof AbstractWeexActivity) {
                // 设置back参数
                ((AbstractWeexActivity) activity).setRouterParam(routerModel);
            }
        }
    }
    return true;
}
Also used : RouterModel(com.benmu.framework.model.RouterModel) AbstractWeexActivity(com.benmu.framework.activity.AbstractWeexActivity) Activity(android.app.Activity) AbstractWeexActivity(com.benmu.framework.activity.AbstractWeexActivity) ParseManager(com.benmu.framework.manager.impl.ParseManager) Map(java.util.Map)

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