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;
}
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());
}
}
});
}
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();
}
}
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);
}
}
Aggregations