Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
ShenghuoquanBusiness
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
bp
ShenghuoquanBusiness
Commits
617a6db6
Commit
617a6db6
authored
Jul 06, 2021
by
shiyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
用户协议和隐私政策页面添加title
parent
126cf715
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
359 additions
and
278 deletions
+359
-278
build.gradle
CommonLib/Common/build.gradle
+1
-2
IBlankViewLoadAgainCallback.kt
...yidian/common/widget/blank/IBlankViewLoadAgainCallback.kt
+2
-2
ManagerChangeActivity.kt
...huoquan/newscontent/personnel/ui/ManagerChangeActivity.kt
+8
-6
LoginLifeCircleActivity.kt
...an/shenghuoquan/newscontent/ui/LoginLifeCircleActivity.kt
+8
-6
ProductSupportActivity.kt
...ian/shenghuoquan/newscontent/ui/ProductSupportActivity.kt
+83
-71
ProtocolActivity.kt
...om/yidian/shenghuoquan/newscontent/ui/ProtocolActivity.kt
+42
-23
ProtocolDialog.kt
...dian/shenghuoquan/newscontent/ui/dialog/ProtocolDialog.kt
+108
-82
ProtocolHintDialog.kt
.../shenghuoquan/newscontent/ui/dialog/ProtocolHintDialog.kt
+80
-66
PrivacyAgreementView.kt
...n/shenghuoquan/newscontent/widget/PrivacyAgreementView.kt
+8
-2
activity_collection.xml
...s/newscontent/src/main/res/layout/activity_collection.xml
+1
-1
activity_news_content.xml
...newscontent/src/main/res/layout/activity_news_content.xml
+2
-4
activity_protocol.xml
...nts/newscontent/src/main/res/layout/activity_protocol.xml
+11
-8
fragment_author.xml
...nents/newscontent/src/main/res/layout/fragment_author.xml
+1
-1
fragment_channel.xml
...ents/newscontent/src/main/res/layout/fragment_channel.xml
+1
-1
fragment_subscription.xml
...newscontent/src/main/res/layout/fragment_subscription.xml
+1
-1
fragment_web.xml
Components/newscontent/src/main/res/layout/fragment_web.xml
+2
-2
No files found.
CommonLib/Common/build.gradle
View file @
617a6db6
...
...
@@ -85,8 +85,7 @@ dependencies {
api
"com.yidian.xarc:xevent:0.0.3"
api
"com.yidian.xpage:xpagenative:0.0.1"
//https://github.com/CymChad/BaseRecyclerViewAdapterHelper
api
"com.github.CymChad:BaseRecyclerViewAdapterHelper:3.0.4"
implementation
(
'com.yidian.android:CommonComponent:0.0.88'
)
{
exclude
(
group:
'com.yidian.android'
,
module:
'NetworkImageLib'
)
}
...
...
CommonLib/Common/src/main/java/com/yidian/common/widget/blank/IBlankViewLoadAgainCallback.kt
View file @
617a6db6
package
com.yidian.
shenghuoquan.newscontent.bean
package
com.yidian.
common.widget.blank
interface
IBlankViewLoadAgainCallback
{
fun
loadAgainCallback
()
}
\ No newline at end of file
}
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/personnel/ui/ManagerChangeActivity.kt
View file @
617a6db6
...
...
@@ -179,16 +179,18 @@ class ManagerChangeActivity : BaseActivity<ActivityManagerChangeBinding>() {
it
.
setSpan
(
ForegroundColorSpan
(
Color
.
parseColor
(
"#1852F1"
)),
28
,
39
,
Spanned
.
SPAN_EXCLUSIVE_EXCLUSIVE
)
it
.
setSpan
(
object
:
ClickableSpan
()
{
override
fun
onClick
(
widget
:
View
)
{
val
urlMap
=
HashMap
<
String
,
String
>()
urlMap
[
ProtocolActivity
.
ProtocolUrlKey
]
=
AppConfig
.
privacyPolicyStatement
XPageManager
.
push
(
XRouterPathConstants
.
PROTOCOL
,
urlMap
)
val
map
=
HashMap
<
String
,
String
>()
map
[
ProtocolActivity
.
ProtocolTitleKey
]
=
resources
.
getString
(
R
.
string
.
user_protocol
)
map
[
ProtocolActivity
.
ProtocolUrlKey
]
=
AppConfig
.
privacyPolicyStatement
XPageManager
.
push
(
XRouterPathConstants
.
PROTOCOL
,
map
)
}
},
28
,
33
,
Spanned
.
SPAN_EXCLUSIVE_EXCLUSIVE
)
it
.
setSpan
(
object
:
ClickableSpan
()
{
override
fun
onClick
(
widget
:
View
)
{
val
urlMap
=
HashMap
<
String
,
String
>()
urlMap
[
ProtocolActivity
.
ProtocolUrlKey
]
=
AppConfig
.
privacyPolicyStatement
XPageManager
.
push
(
XRouterPathConstants
.
PROTOCOL
,
urlMap
)
val
map
=
HashMap
<
String
,
String
>()
map
[
ProtocolActivity
.
ProtocolTitleKey
]
=
resources
.
getString
(
R
.
string
.
privacy_policy_statement
)
map
[
ProtocolActivity
.
ProtocolUrlKey
]
=
AppConfig
.
privacyPolicyStatement
XPageManager
.
push
(
XRouterPathConstants
.
PROTOCOL
,
map
)
}
},
33
,
39
,
Spanned
.
SPAN_EXCLUSIVE_EXCLUSIVE
)
}
...
...
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/ui/LoginLifeCircleActivity.kt
View file @
617a6db6
...
...
@@ -129,15 +129,17 @@ class LoginLifeCircleActivity : BaseActivity<ActivityLoginBinding>(), IGetLifeAc
}
viewBind
.
tvProtocol
.
setOnClickListener
{
val
urlMap
=
HashMap
<
String
,
String
>()
urlMap
[
ProtocolActivity
.
ProtocolUrlKey
]
=
AppConfig
.
userProtocol
XPageManager
.
push
(
XRouterPathConstants
.
PROTOCOL
,
urlMap
)
val
map
=
HashMap
<
String
,
String
>()
map
[
ProtocolActivity
.
ProtocolTitleKey
]
=
resources
.
getString
(
R
.
string
.
user_protocol
)
map
[
ProtocolActivity
.
ProtocolUrlKey
]
=
AppConfig
.
userProtocol
XPageManager
.
push
(
XRouterPathConstants
.
PROTOCOL
,
map
)
}
viewBind
.
tvPrivacy
.
setOnClickListener
{
val
urlMap
=
HashMap
<
String
,
String
>()
urlMap
[
ProtocolActivity
.
ProtocolUrlKey
]
=
AppConfig
.
privacyPolicyStatement
XPageManager
.
push
(
XRouterPathConstants
.
PROTOCOL
,
urlMap
)
val
map
=
HashMap
<
String
,
String
>()
map
[
ProtocolActivity
.
ProtocolTitleKey
]
=
resources
.
getString
(
R
.
string
.
privacy_policy_statement
)
map
[
ProtocolActivity
.
ProtocolUrlKey
]
=
AppConfig
.
privacyPolicyStatement
XPageManager
.
push
(
XRouterPathConstants
.
PROTOCOL
,
map
)
}
}
...
...
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/ui/ProductSupportActivity.kt
View file @
617a6db6
...
...
@@ -14,92 +14,104 @@ import com.orhanobut.hawk.Hawk
import
com.yidian.common.HawkConfig
import
com.yidian.common.XRouterPathConstants.Companion.SUPPORT
import
com.yidian.common.base.BaseActivity
import
com.yidian.common.extensions.initTitleBar
import
com.yidian.shenghuoquan.newscontent.R
import
com.yidian.shenghuoquan.newscontent.databinding.ActivityProtocolBinding
import
com.yidian.xarc.xbrid.XBridManager
import
com.yidian.xarc.xbrid.XWebView
class
ProductSupportActivity
:
BaseActivity
<
ActivityProtocolBinding
>()
{
override
fun
createViewBinding
():
ActivityProtocolBinding
{
return
ActivityProtocolBinding
.
inflate
(
layoutInflater
)
}
class
ProductSupportActivity
:
BaseActivity
<
ActivityProtocolBinding
>()
{
override
fun
getXPageName
():
Str
ing
{
return
SUPPORT
}
override
fun
createViewBinding
():
ActivityProtocolBind
ing
{
return
ActivityProtocolBinding
.
inflate
(
layoutInflater
)
}
private
val
FILE_CHOOSER_RESULT_CODE
=
666
private
var
uploadMessageAboveL
:
ValueCallback
<
Array
<
Uri
>>?
=
null
override
fun
getXPageName
():
String
{
return
SUPPORT
}
private
lateinit
var
webView
:
XWebView
private
val
FILE_CHOOSER_RESULT_CODE
=
666
private
var
uploadMessageAboveL
:
ValueCallback
<
Array
<
Uri
>>?
=
null
@SuppressLint
(
"SetJavaScriptEnabled"
)
override
fun
init
(
savedInstanceState
:
Bundle
?)
{
super
.
init
(
savedInstanceState
)
webView
=
XBridManager
.
getWebView
(
this
,
"testidenfier"
,
viewBind
.
wvProtocol
)
webView
.
settings
.
javaScriptEnabled
=
true
val
webViewClient
:
WebViewClient
=
object
:
WebViewClient
()
{
override
fun
shouldOverrideUrlLoading
(
view
:
WebView
,
url
:
String
?):
Boolean
{
super
.
shouldOverrideUrlLoading
(
view
,
url
)
view
.
loadUrl
(
url
)
return
true
}
}
webView
.
webViewClient
=
webViewClient
webView
.
webChromeClient
=
object
:
WebChromeClient
()
{
override
fun
onShowFileChooser
(
webView
:
WebView
?,
filePathCallback
:
ValueCallback
<
Array
<
Uri
>>?,
fileChooserParams
:
FileChooserParams
?):
Boolean
{
uploadMessageAboveL
=
filePathCallback
openImageChooserActivity
()
return
true
}
}
webView
.
settings
.
javaScriptEnabled
=
true
webView
.
settings
.
domStorageEnabled
=
true
val
url
=
"https://support.qq.com/product/304954"
val
nickname
=
Hawk
.
get
(
HawkConfig
.
Nickname
,
""
)
val
profileUrl
=
Hawk
.
get
(
HawkConfig
.
ProfileUrl
,
""
)
val
username
=
Hawk
.
get
(
HawkConfig
.
Username
,
""
)
val
postData
=
"nickname=$nickname&avatar=$profileUrl&openid=$username"
webView
.
postUrl
(
url
,
postData
.
toByteArray
())
}
private
lateinit
var
webView
:
XWebView
private
fun
openImageChooserActivity
()
{
val
i
=
Intent
(
Intent
.
ACTION_GET_CONTENT
)
i
.
addCategory
(
Intent
.
CATEGORY_OPENABLE
)
i
.
type
=
"image/*"
startActivityForResult
(
Intent
.
createChooser
(
i
,
"Image Chooser"
),
FILE_CHOOSER_RESULT_CODE
)
@SuppressLint
(
"SetJavaScriptEnabled"
)
override
fun
init
(
savedInstanceState
:
Bundle
?)
{
super
.
init
(
savedInstanceState
)
initTitle
()
webView
=
XBridManager
.
getWebView
(
this
,
"testidenfier"
,
viewBind
.
wvProtocol
)
webView
.
settings
.
javaScriptEnabled
=
true
val
webViewClient
:
WebViewClient
=
object
:
WebViewClient
()
{
override
fun
shouldOverrideUrlLoading
(
view
:
WebView
,
url
:
String
?):
Boolean
{
super
.
shouldOverrideUrlLoading
(
view
,
url
)
view
.
loadUrl
(
url
)
return
true
}
}
webView
.
webViewClient
=
webViewClient
webView
.
webChromeClient
=
object
:
WebChromeClient
()
{
override
fun
onShowFileChooser
(
webView
:
WebView
?,
filePathCallback
:
ValueCallback
<
Array
<
Uri
>>?,
fileChooserParams
:
FileChooserParams
?
):
Boolean
{
uploadMessageAboveL
=
filePathCallback
openImageChooserActivity
()
return
true
}
}
webView
.
settings
.
javaScriptEnabled
=
true
webView
.
settings
.
domStorageEnabled
=
true
val
url
=
"https://support.qq.com/product/304954"
val
nickname
=
Hawk
.
get
(
HawkConfig
.
Nickname
,
""
)
val
profileUrl
=
Hawk
.
get
(
HawkConfig
.
ProfileUrl
,
""
)
val
username
=
Hawk
.
get
(
HawkConfig
.
Username
,
""
)
val
postData
=
"nickname=$nickname&avatar=$profileUrl&openid=$username"
webView
.
postUrl
(
url
,
postData
.
toByteArray
())
}
private
fun
initTitle
()
{
initTitleBar
(
viewBind
.
include
.
toolbar
,
viewBind
.
include
.
tvTitle
,
resources
.
getString
(
R
.
string
.
my_staff
))
}
private
fun
onActivityResultAboveL
(
requestCode
:
Int
,
resultCode
:
Int
,
intent
:
Intent
?)
{
if
(
requestCode
!=
FILE_CHOOSER_RESULT_CODE
||
uploadMessageAboveL
==
null
)
return
var
results
:
Array
<
Uri
>?
=
null
if
(
resultCode
==
Activity
.
RESULT_OK
)
{
if
(
intent
!=
null
)
{
val
dataString
=
intent
.
dataString
val
clipData
:
ClipData
?
=
intent
.
clipData
if
(
clipData
!=
null
)
{
results
=
Array
(
clipData
.
itemCount
){
Uri
.
EMPTY
}
for
(
i
in
0
until
clipData
.
itemCount
)
{
val
item
:
ClipData
.
Item
=
clipData
.
getItemAt
(
i
)
results
[
i
]
=
item
.
uri
}
}
if
(
dataString
!=
null
)
results
=
arrayOf
(
Uri
.
parse
(
dataString
))
}
private
fun
openImageChooserActivity
()
{
val
i
=
Intent
(
Intent
.
ACTION_GET_CONTENT
)
i
.
addCategory
(
Intent
.
CATEGORY_OPENABLE
)
i
.
type
=
"image/*"
startActivityForResult
(
Intent
.
createChooser
(
i
,
"Image Chooser"
),
FILE_CHOOSER_RESULT_CODE
)
}
private
fun
onActivityResultAboveL
(
requestCode
:
Int
,
resultCode
:
Int
,
intent
:
Intent
?)
{
if
(
requestCode
!=
FILE_CHOOSER_RESULT_CODE
||
uploadMessageAboveL
==
null
)
return
var
results
:
Array
<
Uri
>?
=
null
if
(
resultCode
==
Activity
.
RESULT_OK
)
{
if
(
intent
!=
null
)
{
val
dataString
=
intent
.
dataString
val
clipData
:
ClipData
?
=
intent
.
clipData
if
(
clipData
!=
null
)
{
results
=
Array
(
clipData
.
itemCount
)
{
Uri
.
EMPTY
}
for
(
i
in
0
until
clipData
.
itemCount
)
{
val
item
:
ClipData
.
Item
=
clipData
.
getItemAt
(
i
)
results
[
i
]
=
item
.
uri
}
}
uploadMessageAboveL
?.
onReceiveValue
(
results
)
uploadMessageAboveL
=
null
if
(
dataString
!=
null
)
results
=
arrayOf
(
Uri
.
parse
(
dataString
)
)
}
}
uploadMessageAboveL
?.
onReceiveValue
(
results
)
uploadMessageAboveL
=
null
}
override
fun
onActivityResult
(
requestCode
:
Int
,
resultCode
:
Int
,
data
:
Intent
?)
{
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
)
if
(
requestCode
==
FILE_CHOOSER_RESULT_CODE
)
{
if
(
uploadMessageAboveL
!=
null
)
{
onActivityResultAboveL
(
requestCode
,
resultCode
,
data
)
}
}
override
fun
onActivityResult
(
requestCode
:
Int
,
resultCode
:
Int
,
data
:
Intent
?)
{
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
)
if
(
requestCode
==
FILE_CHOOSER_RESULT_CODE
)
{
if
(
uploadMessageAboveL
!=
null
)
{
onActivityResultAboveL
(
requestCode
,
resultCode
,
data
)
}
}
}
}
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/ui/ProtocolActivity.kt
View file @
617a6db6
package
com.yidian.shenghuoquan.newscontent.ui
import
android.os.Bundle
import
android.util.Log
import
com.yidian.common.XRouterPathConstants
import
com.yidian.common.XRouterPathConstants.Companion.PROTOCOL
import
com.yidian.common.base.BaseActivity
import
com.yidian.common.extensions.initTitleBar
import
com.yidian.common.utils.ToastUtils
import
com.yidian.shenghuoquan.newscontent.databinding.ActivityProtocolBinding
import
com.yidian.xarc.xbrid.XBridManager
import
com.yidian.xarc.xbrid.XWebView
class
ProtocolActivity
:
BaseActivity
<
ActivityProtocolBinding
>()
{
override
fun
createViewBinding
():
ActivityProtocolBinding
{
return
ActivityProtocolBinding
.
inflate
(
layoutInflater
)
/**
* 用户协议 & 隐私政策
*/
class
ProtocolActivity
:
BaseActivity
<
ActivityProtocolBinding
>()
{
private
lateinit
var
webView
:
XWebView
override
fun
createViewBinding
():
ActivityProtocolBinding
{
return
ActivityProtocolBinding
.
inflate
(
layoutInflater
)
}
override
fun
getXPageName
():
String
{
return
PROTOCOL
}
override
fun
init
(
savedInstanceState
:
Bundle
?)
{
super
.
init
(
savedInstanceState
)
val
serializableExtra
=
intent
.
getSerializableExtra
(
XRouterPathConstants
.
ParamsKey
)
serializableExtra
?.
let
{
val
paramsMap
=
serializableExtra
as
HashMap
<*,
*>
val
protocolTitle
=
paramsMap
[
ProtocolTitleKey
]
as
String
?
val
protocolUrl
=
paramsMap
[
ProtocolUrlKey
]
as
String
?
initTitle
(
protocolTitle
)
initWebView
(
protocolUrl
)
}
}
override
fun
getXPageName
():
String
{
return
PROTOCOL
}
private
fun
initTitle
(
protocolTitle
:
String
?)
{
initTitleBar
(
viewBind
.
include
.
toolbar
,
viewBind
.
include
.
tvTitle
,
protocolTitle
?:
"协议"
)
}
companion
object
{
const
val
ProtocolUrlKey
=
"protocol_url"
private
fun
initWebView
(
protocolUrl
:
String
?)
{
if
(
protocolUrl
.
isNullOrBlank
())
{
ToastUtils
.
showShortSafe
(
"链接地址为空"
)
return
}
webView
=
XBridManager
.
getWebView
(
this
,
"testidenfier"
,
viewBind
.
wvProtocol
)
webView
.
loadUrl
(
protocolUrl
)
}
private
lateinit
var
webView
:
XWebView
companion
object
{
const
val
ProtocolTitleKey
=
"protocol_title"
const
val
ProtocolUrlKey
=
"protocol_url"
}
override
fun
init
(
savedInstanceState
:
Bundle
?)
{
super
.
init
(
savedInstanceState
)
if
(
intent
.
getSerializableExtra
(
XRouterPathConstants
.
ParamsKey
)
!=
null
){
val
paramsMap
=
intent
.
getSerializableExtra
(
XRouterPathConstants
.
ParamsKey
)
as
HashMap
<*,
*>
val
protocolUrl
=
paramsMap
[
ProtocolUrlKey
]
as
String
Log
.
e
(
"zhb-yd"
,
"protocolUrl:$protocolUrl"
)
webView
=
XBridManager
.
getWebView
(
this
,
"testidenfier"
,
viewBind
.
wvProtocol
)
webView
.
loadUrl
(
protocolUrl
)
}
}
}
\ No newline at end of file
}
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/ui/dialog/ProtocolDialog.kt
View file @
617a6db6
...
...
@@ -25,95 +25,121 @@ import com.yidian.shenghuoquan.newscontent.R
import
com.yidian.shenghuoquan.newscontent.ui.ProtocolActivity
import
com.yidian.xpage.XPageManager
/**
* 用户协议 & 隐私政策 弹框
*/
class
ProtocolDialog
(
private
val
activity
:
Activity
,
themeResId
:
Int
,
private
val
paramsMap
:
HashMap
<
String
,
Any
?>?)
:
Dialog
(
activity
,
themeResId
)
{
private
lateinit
var
tvPrivacyPolicyTwo
:
YdTextView
private
lateinit
var
tvAgree
:
YdTextView
private
lateinit
var
tvDisagree
:
YdTextView
private
var
lastClickTime
=
0L
class
ProtocolDialog
(
private
val
activity
:
Activity
,
themeResId
:
Int
,
private
val
paramsMap
:
HashMap
<
String
,
Any
?>?):
Dialog
(
activity
,
themeResId
)
{
private
lateinit
var
tvPrivacyPolicyTwo
:
YdTextView
private
lateinit
var
tvAgree
:
YdTextView
private
lateinit
var
tvDisagree
:
YdTextView
private
var
lastClickTime
=
0L
init
{
setDialog
()
}
init
{
setDialog
()
}
private
fun
setDialog
()
{
this
.
setCanceledOnTouchOutside
(
false
)
this
.
setContentView
(
R
.
layout
.
protocol_dialog
)
this
.
setOwnerActivity
(
activity
)
tvPrivacyPolicyTwo
=
findViewById
(
R
.
id
.
tv_privacyPolicyTwo
)
tvAgree
=
findViewById
(
R
.
id
.
tv_agree
)
tvDisagree
=
findViewById
(
R
.
id
.
tv_disagree
)
setSpannableString
()
setClickListener
()
}
private
fun
setDialog
(){
this
.
setCanceledOnTouchOutside
(
false
)
this
.
setContentView
(
R
.
layout
.
protocol_dialog
)
this
.
setOwnerActivity
(
activity
)
tvPrivacyPolicyTwo
=
findViewById
(
R
.
id
.
tv_privacyPolicyTwo
)
tvAgree
=
findViewById
(
R
.
id
.
tv_agree
)
tvDisagree
=
findViewById
(
R
.
id
.
tv_disagree
)
setSpannableString
()
setClickListener
()
}
private
fun
setSpannableString
()
{
tvPrivacyPolicyTwo
.
highlightColor
=
Color
.
TRANSPARENT
val
textSpannedBuilder
=
SpannableStringBuilder
()
val
textSpanned1
=
SpannableString
(
activity
.
getString
(
R
.
string
.
privacy_policy_two_first
))
val
textSpanned2
=
SpannableString
(
activity
.
getString
(
R
.
string
.
privacy_policy_statement
))
textSpanned2
.
setSpan
(
ForegroundColorSpan
(
activity
.
resources
.
getColor
(
R
.
color
.
lightBlueColor
)),
0
,
textSpanned2
.
length
,
Spanned
.
SPAN_INCLUSIVE_EXCLUSIVE
)
textSpanned2
.
setSpan
(
object
:
ClickableSpan
()
{
override
fun
onClick
(
view
:
View
)
{
val
currentClickTime
=
System
.
currentTimeMillis
()
if
(
currentClickTime
-
lastClickTime
<
1000
)
return
lastClickTime
=
currentClickTime
val
urlMap
=
HashMap
<
String
,
String
>()
urlMap
[
ProtocolActivity
.
ProtocolTitleKey
]
=
activity
.
getString
(
R
.
string
.
privacy_policy_statement
)
urlMap
[
ProtocolActivity
.
ProtocolUrlKey
]
=
privacyPolicyStatement
XPageManager
.
push
(
XRouterPathConstants
.
PROTOCOL
,
urlMap
)
}
private
fun
setSpannableString
(){
tvPrivacyPolicyTwo
.
highlightColor
=
Color
.
TRANSPARENT
val
textSpannedBuilder
=
SpannableStringBuilder
()
val
textSpanned1
=
SpannableString
(
activity
.
getString
(
R
.
string
.
privacy_policy_two_first
))
val
textSpanned2
=
SpannableString
(
activity
.
getString
(
R
.
string
.
privacy_policy_statement
))
textSpanned2
.
setSpan
(
ForegroundColorSpan
(
activity
.
resources
.
getColor
(
R
.
color
.
lightBlueColor
)),
0
,
textSpanned2
.
length
,
Spanned
.
SPAN_INCLUSIVE_EXCLUSIVE
)
textSpanned2
.
setSpan
(
object
:
ClickableSpan
(){
override
fun
onClick
(
view
:
View
)
{
val
currentClickTime
=
System
.
currentTimeMillis
()
if
(
currentClickTime
-
lastClickTime
<
1000
)
return
lastClickTime
=
currentClickTime
val
urlMap
=
HashMap
<
String
,
String
>()
urlMap
[
ProtocolActivity
.
ProtocolUrlKey
]
=
privacyPolicyStatement
XPageManager
.
push
(
XRouterPathConstants
.
PROTOCOL
,
urlMap
)
}
override
fun
updateDrawState
(
ds
:
TextPaint
)
{
ds
.
isUnderlineText
=
false
}
},
0
,
textSpanned2
.
length
,
Spanned
.
SPAN_INCLUSIVE_EXCLUSIVE
)
val
textSpanned3
=
SpannableString
(
activity
.
getString
(
R
.
string
.
and
))
textSpanned3
.
setSpan
(
ForegroundColorSpan
(
activity
.
resources
.
getColor
(
R
.
color
.
mainBlackColor
)),
0
,
textSpanned3
.
length
,
Spanned
.
SPAN_INCLUSIVE_EXCLUSIVE
)
val
textSpanned4
=
SpannableString
(
activity
.
getString
(
R
.
string
.
user_protocol
))
textSpanned4
.
setSpan
(
ForegroundColorSpan
(
activity
.
resources
.
getColor
(
R
.
color
.
lightBlueColor
)),
0
,
textSpanned4
.
length
,
Spanned
.
SPAN_INCLUSIVE_EXCLUSIVE
)
textSpanned4
.
setSpan
(
object
:
ClickableSpan
()
{
override
fun
onClick
(
view
:
View
)
{
val
currentClickTime
=
System
.
currentTimeMillis
()
if
(
currentClickTime
-
lastClickTime
<
1000
)
return
lastClickTime
=
currentClickTime
val
urlMap
=
HashMap
<
String
,
String
>()
urlMap
[
ProtocolActivity
.
ProtocolTitleKey
]
=
activity
.
getString
(
R
.
string
.
user_protocol
)
urlMap
[
ProtocolActivity
.
ProtocolUrlKey
]
=
userProtocol
XPageManager
.
push
(
XRouterPathConstants
.
PROTOCOL
,
urlMap
)
}
override
fun
updateDrawState
(
ds
:
TextPaint
)
{
ds
.
isUnderlineText
=
false
}
},
0
,
textSpanned2
.
length
,
Spanned
.
SPAN_INCLUSIVE_EXCLUSIVE
)
val
textSpanned3
=
SpannableString
(
activity
.
getString
(
R
.
string
.
and
))
textSpanned3
.
setSpan
(
ForegroundColorSpan
(
activity
.
resources
.
getColor
(
R
.
color
.
mainBlackColor
)),
0
,
textSpanned3
.
length
,
Spanned
.
SPAN_INCLUSIVE_EXCLUSIVE
)
val
textSpanned4
=
SpannableString
(
activity
.
getString
(
R
.
string
.
user_protocol
))
textSpanned4
.
setSpan
(
ForegroundColorSpan
(
activity
.
resources
.
getColor
(
R
.
color
.
lightBlueColor
)),
0
,
textSpanned4
.
length
,
Spanned
.
SPAN_INCLUSIVE_EXCLUSIVE
)
textSpanned4
.
setSpan
(
object
:
ClickableSpan
(){
override
fun
onClick
(
view
:
View
)
{
val
currentClickTime
=
System
.
currentTimeMillis
()
if
(
currentClickTime
-
lastClickTime
<
1000
)
return
lastClickTime
=
currentClickTime
val
urlMap
=
HashMap
<
String
,
String
>()
urlMap
[
ProtocolActivity
.
ProtocolUrlKey
]
=
userProtocol
XPageManager
.
push
(
XRouterPathConstants
.
PROTOCOL
,
urlMap
)
}
override
fun
updateDrawState
(
ds
:
TextPaint
)
{
ds
.
isUnderlineText
=
false
}
},
0
,
textSpanned4
.
length
,
Spanned
.
SPAN_INCLUSIVE_EXCLUSIVE
)
val
textSpanned5
=
SpannableString
(
activity
.
getString
(
R
.
string
.
privacy_policy_two_second
))
textSpanned5
.
setSpan
(
ForegroundColorSpan
(
activity
.
resources
.
getColor
(
R
.
color
.
mainBlackColor
)),
0
,
textSpanned5
.
length
,
Spanned
.
SPAN_INCLUSIVE_EXCLUSIVE
)
tvPrivacyPolicyTwo
.
movementMethod
=
LinkMovementMethod
.
getInstance
()
tvPrivacyPolicyTwo
.
text
=
textSpannedBuilder
.
append
(
textSpanned1
).
append
(
textSpanned2
).
append
(
textSpanned3
).
append
(
textSpanned4
).
append
(
textSpanned5
)
}
override
fun
updateDrawState
(
ds
:
TextPaint
)
{
ds
.
isUnderlineText
=
false
}
},
0
,
textSpanned4
.
length
,
Spanned
.
SPAN_INCLUSIVE_EXCLUSIVE
)
val
textSpanned5
=
SpannableString
(
activity
.
getString
(
R
.
string
.
privacy_policy_two_second
))
textSpanned5
.
setSpan
(
ForegroundColorSpan
(
activity
.
resources
.
getColor
(
R
.
color
.
mainBlackColor
)),
0
,
textSpanned5
.
length
,
Spanned
.
SPAN_INCLUSIVE_EXCLUSIVE
)
tvPrivacyPolicyTwo
.
movementMethod
=
LinkMovementMethod
.
getInstance
()
tvPrivacyPolicyTwo
.
text
=
textSpannedBuilder
.
append
(
textSpanned1
).
append
(
textSpanned2
).
append
(
textSpanned3
).
append
(
textSpanned4
).
append
(
textSpanned5
)
private
fun
setClickListener
(
)
{
tvAgree
.
setOnClickListener
{
Hawk
.
put
(
HawkConfig
.
ProtocolIsAgree
,
true
)
dismiss
(
)
Handler
().
postDelayed
({
XPageManager
.
push
(
XRouterPathConstants
.
NEWS_MAIN
,
paramsMap
)
activity
.
finish
()
},
1000
)
}
private
fun
setClickListener
(){
tvAgree
.
setOnClickListener
{
Hawk
.
put
(
HawkConfig
.
ProtocolIsAgree
,
true
)
dismiss
()
Handler
().
postDelayed
({
XPageManager
.
push
(
XRouterPathConstants
.
NEWS_MAIN
,
paramsMap
)
activity
.
finish
()
},
1000
)
}
tvDisagree
.
setOnClickListener
{
dismiss
()
val
protocolHintDialog
=
ProtocolHintDialog
(
activity
,
R
.
style
.
normal_dialog
,
paramsMap
)
protocolHintDialog
.
show
()
}
tvDisagree
.
setOnClickListener
{
dismiss
()
val
protocolHintDialog
=
ProtocolHintDialog
(
activity
,
R
.
style
.
normal_dialog
,
paramsMap
)
protocolHintDialog
.
show
()
}
}
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
val
params
:
WindowManager
.
LayoutParams
?
=
window
?.
attributes
params
?.
width
=
WindowManager
.
LayoutParams
.
MATCH_PARENT
params
?.
height
=
WindowManager
.
LayoutParams
.
WRAP_CONTENT
window
?.
attributes
=
params
window
?.
attributes
?.
gravity
=
Gravity
.
BOTTOM
}
}
\ No newline at end of file
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
val
params
:
WindowManager
.
LayoutParams
?
=
window
?.
attributes
params
?.
width
=
WindowManager
.
LayoutParams
.
MATCH_PARENT
params
?.
height
=
WindowManager
.
LayoutParams
.
WRAP_CONTENT
window
?.
attributes
=
params
window
?.
attributes
?.
gravity
=
Gravity
.
BOTTOM
}
}
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/ui/dialog/ProtocolHintDialog.kt
View file @
617a6db6
...
...
@@ -24,78 +24,92 @@ import com.yidian.shenghuoquan.newscontent.R
import
com.yidian.shenghuoquan.newscontent.ui.ProtocolActivity
import
com.yidian.xpage.XPageManager
/**
* 用户协议 & 隐私政策的 详细内容提示弹框
*/
class
ProtocolHintDialog
(
private
val
activity
:
Activity
,
themeResId
:
Int
,
private
val
paramsMap
:
HashMap
<
String
,
Any
?>?)
:
Dialog
(
activity
,
themeResId
)
{
private
lateinit
var
tvContent
:
YdTextView
private
lateinit
var
tvAgree
:
YdTextView
private
lateinit
var
tvDisagree
:
YdTextView
private
var
lastClickTime
=
0L
class
ProtocolHintDialog
(
private
val
activity
:
Activity
,
themeResId
:
Int
,
private
val
paramsMap
:
HashMap
<
String
,
Any
?>?):
Dialog
(
activity
,
themeResId
)
{
private
lateinit
var
tvContent
:
YdTextView
private
lateinit
var
tvAgree
:
YdTextView
private
lateinit
var
tvDisagree
:
YdTextView
private
var
lastClickTime
=
0L
init
{
setDialog
()
}
init
{
setDialog
()
}
private
fun
setDialog
()
{
this
.
setCanceledOnTouchOutside
(
false
)
this
.
setContentView
(
R
.
layout
.
protocol_hint_dialog
)
this
.
setOwnerActivity
(
activity
)
tvContent
=
findViewById
(
R
.
id
.
tv_content
)
tvAgree
=
findViewById
(
R
.
id
.
tv_agree
)
tvDisagree
=
findViewById
(
R
.
id
.
tv_disagree
)
setSpannableString
()
setClickListener
()
}
private
fun
setDialog
(){
this
.
setCanceledOnTouchOutside
(
false
)
this
.
setContentView
(
R
.
layout
.
protocol_hint_dialog
)
this
.
setOwnerActivity
(
activity
)
tvContent
=
findViewById
(
R
.
id
.
tv_content
)
tvAgree
=
findViewById
(
R
.
id
.
tv_agree
)
tvDisagree
=
findViewById
(
R
.
id
.
tv_disagree
)
setSpannableString
()
setClickListener
()
}
private
fun
setSpannableString
()
{
tvContent
.
highlightColor
=
Color
.
TRANSPARENT
val
textSpannedBuilder
=
SpannableStringBuilder
()
val
textSpanned1
=
SpannableString
(
activity
.
getString
(
R
.
string
.
protocol_hint_content_one
))
val
textSpanned2
=
SpannableString
(
activity
.
getString
(
R
.
string
.
privacy_policy
))
textSpanned2
.
setSpan
(
ForegroundColorSpan
(
activity
.
resources
.
getColor
(
R
.
color
.
lightBlueColor
)),
0
,
textSpanned2
.
length
,
Spanned
.
SPAN_INCLUSIVE_EXCLUSIVE
)
textSpanned2
.
setSpan
(
object
:
ClickableSpan
()
{
override
fun
onClick
(
view
:
View
)
{
val
currentClickTime
=
System
.
currentTimeMillis
()
if
(
currentClickTime
-
lastClickTime
<
1000
)
return
lastClickTime
=
currentClickTime
val
urlMap
=
HashMap
<
String
,
String
>()
urlMap
[
ProtocolActivity
.
ProtocolTitleKey
]
=
activity
.
resources
.
getString
(
R
.
string
.
privacy_policy_statement
)
urlMap
[
ProtocolActivity
.
ProtocolUrlKey
]
=
privacyPolicyStatement
XPageManager
.
push
(
XRouterPathConstants
.
PROTOCOL
,
urlMap
)
}
private
fun
setSpannableString
(){
tvContent
.
highlightColor
=
Color
.
TRANSPARENT
val
textSpannedBuilder
=
SpannableStringBuilder
()
val
textSpanned1
=
SpannableString
(
activity
.
getString
(
R
.
string
.
protocol_hint_content_one
))
val
textSpanned2
=
SpannableString
(
activity
.
getString
(
R
.
string
.
privacy_policy
))
textSpanned2
.
setSpan
(
ForegroundColorSpan
(
activity
.
resources
.
getColor
(
R
.
color
.
lightBlueColor
)),
0
,
textSpanned2
.
length
,
Spanned
.
SPAN_INCLUSIVE_EXCLUSIVE
)
textSpanned2
.
setSpan
(
object
:
ClickableSpan
(){
override
fun
onClick
(
view
:
View
)
{
val
currentClickTime
=
System
.
currentTimeMillis
()
if
(
currentClickTime
-
lastClickTime
<
1000
)
return
lastClickTime
=
currentClickTime
val
urlMap
=
HashMap
<
String
,
String
>()
urlMap
[
ProtocolActivity
.
ProtocolUrlKey
]
=
privacyPolicyStatement
XPageManager
.
push
(
XRouterPathConstants
.
PROTOCOL
,
urlMap
)
}
override
fun
updateDrawState
(
ds
:
TextPaint
)
{
ds
.
isUnderlineText
=
false
}
},
0
,
textSpanned2
.
length
,
Spanned
.
SPAN_INCLUSIVE_EXCLUSIVE
)
val
textSpanned3
=
SpannableString
(
activity
.
getString
(
R
.
string
.
protocol_hint_content_two
))
textSpanned3
.
setSpan
(
ForegroundColorSpan
(
activity
.
resources
.
getColor
(
R
.
color
.
mainBlackColor
)),
0
,
textSpanned3
.
length
,
Spanned
.
SPAN_INCLUSIVE_EXCLUSIVE
)
tvContent
.
movementMethod
=
LinkMovementMethod
.
getInstance
()
tvContent
.
text
=
textSpannedBuilder
.
append
(
textSpanned1
).
append
(
textSpanned2
).
append
(
textSpanned3
)
}
override
fun
updateDrawState
(
ds
:
TextPaint
)
{
ds
.
isUnderlineText
=
false
}
},
0
,
textSpanned2
.
length
,
Spanned
.
SPAN_INCLUSIVE_EXCLUSIVE
)
val
textSpanned3
=
SpannableString
(
activity
.
getString
(
R
.
string
.
protocol_hint_content_two
))
textSpanned3
.
setSpan
(
ForegroundColorSpan
(
activity
.
resources
.
getColor
(
R
.
color
.
mainBlackColor
)),
0
,
textSpanned3
.
length
,
Spanned
.
SPAN_INCLUSIVE_EXCLUSIVE
)
tvContent
.
movementMethod
=
LinkMovementMethod
.
getInstance
()
tvContent
.
text
=
textSpannedBuilder
.
append
(
textSpanned1
).
append
(
textSpanned2
).
append
(
textSpanned3
)
private
fun
setClickListener
(
)
{
tvAgree
.
setOnClickListener
{
Hawk
.
put
(
HawkConfig
.
ProtocolIsAgree
,
true
)
dismiss
(
)
Handler
().
postDelayed
({
XPageManager
.
push
(
XRouterPathConstants
.
NEWS_MAIN
,
paramsMap
)
activity
.
finish
()
},
1000
)
}
private
fun
setClickListener
(){
tvAgree
.
setOnClickListener
{
Hawk
.
put
(
HawkConfig
.
ProtocolIsAgree
,
true
)
dismiss
()
Handler
().
postDelayed
({
XPageManager
.
push
(
XRouterPathConstants
.
NEWS_MAIN
,
paramsMap
)
activity
.
finish
()
},
1000
)
}
tvDisagree
.
setOnClickListener
{
dismiss
()
Handler
().
postDelayed
({
activity
.
finish
()
},
200
)
}
tvDisagree
.
setOnClickListener
{
dismiss
()
Handler
().
postDelayed
({
activity
.
finish
()
},
200
)
}
}
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
val
params
:
WindowManager
.
LayoutParams
?
=
window
?.
attributes
params
?.
width
=
WindowManager
.
LayoutParams
.
MATCH_PARENT
params
?.
height
=
WindowManager
.
LayoutParams
.
WRAP_CONTENT
window
?.
attributes
=
params
window
?.
attributes
?.
gravity
=
Gravity
.
BOTTOM
}
}
\ No newline at end of file
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
val
params
:
WindowManager
.
LayoutParams
?
=
window
?.
attributes
params
?.
width
=
WindowManager
.
LayoutParams
.
MATCH_PARENT
params
?.
height
=
WindowManager
.
LayoutParams
.
WRAP_CONTENT
window
?.
attributes
=
params
window
?.
attributes
?.
gravity
=
Gravity
.
BOTTOM
}
}
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/widget/PrivacyAgreementView.kt
View file @
617a6db6
...
...
@@ -44,10 +44,16 @@ class PrivacyAgreementView @JvmOverloads constructor(
val
id
=
v
?.
id
if
(
id
==
R
.
id
.
tv_privacy_policy
)
{
// 隐私政策
XPageManager
.
push
(
XRouterPathConstants
.
PROTOCOL
,
hashMapOf
(
Pair
(
ProtocolActivity
.
ProtocolUrlKey
,
AppConfig
.
privacyPolicyStatement
)))
val
map
=
HashMap
<
String
,
String
>()
map
[
ProtocolActivity
.
ProtocolTitleKey
]
=
resources
.
getString
(
R
.
string
.
privacy_policy_statement
)
map
[
ProtocolActivity
.
ProtocolUrlKey
]
=
AppConfig
.
privacyPolicyStatement
XPageManager
.
push
(
XRouterPathConstants
.
PROTOCOL
,
map
)
}
else
if
(
id
==
R
.
id
.
tv_user_agreement
)
{
// 用户协议
XPageManager
.
push
(
XRouterPathConstants
.
PROTOCOL
,
hashMapOf
(
Pair
(
ProtocolActivity
.
ProtocolUrlKey
,
AppConfig
.
userProtocol
)))
val
map
=
HashMap
<
String
,
String
>()
map
[
ProtocolActivity
.
ProtocolTitleKey
]
=
resources
.
getString
(
R
.
string
.
user_protocol
)
map
[
ProtocolActivity
.
ProtocolUrlKey
]
=
AppConfig
.
userProtocol
XPageManager
.
push
(
XRouterPathConstants
.
PROTOCOL
,
map
)
}
}
...
...
Components/newscontent/src/main/res/layout/activity_collection.xml
View file @
617a6db6
...
...
@@ -53,7 +53,7 @@
</com.yidian.nightmode.widget.YdRelativeLayout>
<com.yidian.
shenghuoquan.newscontent.widget
.BlankPageView
<com.yidian.
common.widget.blank
.BlankPageView
android:id=
"@+id/fly_blank"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
...
...
Components/newscontent/src/main/res/layout/activity_news_content.xml
View file @
617a6db6
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
android:id=
"@+id/lly_root"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
tools:context=
"com.yidian.subway.newscontent.ui.NewsContentActivity"
>
android:orientation=
"vertical"
>
<FrameLayout
android:id=
"@+id/fly_webContainer"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
android:layout_height=
"match_parent"
/>
</LinearLayout>
\ No newline at end of file
Components/newscontent/src/main/res/layout/activity_protocol.xml
View file @
617a6db6
<?xml version="1.0" encoding="utf-8"?>
<com.yidian.nightmode.widget.YdFrameLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/mainBgColor"
android:fitsSystemWindows=
"true"
tools:ignore=
"MissingDefaultResource
"
>
android:orientation=
"vertical
"
>
<com.yidian.shenghuoquan.newscontent.ui.webview.YiDianWebView
<include
android:id=
"@+id/include"
layout=
"@layout/layout_common_toolbar"
/>
<com.yidian.common.webview.YiDianWebView
android:id=
"@+id/wv_protocol"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:scrollbars=
"none"
/>
android:layout_height=
"0dp"
android:layout_weight=
"1"
android:scrollbars=
"none"
/>
</
com.yidian.nightmode.widget.YdFrame
Layout>
</
Linear
Layout>
...
...
Components/newscontent/src/main/res/layout/fragment_author.xml
View file @
617a6db6
...
...
@@ -5,7 +5,7 @@
android:layout_height=
"match_parent"
android:background=
"@color/mainBgColor"
>
<com.yidian.
shenghuoquan.newscontent.widget
.BlankPageView
<com.yidian.
common.widget.blank
.BlankPageView
android:id=
"@+id/fly_blank"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
...
...
Components/newscontent/src/main/res/layout/fragment_channel.xml
View file @
617a6db6
...
...
@@ -6,7 +6,7 @@
android:layout_height=
"match_parent"
android:background=
"@color/mainBgColor"
>
<com.yidian.
shenghuoquan.newscontent.widget
.BlankPageView
<com.yidian.
common.widget.blank
.BlankPageView
android:id=
"@+id/fly_blank"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
...
...
Components/newscontent/src/main/res/layout/fragment_subscription.xml
View file @
617a6db6
...
...
@@ -5,7 +5,7 @@
android:layout_height=
"match_parent"
android:background=
"@color/white"
>
<com.yidian.
shenghuoquan.newscontent.widget
.BlankPageView
<com.yidian.
common.widget.blank
.BlankPageView
android:id=
"@+id/fly_blank"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
...
...
Components/newscontent/src/main/res/layout/fragment_web.xml
View file @
617a6db6
...
...
@@ -9,7 +9,7 @@
android:orientation=
"vertical"
>
<com.yidian.
shenghuoquan.newscontent.widget
.BlankPageView
<com.yidian.
common.widget.blank
.BlankPageView
android:id=
"@+id/fly_blank"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
...
...
@@ -21,7 +21,7 @@
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
<com.yidian.
shenghuoquan.newscontent.ui
.webview.YiDianWebView
<com.yidian.
common
.webview.YiDianWebView
android:id=
"@+id/comment_web"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
...
...
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