From 20bd0d884c3c586d154ccba7bbb3916e7a309d99 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Mon, 26 Sep 2022 12:00:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BF=AE=E6=94=B9=E5=AD=97?= =?UTF-8?q?=E4=BD=93=E9=A2=9C=E8=89=B2=E7=9A=84js=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../live/activity/ZhuangBanActivity.java | 39 +++++++++++++++---- .../main/activity/ZhuangBanActivity.java | 17 ++++++++ 2 files changed, 49 insertions(+), 7 deletions(-) diff --git a/live/src/main/java/com/yunbao/live/activity/ZhuangBanActivity.java b/live/src/main/java/com/yunbao/live/activity/ZhuangBanActivity.java index aa66c34ba..98de19317 100644 --- a/live/src/main/java/com/yunbao/live/activity/ZhuangBanActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/ZhuangBanActivity.java @@ -1,5 +1,9 @@ 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.ClipboardManager; import android.content.Context; @@ -36,6 +40,8 @@ import com.opensource.svgaplayer.SVGAVideoEntity; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; 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.L; import com.yunbao.common.utils.SVGAViewUtils; @@ -46,10 +52,6 @@ import com.yunbao.live.R; import java.net.MalformedURLException; 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 { private ProgressBar mProgressBar; @@ -82,9 +84,9 @@ public class ZhuangBanActivity extends AbsActivity { title.setVisibility(View.GONE); } if (getIntent().hasExtra("title")) { - if (TextUtils.isEmpty(titleString)){ + if (TextUtils.isEmpty(titleString)) { title.setVisibility(View.GONE); - }else { + } else { if (TextUtils.equals(titleString, "blank")) { title.setVisibility(View.GONE); RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) rootView.getLayoutParams(); @@ -114,7 +116,13 @@ public class ZhuangBanActivity extends AbsActivity { copy(content); } } else { - view.loadUrl(url); + mWebView.post(new Runnable() { + @Override + public void run() { + view.loadUrl(url); + } + }); + } return true; } @@ -273,6 +281,23 @@ public class ZhuangBanActivity extends AbsActivity { 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调用原生 diff --git a/main/src/main/java/com/yunbao/main/activity/ZhuangBanActivity.java b/main/src/main/java/com/yunbao/main/activity/ZhuangBanActivity.java index fe0365787..9150749eb 100644 --- a/main/src/main/java/com/yunbao/main/activity/ZhuangBanActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/ZhuangBanActivity.java @@ -33,7 +33,9 @@ import com.opensource.svgaplayer.SVGAVideoEntity; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; import com.yunbao.common.activity.AbsActivity; +import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.interfaces.CommonCallback; +import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.GifCacheUtil; import com.yunbao.common.utils.L; @@ -301,6 +303,21 @@ public class ZhuangBanActivity extends AbsActivity { 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 valueCallback) {