Search in sources :

Example 1 with AbstractWeexActivity

use of com.benmu.framework.activity.AbstractWeexActivity 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)

Example 2 with AbstractWeexActivity

use of com.benmu.framework.activity.AbstractWeexActivity in project WeexErosFramework by bmfe.

the class BMWXApplication method registerLifecycle.

private void registerLifecycle() {
    LifecycleManager lifecycleManager = ManagerFactory.getManagerService(LifecycleManager.class);
    lifecycleManager.register(this).setOnTaskSwitchListenner(new LifecycleManager.OnTaskSwitchListener() {

        @Override
        public void onTaskSwitchToForeground() {
            Activity activity = RouterTracker.peekActivity();
            if (activity != null) {
                GlobalEventManager.appActive(((AbstractWeexActivity) activity).getWXSDkInstance());
            }
            // app resume  try check verison
            if (mVersionChecker != null) {
                mVersionChecker.checkVersion();
            }
        }

        @Override
        public void onTaskSwitchToBackground() {
            Activity activity = RouterTracker.peekActivity();
            if (activity != null) {
                GlobalEventManager.appDeactive(((AbstractWeexActivity) activity).getWXSDkInstance());
            }
        }
    });
}
Also used : LifecycleManager(com.benmu.framework.manager.impl.LifecycleManager) AbstractWeexActivity(com.benmu.framework.activity.AbstractWeexActivity) Activity(android.app.Activity) AbstractWeexActivity(com.benmu.framework.activity.AbstractWeexActivity)

Example 3 with AbstractWeexActivity

use of com.benmu.framework.activity.AbstractWeexActivity in project WeexErosFramework by bmfe.

the class DefaultWXHttpAdapter method hideError.

private void hideError() {
    if (!DebugableUtil.isDebug())
        return;
    Activity activity = RouterTracker.peekActivity();
    if (activity != null && activity instanceof AbstractWeexActivity) {
        AbstractWeexActivity abs = (AbstractWeexActivity) activity;
        abs.hideError();
    }
}
Also used : AbstractWeexActivity(com.benmu.framework.activity.AbstractWeexActivity) Activity(android.app.Activity) AbstractWeexActivity(com.benmu.framework.activity.AbstractWeexActivity)

Example 4 with AbstractWeexActivity

use of com.benmu.framework.activity.AbstractWeexActivity in project WeexErosFramework by bmfe.

the class PushManager method handlePush.

public void handlePush(Context context, String data) {
    // 判断当前应用是在前台还是后台
    boolean isForeground = BaseCommonUtil.isAPPRunningForeground(context);
    ParseManager parseManager = ManagerFactory.getManagerService(ParseManager.class);
    NotificationBean bean = parseManager.parseObject(data, NotificationBean.class);
    if (isForeground) {
        // 在前台 通知js
        Activity activity = RouterTracker.peekActivity();
        if (activity instanceof AbstractWeexActivity) {
            WXSDKInstance instance = ((AbstractWeexActivity) activity).getWXSDkInstance();
            GlobalEventManager.pushMessage(instance, getParams(bean, false));
        }
    } else {
        // 在后台  显示通知
        showNotification(context, bean);
    }
}
Also used : NotificationBean(com.benmu.framework.model.NotificationBean) WXSDKInstance(com.taobao.weex.WXSDKInstance) ResultActivity(com.benmu.framework.activity.ResultActivity) AbstractWeexActivity(com.benmu.framework.activity.AbstractWeexActivity) Activity(android.app.Activity) AbstractWeexActivity(com.benmu.framework.activity.AbstractWeexActivity)

Aggregations

Activity (android.app.Activity)4 AbstractWeexActivity (com.benmu.framework.activity.AbstractWeexActivity)4 ResultActivity (com.benmu.framework.activity.ResultActivity)1 LifecycleManager (com.benmu.framework.manager.impl.LifecycleManager)1 ParseManager (com.benmu.framework.manager.impl.ParseManager)1 NotificationBean (com.benmu.framework.model.NotificationBean)1 RouterModel (com.benmu.framework.model.RouterModel)1 WXSDKInstance (com.taobao.weex.WXSDKInstance)1 Map (java.util.Map)1