Search in sources :

Example 1 with WebViewParamBean

use of com.eros.framework.model.WebViewParamBean 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(getWebViewCategory(context));
    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);
        }
    }
}
Also used : RouterModel(com.eros.framework.model.RouterModel) AbstractWeexActivity(com.eros.framework.activity.AbstractWeexActivity) Activity(android.app.Activity) Intent(android.content.Intent) ParseManager(com.eros.framework.manager.impl.ParseManager) WebViewParamBean(com.eros.framework.model.WebViewParamBean)

Aggregations

Activity (android.app.Activity)1 Intent (android.content.Intent)1 AbstractWeexActivity (com.eros.framework.activity.AbstractWeexActivity)1 ParseManager (com.eros.framework.manager.impl.ParseManager)1 RouterModel (com.eros.framework.model.RouterModel)1 WebViewParamBean (com.eros.framework.model.WebViewParamBean)1