Search in sources :

Example 1 with RouterModel

use of com.eros.framework.model.RouterModel 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 2 with RouterModel

use of com.eros.framework.model.RouterModel 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.eros.framework.model.RouterModel) AbstractWeexActivity(com.eros.framework.activity.AbstractWeexActivity) Activity(android.app.Activity) AbstractWeexActivity(com.eros.framework.activity.AbstractWeexActivity) ParseManager(com.eros.framework.manager.impl.ParseManager) Map(java.util.Map)

Example 3 with RouterModel

use of com.eros.framework.model.RouterModel 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)

Example 4 with RouterModel

use of com.eros.framework.model.RouterModel in project WeexErosFramework by bmfe.

the class EventGetBackParams method getBackParams.

public void getBackParams(Context context, JSCallback jscallback) {
    RouterManager routerManager = ManagerFactory.getManagerService(RouterManager.class);
    RouterModel routerModel = routerManager.getParams(context);
    if (routerModel != null && jscallback != null) {
        jscallback.invoke(routerModel.params);
    }
}
Also used : RouterManager(com.eros.framework.manager.impl.RouterManager) RouterModel(com.eros.framework.model.RouterModel)

Example 5 with RouterModel

use of com.eros.framework.model.RouterModel in project WeexErosFramework by bmfe.

the class PersistentManager method getCacheRouter.

public RouterModel getCacheRouter() {
    RouterModel router = mCacheRouter;
    mCacheRouter = null;
    return router;
}
Also used : RouterModel(com.eros.framework.model.RouterModel)

Aggregations

RouterModel (com.eros.framework.model.RouterModel)9 AbstractWeexActivity (com.eros.framework.activity.AbstractWeexActivity)4 ParseManager (com.eros.framework.manager.impl.ParseManager)4 Activity (android.app.Activity)3 Intent (android.content.Intent)2 RouterManager (com.eros.framework.manager.impl.RouterManager)2 StorageManager (com.eros.framework.manager.StorageManager)1 DispatchEventManager (com.eros.framework.manager.impl.dispatcher.DispatchEventManager)1 NatigatorModel (com.eros.framework.model.NatigatorModel)1 WebViewParamBean (com.eros.framework.model.WebViewParamBean)1 WeexEventBean (com.eros.framework.model.WeexEventBean)1 Map (java.util.Map)1