Commit 03d08c58 authored by 张释方's avatar 张释方

修改720多余按钮问题

parent 2925c18b
...@@ -42,7 +42,7 @@ class GridMapAdapter(val context: Context, var list: List<VrmapBean.Internal>?) ...@@ -42,7 +42,7 @@ class GridMapAdapter(val context: Context, var list: List<VrmapBean.Internal>?)
//设置点击跳转 //设置点击跳转
RxUtils.onMultiClick(holder.itemView){ RxUtils.onMultiClick(holder.itemView){
//页面跳转 //页面跳转
MintsWebViewActivity.startWebView(name, url = url) MintsWebViewActivity.startWebView(name, url = url,is720 = true)
} }
holder.binding.llstart.setNumber(stars?.toInt()?:5) holder.binding.llstart.setNumber(stars?.toInt()?:5)
} }
......
...@@ -2,6 +2,7 @@ package com.mints.street.webview ...@@ -2,6 +2,7 @@ package com.mints.street.webview
import android.content.Intent import android.content.Intent
import android.os.Bundle import android.os.Bundle
import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.webkit.WebChromeClient import android.webkit.WebChromeClient
import android.webkit.WebView import android.webkit.WebView
...@@ -22,34 +23,39 @@ import me.goldze.mvvmhabit.utils.KLog ...@@ -22,34 +23,39 @@ import me.goldze.mvvmhabit.utils.KLog
*/ */
class MintsWebViewActivity : BaseActivity<ActivityMintsWebViewBinding, MintsWebViewModel>() { class MintsWebViewActivity : BaseActivity<ActivityMintsWebViewBinding, MintsWebViewModel>() {
companion object{ companion object {
//打开地图的webView //打开地图的webView
fun startWebView(name:String?=null,url:String?=null){ fun startWebView(name: String? = null, url: String? = null, is720: Boolean? = false) {
AppManager.getAppManager().currentActivity?.apply { AppManager.getAppManager().currentActivity?.apply {
val intent = Intent(this,MintsWebViewActivity::class.java) val intent = Intent(this, MintsWebViewActivity::class.java)
intent.putExtra("name",name) intent.putExtra("name", name)
intent.putExtra("url",url) intent.putExtra("url", url)
intent.putExtra("is720", is720)
this.startActivity(intent) this.startActivity(intent)
} }
} }
//谷歌地址拼接 //谷歌地址拼接
fun toGoogleVR(u:String?,gk:String?,base:String?,lat:String?,lng:String?,ut:String?):String{ fun toGoogleVR(u: String?, gk: String?, base: String?, lat: String?, lng: String?, ut: String?): String {
KLog.i("MintsWebViewActivity","file:///android_asset/web/streets.html?u=${u KLog.i("MintsWebViewActivity", "file:///android_asset/web/streets.html?u=${u
}&gk=${gk}&base=${base}&lat=${lat}&lng=${lng}&ut=${ut}") }&gk=${gk}&base=${base}&lat=${lat}&lng=${lng}&ut=${ut}")
return "file:///android_asset/web/streets.html?u=${u return "file:///android_asset/web/streets.html?u=${u
}&gk=${gk}&base=${base}&lat=${lat}&lng=${lng}&ut=${ut}" }&gk=${gk}&base=${base}&lat=${lat}&lng=${lng}&ut=${ut}"
} }
//地图上跳转百度的地址拼接 //地图上跳转百度的地址拼接
fun toBaduVR(d:String?,bk:String?):String{ fun toBaduVR(d: String?, bk: String?): String {
KLog.i("MintsWebViewActivity","file:///android_asset/web/mr.html?d=${d}&bk=${bk}") KLog.i("MintsWebViewActivity", "file:///android_asset/web/mr.html?d=${d}&bk=${bk}")
return "file:///android_asset/web/mr.html?d=${d}&bk=${bk}" return "file:///android_asset/web/mr.html?d=${d}&bk=${bk}"
} }
//其他的跳转百度的地址拼接 //其他的跳转百度的地址拼接
fun toBaduVR(lat:String?,lng:String?,bk:String?):String{ fun toBaduVR(lat: String?, lng: String?, bk: String?): String {
KLog.i("MintsWebViewActivity","file:///android_asset/web/m.html?lat=${lat}&lng=${lng}&bk=${bk}") KLog.i("MintsWebViewActivity", "file:///android_asset/web/m.html?lat=${lat}&lng=${lng}&bk=${bk}")
return "file:///android_asset/web/m.html?lat=${lat}&lng=${lng}&bk=${bk}" return "file:///android_asset/web/m.html?lat=${lat}&lng=${lng}&bk=${bk}"
} }
} }
override fun initContentView(savedInstanceState: Bundle?) = R.layout.activity_mints_web_view override fun initContentView(savedInstanceState: Bundle?) = R.layout.activity_mints_web_view
override fun initVariableId() = BR.viewModel override fun initVariableId() = BR.viewModel
...@@ -57,13 +63,13 @@ class MintsWebViewActivity : BaseActivity<ActivityMintsWebViewBinding, MintsWebV ...@@ -57,13 +63,13 @@ class MintsWebViewActivity : BaseActivity<ActivityMintsWebViewBinding, MintsWebV
override fun initData() { override fun initData() {
super.initData() super.initData()
binding.ctbTitle.setTitle(intent.getStringExtra("name")) binding.ctbTitle.setTitle(intent.getStringExtra("name"))
if(intent.getStringExtra("url")!=null && "" != intent.getStringExtra("url")){ if (intent.getStringExtra("url") != null && "" != intent.getStringExtra("url")) {
binding.webview.loadUrl(intent.getStringExtra("url")?:"") binding.webview.loadUrl(intent.getStringExtra("url") ?: "")
} }
binding.webview.webViewClient = object : WebViewClient() { binding.webview.webViewClient = object : WebViewClient() {
override fun shouldOverrideUrlLoading(view: WebView?, url: String?): Boolean { override fun shouldOverrideUrlLoading(view: WebView?, url: String?): Boolean {
KLog.i("MintsWebViewActivity",url) KLog.i("MintsWebViewActivity", url)
//使用WebView加载显示url //使用WebView加载显示url
if (url != null) { if (url != null) {
view?.loadUrl(url) view?.loadUrl(url)
...@@ -80,13 +86,18 @@ class MintsWebViewActivity : BaseActivity<ActivityMintsWebViewBinding, MintsWebV ...@@ -80,13 +86,18 @@ class MintsWebViewActivity : BaseActivity<ActivityMintsWebViewBinding, MintsWebV
binding.webview.setDefaultHandler(object : DefaultHandler() { binding.webview.setDefaultHandler(object : DefaultHandler() {
override fun handler(data: String, function: CallBackFunction) { override fun handler(data: String, function: CallBackFunction) {
showMessage(AppManager.getAppManager().currentActivity showMessage(AppManager.getAppManager().currentActivity
,content = data,confirmListener = OnConfirmListener{ , content = data, confirmListener = OnConfirmListener {
}) })
} }
}) })
if (intent?.getBooleanExtra("is720",false)?:false){
binding.v720Bg.visibility = View.VISIBLE
}else{
binding.v720Bg.visibility = View.GONE
}
} }
......
<resources> <resources>
<string name="app_name">3D高清街景</string> <string name="app_name">世界3D高清街景</string>
</resources> </resources>
\ 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