Commit bd9a79ff by 霍志良

feat:底部弹窗修改

parent 5c3f35b7
...@@ -75,6 +75,7 @@ dependencies { ...@@ -75,6 +75,7 @@ dependencies {
implementation 'com.daimajia.androidanimations:library:2.3@aar' implementation 'com.daimajia.androidanimations:library:2.3@aar'
api 'fr.tvbarthel.blurdialogfragment:lib:2.1.5' api 'fr.tvbarthel.blurdialogfragment:lib:2.1.5'
api "com.alibaba:arouter-api:$arouter_api" api "com.alibaba:arouter-api:$arouter_api"
api 'com.tencent.tbs.tbssdk:sdk:43903'
// 注意此处的依赖方式:kotlin中使用和java中使用方式有不同 // 注意此处的依赖方式:kotlin中使用和java中使用方式有不同
kapt "com.alibaba:arouter-compiler:$arouter_compiler" kapt "com.alibaba:arouter-compiler:$arouter_compiler"
implementation 'com.alibaba:fastjson:1.2.38' implementation 'com.alibaba:fastjson:1.2.38'
......
package com.ydl.confide.home.event package com.ydl.confide.home.event
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 android.net.Uri import android.net.Uri
import androidx.appcompat.app.AppCompatActivity import android.os.Build
import android.text.TextUtils import android.text.TextUtils
import android.view.MotionEvent
import android.view.View import android.view.View
import androidx.appcompat.app.AppCompatActivity
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.tencent.smtt.sdk.WebSettings
import com.ydl.confide.R
import com.ydl.confide.home.ConfideHomeActivity import com.ydl.confide.home.ConfideHomeActivity
import com.ydl.confide.home.adapter.ConfideHomeAdapter import com.ydl.confide.home.adapter.ConfideHomeAdapter
import com.ydl.confide.home.bean.ConfideHomeAllFiltersBean import com.ydl.confide.home.bean.ConfideHomeAllFiltersBean
...@@ -24,11 +31,15 @@ import com.ydl.media.audio.AudioPlayer ...@@ -24,11 +31,15 @@ import com.ydl.media.audio.AudioPlayer
import com.ydl.media.audio.model.Music import com.ydl.media.audio.model.Music
import com.ydl.media.view.PlayerFloatHelper import com.ydl.media.view.PlayerFloatHelper
import com.ydl.media.view.PlayerFloatView import com.ydl.media.view.PlayerFloatView
import com.ydl.webview.ProgressWebView
import com.ydl.webview.TellData
import com.ydl.webview.WebModularServiceUtils.Companion.getWebService
import com.ydl.ydl_router.manager.YDLRouterManager import com.ydl.ydl_router.manager.YDLRouterManager
import com.ydl.ydl_router.manager.YDLRouterParams import com.ydl.ydl_router.manager.YDLRouterParams
import com.ydl.ydlcommon.base.BaseActivity import com.ydl.ydlcommon.base.BaseActivity
import com.ydl.ydlcommon.router.IYDLRouterConstant import com.ydl.ydlcommon.router.IYDLRouterConstant
import com.ydl.ydlcommon.utils.remind.ToastHelper import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.ToastUtil import com.yidianling.common.tools.ToastUtil
import com.yidianling.im.api.bean.IMRequestCallback import com.yidianling.im.api.bean.IMRequestCallback
...@@ -125,8 +136,53 @@ class ConfideHomeEventImpl(context: Context, var confideHomeView: IConfideHomeCo ...@@ -125,8 +136,53 @@ class ConfideHomeEventImpl(context: Context, var confideHomeView: IConfideHomeCo
* 最佳倾诉榜单--点我倾诉 * 最佳倾诉榜单--点我倾诉
* @param linkUrl 跳转地址 * @param linkUrl 跳转地址
*/ */
@SuppressLint("JavascriptInterface", "ClickableViewAccessibility")
override fun consultantClick(linkUrl: String?) { override fun consultantClick(linkUrl: String?) {
link(linkUrl) val bottomSheetDialog= mContext?.let { BottomSheetDialog(it) }
bottomSheetDialog?.setContentView(R.layout.confide_webview)
bottomSheetDialog?.show()
var wv_content = bottomSheetDialog?.findViewById<ProgressWebView>(com.ydl.webview.R.id.wv_content)
val setting: WebSettings = wv_content?.settings!!
//支持js
//支持js
setting.setJavaScriptEnabled(true)
//设置字符编码
//设置字符编码
setting.setDefaultTextEncodingName("GBK")
setting.setDomStorageEnabled(true)
val appCachePath: String = mContext?.getCacheDir()?.getAbsolutePath().toString()
setting.setAppCachePath(appCachePath)
setting.setAllowFileAccessFromFileURLs(true)
setting.setAppCacheEnabled(true)
setting.setAllowFileAccess(true)
// 解决图片不显示
// 解决图片不显示
setting.setBlockNetworkImage(false)
wv_content!!.scrollBarStyle = View.SCROLLBARS_INSIDE_OVERLAY //滚动条风格,为0指滚动条不占用空间,直接覆盖在网页上
var jtoJHandle = getWebService().getJavascripHandler(mContext as Activity,tellData = TellData())
wv_content!!.addJavascriptInterface(jtoJHandle, "javascriptHandler")
bottomSheetDialog?.behavior?.peekHeight=1500
//true是跳过peekHeight,直接滑下去,false是可以滑动到顶部还可以保持peekHeight在滑下去
// bottomSheetDialog?.behavior?.skipCollapsed=true
wv_content.loadUrl("https://m.ydl.com/jy/experts/23035?v=4.0.99&uid=9404770&ts=1652787528&toConfide=1&" +
"platform_main_theme_light=00D4DF&platform_main_theme_bright=EAFAFC&platform_main_theme=00C9E2&isFromApp=1&" +
"id=1927&ffrom=android_zhuzhan&barHeight=81&accessToken=87cba5b57f9bb196856ade3522805c11MjIwMw&sign=" +
"6ce496690d7d5a184935f986c3631cc2")
wv_content.setOnTouchListener(object :View.OnTouchListener{
override fun onTouch(p0: View?, p1: MotionEvent?): Boolean {
//canScrollVertically(-1)的值表示是否能向下滚动,false表示已经滚动到顶部
if (!wv_content.canScrollVertically(-1)) {
wv_content.requestDisallowInterceptTouchEvent(false);
}else{
wv_content.requestDisallowInterceptTouchEvent(true);
}
return false;
}
})
// link(linkUrl)
} }
/** /**
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.ydl.webview.ProgressWebView
android:id="@+id/wv_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/platform_transparent"/>
</RelativeLayout>
\ No newline at end of file
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