use of com.benmu.framework.model.RouterModel 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);
}
use of com.benmu.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;
}
use of com.benmu.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(Constant.BMWEBVIEW_CATEGORY);
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);
}
}
}
use of com.benmu.framework.model.RouterModel in project WeexErosFramework by bmfe.
the class EventSetHomePage method setHomePage.
@SuppressWarnings("WrongConstant")
public void setHomePage(Context context, String params) {
StorageManager storageManager = ManagerFactory.getManagerService(StorageManager.class);
storageManager.setData(context, Constant.SP.SP_HOMEPAGE_URL, params);
String homePage = BMWXEnvironment.mPlatformConfig.getPage().getHomePage(context);
RouterModel router = new RouterModel(homePage, Constant.ACTIVITIES_ANIMATION.ANIMATION_PUSH, null, null, false, null);
Intent intent = performStartActivity(router, Constant.BMPAGE_CATEGORY);
context.startActivity(intent);
// PendingIntent restartIntent = PendingIntent.getActivity(
// context.getApplicationContext(), 0, intent, Intent.FLAG_ACTIVITY_CLEAR_TASK);
// AlarmManager mgr = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
// mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 100,
// restartIntent);
}
use of com.benmu.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);
}
}
Aggregations