Commit 6368f2cb by YKai

feat: 新增js方法拆分

parent 4dfc6b87
...@@ -30,4 +30,6 @@ android { ...@@ -30,4 +30,6 @@ android {
dependencies { dependencies {
implementation "com.alibaba:arouter-api:$arouter_api" implementation "com.alibaba:arouter-api:$arouter_api"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
compileOnly(project(":ydl-webview"))
} }
\ No newline at end of file
...@@ -4,6 +4,7 @@ import android.app.Activity ...@@ -4,6 +4,7 @@ import android.app.Activity
import android.content.Context import android.content.Context
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import com.alibaba.android.arouter.facade.template.IProvider import com.alibaba.android.arouter.facade.template.IProvider
import com.ydl.webview.H5JsBean
import com.yidianling.consultant.bean.GuideBean import com.yidianling.consultant.bean.GuideBean
import com.yidianling.consultant.bean.Keyworks import com.yidianling.consultant.bean.Keyworks
import com.yidianling.consultant.OnBottomWordListener import com.yidianling.consultant.OnBottomWordListener
...@@ -51,4 +52,7 @@ interface IConsultantService: IProvider { ...@@ -51,4 +52,7 @@ interface IConsultantService: IProvider {
//获取底纹词 //获取底纹词
fun getbottomWord(type: Int, listener: OnBottomWordListener) fun getbottomWord(type: Int, listener: OnBottomWordListener)
// 预览资源
fun resourceToPreview(dataList:List<H5JsBean.MediaInfo>?,params:H5JsBean.H5JsCmd.Params,activity: Activity)
} }
\ No newline at end of file
...@@ -14,7 +14,7 @@ buildscript { ...@@ -14,7 +14,7 @@ buildscript {
ydlrouter_version = '1.2.3' ydlrouter_version = '1.2.3'
constrait_support_version = '1.0.2' constrait_support_version = '1.0.2'
componentVersion = "0.3.0.12" componentVersion = "0.3.0.12-yk"
} }
repositories { repositories {
mavenCentral() mavenCentral()
......
...@@ -4,25 +4,30 @@ import android.annotation.SuppressLint ...@@ -4,25 +4,30 @@ import android.annotation.SuppressLint
import android.app.Activity import android.app.Activity
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import androidx.fragment.app.Fragment import android.graphics.Rect
import android.text.TextUtils import android.text.TextUtils
import androidx.fragment.app.Fragment
import com.alibaba.android.arouter.facade.annotation.Route import com.alibaba.android.arouter.facade.annotation.Route
import com.blankj.utilcode.util.ScreenUtils
import com.google.gson.Gson import com.google.gson.Gson
import com.google.gson.reflect.TypeToken import com.google.gson.reflect.TypeToken
import com.ydl.webview.H5JsBean
import com.ydl.ydlcommon.base.BaseApp import com.ydl.ydlcommon.base.BaseApp
import com.ydl.ydlcommon.data.http.RxUtils import com.ydl.ydlcommon.data.http.RxUtils
import com.ydl.ydlcommon.utils.SharedPreferencesEditor import com.ydl.ydlcommon.utils.SharedPreferencesEditor
import com.ydl.ydlcommon.utils.remind.HttpErrorUtils import com.ydl.ydlcommon.utils.remind.HttpErrorUtils
import com.yidianling.consultant.ExpertSearchActivity import com.yidianling.consultant.ExpertSearchActivity
import com.yidianling.consultant.ExpertSearchFragment import com.yidianling.consultant.ExpertSearchFragment
import com.yidianling.consultant.OnBottomWordListener
import com.yidianling.consultant.api.IConsultantService import com.yidianling.consultant.api.IConsultantService
import com.yidianling.consultant.bean.GuideBean import com.yidianling.consultant.bean.GuideBean
import com.yidianling.consultant.bean.Keyworks import com.yidianling.consultant.bean.Keyworks
import com.yidianling.consultant.data.ConsultantDataManager import com.yidianling.consultant.data.ConsultantDataManager
import com.yidianling.consultant.OnBottomWordListener
import com.yidianling.consultant.model.SearchApi import com.yidianling.consultant.model.SearchApi
import com.yidianling.consultant.modular.singlton.ConsultAssistantDialogUtils import com.yidianling.consultant.modular.singlton.ConsultAssistantDialogUtils
import com.yidianling.consultant.modular.utils.ConsultAssistantEntryUtils import com.yidianling.consultant.modular.utils.ConsultAssistantEntryUtils
import com.yidianling.consultant.preview.GPreviewBuilder
import com.yidianling.consultant.preview.UserViewInfo
import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers import io.reactivex.schedulers.Schedulers
...@@ -149,6 +154,31 @@ class ConsultantServiceImp : IConsultantService { ...@@ -149,6 +154,31 @@ class ConsultantServiceImp : IConsultantService {
}) })
} }
override fun resourceToPreview(dataList:List<H5JsBean.MediaInfo>?,params:H5JsBean.H5JsCmd.Params,activity: Activity) {
val mThumbViewInfoList: MutableList<UserViewInfo> = ArrayList()
dataList?.let {
for (mediaInfo in it) {
val userViewInfo = UserViewInfo(mediaInfo.cover, mediaInfo.url, mediaInfo.sourcesType)
val bounds = Rect()
bounds.left = ScreenUtils.getScreenWidth() / 2
bounds.top = ScreenUtils.getScreenHeight() / 2
bounds.right = ScreenUtils.getScreenWidth() / 2
bounds.bottom = ScreenUtils.getScreenHeight() / 2
userViewInfo.bounds = bounds
mThumbViewInfoList.add(userViewInfo)
}
GPreviewBuilder.form(activity)
.setData(mThumbViewInfoList)
.setCurrentIndex(params.preview_index)
.setFullscreen(true)
.setToUid(params.info?.toUid.toString() + "")
.setDoctorId(params.info?.doctorId)
.setType(GPreviewBuilder.IndicatorType.Dot)
.start()
}
}
override fun resetConsultAssistantDialogStatus() { override fun resetConsultAssistantDialogStatus() {
ConsultAssistantDialogUtils.INSTANCE.resetStatus() ConsultAssistantDialogUtils.INSTANCE.resetStatus()
} }
......
...@@ -113,7 +113,7 @@ class JsMethod(private val webView: WebView?) { ...@@ -113,7 +113,7 @@ class JsMethod(private val webView: WebView?) {
if (callback.isNullOrBlank()) return true if (callback.isNullOrBlank()) return true
webView?.post { webView?.post {
when (type) { when (type) {
1 -> {//检查音频权限能力 1,2 -> {//检查音频权限能力
webView.loadUrl("javascript:$callback(1)") webView.loadUrl("javascript:$callback(1)")
} }
else -> { else -> {
......
...@@ -29,6 +29,7 @@ import com.ydl.webview.NewH5Activity; ...@@ -29,6 +29,7 @@ import com.ydl.webview.NewH5Activity;
import com.ydl.ydl_router.manager.YDLRouterManager; import com.ydl.ydl_router.manager.YDLRouterManager;
import com.ydl.ydlcommon.base.config.HttpConfig; import com.ydl.ydlcommon.base.config.HttpConfig;
import com.ydl.ydlcommon.modular.ModularServiceManager; import com.ydl.ydlcommon.modular.ModularServiceManager;
import com.ydl.ydlcommon.modular.ModularServiceManagerKt;
import com.ydl.ydlcommon.router.IYDLRouterConstant; import com.ydl.ydlcommon.router.IYDLRouterConstant;
import com.ydl.ydlcommon.router.YdlCommonOut; import com.ydl.ydlcommon.router.YdlCommonOut;
import com.ydl.ydlcommon.utils.ActivityManager; import com.ydl.ydlcommon.utils.ActivityManager;
...@@ -1146,6 +1147,18 @@ public class NewH5_WVClickAbstractListener implements NewH5_WebViewClientClickLi ...@@ -1146,6 +1147,18 @@ public class NewH5_WVClickAbstractListener implements NewH5_WebViewClientClickLi
@Override @Override
public void chatCloseBottomWebView() { public void chatCloseBottomWebView() {
EventBus.getDefault().post(new CloseBottomWebviewEvent(true)); EventBus.getDefault().post(new CloseBottomWebviewEvent(true));
ModularServiceManager.INSTANCE.provide(IImService.class).dismissConsultServiceDialog();
}
@Override
public void resourceToPreview(H5JsBean.H5JsCmd.Params params) {
List<H5JsBean.MediaInfo> dataList = params.getDataList();
ModularServiceManagerKt.findRouteService(IConsultantService.class).resourceToPreview(dataList,params,mActivity);
}
@Override
public void showDocBooking(H5JsBean.H5JsCmd.Params params) {
ModularServiceManager.INSTANCE.provide(IImService.class).showConsultServiceDialog(mActivity, params.getToUid() + "", params.getDoctorId() + "");
} }
@Override @Override
...@@ -1223,4 +1236,11 @@ public class NewH5_WVClickAbstractListener implements NewH5_WebViewClientClickLi ...@@ -1223,4 +1236,11 @@ public class NewH5_WVClickAbstractListener implements NewH5_WebViewClientClickLi
((NewH5Activity) mActivity).setBG(rgb, alpha); ((NewH5Activity) mActivity).setBG(rgb, alpha);
} }
} }
@Override
public void showCommentArticleDialog(H5JsBean.H5JsCmd.Params params) {
if (mActivity instanceof NewH5Activity){
((NewH5Activity)mActivity).showCommentArticleDialog(params.getTitle());
}
}
} }
...@@ -37,7 +37,7 @@ public interface NewH5_WebViewClientClickListener { ...@@ -37,7 +37,7 @@ public interface NewH5_WebViewClientClickListener {
void openTest(H5JsBean.H5JsCmd.Params params); void openTest(H5JsBean.H5JsCmd.Params params);
//注册引导页--跳转私聊界面 //注册引导页--跳转私聊界面
void chat(int id, int toUid, int canTalk, String accessToken, int isFromQingShu, boolean closeReplaceChat); void chat(int id, int toUid, int canTalk, String accessToken, int isFromQingShu,boolean closeReplaceChat);
void chatSendMessage(int id, int toUid, int canTalk, String accessToken, int isFromQingShu); void chatSendMessage(int id, int toUid, int canTalk, String accessToken, int isFromQingShu);
...@@ -224,4 +224,10 @@ public interface NewH5_WebViewClientClickListener { ...@@ -224,4 +224,10 @@ public interface NewH5_WebViewClientClickListener {
* 关闭私聊窗口立即咨询webview * 关闭私聊窗口立即咨询webview
*/ */
void chatCloseBottomWebView(); void chatCloseBottomWebView();
void showCommentArticleDialog(H5JsBean.H5JsCmd.Params params);
void resourceToPreview(H5JsBean.H5JsCmd.Params params);
void showDocBooking(H5JsBean.H5JsCmd.Params params);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment