Commit 2df23ebf authored by fengruiyu's avatar fengruiyu

修改webView页面

parent 694c22e1
...@@ -13,6 +13,7 @@ import com.mints.street.R ...@@ -13,6 +13,7 @@ import com.mints.street.R
import com.mints.street.databinding.ActivityMoresettingsBinding import com.mints.street.databinding.ActivityMoresettingsBinding
import com.mints.street.main.MainActivity import com.mints.street.main.MainActivity
import com.mints.street.manager.UserManager import com.mints.street.manager.UserManager
import com.mints.street.webview.MintsWebViewActivity
import kotlinx.android.synthetic.main.activity_moresettings.* import kotlinx.android.synthetic.main.activity_moresettings.*
import kotlinx.android.synthetic.main.include_header.* import kotlinx.android.synthetic.main.include_header.*
import me.goldze.mvvmhabit.utils.KLog import me.goldze.mvvmhabit.utils.KLog
...@@ -120,10 +121,10 @@ class MoresettingsActivity : BaseActivity<ActivityMoresettingsBinding, Moresetti ...@@ -120,10 +121,10 @@ class MoresettingsActivity : BaseActivity<ActivityMoresettingsBinding, Moresetti
KLog.e("setOnClick", "btn_switch has been clicked.") KLog.e("setOnClick", "btn_switch has been clicked.")
} }
R.id.item_userAgree -> {//用户协议 R.id.item_userAgree -> {//用户协议
ToastUtils.showShort("点击了《注册协议》") MintsWebViewActivity.startWebView(name = "用户协议",url = "http://test.mints-id.com/map-api/map/register.html")
} }
R.id.item_privacyAgree -> {//隐私协议 R.id.item_privacyAgree -> {//隐私协议
ToastUtils.showShort("点击了《隐私协议》") MintsWebViewActivity.startWebView(name = "隐私协议",url = "http://test.mints-id.com/map-api/map/privacy.html")
} }
} }
......
...@@ -15,6 +15,7 @@ import androidx.lifecycle.Observer ...@@ -15,6 +15,7 @@ import androidx.lifecycle.Observer
import cn.sharesdk.framework.ShareSDK import cn.sharesdk.framework.ShareSDK
import cn.sharesdk.wechat.friends.Wechat import cn.sharesdk.wechat.friends.Wechat
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
import com.bytedance.sdk.component.image.LoadConfig
import com.fry.base.base.BaseFragment import com.fry.base.base.BaseFragment
import com.google.android.material.bottomsheet.BottomSheetDialog import com.google.android.material.bottomsheet.BottomSheetDialog
import com.mints.street.BR import com.mints.street.BR
...@@ -27,6 +28,7 @@ import com.mints.street.login.LoginApi ...@@ -27,6 +28,7 @@ import com.mints.street.login.LoginApi
import com.mints.street.login.OnLoginListener import com.mints.street.login.OnLoginListener
import com.mints.street.manager.UserManager import com.mints.street.manager.UserManager
import com.mints.street.utils.json.JsonUtil import com.mints.street.utils.json.JsonUtil
import com.mints.street.webview.MintsWebViewActivity
import com.scwang.smartrefresh.layout.api.RefreshLayout import com.scwang.smartrefresh.layout.api.RefreshLayout
import com.scwang.smartrefresh.layout.listener.OnRefreshListener import com.scwang.smartrefresh.layout.listener.OnRefreshListener
import com.tbruyelle.rxpermissions2.RxPermissions import com.tbruyelle.rxpermissions2.RxPermissions
...@@ -195,12 +197,11 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList ...@@ -195,12 +197,11 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
// } // }
// } // }
R.id.tv_regist -> { R.id.tv_regist -> {
KLog.e("sssss", "点击了《注册协议》") MintsWebViewActivity.startWebView(name = "用户协议",url = "http://test.mints-id.com/map-api/map/register.html")
ToastUtils.showShort("点击了《注册协议》")
} }
R.id.tv_private -> { R.id.tv_private -> {
KLog.e("sssss", "点击了《隐私协议》") MintsWebViewActivity.startWebView(name = "隐私协议",url = "http://test.mints-id.com/map-api/map/privacy.html")
ToastUtils.showShort("点击了《隐私协议》")
} }
} }
} }
......
...@@ -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.webkit.WebSettings
import android.webkit.WebView import android.webkit.WebView
import android.webkit.WebViewClient import android.webkit.WebViewClient
import com.fry.base.base.BaseActivity import com.fry.base.base.BaseActivity
...@@ -17,12 +18,13 @@ import me.goldze.mvvmhabit.utils.KLog ...@@ -17,12 +18,13 @@ import me.goldze.mvvmhabit.utils.KLog
class MintsWebViewActivity : BaseActivity<ActivityMintsWebViewBinding, MintsWebViewModel>() { class MintsWebViewActivity : BaseActivity<ActivityMintsWebViewBinding, MintsWebViewModel>() {
companion object{ companion object{
fun startWebView(name:String?,latitude:String?,longitude:String?){ fun startWebView(name:String?=null,latitude:String?=null,longitude:String?=null,url:String?=null){
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("latitude",latitude) intent.putExtra("latitude",latitude)
intent.putExtra("longitude",longitude) intent.putExtra("longitude",longitude)
intent.putExtra("url",url)
this.startActivity(intent) this.startActivity(intent)
} }
} }
...@@ -34,12 +36,16 @@ class MintsWebViewActivity : BaseActivity<ActivityMintsWebViewBinding, MintsWebV ...@@ -34,12 +36,16 @@ 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"))
KLog.e("MintsWebViewActivity","file:///android_asset/web/m.html?a=${intent.getStringExtra("longitude")}" + if(intent.getStringExtra("url")!=null && "" != intent.getStringExtra("url")){
"&b=${intent.getStringExtra("latitude")}&c=1") binding.webview.loadUrl(intent.getStringExtra("url")?:"")
binding.webview.loadUrl("file:///android_asset/web/m.html?a=${intent.getStringExtra("longitude")}" + }else{
"&b=${intent.getStringExtra("latitude")}&c=1");//加载asset文件夹下html binding.webview.loadUrl("file:///android_asset/web/m.html?a=${intent.getStringExtra("longitude")}" +
"&b=${intent.getStringExtra("latitude")}&c=1");//加载asset文件夹下html
}
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.e("MintsWebViewActivity",url)
//使用WebView加载显示url //使用WebView加载显示url
if (url != null) { if (url != null) {
view?.loadUrl(url) view?.loadUrl(url)
...@@ -53,8 +59,9 @@ class MintsWebViewActivity : BaseActivity<ActivityMintsWebViewBinding, MintsWebV ...@@ -53,8 +59,9 @@ class MintsWebViewActivity : BaseActivity<ActivityMintsWebViewBinding, MintsWebV
webSettings.setJavaScriptEnabled(true);//允许使用js webSettings.setJavaScriptEnabled(true);//允许使用js
//支持屏幕缩放 //支持屏幕缩放
webSettings.setSupportZoom(true); webSettings.setSupportZoom(true)
webSettings.builtInZoomControls = true; webSettings.builtInZoomControls = true
webSettings.layoutAlgorithm = WebSettings.LayoutAlgorithm.SINGLE_COLUMN;
} }
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
</FrameLayout> </FrameLayout>
<FrameLayout <FrameLayout
android:visibility="gone"
android:id="@+id/flTakephoto" android:id="@+id/flTakephoto"
android:layout_width="68dp" android:layout_width="68dp"
android:layout_height="68dp" android:layout_height="68dp"
...@@ -46,7 +47,6 @@ ...@@ -46,7 +47,6 @@
app:layout_constraintRight_toRightOf="parent"> app:layout_constraintRight_toRightOf="parent">
<ImageView <ImageView
android:visibility="gone"
android:id="@+id/ivTakephoto" android:id="@+id/ivTakephoto"
android:layout_width="60dp" android:layout_width="60dp"
android:layout_height="60dp" android:layout_height="60dp"
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<ImageView <ImageView
android:visibility="gone"
android:id="@+id/image_map_history" android:id="@+id/image_map_history"
android:layout_width="35dp" android:layout_width="35dp"
android:layout_height="35dp" android:layout_height="35dp"
......
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