修改侧边栏跳转问题

This commit is contained in:
18401019693
2023-04-14 16:09:02 +08:00
parent 90c7483dbc
commit 32e3584fef
4 changed files with 33 additions and 14 deletions

View File

@@ -461,7 +461,7 @@ public class JavascriptInterfaceUtils {
} else {
url1 = svg;
}
GiftCacheUtil.getFile(mContext,Constants.GIF_CAR_PREFIX + id, url1, "0", new CommonCallback<File>() {
GiftCacheUtil.getFile(mContext, Constants.GIF_CAR_PREFIX + id, url1, "0", new CommonCallback<File>() {
@Override
public void callback(File bean) {
@@ -493,20 +493,21 @@ public class JavascriptInterfaceUtils {
/**
* 设置webView高度
*
* @param useDp 是否用dp换算
*/
@JavascriptInterface
public void setHeight(String height, String width,boolean useDp) {
public void setHeight(String height, String width, boolean useDp) {
if ("0".equals(height)) {
return;
}
Handler handler = new Handler(Looper.getMainLooper());
handler.post(() -> {
ViewGroup.LayoutParams params = mWebView.getLayoutParams();
if("-1".equals(height)){
params.height=ViewGroup.LayoutParams.MATCH_PARENT;
}else {
params.height = useDp?DpUtil.dp2px(Integer.parseInt(height)):Integer.parseInt(height);
if ("-1".equals(height)) {
params.height = ViewGroup.LayoutParams.MATCH_PARENT;
} else {
params.height = useDp ? DpUtil.dp2px(Integer.parseInt(height)) : Integer.parseInt(height);
}
mWebView.setLayoutParams(params);
mWebView.setVisibility(View.VISIBLE);
@@ -515,22 +516,30 @@ public class JavascriptInterfaceUtils {
/**
* 社区分享
*
* @param avatar 头像
* @param link 分享连接
* @param link 分享连接
*/
@JavascriptInterface
public void androidCommunityShare(String avatar,String link){
JSONObject json=new JSONObject();
json.put("avatar",avatar);
json.put("link",link);
public void androidCommunityShare(String avatar, String link) {
JSONObject json = new JSONObject();
json.put("avatar", avatar);
json.put("link", link);
Bus.get().post(new JavascriptInterfaceEvent()
.setMethod("androidCommunityShare")
.setData(json.toJSONString()));
}
@JavascriptInterface
public void androidInviteShare(String url){
public void androidInviteShare(String url) {
Bus.get().post(new JavascriptInterfaceEvent()
.setMethod("androidInviteShare")
.setData(url));
}
@JavascriptInterface
public void closeLiveRoom() {
Bus.get().post(new JavascriptInterfaceEvent()
.setMethod("closeLiveRoom"));
}
}