use of vip.kuaifan.weiui.PageActivity in project weiui by kuaifan.
the class weiuiModule method reloadPage.
/**
* 重新加载页面(刷新)
* @param object
*/
@JSMethod
public void reloadPage(String object) {
JSONObject json = weiuiJson.parseObject(object);
if (json.size() == 0) {
json.put("pageName", object);
}
String pageName = json.getString("pageName");
if (pageName == null || pageName.isEmpty()) {
if (mWXSDKInstance.getContext() instanceof PageActivity) {
((PageActivity) mWXSDKInstance.getContext()).reload();
}
return;
}
weiuiPage.reloadWin(pageName);
}
use of vip.kuaifan.weiui.PageActivity in project weiui by kuaifan.
the class weiuiModule method getPageInfo.
/**
* 获取页面信息
* @param object
* @return
*/
@JSMethod(uiThread = false)
public Object getPageInfo(String object) {
JSONObject json = weiuiJson.parseObject(object);
if (json.size() == 0) {
json.put("pageName", object);
}
String pageName = json.getString("pageName");
if (pageName == null || pageName.isEmpty()) {
if (mWXSDKInstance.getContext() instanceof PageActivity) {
return ((PageActivity) mWXSDKInstance.getContext()).getPageInfo().toMap();
}
return null;
}
return weiuiPage.getWinInfo(pageName).toMap();
}
use of vip.kuaifan.weiui.PageActivity in project weiui by kuaifan.
the class weiuiModule method setPageBackPressed.
/**
* 拦截返回按键事件
* @param object
* @param callback 为null时取消拦截
*/
@JSMethod
public void setPageBackPressed(String object, JSCallback callback) {
JSONObject json = weiuiJson.parseObject(object);
if (json.size() == 0) {
json.put("pageName", object);
}
String pageName = json.getString("pageName");
if (pageName == null || pageName.isEmpty()) {
if (mWXSDKInstance.getContext() instanceof PageActivity) {
pageName = ((PageActivity) mWXSDKInstance.getContext()).getPageInfo().getPageName();
}
}
PageBean mPageBean = weiuiPage.getWinInfo(pageName);
if (mPageBean == null) {
return;
}
PageActivity mPageActivity = ((PageActivity) mPageBean.getContext());
if (callback == null) {
mPageActivity.setOnBackPressed(null);
} else {
mPageActivity.setOnBackPressed(() -> {
callback.invokeAndKeepAlive(null);
return true;
});
}
}
use of vip.kuaifan.weiui.PageActivity in project weiui by kuaifan.
the class weiuiPage method getWinInfo.
public static PageBean getWinInfo(String name) {
if (name == null) {
return null;
}
PageBean mBean = getPageBean(name);
if (mBean == null) {
return null;
}
Activity activity = mBean.getActivity();
if (activity == null) {
return null;
}
if (activity instanceof PageActivity) {
return ((PageActivity) activity).getPageInfo();
}
return null;
}
use of vip.kuaifan.weiui.PageActivity in project weiui by kuaifan.
the class weiuiPage method reloadWin.
public static void reloadWin(String name) {
if (name == null) {
return;
}
PageBean mBean = getPageBean(name);
if (mBean == null) {
return;
}
Activity activity = mBean.getActivity();
if (activity == null) {
return;
}
if (activity instanceof PageActivity) {
((PageActivity) activity).reload();
}
}
Aggregations