Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_street
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
android
android_street
Commits
2df23ebf
Commit
2df23ebf
authored
Jul 19, 2021
by
fengruiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改webView页面
parent
694c22e1
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
14 deletions
+24
-14
MoresettingsActivity.kt
...ain/java/com/mints/street/main/my/MoresettingsActivity.kt
+3
-2
MyFragment.kt
app/src/main/java/com/mints/street/main/my/MyFragment.kt
+5
-4
MintsWebViewActivity.kt
...ain/java/com/mints/street/webview/MintsWebViewActivity.kt
+14
-7
activity_main.xml
app/src/main/res/layout/activity_main.xml
+1
-1
fragment_home.xml
app/src/main/res/layout/fragment_home.xml
+1
-0
No files found.
app/src/main/java/com/mints/street/main/my/MoresettingsActivity.kt
View file @
2df23ebf
...
...
@@ -13,6 +13,7 @@ import com.mints.street.R
import
com.mints.street.databinding.ActivityMoresettingsBinding
import
com.mints.street.main.MainActivity
import
com.mints.street.manager.UserManager
import
com.mints.street.webview.MintsWebViewActivity
import
kotlinx.android.synthetic.main.activity_moresettings.*
import
kotlinx.android.synthetic.main.include_header.*
import
me.goldze.mvvmhabit.utils.KLog
...
...
@@ -120,10 +121,10 @@ class MoresettingsActivity : BaseActivity<ActivityMoresettingsBinding, Moresetti
KLog
.
e
(
"setOnClick"
,
"btn_switch has been clicked."
)
}
R
.
id
.
item_userAgree
->
{
//用户协议
ToastUtils
.
showShort
(
"点击了《注册协议》
"
)
MintsWebViewActivity
.
startWebView
(
name
=
"用户协议"
,
url
=
"http://test.mints-id.com/map-api/map/register.html
"
)
}
R
.
id
.
item_privacyAgree
->
{
//隐私协议
ToastUtils
.
showShort
(
"点击了《隐私协议》
"
)
MintsWebViewActivity
.
startWebView
(
name
=
"隐私协议"
,
url
=
"http://test.mints-id.com/map-api/map/privacy.html
"
)
}
}
...
...
app/src/main/java/com/mints/street/main/my/MyFragment.kt
View file @
2df23ebf
...
...
@@ -15,6 +15,7 @@ import androidx.lifecycle.Observer
import
cn.sharesdk.framework.ShareSDK
import
cn.sharesdk.wechat.friends.Wechat
import
com.bumptech.glide.Glide
import
com.bytedance.sdk.component.image.LoadConfig
import
com.fry.base.base.BaseFragment
import
com.google.android.material.bottomsheet.BottomSheetDialog
import
com.mints.street.BR
...
...
@@ -27,6 +28,7 @@ import com.mints.street.login.LoginApi
import
com.mints.street.login.OnLoginListener
import
com.mints.street.manager.UserManager
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.listener.OnRefreshListener
import
com.tbruyelle.rxpermissions2.RxPermissions
...
...
@@ -195,12 +197,11 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
// }
// }
R
.
id
.
tv_regist
->
{
KLog
.
e
(
"sssss"
,
"点击了《注册协议》"
)
ToastUtils
.
showShort
(
"点击了《注册协议》"
)
MintsWebViewActivity
.
startWebView
(
name
=
"用户协议"
,
url
=
"http://test.mints-id.com/map-api/map/register.html"
)
}
R
.
id
.
tv_private
->
{
KLog
.
e
(
"sssss"
,
"点击了《隐私协议》
"
)
ToastUtils
.
showShort
(
"点击了《隐私协议》"
)
MintsWebViewActivity
.
startWebView
(
name
=
"隐私协议"
,
url
=
"http://test.mints-id.com/map-api/map/privacy.html
"
)
}
}
}
...
...
app/src/main/java/com/mints/street/webview/MintsWebViewActivity.kt
View file @
2df23ebf
...
...
@@ -2,6 +2,7 @@ package com.mints.street.webview
import
android.content.Intent
import
android.os.Bundle
import
android.webkit.WebSettings
import
android.webkit.WebView
import
android.webkit.WebViewClient
import
com.fry.base.base.BaseActivity
...
...
@@ -17,12 +18,13 @@ import me.goldze.mvvmhabit.utils.KLog
class
MintsWebViewActivity
:
BaseActivity
<
ActivityMintsWebViewBinding
,
MintsWebViewModel
>()
{
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
{
val
intent
=
Intent
(
this
,
MintsWebViewActivity
::
class
.
java
)
intent
.
putExtra
(
"name"
,
name
)
intent
.
putExtra
(
"latitude"
,
latitude
)
intent
.
putExtra
(
"longitude"
,
longitude
)
intent
.
putExtra
(
"url"
,
url
)
this
.
startActivity
(
intent
)
}
}
...
...
@@ -34,12 +36,16 @@ class MintsWebViewActivity : BaseActivity<ActivityMintsWebViewBinding, MintsWebV
override
fun
initData
()
{
super
.
initData
()
binding
.
ctbTitle
.
setTitle
(
intent
.
getStringExtra
(
"name"
))
KLog
.
e
(
"MintsWebViewActivity"
,
"file:///android_asset/web/m.html?a=${intent.getStringExtra("
longitude
")}"
+
"&b=${intent.getStringExtra("
latitude
")}&c=1"
)
if
(
intent
.
getStringExtra
(
"url"
)!=
null
&&
""
!=
intent
.
getStringExtra
(
"url"
)){
binding
.
webview
.
loadUrl
(
intent
.
getStringExtra
(
"url"
)
?:
""
)
}
else
{
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
()
{
override
fun
shouldOverrideUrlLoading
(
view
:
WebView
?,
url
:
String
?):
Boolean
{
KLog
.
e
(
"MintsWebViewActivity"
,
url
)
//使用WebView加载显示url
if
(
url
!=
null
)
{
view
?.
loadUrl
(
url
)
...
...
@@ -53,8 +59,9 @@ class MintsWebViewActivity : BaseActivity<ActivityMintsWebViewBinding, MintsWebV
webSettings
.
setJavaScriptEnabled
(
true
);
//允许使用js
//支持屏幕缩放
webSettings
.
setSupportZoom
(
true
);
webSettings
.
builtInZoomControls
=
true
;
webSettings
.
setSupportZoom
(
true
)
webSettings
.
builtInZoomControls
=
true
webSettings
.
layoutAlgorithm
=
WebSettings
.
LayoutAlgorithm
.
SINGLE_COLUMN
;
}
...
...
app/src/main/res/layout/activity_main.xml
View file @
2df23ebf
...
...
@@ -36,6 +36,7 @@
</FrameLayout>
<FrameLayout
android:visibility=
"gone"
android:id=
"@+id/flTakephoto"
android:layout_width=
"68dp"
android:layout_height=
"68dp"
...
...
@@ -46,7 +47,6 @@
app:layout_constraintRight_toRightOf=
"parent"
>
<ImageView
android:visibility=
"gone"
android:id=
"@+id/ivTakephoto"
android:layout_width=
"60dp"
android:layout_height=
"60dp"
...
...
app/src/main/res/layout/fragment_home.xml
View file @
2df23ebf
...
...
@@ -39,6 +39,7 @@
app:layout_constraintTop_toTopOf=
"parent"
/>
<ImageView
android:visibility=
"gone"
android:id=
"@+id/image_map_history"
android:layout_width=
"35dp"
android:layout_height=
"35dp"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment