新增修改字体颜色的js接口

This commit is contained in:
18401019693 2022-09-26 12:00:04 +08:00
parent 9509ac721e
commit 20bd0d884c
2 changed files with 49 additions and 7 deletions

View File

@ -1,5 +1,9 @@
package com.yunbao.live.activity; package com.yunbao.live.activity;
import static com.yunbao.common.CommonAppContext.logger;
import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics;
import static com.yunbao.common.utils.RouteUtil.PATH_COIN;
import android.content.ClipData; import android.content.ClipData;
import android.content.ClipboardManager; import android.content.ClipboardManager;
import android.content.Context; import android.content.Context;
@ -36,6 +40,8 @@ import com.opensource.svgaplayer.SVGAVideoEntity;
import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants; import com.yunbao.common.Constants;
import com.yunbao.common.activity.AbsActivity; import com.yunbao.common.activity.AbsActivity;
import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.L; import com.yunbao.common.utils.L;
import com.yunbao.common.utils.SVGAViewUtils; import com.yunbao.common.utils.SVGAViewUtils;
@ -46,10 +52,6 @@ import com.yunbao.live.R;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import static com.yunbao.common.CommonAppContext.logger;
import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics;
import static com.yunbao.common.utils.RouteUtil.PATH_COIN;
public class ZhuangBanActivity extends AbsActivity { public class ZhuangBanActivity extends AbsActivity {
private ProgressBar mProgressBar; private ProgressBar mProgressBar;
@ -82,9 +84,9 @@ public class ZhuangBanActivity extends AbsActivity {
title.setVisibility(View.GONE); title.setVisibility(View.GONE);
} }
if (getIntent().hasExtra("title")) { if (getIntent().hasExtra("title")) {
if (TextUtils.isEmpty(titleString)){ if (TextUtils.isEmpty(titleString)) {
title.setVisibility(View.GONE); title.setVisibility(View.GONE);
}else { } else {
if (TextUtils.equals(titleString, "blank")) { if (TextUtils.equals(titleString, "blank")) {
title.setVisibility(View.GONE); title.setVisibility(View.GONE);
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) rootView.getLayoutParams(); RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) rootView.getLayoutParams();
@ -114,7 +116,13 @@ public class ZhuangBanActivity extends AbsActivity {
copy(content); copy(content);
} }
} else { } else {
view.loadUrl(url); mWebView.post(new Runnable() {
@Override
public void run() {
view.loadUrl(url);
}
});
} }
return true; return true;
} }
@ -273,6 +281,23 @@ public class ZhuangBanActivity extends AbsActivity {
mContext.startActivity(intent); mContext.startActivity(intent);
} }
/**
* 设置超皇字体颜色
*
* @param startColor 渐变色
* @param endColor 渐变色
* @param contentColor 内容颜色
*/
@JavascriptInterface
public void androidSetColor(String startColor, String endColor, String contentColor) {
IMLoginModel model = IMLoginManager.get(mContext).getUserInfo();
model.setStartColor("#"+startColor)
.setEndColor("#"+endColor)
.setContentColor("#"+contentColor);
IMLoginManager.get(mContext).upDataUserInfo(model);
}
} }
// //js调用原生 // //js调用原生

View File

@ -33,7 +33,9 @@ import com.opensource.svgaplayer.SVGAVideoEntity;
import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants; import com.yunbao.common.Constants;
import com.yunbao.common.activity.AbsActivity; import com.yunbao.common.activity.AbsActivity;
import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.interfaces.CommonCallback; import com.yunbao.common.interfaces.CommonCallback;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.GifCacheUtil; import com.yunbao.common.utils.GifCacheUtil;
import com.yunbao.common.utils.L; import com.yunbao.common.utils.L;
@ -301,6 +303,21 @@ public class ZhuangBanActivity extends AbsActivity {
mContext.startActivity(intent); mContext.startActivity(intent);
} }
/**
* 设置超皇字体颜色
*
* @param startColor 渐变色
* @param endColor 渐变色
* @param contentColor 内容颜色
*/
@JavascriptInterface
public void androidSetColor(String startColor, String endColor, String contentColor) {
IMLoginModel model = IMLoginManager.get(mContext).getUserInfo();
model.setStartColor("#"+startColor)
.setEndColor("#"+endColor)
.setContentColor("#"+contentColor);
IMLoginManager.get(mContext).upDataUserInfo(model);
}
} }
private void openImageChooserActivity(ValueCallback<Uri> valueCallback) { private void openImageChooserActivity(ValueCallback<Uri> valueCallback) {