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
5b9af99f
Commit
5b9af99f
authored
Jul 21, 2021
by
yinjiacheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
del 代码整理
parent
608fb9d5
Changes
45
Hide whitespace changes
Inline
Side-by-side
Showing
45 changed files
with
6 additions
and
4778 deletions
+6
-4778
AndroidManifest.xml
Components/newscontent/src/main/AndroidManifest.xml
+0
-54
FeedbackDetailAdapter.kt
...shenghuoquan/newscontent/adapter/FeedbackDetailAdapter.kt
+0
-54
ShareAdapter.kt
...m/yidian/shenghuoquan/newscontent/adapter/ShareAdapter.kt
+0
-68
StoreAdapter.kt
...m/yidian/shenghuoquan/newscontent/adapter/StoreAdapter.kt
+1
-1
UpdateVersionDesAdapter.kt
...enghuoquan/newscontent/adapter/UpdateVersionDesAdapter.kt
+0
-43
ViewPagerAdapter.kt
...dian/shenghuoquan/newscontent/adapter/ViewPagerAdapter.kt
+0
-13
NewsContentApplication.kt
...an/shenghuoquan/newscontent/app/NewsContentApplication.kt
+4
-74
AudioPlayerManager.kt
...dian/shenghuoquan/newscontent/audio/AudioPlayerManager.kt
+0
-224
AudioService.kt
...com/yidian/shenghuoquan/newscontent/audio/AudioService.kt
+0
-88
IAudioControl.kt
...om/yidian/shenghuoquan/newscontent/audio/IAudioControl.kt
+0
-23
CommentService.kt
...yidian/shenghuoquan/newscontent/service/CommentService.kt
+0
-65
DeepLinkService.kt
...idian/shenghuoquan/newscontent/service/DeepLinkService.kt
+0
-56
RequestService.kt
...yidian/shenghuoquan/newscontent/service/RequestService.kt
+0
-134
UniversalService.kt
...dian/shenghuoquan/newscontent/service/UniversalService.kt
+0
-179
UserService.kt
...om/yidian/shenghuoquan/newscontent/service/UserService.kt
+0
-41
CommentWebFragment.kt
.../yidian/shenghuoquan/newscontent/ui/CommentWebFragment.kt
+0
-107
DeepLinkActivity.kt
...om/yidian/shenghuoquan/newscontent/ui/DeepLinkActivity.kt
+0
-32
LifeAccountEnterpriseCertificationActivity.kt
...scontent/ui/LifeAccountEnterpriseCertificationActivity.kt
+0
-237
NewsContentActivity.kt
...yidian/shenghuoquan/newscontent/ui/NewsContentActivity.kt
+0
-57
ProductSupportActivity.kt
...ian/shenghuoquan/newscontent/ui/ProductSupportActivity.kt
+0
-117
AliveTestActivity.kt
...an/shenghuoquan/newscontent/ui/alive/AliveTestActivity.kt
+0
-219
GenerateSign.java
...idian/shenghuoquan/newscontent/ui/alive/GenerateSign.java
+0
-71
ProtocolDialog.kt
...dian/shenghuoquan/newscontent/ui/dialog/ProtocolDialog.kt
+0
-145
ProtocolHintDialog.kt
.../shenghuoquan/newscontent/ui/dialog/ProtocolHintDialog.kt
+0
-115
ShareDialog.kt
.../yidian/shenghuoquan/newscontent/ui/dialog/ShareDialog.kt
+0
-179
ShareImageDialog.kt
...an/shenghuoquan/newscontent/ui/dialog/ShareImageDialog.kt
+0
-154
SharePosterDialog.kt
...n/shenghuoquan/newscontent/ui/dialog/SharePosterDialog.kt
+0
-176
UpdateVersionDialog.kt
...shenghuoquan/newscontent/ui/dialog/UpdateVersionDialog.kt
+0
-106
IDCardResultActivity.kt
...henghuoquan/newscontent/ui/idcard/IDCardResultActivity.kt
+0
-44
IDCardTestActivity.kt
.../shenghuoquan/newscontent/ui/idcard/IDCardTestActivity.kt
+0
-271
FeedbackDetailPopupWindow.kt
...uan/newscontent/ui/popwindow/FeedbackDetailPopupWindow.kt
+0
-92
FeedbackPopupWindow.kt
...nghuoquan/newscontent/ui/popwindow/FeedbackPopupWindow.kt
+0
-82
StoreViewHolder.kt
...uoquan/newscontent/ui/store/viewholder/StoreViewHolder.kt
+1
-1
AccountUtil.kt
.../com/yidian/shenghuoquan/newscontent/utils/AccountUtil.kt
+0
-57
FloatWindowPermissionManager.java
...oquan/newscontent/utils/FloatWindowPermissionManager.java
+0
-328
HeightProvider.java
...yidian/shenghuoquan/newscontent/utils/HeightProvider.java
+0
-80
RomUtils.java
...a/com/yidian/shenghuoquan/newscontent/utils/RomUtils.java
+0
-266
SystemProperties.java
...dian/shenghuoquan/newscontent/utils/SystemProperties.java
+0
-81
UploadFileUtils.kt
.../yidian/shenghuoquan/newscontent/utils/UploadFileUtils.kt
+0
-15
VideoAudioUtil.kt
...m/yidian/shenghuoquan/newscontent/utils/VideoAudioUtil.kt
+0
-6
ExpandTextView.java
...idian/shenghuoquan/newscontent/widget/ExpandTextView.java
+0
-270
ExpandTextViewReal.kt
...ian/shenghuoquan/newscontent/widget/ExpandTextViewReal.kt
+0
-14
FloatAudioView.kt
.../yidian/shenghuoquan/newscontent/widget/FloatAudioView.kt
+0
-113
AndroidManifest.xml
Components/newscontent/src/main/manifest/AndroidManifest.xml
+0
-67
item_video_detail.xml
...nts/newscontent/src/main/res/layout/item_video_detail.xml
+0
-159
No files found.
Components/newscontent/src/main/AndroidManifest.xml
View file @
5b9af99f
...
...
@@ -3,33 +3,6 @@
package=
"com.yidian.shenghuoquan.newscontent"
>
<application>
<activity
android:name=
".ui.DeepLinkActivity"
>
<intent-filter>
<action
android:name=
"android.intent.action.VIEW"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<category
android:name=
"android.intent.category.BROWSABLE"
/>
<data
android:host=
"link_news"
android:scheme=
"ydsubway"
/>
</intent-filter>
</activity>
<activity
android:name=
".ui.NewsContentActivity"
android:configChanges=
"keyboard|keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize|uiMode"
/>
<service
android:name=
".audio.AudioService"
android:enabled=
"true"
android:exported=
"true"
/>
<activity
android:name=
".ui.alive.AliveTestActivity"
android:theme=
"@style/Transparent"
/>
<activity
android:name=
".ui.idcard.IDCardTestActivity"
android:theme=
"@style/Transparent"
/>
<activity
android:name=
".ui.auth.LifeAccountEnterpriseAuthCompleteActivity"
android:theme=
"@style/Transparent"
/>
...
...
@@ -39,60 +12,38 @@
<activity
android:name=
".ui.auth.LifeAccountCreateCompleteActivity"
android:theme=
"@style/Transparent"
/>
<activity
android:name=
".ui.idcard.IDCardResultActivity"
android:theme=
"@style/Transparent"
/>
<activity
android:name=
".ui.ProtocolActivity"
android:theme=
"@style/Transparent"
/>
<activity
android:name=
".ui.ProductSupportActivity"
android:theme=
"@style/Transparent"
/>
<activity
android:name=
".ui.LoginLifeCircleActivity"
/>
<activity
android:name=
".ui.store.StoreManagementActivity"
android:theme=
"@style/Transparent"
/>
<activity
android:name=
".ui.store.EditStoreActivity"
android:theme=
"@style/Transparent"
/>
<activity
android:name=
".ui.store.SelectAddressActivity"
android:theme=
"@style/Transparent"
/>
<activity
android:name=
".ui.store.SearchAddActivity"
android:theme=
"@style/Transparent"
/>
<activity
android:name=
".ui.auth.LifeAccountIdentityActivity"
android:theme=
"@style/Transparent"
/>
<activity
android:name=
".ui.auth.LifeAccountAuthActivity"
android:theme=
"@style/Transparent"
/>
<activity
android:name=
".ui.LifeAccountEnterpriseCertificationActivity"
android:theme=
"@style/Transparent"
/>
<activity
android:name=
".ui.auth.LifeAccountCreateActivity"
android:theme=
"@style/Transparent"
android:windowSoftInputMode=
"stateHidden|adjustResize"
/>
<activity
android:name=
".ui.auth.LifeAccountPersonalAuthActivity"
android:theme=
"@style/Transparent"
/>
<activity
android:name=
".ui.auth.LifeAccountEnterpriseAuthActivity"
android:theme=
"@style/Transparent"
/>
<activity
android:name=
".personnel.ui.MyStaffActivity"
android:launchMode=
"singleTask"
...
...
@@ -115,20 +66,16 @@
<activity
android:name=
".ui.setting.SystemSettingActivity"
android:theme=
"@style/Transparent"
/>
<activity
android:name=
".ui.center.MerchantCenterActivity"
android:theme=
"@style/Transparent"
/>
<activity
android:name=
".ui.center.MerchantInfoActivity"
android:theme=
"@style/Transparent"
/>
<activity
android:name=
".ui.center.LifeAccountModifyNameActivity"
android:theme=
"@style/Transparent"
android:windowSoftInputMode=
"stateVisible"
/>
<activity
android:name=
".ui.center.MerchantAuthInfoActivity"
android:theme=
"@style/Transparent"
/>
...
...
@@ -146,7 +93,6 @@
android:name=
".ui.center.MerchantAuthManagementActivity"
android:theme=
"@android:style/Theme.Translucent.NoTitleBar.Fullscreen"
/>
<activity
android:name=
".ui.setting.FeedbackActivity"
/>
</application>
</manifest>
\ No newline at end of file
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/adapter/FeedbackDetailAdapter.kt
deleted
100644 → 0
View file @
608fb9d5
package
com.yidian.shenghuoquan.newscontent.adapter
import
android.view.View
import
android.view.ViewGroup
import
android.widget.TextView
import
androidx.recyclerview.widget.RecyclerView
import
com.yidian.bcommon.cardutils.adapter.OnItemClickListener
import
com.yidian.bcommon.utils.ViewHolderUtil.Companion.createItemView
import
com.yidian.shenghuoquan.newscontent.R
import
kotlinx.android.extensions.LayoutContainer
class
FeedbackDetailAdapter
:
RecyclerView
.
Adapter
<
RecyclerView
.
ViewHolder
>()
{
private
val
dataList
:
ArrayList
<
String
>
by
lazy
{
ArrayList
<
String
>()
}
private
lateinit
var
mOnItemClickListener
:
OnItemClickListener
<
String
>
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
RecyclerView
.
ViewHolder
{
return
ViewHolder
(
createItemView
(
parent
,
R
.
layout
.
item_feedback_detail
))
}
override
fun
onBindViewHolder
(
holder
:
RecyclerView
.
ViewHolder
,
position
:
Int
)
{
holder
as
ViewHolder
val
tvContent
=
holder
.
itemView
.
findViewById
<
TextView
>(
R
.
id
.
tv_content
)
holder
.
setData
(
dataList
[
position
],
tvContent
)
holder
.
itemView
.
setOnClickListener
{
mOnItemClickListener
.
onClick
(
it
,
position
,
dataList
[
position
])
}
}
fun
update
(
newData
:
ArrayList
<
String
>)
{
newData
.
let
{
dataList
.
clear
()
dataList
.
addAll
(
it
)
notifyDataSetChanged
()
}
}
override
fun
getItemCount
():
Int
{
return
dataList
.
size
}
fun
setOnItemClickListener
(
onItemClickListener
:
OnItemClickListener
<
String
>)
{
mOnItemClickListener
=
onItemClickListener
}
class
ViewHolder
(
itemView
:
View
)
:
RecyclerView
.
ViewHolder
(
itemView
),
LayoutContainer
{
override
val
containerView
:
View
get
()
=
itemView
fun
setData
(
content
:
String
,
tvContent
:
TextView
)
{
tvContent
.
text
=
content
}
}
}
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/adapter/ShareAdapter.kt
deleted
100644 → 0
View file @
608fb9d5
package
com.yidian.shenghuoquan.newscontent.adapter
import
android.view.View
import
android.view.ViewGroup
import
android.widget.ImageView
import
android.widget.TextView
import
androidx.recyclerview.widget.RecyclerView
import
com.yidian.bcommon.cardutils.adapter.OnItemClickListener
import
com.yidian.bcommon.utils.ViewHolderUtil.Companion.createItemView
import
com.yidian.shenghuoquan.newscontent.R
import
com.yidian.shenghuoquan.newscontent.bean.SharePlatformBean
import
kotlinx.android.extensions.LayoutContainer
class
ShareAdapter
:
RecyclerView
.
Adapter
<
RecyclerView
.
ViewHolder
>()
{
companion
object
{
const
val
normalType
=
0
const
val
headType
=
-
1
const
val
footType
=
-
2
}
private
val
dataList
:
ArrayList
<
SharePlatformBean
>
by
lazy
{
ArrayList
<
SharePlatformBean
>()
}
private
lateinit
var
mOnItemClickListener
:
OnItemClickListener
<
SharePlatformBean
>
override
fun
getItemViewType
(
position
:
Int
):
Int
{
return
dataList
[
position
].
viewType
}
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
RecyclerView
.
ViewHolder
{
return
when
(
viewType
){
headType
->
ViewHolder
(
createItemView
(
parent
,
R
.
layout
.
item_share_card
))
footType
->
ViewHolder
(
createItemView
(
parent
,
R
.
layout
.
item_share_link
))
else
->
ViewHolder
(
createItemView
(
parent
,
R
.
layout
.
item_share_platform
))
}
}
override
fun
onBindViewHolder
(
holder
:
RecyclerView
.
ViewHolder
,
position
:
Int
)
{
holder
as
ViewHolder
holder
.
setData
(
dataList
[
position
],
holder
)
holder
.
itemView
.
setOnClickListener
{
mOnItemClickListener
.
onClick
(
it
,
position
,
dataList
[
position
])
}
}
fun
update
(
newData
:
ArrayList
<
SharePlatformBean
>){
newData
.
let
{
dataList
.
clear
()
dataList
.
addAll
(
it
)
notifyDataSetChanged
()
}
}
override
fun
getItemCount
():
Int
{
return
dataList
.
size
}
fun
setOnItemClickListener
(
onItemClickListener
:
OnItemClickListener
<
SharePlatformBean
>)
{
mOnItemClickListener
=
onItemClickListener
}
class
ViewHolder
(
itemView
:
View
)
:
RecyclerView
.
ViewHolder
(
itemView
),
LayoutContainer
{
override
val
containerView
:
View
get
()
=
itemView
fun
setData
(
sharePlatformBean
:
SharePlatformBean
,
holder
:
ViewHolder
)
{
holder
.
itemView
.
findViewById
<
ImageView
>(
R
.
id
.
iv_platform
).
setBackgroundResource
(
sharePlatformBean
.
imageId
)
holder
.
itemView
.
findViewById
<
TextView
>(
R
.
id
.
tv_platform
).
text
=
sharePlatformBean
.
name
}
}
}
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/adapter/StoreAdapter.kt
View file @
5b9af99f
...
...
@@ -8,7 +8,7 @@ import androidx.recyclerview.widget.RecyclerView
import
com.yidian.shenghuoquan.newscontent.R
import
com.yidian.shenghuoquan.newscontent.http.httpbean.GetShopListBean
import
com.yidian.shenghuoquan.newscontent.ui.store.EditStoreActivity
import
com.yidian.shenghuoquan.newscontent.viewholder.StoreViewHolder
import
com.yidian.shenghuoquan.newscontent.
ui.store.
viewholder.StoreViewHolder
/**
* 门店管理列表的adapter
...
...
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/adapter/UpdateVersionDesAdapter.kt
deleted
100644 → 0
View file @
608fb9d5
package
com.yidian.shenghuoquan.newscontent.adapter
import
android.view.View
import
android.view.ViewGroup
import
android.widget.TextView
import
androidx.recyclerview.widget.RecyclerView
import
com.yidian.bcommon.utils.ViewHolderUtil.Companion.createItemView
import
com.yidian.shenghuoquan.newscontent.R
import
kotlinx.android.extensions.LayoutContainer
class
UpdateVersionDesAdapter
:
RecyclerView
.
Adapter
<
RecyclerView
.
ViewHolder
>()
{
private
val
dataList
:
ArrayList
<
String
>
by
lazy
{
ArrayList
<
String
>()
}
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
RecyclerView
.
ViewHolder
{
return
ViewHolder
(
createItemView
(
parent
,
R
.
layout
.
item_update_version_des
))
}
override
fun
onBindViewHolder
(
holder
:
RecyclerView
.
ViewHolder
,
position
:
Int
)
{
holder
as
ViewHolder
holder
.
setData
(
dataList
[
position
],
holder
)
}
override
fun
getItemCount
():
Int
{
return
dataList
.
size
}
fun
update
(
newData
:
ArrayList
<
String
>)
{
newData
.
let
{
dataList
.
clear
()
dataList
.
addAll
(
it
)
notifyDataSetChanged
()
}
}
class
ViewHolder
(
itemView
:
View
)
:
RecyclerView
.
ViewHolder
(
itemView
),
LayoutContainer
{
override
val
containerView
:
View
get
()
=
itemView
fun
setData
(
des
:
String
,
holder
:
ViewHolder
)
{
holder
.
itemView
.
findViewById
<
TextView
>(
R
.
id
.
tv_versionDes
).
text
=
des
}
}
}
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/adapter/ViewPagerAdapter.kt
deleted
100755 → 0
View file @
608fb9d5
package
com.yidian.shenghuoquan.newscontent.adapter
import
androidx.fragment.app.Fragment
import
androidx.fragment.app.FragmentManager
import
androidx.fragment.app.FragmentPagerAdapter
class
ViewPagerAdapter
(
fragmentManager
:
FragmentManager
,
private
val
fragments
:
List
<
Fragment
>)
:
FragmentPagerAdapter
(
fragmentManager
,
BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT
)
{
override
fun
getItem
(
index
:
Int
):
Fragment
=
fragments
[
index
]
override
fun
getCount
():
Int
=
fragments
.
size
}
\ No newline at end of file
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/app/NewsContentApplication.kt
View file @
5b9af99f
...
...
@@ -4,14 +4,12 @@ import android.content.Intent
import
com.yidian.bcommon.XRouterPathConstants
import
com.yidian.bcommon.XRouterPathConstants.Companion.CHOOSE_CAREER
import
com.yidian.bcommon.XRouterPathConstants.Companion.CHOOSE_STORE_ACTIVITY
import
com.yidian.bcommon.XRouterPathConstants.Companion.ID_CARD_TEST
import
com.yidian.bcommon.XRouterPathConstants.Companion.LIFE_ACCOUNT_AUTH
import
com.yidian.bcommon.XRouterPathConstants.Companion.LIFE_ACCOUNT_AUTH_INFO
import
com.yidian.bcommon.XRouterPathConstants.Companion.LIFE_ACCOUNT_CREATE
import
com.yidian.bcommon.XRouterPathConstants.Companion.LIFE_ACCOUNT_CREATE_COMPLETE
import
com.yidian.bcommon.XRouterPathConstants.Companion.LIFE_ACCOUNT_ENTERPRISE_AUTH
import
com.yidian.bcommon.XRouterPathConstants.Companion.LIFE_ACCOUNT_ENTERPRISE_AUTH_COMPLETE
import
com.yidian.bcommon.XRouterPathConstants.Companion.LIFE_ACCOUNT_ENTERPRISE_CERTIFICATION
import
com.yidian.bcommon.XRouterPathConstants.Companion.LIFE_ACCOUNT_IDENTITY
import
com.yidian.bcommon.XRouterPathConstants.Companion.LIFE_ACCOUNT_INFO
import
com.yidian.bcommon.XRouterPathConstants.Companion.LIFE_ACCOUNT_MODIFY_NAME
...
...
@@ -19,7 +17,6 @@ import com.yidian.bcommon.XRouterPathConstants.Companion.LIFE_ACCOUNT_PERSONAL_A
import
com.yidian.bcommon.XRouterPathConstants.Companion.LIFE_ACCOUNT_PERSONAL_AUTH_COMPLETE
import
com.yidian.bcommon.XRouterPathConstants.Companion.LOGIN_LIFE_CIRCLE
import
com.yidian.bcommon.XRouterPathConstants.Companion.MERCHANT_CENTER
import
com.yidian.bcommon.XRouterPathConstants.Companion.NEWS_CONTENT
import
com.yidian.bcommon.XRouterPathConstants.Companion.PERSONAL_ADD_STAFF
import
com.yidian.bcommon.XRouterPathConstants.Companion.PERSONAL_MANAGER_CHANGE
import
com.yidian.bcommon.XRouterPathConstants.Companion.PERSONAL_MANAGER_INFO
...
...
@@ -28,18 +25,18 @@ import com.yidian.bcommon.XRouterPathConstants.Companion.PERSONAL_STAFF_INFO
import
com.yidian.bcommon.XRouterPathConstants.Companion.PERSONAL_STAFF_MANAGE
import
com.yidian.bcommon.XRouterPathConstants.Companion.PROTOCOL
import
com.yidian.bcommon.XRouterPathConstants.Companion.STORE_MANAGEMENT
import
com.yidian.bcommon.XRouterPathConstants.Companion.SUPPORT
import
com.yidian.bcommon.XRouterPathConstants.Companion.SYSTEM_SETTING
import
com.yidian.bcommon.YdBaseApplication
import
com.yidian.bcommon.services.ZapServiceNameConstants
import
com.yidian.news.util.ProcessUtil
import
com.yidian.nightmode.util.NightModeUtil
import
com.yidian.shenghuoquan.newscontent.personnel.ui.*
import
com.yidian.shenghuoquan.newscontent.service.*
import
com.yidian.shenghuoquan.newscontent.ui.*
import
com.yidian.shenghuoquan.newscontent.service.LifeNumberListService
import
com.yidian.shenghuoquan.newscontent.service.SelectStoreService
import
com.yidian.shenghuoquan.newscontent.ui.LoginLifeCircleActivity
import
com.yidian.shenghuoquan.newscontent.ui.ProtocolActivity
import
com.yidian.shenghuoquan.newscontent.ui.auth.*
import
com.yidian.shenghuoquan.newscontent.ui.center.*
import
com.yidian.shenghuoquan.newscontent.ui.idcard.IDCardTestActivity
import
com.yidian.shenghuoquan.newscontent.ui.setting.FeedbackActivity
import
com.yidian.shenghuoquan.newscontent.ui.setting.SystemSettingActivity
import
com.yidian.shenghuoquan.newscontent.ui.store.ChooseStoreActivity
...
...
@@ -80,7 +77,6 @@ class NewsContentApplication : YdBaseApplication() {
context
.
startActivity
(
intent
)
}
}),
XPageNode
(
STORE_MANAGEMENT
,
XPageNodePageType
.
NATIVE
,
object
:
XPageHandler
{
override
fun
handler
(
params
:
Map
<
String
,
Any
?
>?)
{
val
intent
=
Intent
()
...
...
@@ -92,7 +88,6 @@ class NewsContentApplication : YdBaseApplication() {
context
.
startActivity
(
intent
)
}
}),
XPageNode
(
CHOOSE_STORE_ACTIVITY
,
XPageNodePageType
.
NATIVE
,
object
:
XPageHandler
{
override
fun
handler
(
params
:
Map
<
String
,
Any
?
>?)
{
val
intent
=
Intent
()
...
...
@@ -104,7 +99,6 @@ class NewsContentApplication : YdBaseApplication() {
context
.
startActivity
(
intent
)
}
}),
XPageNode
(
LIFE_ACCOUNT_IDENTITY
,
XPageNodePageType
.
NATIVE
,
object
:
XPageHandler
{
override
fun
handler
(
params
:
Map
<
String
,
Any
?
>?)
{
val
intent
=
Intent
()
...
...
@@ -116,7 +110,6 @@ class NewsContentApplication : YdBaseApplication() {
context
.
startActivity
(
intent
)
}
}),
XPageNode
(
LIFE_ACCOUNT_AUTH
,
XPageNodePageType
.
NATIVE
,
object
:
XPageHandler
{
override
fun
handler
(
params
:
Map
<
String
,
Any
?
>?)
{
val
intent
=
Intent
()
...
...
@@ -128,31 +121,6 @@ class NewsContentApplication : YdBaseApplication() {
context
.
startActivity
(
intent
)
}
}),
XPageNode
(
ID_CARD_TEST
,
XPageNodePageType
.
NATIVE
,
object
:
XPageHandler
{
override
fun
handler
(
params
:
Map
<
String
,
Any
?
>?)
{
val
intent
=
Intent
()
if
(
params
!=
null
)
{
intent
.
putExtra
(
XRouterPathConstants
.
ParamsKey
,
params
as
HashMap
)
}
intent
.
setClass
(
context
,
IDCardTestActivity
::
class
.
java
)
intent
.
flags
=
Intent
.
FLAG_ACTIVITY_NEW_TASK
context
.
startActivity
(
intent
)
}
}),
XPageNode
(
LIFE_ACCOUNT_ENTERPRISE_CERTIFICATION
,
XPageNodePageType
.
NATIVE
,
object
:
XPageHandler
{
override
fun
handler
(
params
:
Map
<
String
,
Any
?
>?)
{
val
intent
=
Intent
()
if
(
params
!=
null
)
{
intent
.
putExtra
(
XRouterPathConstants
.
ParamsKey
,
params
as
HashMap
)
}
intent
.
setClass
(
context
,
LifeAccountEnterpriseCertificationActivity
::
class
.
java
)
intent
.
flags
=
Intent
.
FLAG_ACTIVITY_NEW_TASK
context
.
startActivity
(
intent
)
}
}),
XPageNode
(
LIFE_ACCOUNT_PERSONAL_AUTH
,
XPageNodePageType
.
NATIVE
,
object
:
XPageHandler
{
override
fun
handler
(
params
:
Map
<
String
,
Any
?
>?)
{
val
intent
=
Intent
()
...
...
@@ -164,7 +132,6 @@ class NewsContentApplication : YdBaseApplication() {
context
.
startActivity
(
intent
)
}
}),
XPageNode
(
LIFE_ACCOUNT_ENTERPRISE_AUTH
,
XPageNodePageType
.
NATIVE
,
object
:
XPageHandler
{
override
fun
handler
(
params
:
Map
<
String
,
Any
?
>?)
{
val
intent
=
Intent
()
...
...
@@ -176,7 +143,6 @@ class NewsContentApplication : YdBaseApplication() {
context
.
startActivity
(
intent
)
}
}),
XPageNode
(
LIFE_ACCOUNT_PERSONAL_AUTH_COMPLETE
,
XPageNodePageType
.
NATIVE
,
object
:
XPageHandler
{
override
fun
handler
(
params
:
Map
<
String
,
Any
?
>?)
{
val
intent
=
Intent
()
...
...
@@ -188,7 +154,6 @@ class NewsContentApplication : YdBaseApplication() {
context
.
startActivity
(
intent
)
}
}),
XPageNode
(
LIFE_ACCOUNT_ENTERPRISE_AUTH_COMPLETE
,
XPageNodePageType
.
NATIVE
,
object
:
XPageHandler
{
override
fun
handler
(
params
:
Map
<
String
,
Any
?
>?)
{
val
intent
=
Intent
()
...
...
@@ -200,7 +165,6 @@ class NewsContentApplication : YdBaseApplication() {
context
.
startActivity
(
intent
)
}
}),
XPageNode
(
LIFE_ACCOUNT_CREATE
,
XPageNodePageType
.
NATIVE
,
object
:
XPageHandler
{
override
fun
handler
(
params
:
Map
<
String
,
Any
?
>?)
{
val
intent
=
Intent
()
...
...
@@ -212,7 +176,6 @@ class NewsContentApplication : YdBaseApplication() {
context
.
startActivity
(
intent
)
}
}),
XPageNode
(
LIFE_ACCOUNT_CREATE_COMPLETE
,
XPageNodePageType
.
NATIVE
,
object
:
XPageHandler
{
override
fun
handler
(
params
:
Map
<
String
,
Any
?
>?)
{
val
intent
=
Intent
()
...
...
@@ -224,19 +187,6 @@ class NewsContentApplication : YdBaseApplication() {
context
.
startActivity
(
intent
)
}
}),
XPageNode
(
NEWS_CONTENT
,
XPageNodePageType
.
NATIVE
,
object
:
XPageHandler
{
override
fun
handler
(
params
:
Map
<
String
,
Any
?
>?)
{
val
intent
=
Intent
()
if
(
params
!=
null
)
{
intent
.
putExtra
(
XRouterPathConstants
.
ParamsKey
,
params
as
HashMap
)
}
intent
.
setClass
(
context
,
NewsContentActivity
::
class
.
java
)
intent
.
flags
=
Intent
.
FLAG_ACTIVITY_NEW_TASK
context
.
startActivity
(
intent
)
}
}),
XPageNode
(
PROTOCOL
,
XPageNodePageType
.
NATIVE
,
object
:
XPageHandler
{
override
fun
handler
(
params
:
Map
<
String
,
Any
?
>?)
{
val
intent
=
Intent
()
...
...
@@ -248,17 +198,6 @@ class NewsContentApplication : YdBaseApplication() {
context
.
startActivity
(
intent
)
}
}),
XPageNode
(
SUPPORT
,
XPageNodePageType
.
NATIVE
,
object
:
XPageHandler
{
override
fun
handler
(
params
:
Map
<
String
,
Any
?
>?)
{
val
intent
=
Intent
()
if
(
params
!=
null
)
{
intent
.
putExtra
(
XRouterPathConstants
.
ParamsKey
,
params
as
HashMap
)
}
intent
.
setClass
(
context
,
ProductSupportActivity
::
class
.
java
)
intent
.
flags
=
Intent
.
FLAG_ACTIVITY_NEW_TASK
context
.
startActivity
(
intent
)
}
}),
XPageNode
(
CHOOSE_CAREER
,
XPageNodePageType
.
NATIVE
,
object
:
XPageHandler
{
override
fun
handler
(
params
:
Map
<
String
,
Any
?
>?)
{
val
intent
=
Intent
()
...
...
@@ -270,7 +209,6 @@ class NewsContentApplication : YdBaseApplication() {
context
.
startActivity
(
intent
)
}
}),
// 人员管理 —— 我的员工
XPageNode
(
PERSONAL_MY_STAFF
,
XPageNodePageType
.
NATIVE
,
object
:
XPageHandler
{
override
fun
handler
(
params
:
Map
<
String
,
Any
?
>?)
{
val
intent
=
Intent
()
...
...
@@ -486,14 +424,6 @@ class NewsContentApplication : YdBaseApplication() {
private
fun
initService
()
{
Zap
.
addService
(
ZapServiceNameConstants
.
LifeNumberListServiceName
,
LifeNumberListService
())
// 未使用的服务
Zap
.
addService
(
RequestService
.
serviceName
,
RequestService
())
Zap
.
addService
(
CommentService
.
serviceName
,
CommentService
())
Zap
.
addService
(
UniversalService
.
serviceName
,
UniversalService
())
Zap
.
addService
(
UserService
.
serviceName
,
UserService
())
Zap
.
addService
(
DeepLinkService
.
serviceName
,
DeepLinkService
())
Zap
.
addService
(
SelectStoreService
.
serviceName
,
SelectStoreService
())
}
...
...
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/audio/AudioPlayerManager.kt
deleted
100644 → 0
View file @
608fb9d5
package
com.yidian.shenghuoquan.newscontent.audio
import
android.media.MediaPlayer
import
java.lang.ref.WeakReference
class
AudioPlayerManager
private
constructor
():
IAudioControl
{
companion
object
{
val
instance
:
AudioPlayerManager
by
lazy
(
LazyThreadSafetyMode
.
SYNCHRONIZED
)
{
AudioPlayerManager
()
}
const
val
STATUS_START
=
0
const
val
STATUS_PAUSE
=
1
const
val
STATUS_STOP
=
2
}
private
var
isAutoPlay
=
false
private
var
singleLoop
=
false
private
var
onPrepare
:
(()
->
Unit
)?
=
null
private
var
prepareResult
:
((
Boolean
,
Long
)
->
Unit
)?
=
null
private
var
onError
:
(()
->
Unit
)?
=
null
private
var
bufferUpdate
:
((
Int
)
->
Unit
)?
=
null
private
var
onComplete
:
(()
->
Unit
)?
=
null
private
var
audioPlayer
:
MediaPlayer
?
=
null
private
var
audioView
:
WeakReference
<
IAudioView
>?=
null
private
val
audioList
=
mutableListOf
<
String
>()
private
var
currentIndex
=
0
private
var
duration
:
Int
=
0
private
var
currentStatus
=
STATUS_STOP
private
val
prepareListener
=
MediaPlayer
.
OnPreparedListener
{
onPrepare
?.
invoke
()
prepareResult
?.
invoke
(
true
,
it
.
duration
.
toLong
())
}
private
val
errorListener
=
MediaPlayer
.
OnErrorListener
{
mr
,
what
,
extra
->
onError
?.
invoke
()
return
@OnErrorListener
true
}
private
val
bufferListener
=
MediaPlayer
.
OnBufferingUpdateListener
{
mp
,
percent
->
bufferUpdate
?.
invoke
(
percent
)
}
private
val
completeListener
=
MediaPlayer
.
OnCompletionListener
{
if
(
onComplete
!=
null
){
onComplete
?.
invoke
()
}
else
{
if
(
isAutoPlay
){
next
()
}
}
}
fun
setAudioList
(
list
:
MutableList
<
String
>,
index
:
Int
=
0
){
currentIndex
=
index
audioList
.
clear
()
audioList
.
addAll
(
list
)
}
fun
prepareAsync
(
url
:
String
?=
null
,
result
:
((
Boolean
,
Long
)
->
Unit
)?=
null
)
{
val
realUrl
=
if
(
url
.
isNullOrEmpty
())
{
if
(
currentIndex
>=
audioList
.
size
)
null
else
audioList
[
currentIndex
]
}
else
url
if
(
realUrl
.
isNullOrEmpty
())
{
result
?.
invoke
(
false
,
0
)
return
}
prepareResult
=
result
if
(
audioPlayer
==
null
)
{
audioPlayer
=
MediaPlayer
()
}
audioPlayer
?.
apply
{
setDataSource
(
realUrl
)
setOnPreparedListener
(
prepareListener
)
setOnErrorListener
(
errorListener
)
setOnBufferingUpdateListener
(
bufferListener
)
setOnCompletionListener
(
completeListener
)
prepareAsync
()
}
}
override
fun
bindAudioView
(
view
:
IAudioView
)
{
audioView
=
WeakReference
(
view
)
view
.
bindAudioControl
(
this
)
}
override
fun
start
(
progress
:
Int
,
user
:
Boolean
)
{
if
(
audioPlayer
==
null
||
audioPlayer
?.
duration
?:
0
==
0
)
return
if
(
user
)
isAutoPlay
=
true
if
(
progress
<
0
){
audioPlayer
?.
start
()
return
}
val
duration
=
(
audioPlayer
!!
.
duration
*
progress
.
toFloat
()/
100
+
0.5f
).
toInt
()
audioPlayer
?.
seekTo
(
duration
)
audioPlayer
?.
start
()
}
override
fun
pause
()
{
audioPlayer
?.
pause
()
}
override
fun
stop
()
{
audioPlayer
?.
stop
()
}
override
fun
seekTo
(
progress
:
Int
)
{
val
total
=
audioPlayer
?.
duration
?:
0
if
(
total
==
0
)
return
audioPlayer
?.
seekTo
((
total
*
progress
.
toFloat
()/
total
).
toInt
())
}
override
fun
isPlaying
()
:
Boolean
{
return
audioPlayer
!=
null
&&
audioPlayer
!!
.
isPlaying
}
override
fun
next
()
{
if
(
audioPlayer
?.
isPlaying
==
true
){
audioPlayer
?.
stop
()
}
audioPlayer
?.
reset
()
currentIndex
++
if
(
currentIndex
>=
audioList
.
size
){
currentIndex
--
checkPrevAndNext
(
currentIndex
)
return
}
checkPrevAndNext
(
currentIndex
)
audioView
?.
get
()
?.
setContent
(
"第${currentIndex+1}首"
)
prepareAsync
{
result
,
_
->
if
(
result
){
audioView
?.
get
()
?.
setPlayEnable
(
true
)
if
(
isAutoPlay
)
start
(
0
,
false
)
}
}
}
override
fun
previous
()
{
if
(
audioPlayer
?.
isPlaying
==
true
){
audioPlayer
?.
stop
()
}
audioPlayer
?.
reset
()
currentIndex
--
if
(
currentIndex
<
0
){
currentIndex
=
0
checkPrevAndNext
(
currentIndex
)
return
}
checkPrevAndNext
(
currentIndex
)
audioView
?.
get
()
?.
setContent
(
"第${currentIndex+1}首"
)
if
(
currentIndex
==
0
){
audioView
?.
get
()
?.
setPrevEnable
(
false
)
}
prepareAsync
{
result
,
_
->
if
(
result
){
audioView
?.
get
()
?.
setPlayEnable
(
true
)
if
(
isAutoPlay
)
start
(
0
,
false
)
}
}
}
private
fun
checkPrevAndNext
(
index
:
Int
){
if
(
index
==
0
){
audioView
?.
get
()
?.
setPrevEnable
(
false
)
}
if
(
index
>=
audioList
.
size
){
audioView
?.
get
()
?.
setNextEnable
(
false
)
}
if
(
index
>
0
&&
index
<
audioList
.
size
-
1
){
audioView
?.
get
()
?.
setPrevEnable
(
true
)
audioView
?.
get
()
?.
setNextEnable
(
true
)
}
}
override
fun
release
()
{
audioView
?.
clear
()
audioView
=
null
onPrepare
=
null
onError
=
null
bufferUpdate
=
null
audioPlayer
?.
reset
()
audioPlayer
?.
release
()
audioPlayer
=
null
}
fun
setOnPrepareListener
(
onPrepare
:
()
->
Unit
)
{
this
.
onPrepare
=
onPrepare
}
fun
setOnErrorListener
(
onError
:
()
->
Unit
)
{
this
.
onError
=
onError
}
fun
setOnBufferListener
(
bufferUpdate
:
(
Int
)
->
Unit
)
{
this
.
bufferUpdate
=
bufferUpdate
}
fun
setOnCompleteListener
(
onComplete
:
()
->
Unit
)
{
this
.
onComplete
=
onComplete
}
/**
* 在视频页面必须停止播放音频,释放资源。在这里需要记录当前的播放状态,播放进度
*/
fun
pauseForVideo
()
{
}
/**
* 因视频暂停音频播放后的恢复操作
*/
fun
restartAudio
(){
}
class
AudioPauseStatus
{
var
playStatus
:
Int
=
STATUS_STOP
var
duration
=
0
}
}
\ No newline at end of file
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/audio/AudioService.kt
deleted
100644 → 0
View file @
608fb9d5
package
com.yidian.shenghuoquan.newscontent.audio
import
android.app.Service
import
android.content.Intent
import
android.graphics.PixelFormat
import
android.os.Build
import
android.os.IBinder
import
android.util.Log
import
android.view.*
import
android.view.WindowManager.LayoutParams.*
import
androidx.core.view.isGone
import
com.yidian.shenghuoquan.newscontent.utils.audioManager
import
com.yidian.shenghuoquan.newscontent.widget.FloatAudioView
/**
* 主要控制音频的生命周期
*/
class
AudioService
:
Service
()
{
private
val
TAG
=
"AudioService"
private
var
windowManager
:
WindowManager
?=
null
private
lateinit
var
rootView
:
FloatAudioView
override
fun
onCreate
()
{
super
.
onCreate
()
windowManager
=
getSystemService
(
WINDOW_SERVICE
)
as
WindowManager
?
rootView
=
FloatAudioView
(
this
)
rootView
.
setPlayEnable
(
false
)
audioManager
.
prepareAsync
{
result
,
_
->
Log
.
e
(
TAG
,
"onCreate: prepare$result"
)
if
(
result
){
rootView
.
setContent
(
"第一首歌"
)
rootView
.
setPlayEnable
(
true
)
}
}
audioManager
.
setOnErrorListener
{
Log
.
e
(
TAG
,
"onError: ========="
)
}
rootView
.
setOnCloseListener
{
stopSelf
()
}
}
override
fun
onBind
(
intent
:
Intent
):
IBinder
?
{
return
null
}
override
fun
onStartCommand
(
intent
:
Intent
?,
flags
:
Int
,
startId
:
Int
):
Int
{
showFloatingWindow
()
return
START_STICKY
}
private
fun
showFloatingWindow
(){
val
params
=
WindowManager
.
LayoutParams
()
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
){
params
.
type
=
TYPE_APPLICATION_OVERLAY
}
else
{
params
.
type
=
TYPE_PHONE
}
params
.
packageName
=
packageName
params
.
flags
=
params
.
flags
or
FLAG_HARDWARE_ACCELERATED
params
.
flags
=
params
.
flags
or
FLAG_NOT_FOCUSABLE
or
FLAG_NOT_TOUCH_MODAL
params
.
flags
=
params
.
flags
or
FLAG_LAYOUT_INSET_DECOR
or
FLAG_LAYOUT_IN_SCREEN
params
.
width
=
MATCH_PARENT
params
.
height
=
WRAP_CONTENT
params
.
format
=
PixelFormat
.
TRANSPARENT
params
.
gravity
=
Gravity
.
BOTTOM
params
.
x
=
0
params
.
y
=
500
windowManager
?.
addView
(
rootView
,
params
)
audioManager
.
bindAudioView
(
rootView
)
}
override
fun
onDestroy
()
{
super
.
onDestroy
()
rootView
.
isGone
=
true
windowManager
?.
removeView
(
rootView
)
windowManager
=
null
audioManager
.
release
()
}
}
\ No newline at end of file
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/audio/IAudioControl.kt
deleted
100644 → 0
View file @
608fb9d5
package
com.yidian.shenghuoquan.newscontent.audio
interface
IAudioControl
{
fun
start
(
progress
:
Int
=
-
1
,
user
:
Boolean
=
true
)
fun
next
()
fun
previous
()
fun
pause
()
fun
stop
()
fun
isPlaying
():
Boolean
fun
release
()
fun
seekTo
(
progress
:
Int
)
fun
bindAudioView
(
view
:
IAudioView
)
}
interface
IAudioView
{
fun
setPrevEnable
(
enable
:
Boolean
)
fun
setNextEnable
(
enable
:
Boolean
)
fun
setPlayEnable
(
enable
:
Boolean
)
fun
setContent
(
content
:
String
)
fun
updatePlayUi
(
isPlay
:
Boolean
)
fun
bindAudioControl
(
control
:
IAudioControl
)
}
\ No newline at end of file
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/service/CommentService.kt
deleted
100644 → 0
View file @
608fb9d5
package
com.yidian.shenghuoquan.newscontent.service
import
com.yidian.bcommon.XEventConfig.Companion.GO_TO_COMMENT_DETAIL
import
com.yidian.bcommon.XEventConfig.Companion.REPLY_COMMENT
import
com.yidian.bcommon.XEventConfig.Companion.REPLY_DETAIL_COMMENT
import
com.yidian.bcommon.XEventConfig.Companion.UPDATE_COMMENT
import
com.yidian.bcommon.XEventConfig.Companion.UPDATE_LIKE
import
com.yidian.bcommon.utils.ToolsUtil
import
com.yidian.xarc.xrouter.ResultResolver
import
com.yidian.yac.core.zap.ZapService
import
org.json.JSONObject
class
CommentService
:
ZapService
()
{
companion
object
{
const
val
serviceName
:
String
=
"CommentService"
}
private
lateinit
var
resolver
:
ResultResolver
override
fun
onAction
(
name
:
String
,
action
:
String
,
params
:
Any
,
options
:
Any
,
resolver
:
ResultResolver
)
{
when
(
action
)
{
REPLY_COMMENT
->
{
ToolsUtil
.
doAction
(
REPLY_COMMENT
,
params
)
}
GO_TO_COMMENT_DETAIL
->
{
ToolsUtil
.
doAction
(
GO_TO_COMMENT_DETAIL
,
params
)
}
REPLY_DETAIL_COMMENT
->
{
ToolsUtil
.
doAction
(
REPLY_DETAIL_COMMENT
,
params
)
}
UPDATE_COMMENT
->
{
ToolsUtil
.
doAction
(
UPDATE_COMMENT
,
params
)
}
UPDATE_LIKE
->
{
ToolsUtil
.
doAction
(
UPDATE_LIKE
,
params
)
}
}
this
.
resolver
=
resolver
params
as
JSONObject
val
path
=
params
.
optString
(
"name"
)
val
body
=
params
.
optJSONObject
(
"body"
)
when
(
action
)
{
"addComment"
->
addComment
(
path
,
body
)
"like"
->
like
(
path
,
body
)
}
}
override
fun
onExit
()
{
}
override
fun
onInit
()
{
}
private
fun
addComment
(
path
:
String
,
params
:
JSONObject
)
{
}
private
fun
like
(
path
:
String
,
params
:
JSONObject
)
{
}
}
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/service/DeepLinkService.kt
deleted
100644 → 0
View file @
608fb9d5
package
com.yidian.shenghuoquan.newscontent.service
import
com.yidian.bcommon.XRouterPathConstants
import
com.yidian.shenghuoquan.newscontent.ui.NewsContentActivity
import
com.yidian.xarc.xrouter.ResultResolver
import
com.yidian.xpage.XPageManager
import
com.yidian.yac.core.zap.ZapService
import
org.json.JSONObject
class
DeepLinkService
:
ZapService
()
{
companion
object
{
const
val
serviceName
:
String
=
"DeepLinkService"
}
private
lateinit
var
resolver
:
ResultResolver
override
fun
onAction
(
name
:
String
,
action
:
String
,
params
:
Any
,
options
:
Any
,
resolver
:
ResultResolver
)
{
this
.
resolver
=
resolver
params
as
JSONObject
val
parameters
=
params
.
optJSONObject
(
"parameters"
)
when
(
params
.
optString
(
"path"
))
{
"ydnews"
->
jumpNewsText
(
parameters
)
"ydvideo"
->
jumpNewsVideo
(
parameters
)
"ydauthor"
->
jumpAuthorHomePage
(
parameters
)
}
}
override
fun
onExit
()
{
}
override
fun
onInit
()
{
}
private
fun
jumpNewsText
(
params
:
JSONObject
)
{
val
docId
=
params
.
optString
(
"docid"
)
val
paramsMap
=
HashMap
<
String
,
Any
?>()
paramsMap
[
NewsContentActivity
.
ContentType
]
=
NewsContentActivity
.
TextType
paramsMap
[
NewsContentActivity
.
DocId
]
=
docId
XPageManager
.
push
(
XRouterPathConstants
.
NEWS_CONTENT
,
paramsMap
)
}
private
fun
jumpNewsVideo
(
params
:
JSONObject
)
{
val
docId
=
params
.
optString
(
"docid"
)
val
paramsMap
=
HashMap
<
String
,
Any
?>()
paramsMap
[
NewsContentActivity
.
ContentType
]
=
NewsContentActivity
.
VideoType
paramsMap
[
NewsContentActivity
.
DocId
]
=
docId
XPageManager
.
push
(
XRouterPathConstants
.
NEWS_CONTENT
,
paramsMap
)
}
private
fun
jumpAuthorHomePage
(
params
:
JSONObject
)
{
val
fromId
=
params
.
optString
(
"fromid"
)
val
paramsMap
=
HashMap
<
String
,
Any
?>()
}
}
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/service/RequestService.kt
deleted
100644 → 0
View file @
608fb9d5
package
com.yidian.shenghuoquan.newscontent.service
import
android.graphics.Bitmap
import
com.google.gson.Gson
import
com.yidian.bcommon.YdBaseApplication
import
com.yidian.bcommon.http.HttpResult
import
com.yidian.shenghuoquan.newscontent.http.ApiService
import
com.yidian.shenghuoquan.newscontent.http.httpbean.IUploadFileCallback
import
com.yidian.shenghuoquan.newscontent.http.httpbean.IUserInfoCallback
import
com.yidian.shenghuoquan.newscontent.utils.UploadFileUtils
import
com.yidian.xarc.xrouter.ResultResolver
import
com.yidian.yac.core.zap.ZapService
import
id.zelory.compressor.Compressor
import
id.zelory.compressor.constraint.format
import
id.zelory.compressor.constraint.quality
import
id.zelory.compressor.constraint.resolution
import
id.zelory.compressor.constraint.size
import
kotlinx.coroutines.CoroutineScope
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.GlobalScope
import
kotlinx.coroutines.launch
import
org.json.JSONObject
import
java.io.File
class
RequestService
:
ZapService
()
{
companion
object
{
const
val
serviceName
:
String
=
"RequestService"
}
private
lateinit
var
resolver
:
ResultResolver
override
fun
onAction
(
name
:
String
,
action
:
String
,
params
:
Any
,
options
:
Any
,
resolver
:
ResultResolver
)
{
this
.
resolver
=
resolver
params
as
JSONObject
val
path
=
params
.
optString
(
"path"
)
var
body
=
params
.
optJSONObject
(
"body"
)
if
(
body
==
null
)
{
body
=
JSONObject
()
}
when
(
action
)
{
"request"
->
requestApi
(
path
,
body
)
"download"
->
download
(
path
,
body
)
"uploadImage"
->
uploadFile
(
body
)
}
}
override
fun
onExit
()
{
}
override
fun
onInit
()
{
}
private
fun
download
(
path
:
String
,
params
:
JSONObject
)
{
}
private
val
userInfoImpl
=
object
:
IUserInfoCallback
{
override
fun
userInfoCallback
(
t
:
HttpResult
<
Any
?
>?)
{
val
params
=
Gson
().
toJson
(
t
)
resolver
.
success
(
JSONObject
(
params
))
}
override
fun
modifyNicknameCallback
(
t
:
HttpResult
<
Any
?
>?)
{
val
params
=
Gson
().
toJson
(
t
)
resolver
.
success
(
JSONObject
(
params
))
}
}
private
fun
requestApi
(
path
:
String
,
params
:
JSONObject
)
{
// when (path) {
// URLs.videoCommentList -> {
// val docId = params.optString("docid")
// val pageSize = params.optInt("page_size")
// val page = params.optInt("page")
// val videoCommentRequest = VideoCommentBean.Request(docId, pageSize, page)
// ApiService.videoCommentList(videoContentImpl, videoCommentRequest)
// }
// URLs.userInfo -> {
// ApiService.userInfo(userInfoImpl)
// }
// URLs.modifyNickname -> {
// val nickname = params.optString("nickname")
// val requestMap = HashMap<String, String>()
// requestMap["nickname"] = nickname
// ApiService.modifyNickname(userInfoImpl, requestMap)
// }
// URLs.likeComment -> {
// val docId = params.optString("docid")
// val commentId = params.optString("comment_id")
// val status = params.optInt("status")
// val likeRequest = LikeCommentBean.Request(docId, commentId, status)
// ApiService.likeComment(likeCommentImpl, likeRequest)
// }
// URLs.addSubscribe -> {
// val type = params.optInt("type")
// val subscribeId = params.optString("subscribe_id")
// val subscribeBean = AddSubscribeBean.Request(type, subscribeId)
// ApiService.addSubscribe(subscribeImpl, subscribeBean)
// }
// URLs.deleteSubscribe -> {
// val type = params.optInt("type")
// val subscribeIds = params.optString("subscribe_ids")
// val subscribeBean = DeleteSubscribeBean.Request(type, subscribeIds)
// ApiService.deleteSubscribe(subscribeImpl, subscribeBean)
// }
// }
}
private
val
uploadFileCallback
=
object
:
IUploadFileCallback
{
override
fun
uploadFileCallBack
(
t
:
HttpResult
<
Any
?
>?)
{
val
params
=
Gson
().
toJson
(
t
)
resolver
.
success
(
JSONObject
(
params
))
}
}
private
fun
uploadFile
(
params
:
JSONObject
)
{
if
(
YdBaseApplication
.
activityList
.
size
<=
0
)
return
val
activity
=
YdBaseApplication
.
activityList
[
YdBaseApplication
.
activityList
.
size
-
1
]
val
filePath
=
params
.
optString
(
"profile"
)
val
file
=
File
(
filePath
)
CoroutineScope
(
Dispatchers
.
IO
).
launch
{
val
compressedImageFile
=
Compressor
.
compress
(
activity
,
file
)
{
resolution
(
360
,
360
)
quality
(
80
)
format
(
Bitmap
.
CompressFormat
.
PNG
)
size
(
307200
)
}
val
requestBody
=
UploadFileUtils
.
fileToMultipartBodyPart
(
"profile"
,
compressedImageFile
)
ApiService
.
uploadFile
(
uploadFileCallback
,
requestBody
)
}
}
}
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/service/UniversalService.kt
deleted
100644 → 0
View file @
608fb9d5
package
com.yidian.shenghuoquan.newscontent.service
import
android.util.Log
import
android.widget.Toast
import
androidx.core.app.NotificationManagerCompat
import
com.google.gson.Gson
import
com.orhanobut.hawk.Hawk
import
com.yidian.bcommon.AppConfig
import
com.yidian.bcommon.HawkConfig
import
com.yidian.bcommon.XEventConfig
import
com.yidian.bcommon.YdBaseApplication
import
com.yidian.bcommon.services.XEventService
import
com.yidian.shenghuoquan.newscontent.R
import
com.yidian.shenghuoquan.newscontent.bean.IUpdateDialogCallback
import
com.yidian.shenghuoquan.newscontent.bean.ImageItemBean
import
com.yidian.shenghuoquan.newscontent.bean.xbrid.ClientInfoBean
import
com.yidian.shenghuoquan.newscontent.bean.xevent.XEventOpenGalleryBean
import
com.yidian.shenghuoquan.newscontent.ui.dialog.UpdateVersionDialog
import
com.yidian.shenghuoquan.newscontent.utils.DataCleanManager
import
com.yidian.utils.ToastUtil
import
com.yidian.xarc.xbase.net.CheckUpdateCallback
import
com.yidian.xarc.xevent.XBaseEvent
import
com.yidian.xarc.xrouter.ResultResolver
import
com.yidian.yac.core.zap.ZapService
import
com.yidian.yac.pm.appupdate.AppUpdateEchoData
import
com.yidian.yac.pm.appupdate.AppUpdateInfo
import
com.yidian.yac.pm.appupdate.YDAppUpdateManager
import
com.yidian.yac.pm.appupdate.callback.AppUpdateCallback
import
com.yidian.yac.pm.base.UpdateInfo
import
org.json.JSONObject
import
java.io.File
class
UniversalService
:
ZapService
(){
companion
object
{
const
val
serviceName
:
String
=
"UniversalService"
}
private
lateinit
var
resolver
:
ResultResolver
private
lateinit
var
updateInfoTemp
:
AppUpdateInfo
<
AppUpdateEchoData
>
override
fun
onAction
(
name
:
String
,
action
:
String
,
params
:
Any
,
options
:
Any
,
resolver
:
ResultResolver
)
{
this
.
resolver
=
resolver
params
as
JSONObject
when
(
action
){
"makeToast"
->
showToast
(
params
)
"openGallery"
->
openGallery
(
params
)
"getClientInfo"
->
getClientInfo
()
"getAllCache"
->
getAllCache
()
"clearAllCache"
->
clearAllCache
()
"notificationStatus"
->
getNotificationStatus
()
"notificationOnSetting"
->
notificationOnSetting
()
"checkNewVersion"
->
checkUpdate
()
"popNewVersion"
->
popNewVersion
(
updateInfoTemp
)
}
}
override
fun
onExit
()
{
}
override
fun
onInit
()
{
}
private
fun
showToast
(
params
:
JSONObject
){
val
message
=
params
.
optString
(
"message"
,
""
)
Toast
.
makeText
(
YdBaseApplication
.
context
,
message
,
Toast
.
LENGTH_SHORT
).
show
()
}
private
fun
openGallery
(
params
:
JSONObject
){
val
index
=
params
.
optInt
(
"index"
)
val
imageArray
=
params
.
optJSONArray
(
"imageList"
)
val
url
=
params
.
optString
(
"url"
)
val
imageList
=
ArrayList
<
ImageItemBean
>()
repeat
(
imageArray
.
length
()){
imageList
.
add
(
ImageItemBean
(
imageArray
.
get
(
it
).
toString
()))
}
val
xbaseEvent
=
XBaseEvent
(
XEventConfig
.
OPEN_GALLERY
,
XEventOpenGalleryBean
(
index
,
imageList
,
url
))
XEventService
.
postEvent
(
xbaseEvent
)
}
private
fun
getClientInfo
(){
val
userId
=
Hawk
.
get
(
HawkConfig
.
Username
,
""
)
val
nickname
=
Hawk
.
get
(
HawkConfig
.
Nickname
,
""
)
val
portrait
=
Hawk
.
get
(
HawkConfig
.
ProfileUrl
,
""
)
val
loginStatus
=
Hawk
.
get
(
HawkConfig
.
LoginStatus
,
false
)
val
userInfo
=
ClientInfoBean
.
UserInfo
(
userId
,
nickname
,
portrait
,
loginStatus
)
val
appInfo
=
ClientInfoBean
.
AppInfo
(
AppConfig
.
cv
)
val
clientInfoBean
=
ClientInfoBean
(
userInfo
,
appInfo
)
val
params
=
Gson
().
toJson
(
clientInfoBean
)
resolver
.
success
(
JSONObject
(
params
))
}
private
fun
getAllCache
(){
val
cacheSize
=
DataCleanManager
.
getTotalCacheSizeShow
(
YdBaseApplication
.
context
)
resolver
.
success
(
cacheSize
)
}
private
fun
clearAllCache
(){
Thread
{
DataCleanManager
.
clearAllCache
(
YdBaseApplication
.
context
)
}.
start
()
resolver
.
success
(
"0K"
)
}
private
fun
getNotificationStatus
(){
if
(
YdBaseApplication
.
activityList
.
size
<=
0
)
return
val
activity
=
YdBaseApplication
.
activityList
[
YdBaseApplication
.
activityList
.
size
-
1
]
val
manage
=
NotificationManagerCompat
.
from
(
activity
)
val
isOpen
=
manage
.
areNotificationsEnabled
()
resolver
.
success
(
isOpen
)
}
private
fun
notificationOnSetting
(){
val
xbaseEvent
=
XBaseEvent
(
XEventConfig
.
OPEN_PUSH
,
""
)
XEventService
.
postEvent
(
xbaseEvent
)
}
private
fun
checkUpdate
(){
val
activity
=
YdBaseApplication
.
activityList
[
YdBaseApplication
.
activityList
.
size
-
1
]
YDAppUpdateManager
.
checkAppUpdate
(
object
:
CheckUpdateCallback
()
{
override
fun
onSucess
(
updateInfo
:
UpdateInfo
<
Any
>?)
{
updateInfoTemp
=
updateInfo
as
AppUpdateInfo
<
AppUpdateEchoData
>
val
jsonString
=
Gson
().
toJson
(
updateInfoTemp
)
val
jsonObject
=
JSONObject
(
jsonString
)
jsonObject
.
put
(
"localVersion"
,
AppConfig
.
cv
)
activity
.
runOnUiThread
{
resolver
.
success
(
jsonObject
)
}
}
override
fun
onFail
(
msg
:
String
)
{
activity
.
runOnUiThread
{
ToastUtil
.
showToast
(
activity
,
msg
)
}
}
})
}
private
val
updateDialogCallback
=
object
:
IUpdateDialogCallback
{
override
fun
downloadCallback
(
updateInfo
:
AppUpdateInfo
<
AppUpdateEchoData
>)
{
updateDownload
(
updateInfo
)
}
}
private
fun
popNewVersion
(
updateInfo
:
AppUpdateInfo
<
AppUpdateEchoData
>){
val
activity
=
YdBaseApplication
.
activityList
[
YdBaseApplication
.
activityList
.
size
-
1
]
activity
.
runOnUiThread
{
val
updateDialog
=
UpdateVersionDialog
(
activity
,
R
.
style
.
update_dialog
,
updateDialogCallback
)
updateDialog
.
setData
(
updateInfo
)
updateDialog
.
show
()
}
}
private
fun
updateDownload
(
updateInfo
:
AppUpdateInfo
<
AppUpdateEchoData
>){
YDAppUpdateManager
.
download
(
updateInfo
,
object
:
AppUpdateCallback
()
{
override
fun
onProgress
(
total
:
Long
,
current
:
Long
,
percentage
:
Int
)
{
Log
.
e
(
"zhb-yd"
,
"进度:========$percentage"
)
}
override
fun
onDownloadSuccess
(
apkFile
:
File
,
isCache
:
Boolean
)
{
YDAppUpdateManager
.
installApk
(
apkFile
)
}
override
fun
onDownloadFailed
()
{
}
override
fun
onDownloadPaused
()
{
}
override
fun
onInstallFailed
()
{
}
override
fun
onSignatureVerifiyFailed
()
{
}
},
false
)
}
}
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/service/UserService.kt
deleted
100644 → 0
View file @
608fb9d5
package
com.yidian.shenghuoquan.newscontent.service
import
com.yidian.xarc.xrouter.ResultResolver
import
com.yidian.yac.core.zap.ZapService
import
org.json.JSONObject
class
UserService
:
ZapService
()
{
companion
object
{
const
val
serviceName
:
String
=
"UserService"
}
private
lateinit
var
resolver
:
ResultResolver
override
fun
onAction
(
name
:
String
,
action
:
String
,
params
:
Any
,
options
:
Any
,
resolver
:
ResultResolver
)
{
this
.
resolver
=
resolver
params
as
JSONObject
val
path
=
params
.
optString
(
"path"
)
val
body
=
params
.
optJSONObject
(
"body"
)
when
(
action
)
{
"addComment"
->
addComment
(
path
,
body
)
"like"
->
like
(
path
,
body
)
}
}
override
fun
onExit
()
{
}
override
fun
onInit
()
{
}
private
fun
addComment
(
path
:
String
,
params
:
JSONObject
)
{
}
private
fun
like
(
path
:
String
,
params
:
JSONObject
)
{
}
}
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/ui/CommentWebFragment.kt
deleted
100644 → 0
View file @
608fb9d5
package
com.yidian.shenghuoquan.newscontent.ui
import
android.annotation.SuppressLint
import
android.os.Bundle
import
android.view.LayoutInflater
import
android.view.ViewGroup
import
android.webkit.WebChromeClient
import
android.webkit.WebView
import
androidx.core.os.bundleOf
import
com.google.gson.Gson
import
com.yidian.bcommon.XEventConfig
import
com.yidian.bcommon.XRouterPathConstants
import
com.yidian.bcommon.base.BaseFragment
import
com.yidian.bcommon.http.HttpResult
import
com.yidian.shenghuoquan.newscontent.bean.ContentDetailBean
import
com.yidian.shenghuoquan.newscontent.databinding.FragmentWebBinding
import
com.yidian.xarc.xbrid.XBridManager
import
com.yidian.xarc.xbrid.XWebView
import
com.yidian.xarc.xevent.XBaseEvent
import
com.yidian.xarc.xevent.XEventManager
import
org.greenrobot.eventbus.Subscribe
import
org.greenrobot.eventbus.ThreadMode
import
org.json.JSONObject
class
CommentWebFragment
:
BaseFragment
<
FragmentWebBinding
>()
{
companion
object
{
fun
newInstance
(
paramsMap
:
Map
<
*
,
*
>):
CommentWebFragment
{
return
CommentWebFragment
().
apply
{
arguments
=
bundleOf
(
Pair
(
XRouterPathConstants
.
ParamsKey
,
paramsMap
))
}
}
}
private
lateinit
var
webView
:
XWebView
private
var
loadDataFinish
=
false
private
var
loadWebViewFinish
=
false
private
var
data
:
HttpResult
<
Any
?>?
=
null
private
var
isDestroy
=
false
override
fun
createViewBinding
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?
):
FragmentWebBinding
{
return
FragmentWebBinding
.
inflate
(
inflater
,
container
,
false
)
}
override
fun
init
(
savedInstanceState
:
Bundle
?)
{
super
.
init
(
savedInstanceState
)
val
paramsMap
=
arguments
?.
getSerializable
(
XRouterPathConstants
.
ParamsKey
)
as
Map
<*,
*>
initData
()
initWebView
()
setClickListener
()
}
private
fun
initData
()
{
}
@SuppressLint
(
"SetJavaScriptEnabled"
)
private
fun
initWebView
()
{
webView
=
XBridManager
.
getWebView
(
requireContext
(),
"testidenfier"
,
viewBinding
.
commentWeb
)
webView
.
loadUrl
(
"xbrid_article"
)
webView
.
webChromeClient
=
object
:
WebChromeClient
()
{
override
fun
onProgressChanged
(
view
:
WebView
?,
newProgress
:
Int
)
{
super
.
onProgressChanged
(
view
,
newProgress
)
if
(
newProgress
==
100
)
{
loadWebViewFinish
=
true
postDataToWeb
()
}
}
}
WebView
.
setWebContentsDebuggingEnabled
(
true
)
}
private
fun
postDataToWeb
()
{
if
(
loadDataFinish
&&
loadWebViewFinish
)
{
val
contentDetailBean
=
ContentDetailBean
(
"getArticleData"
,
data
)
val
params
=
Gson
().
toJson
(
contentDetailBean
)
XBridManager
.
postEvent
(
"ArticleService"
,
JSONObject
(
params
),
webView
)
}
}
private
fun
setClickListener
()
{
}
override
fun
onDestroy
()
{
super
.
onDestroy
()
isDestroy
=
true
if
(
::
webView
.
isInitialized
)
{
XBridManager
.
backWebView
(
webView
)
}
XEventManager
.
unRegister
(
this
)
}
@Subscribe
(
sticky
=
false
,
threadMode
=
ThreadMode
.
MAIN
)
fun
onEvent
(
event
:
XBaseEvent
?)
{
when
(
event
?.
name
)
{
XEventConfig
.
SCROLL_SETTING_BAR
->
{
val
isShow
=
event
.
body
as
Boolean
}
}
}
}
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/ui/DeepLinkActivity.kt
deleted
100644 → 0
View file @
608fb9d5
package
com.yidian.shenghuoquan.newscontent.ui
import
android.os.Bundle
import
android.util.Log
import
android.view.View
import
android.view.Window
import
androidx.appcompat.app.AppCompatActivity
import
com.yidian.bcommon.XRouterPathConstants.Companion.FLASH
import
com.yidian.xpage.XPageManager
class
DeepLinkActivity
:
AppCompatActivity
()
{
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
requestWindowFeature
(
Window
.
FEATURE_NO_TITLE
)
super
.
onCreate
(
savedInstanceState
)
setContentView
(
View
(
this
))
getDataFromBrowser
()
}
private
fun
getDataFromBrowser
()
{
val
uri
=
intent
.
data
Log
.
e
(
"zhb-yd"
,
"deepUri:$uri"
)
val
scheme
=
uri
?.
scheme
val
host
=
uri
?.
host
val
deepData
=
uri
?.
getQueryParameter
(
"deep_data"
)
Log
.
e
(
"zhb-yd"
,
"scheme:$scheme====host:$host====deepJson:$deepData"
)
val
paramsMap
=
HashMap
<
String
,
Any
?>()
paramsMap
[
"jumpFrom"
]
=
"DeepLink"
paramsMap
[
"deepData"
]
=
deepData
XPageManager
.
push
(
FLASH
,
paramsMap
)
finish
()
}
}
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/ui/LifeAccountEnterpriseCertificationActivity.kt
deleted
100644 → 0
View file @
608fb9d5
package
com.yidian.shenghuoquan.newscontent.ui
import
android.app.Activity
import
android.content.ContentResolver
import
android.content.Intent
import
android.graphics.Bitmap
import
android.graphics.BitmapFactory
import
android.net.Uri
import
android.os.Build
import
android.os.Bundle
import
android.os.FileUtils
import
android.provider.MediaStore
import
android.util.Log
import
androidx.core.content.FileProvider
import
com.yidian.bcommon.XRouterPathConstants
import
com.yidian.bcommon.base.BaseActivity
import
com.yidian.bcommon.constant.GlobalConstants
import
com.yidian.bcommon.utils.YdFileUtils
import
com.yidian.shenghuoquan.newscontent.databinding.ActivityLifeAccountEnterpriseCertificationBinding
import
com.yidian.shenghuoquan.newscontent.http.ApiService
import
com.yidian.shenghuoquan.newscontent.http.httpbean.BusinessLicenseOCRBean
import
com.yidian.shenghuoquan.newscontent.http.httpbean.IBusinessLicenseOCRCallback
import
com.yidian.shenghuoquan.newscontent.utils.KS3Core
import
com.yidian.utils.ToastUtil
import
java.io.File
import
java.io.FileOutputStream
/**
* author: yinjiacheng
* date: 5/24/21 3:15 PM
* description: 企业生活号认证
*/
class
LifeAccountEnterpriseCertificationActivity
:
BaseActivity
<
ActivityLifeAccountEnterpriseCertificationBinding
>()
{
companion
object
{
private
const
val
TAG
=
"BusinessLicenseOCR"
private
const
val
REQUEST_CODE_PERMISSIONS
=
1000
//权限
private
const
val
REQUEST_CODE_ALBUM
=
1001
//相册
private
const
val
REQUEST_CODE_CAMERA
=
1002
//相机
private
const
val
FILE_PATH_BUSINESS_LICENSE_CAMERA
=
"/ocr/business_license_camera.jpg"
private
const
val
FILE_PATH_BUSINESS_LICENSE
=
"/ocr/business_license.jpg"
}
/**
* 调用系统相机拍照,照片Uri
*/
private
lateinit
var
photoUri
:
Uri
/**
* 营业执照文件路径
*/
private
var
filePath
:
String
?
=
null
override
fun
createViewBinding
():
ActivityLifeAccountEnterpriseCertificationBinding
{
return
ActivityLifeAccountEnterpriseCertificationBinding
.
inflate
(
layoutInflater
)
}
override
fun
getXPageName
():
String
{
return
XRouterPathConstants
.
LIFE_ACCOUNT_ENTERPRISE_CERTIFICATION
}
override
fun
init
(
savedInstanceState
:
Bundle
?)
{
super
.
init
(
savedInstanceState
)
initListener
()
}
private
fun
initListener
()
{
viewBind
.
btnOpenAlbum
.
setOnClickListener
{
// 打开系统相册
val
intent
=
Intent
()
intent
.
action
=
Intent
.
ACTION_PICK
intent
.
setDataAndType
(
MediaStore
.
Images
.
Media
.
EXTERNAL_CONTENT_URI
,
"image/*"
)
startActivityForResult
(
intent
,
REQUEST_CODE_ALBUM
)
}
viewBind
.
btnTakePhoto
.
setOnClickListener
{
val
file
=
File
(
externalCacheDir
?.
absolutePath
+
FILE_PATH_BUSINESS_LICENSE_CAMERA
)
if
(
file
.
exists
())
{
file
.
delete
()
}
else
{
file
.
parentFile
?.
mkdirs
()
file
.
createNewFile
()
}
photoUri
=
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N
)
{
//适配Android 7.0文件权限,通过FileProvider创建一个content类型的Uri
FileProvider
.
getUriForFile
(
this
,
GlobalConstants
.
AUTHORITY
,
file
)
}
else
{
Uri
.
fromFile
(
file
)
}
val
intent
=
Intent
(
MediaStore
.
ACTION_IMAGE_CAPTURE
)
//android11以后强制分区存储,外部资源无法访问,所以添加一个输出保存位置,然后取值操作
intent
.
putExtra
(
MediaStore
.
EXTRA_OUTPUT
,
photoUri
)
startActivityForResult
(
intent
,
REQUEST_CODE_CAMERA
)
}
viewBind
.
btnOcr
.
setOnClickListener
{
KS3Core
.
INSTANCE
.
uploadObject
(
generateUploadFile
(
filePath
),
KS3Core
.
ObjectType
.
IMAGE
,
KS3Core
.
ScenarioType
.
BUSINESS_LICENSE
,
object
:
KS3Core
.
OnKS3TaskListener
{
override
fun
onTaskStart
()
{
}
override
fun
onTaskProgress
(
progress
:
Double
)
{
}
override
fun
onTaskFinish
()
{
}
override
fun
onTaskCancel
()
{
}
override
fun
onTaskSuccess
(
bucket
:
String
?,
objectKey
:
String
?)
{
if
(
bucket
==
null
||
objectKey
==
null
)
return
val
requestParams
=
HashMap
<
String
,
String
?>()
requestParams
[
"business_image_objectid"
]
=
objectKey
requestParams
[
"business_image_bucket"
]
=
bucket
ApiService
.
businessLicenseOCR
(
object
:
IBusinessLicenseOCRCallback
{
override
fun
businessLicenseOCRSuccess
(
result
:
BusinessLicenseOCRBean
.
Response
?)
{
Log
.
d
(
TAG
,
"name: ${result?.name}, code: ${result?.code}"
)
ToastUtil
.
showToast
(
this
@LifeAccountEnterpriseCertificationActivity
,
"ocr result, name: ${result?.name}, code: ${result?.code}"
)
}
override
fun
businessLicenseOCRFailure
(
message
:
String
?)
{
}
},
requestParams
)
}
override
fun
onTaskFailure
(
statesCode
:
Int
,
message
:
String
?)
{
}
})
}
}
/**
* 通过Uri获取文件全路径
* 适配Android Q
*/
private
fun
getFilePathFromUri
(
uri
:
Uri
?):
String
?
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
Q
)
{
val
file
=
File
(
externalCacheDir
?.
absolutePath
+
FILE_PATH_BUSINESS_LICENSE
)
if
(
file
.
exists
())
{
file
.
delete
()
}
else
{
file
.
parentFile
?.
mkdirs
()
file
.
createNewFile
()
}
if
(
uri
?.
scheme
==
ContentResolver
.
SCHEME_CONTENT
)
{
val
inputStream
=
contentResolver
.
openInputStream
(
uri
)
val
fileOutputStream
=
FileOutputStream
(
file
)
inputStream
?.
let
{
FileUtils
.
copy
(
it
,
fileOutputStream
)
}
inputStream
?.
close
()
fileOutputStream
.
close
()
return
file
.
absolutePath
}
return
null
}
else
{
return
YdFileUtils
.
getImageAbsolutePath
(
this
,
uri
)
}
}
/**
* 生成金山云上传文件
*/
private
fun
generateUploadFile
(
filePath
:
String
?):
File
{
BitmapFactory
.
decodeFile
(
filePath
)
.
compress
(
Bitmap
.
CompressFormat
.
JPEG
,
10
,
FileOutputStream
(
filePath
))
return
File
(
filePath
)
}
/**
* 根据容器大小生成Bitmap
*
* @param filePath 本地文件路径
*/
private
fun
generateBitmap
(
filePath
:
String
?):
Bitmap
?
{
val
options
=
BitmapFactory
.
Options
()
options
.
inJustDecodeBounds
=
true
BitmapFactory
.
decodeFile
(
filePath
,
options
)
options
.
inSampleSize
=
calculateInSampleSize
(
options
,
viewBind
.
ivImage
.
width
,
viewBind
.
ivImage
.
height
)
options
.
inJustDecodeBounds
=
false
return
BitmapFactory
.
decodeFile
(
filePath
,
options
)
}
/**
* 计算Bitmap inSampleSize
*
* @param targetWidth 容器宽
* @param targetHeight 容器高
*/
private
fun
calculateInSampleSize
(
options
:
BitmapFactory
.
Options
,
targetWidth
:
Int
,
targetHeight
:
Int
):
Int
{
val
sourceWidth
=
options
.
outWidth
val
sourceHeight
=
options
.
outHeight
var
inSampleSize
=
1
if
(
sourceWidth
>
targetWidth
||
sourceHeight
>
targetHeight
)
{
val
halfWidth
=
sourceWidth
/
2
val
halfHeight
=
sourceHeight
/
2
// 压缩后的尺寸与所需的尺寸进行比较
while
(
halfWidth
/
inSampleSize
>=
targetWidth
&&
halfHeight
/
inSampleSize
>=
targetHeight
)
{
inSampleSize
*=
2
}
}
return
inSampleSize
}
override
fun
onActivityResult
(
requestCode
:
Int
,
resultCode
:
Int
,
data
:
Intent
?)
{
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
)
if
(
resultCode
==
Activity
.
RESULT_OK
)
{
when
(
requestCode
)
{
REQUEST_CODE_ALBUM
->
{
filePath
=
getFilePathFromUri
(
data
?.
data
)
viewBind
.
ivImage
.
setImageBitmap
(
generateBitmap
(
filePath
))
}
REQUEST_CODE_CAMERA
->
{
filePath
=
getFilePathFromUri
(
photoUri
)
viewBind
.
ivImage
.
setImageBitmap
(
generateBitmap
(
filePath
))
}
}
}
}
}
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/ui/NewsContentActivity.kt
deleted
100644 → 0
View file @
608fb9d5
package
com.yidian.shenghuoquan.newscontent.ui
import
android.content.Intent
import
android.os.Bundle
import
com.umeng.socialize.UMShareAPI
import
com.yidian.bcommon.XRouterPathConstants
import
com.yidian.bcommon.XRouterPathConstants.Companion.NEWS_CONTENT
import
com.yidian.bcommon.base.BaseActivity
import
com.yidian.shenghuoquan.newscontent.R
import
com.yidian.shenghuoquan.newscontent.databinding.ActivityNewsContentBinding
class
NewsContentActivity
:
BaseActivity
<
ActivityNewsContentBinding
>()
{
override
fun
createViewBinding
():
ActivityNewsContentBinding
{
return
ActivityNewsContentBinding
.
inflate
(
layoutInflater
)
}
override
fun
getXPageName
():
String
{
return
NEWS_CONTENT
}
companion
object
{
const
val
ContentType
=
"content_type"
const
val
TextType
=
"text_detail"
const
val
VideoType
=
"video_detail"
const
val
DocId
=
"doc_id"
const
val
JumpFrom
=
"jump_from"
}
override
fun
init
(
savedInstanceState
:
Bundle
?)
{
super
.
init
(
savedInstanceState
)
if
(
intent
.
getSerializableExtra
(
XRouterPathConstants
.
ParamsKey
)
!=
null
){
val
paramsMap
=
intent
.
getSerializableExtra
(
XRouterPathConstants
.
ParamsKey
)
as
HashMap
<*,
*>
val
newContentType
=
paramsMap
[
ContentType
]
as
String
initFragment
(
newContentType
,
paramsMap
)
}
}
private
fun
initFragment
(
contentType
:
String
,
paramsMap
:
Map
<
*
,
*
>)
{
when
(
contentType
)
{
TextType
->
{
val
commentFragment
=
CommentWebFragment
.
newInstance
(
paramsMap
)
supportFragmentManager
.
beginTransaction
().
replace
(
R
.
id
.
fly_webContainer
,
commentFragment
).
commit
()
}
}
}
override
fun
onDestroy
()
{
super
.
onDestroy
()
UMShareAPI
.
get
(
this
).
release
()
}
override
fun
onActivityResult
(
requestCode
:
Int
,
resultCode
:
Int
,
data
:
Intent
?)
{
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
)
UMShareAPI
.
get
(
this
).
onActivityResult
(
requestCode
,
resultCode
,
data
)
}
}
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/ui/ProductSupportActivity.kt
deleted
100644 → 0
View file @
608fb9d5
package
com.yidian.shenghuoquan.newscontent.ui
import
android.annotation.SuppressLint
import
android.app.Activity
import
android.content.ClipData
import
android.content.Intent
import
android.net.Uri
import
android.os.Bundle
import
android.webkit.ValueCallback
import
android.webkit.WebChromeClient
import
android.webkit.WebView
import
android.webkit.WebViewClient
import
com.orhanobut.hawk.Hawk
import
com.yidian.bcommon.HawkConfig
import
com.yidian.bcommon.XRouterPathConstants.Companion.SUPPORT
import
com.yidian.bcommon.base.BaseActivity
import
com.yidian.bcommon.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
)
}
override
fun
getXPageName
():
String
{
return
SUPPORT
}
private
val
FILE_CHOOSER_RESULT_CODE
=
666
private
var
uploadMessageAboveL
:
ValueCallback
<
Array
<
Uri
>>?
=
null
private
lateinit
var
webView
:
XWebView
@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
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
}
}
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
)
}
}
}
}
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/ui/alive/AliveTestActivity.kt
deleted
100644 → 0
View file @
608fb9d5
package
com.yidian.shenghuoquan.newscontent.ui.alive
import
android.app.ProgressDialog
import
android.os.Bundle
import
android.widget.Toast
import
com.megvii.meglive_sdk.listener.DetectCallback
import
com.megvii.meglive_sdk.listener.PreCallback
import
com.megvii.meglive_sdk.manager.MegLiveManager
import
com.yidian.bcommon.AppConfig
import
com.yidian.bcommon.base.BaseActivity
import
com.yidian.bcommon.http.HttpResult
import
com.yidian.bcommon.utils.ToolsUtil
import
com.yidian.shenghuoquan.newscontent.databinding.ActivityAliveLayoutBinding
import
com.yidian.shenghuoquan.newscontent.http.ApiService
import
com.yidian.shenghuoquan.newscontent.http.httpbean.AuthPersonalGetTokenBean
import
com.yidian.shenghuoquan.newscontent.http.httpbean.AuthPersonalGetTokenCallback
import
com.yidian.shenghuoquan.newscontent.http.httpbean.IdentifyIdOcrVerifyBean
import
com.yidian.shenghuoquan.newscontent.http.httpbean.IdentifyIdOcrVerifyCallback
import
com.yidian.shenghuoquan.newscontent.utils.KS3Core
import
java.io.File
import
java.io.FileOutputStream
import
java.io.InputStream
/**
* Author: sym
* Date: 2021/5/19 6:11 PM
* Describe:onPreStart showDialogDismiss onPreFinish progressDialogDismiss
*/
class
AliveTestActivity
:
BaseActivity
<
ActivityAliveLayoutBinding
>(),
PreCallback
,
DetectCallback
{
private
var
sign
=
""
private
var
bizToken
=
""
private
var
megLiveManager
:
MegLiveManager
?
=
null
private
var
modelPath
=
""
// 模型本地存放路径
private
var
dataPath
=
""
// 模型本地存放路径
private
var
mProgressDialog
:
ProgressDialog
?
=
null
private
var
idCardName
:
String
?
=
null
private
var
idCardNo
:
String
?
=
null
override
fun
createViewBinding
():
ActivityAliveLayoutBinding
{
return
ActivityAliveLayoutBinding
.
inflate
(
layoutInflater
)
}
override
fun
getXPageName
():
String
{
return
""
}
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
initSign
()
setOnListener
()
idCardName
=
intent
.
getStringExtra
(
"idCardName"
)
idCardNo
=
intent
.
getStringExtra
(
"idCardNo"
)
}
private
fun
initSign
()
{
val
currtTime
=
System
.
currentTimeMillis
()
/
1000
val
expireTime
=
(
System
.
currentTimeMillis
()
+
60
*
60
*
100
)
/
1000
sign
=
GenerateSign
.
appSign
(
AppConfig
.
KUANGSHI_ALIVE_API_KEY
,
AppConfig
.
KUANGSHI_SECRET
,
currtTime
,
expireTime
)
megLiveManager
=
MegLiveManager
.
getInstance
()
modelPath
=
saveAssets
(
"faceidmodel.bin"
,
"model"
)
!!
mProgressDialog
=
ProgressDialog
(
this
)
mProgressDialog
!!
.
setCancelable
(
false
)
}
private
fun
setOnListener
()
{
viewBind
.
btActionYy
.
setOnClickListener
{
val
requestParams
=
HashMap
<
String
,
String
?>()
requestParams
[
"id_number"
]
=
idCardNo
requestParams
[
"id_card_name"
]
=
idCardName
requestParams
[
"liveness_type"
]
=
"meglive"
ApiService
.
authPersonalGetToken
(
authPersonalGetTokenCallback
,
requestParams
)
}
}
private
val
authPersonalGetTokenCallback
=
object
:
AuthPersonalGetTokenCallback
{
override
fun
getTokenSuccess
(
t
:
HttpResult
<
AuthPersonalGetTokenBean
.
Response
?
>?)
{
bizToken
=
t
?.
result
?.
biz_token
!!
megLiveManager
?.
preDetect
(
this
@AliveTestActivity
,
bizToken
,
"zh"
,
"https://api.megvii.com"
,
modelPath
,
this
@AliveTestActivity
)
}
}
private
fun
saveAssets
(
fileName
:
String
,
path
:
String
):
String
?
{
val
dir
=
File
(
getExternalFilesDir
(
"megvii"
),
path
)
if
(!
dir
.
exists
())
{
if
(!
dir
.
mkdirs
())
{
return
null
}
}
val
file
=
File
(
dir
,
fileName
)
var
fos
:
FileOutputStream
?
=
null
var
`is`
:
InputStream
?
=
null
var
ret
:
String
?
=
null
try
{
var
count
:
Int
val
buffer
=
ByteArray
(
1024
)
fos
=
FileOutputStream
(
file
)
`is`
=
this
.
assets
.
open
(
fileName
)
while
(
`is`
.
read
(
buffer
).
also
{
count
=
it
}
!=
-
1
)
{
fos
.
write
(
buffer
,
0
,
count
)
}
ret
=
file
.
absolutePath
}
catch
(
e
:
Exception
)
{
e
.
printStackTrace
()
return
null
}
finally
{
try
{
fos
?.
close
()
`is`
?.
close
()
}
catch
(
e
:
Exception
)
{
e
.
printStackTrace
()
}
}
return
ret
}
override
fun
onPreStart
()
{
showDialogDismiss
()
}
private
fun
showDialogDismiss
()
{
runOnUiThread
{
mProgressDialog
?.
show
()
}
}
override
fun
onPreFinish
(
token
:
String
?,
errorCode
:
Int
,
errorMessage
:
String
?)
{
progressDialogDismiss
()
if
(
errorCode
==
1000
)
{
megLiveManager
!!
.
setVerticalDetectionType
(
MegLiveManager
.
DETECT_VERITICAL_FRONT
)
megLiveManager
!!
.
startDetect
(
this
@AliveTestActivity
)
}
}
private
fun
progressDialogDismiss
()
{
runOnUiThread
{
if
(
mProgressDialog
!=
null
)
{
mProgressDialog
!!
.
dismiss
()
}
}
}
override
fun
onDetectFinish
(
token
:
String
?,
errorCode
:
Int
,
errorMessage
:
String
?,
data
:
String
?)
{
if
(
errorCode
==
1000
)
{
token
?.
let
{
verify
(
it
,
data
!!
.
toByteArray
())
}
}
else
{
Toast
.
makeText
(
this
@AliveTestActivity
,
errorMessage
,
Toast
.
LENGTH_SHORT
).
show
()
}
}
private
fun
verify
(
token
:
String
,
data
:
ByteArray
)
{
showDialogDismiss
()
saveFile
(
ToolsUtil
.
randomName
(),
data
)
}
private
val
identifyIdOcrVerifyCallback
=
object
:
IdentifyIdOcrVerifyCallback
{
override
fun
identifyIdOcrVerifySuccess
(
t
:
HttpResult
<
IdentifyIdOcrVerifyBean
.
Response
?
>?)
{
progressDialogDismiss
()
if
(
t
!!
.
result
!!
.
verify_result
)
{
Toast
.
makeText
(
this
@AliveTestActivity
,
"活体检测结果成功 verify_result = true "
,
Toast
.
LENGTH_SHORT
).
show
()
}
else
{
Toast
.
makeText
(
this
@AliveTestActivity
,
"活体检测结果失败 msg = ${t.reason}"
,
Toast
.
LENGTH_SHORT
).
show
()
}
}
override
fun
identifyIdOcrVerifyFailure
(
t
:
HttpResult
<
IdentifyIdOcrVerifyBean
.
Response
?
>?)
{
progressDialogDismiss
()
}
}
// 将字节流转换成文件
@Throws
(
Exception
::
class
)
fun
saveFile
(
filename
:
String
,
data
:
ByteArray
?)
{
if
(
data
!=
null
)
{
dataPath
=
externalCacheDir
?.
absolutePath
+
"/alive/meglive"
val
file
=
File
(
dataPath
)
if
(
file
.
exists
())
{
file
.
delete
()
}
else
{
file
.
parentFile
?.
mkdirs
()
file
.
createNewFile
()
}
val
fos
=
FileOutputStream
(
file
)
fos
.
write
(
data
,
0
,
data
.
size
)
fos
.
flush
()
fos
.
close
()
KS3Core
.
INSTANCE
.
uploadObject
(
file
,
KS3Core
.
ScenarioType
.
ALIVE_DETECT
,
object
:
KS3Core
.
OnKS3TaskListener
{
override
fun
onTaskStart
()
{
}
override
fun
onTaskProgress
(
progress
:
Double
)
{
}
override
fun
onTaskFinish
()
{
}
override
fun
onTaskCancel
()
{
}
override
fun
onTaskSuccess
(
bucket
:
String
?,
objectKey
:
String
?)
{
val
requestParams
=
HashMap
<
String
,
String
?>()
requestParams
[
"biz_token"
]
=
bizToken
requestParams
[
"meglive_objectid"
]
=
objectKey
requestParams
[
"meglive_bucket"
]
=
bucket
ApiService
.
identifyIdOcrVerify
(
identifyIdOcrVerifyCallback
,
requestParams
)
}
override
fun
onTaskFailure
(
statesCode
:
Int
,
message
:
String
?)
{
}
})
}
}
}
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/ui/alive/GenerateSign.java
deleted
100755 → 0
View file @
608fb9d5
package
com
.
yidian
.
shenghuoquan
.
newscontent
.
ui
.
alive
;
import
android.util.Base64
;
import
java.util.Random
;
import
javax.crypto.Mac
;
import
javax.crypto.spec.SecretKeySpec
;
/**
* Created by mafuxin on 2018/5/23.
*/
public
class
GenerateSign
{
public
static
String
appSign
(
String
apiKey
,
String
secret
,
long
currtTime
,
long
expireTime
)
{
try
{
int
rdm
=
Math
.
abs
(
new
Random
().
nextInt
());
String
plainText
=
String
.
format
(
"a=%s&b=%d&c=%d&d=%d"
,
apiKey
,
expireTime
,
currtTime
,
rdm
);
byte
[]
hmacDigest
=
HmacSha1
(
plainText
,
secret
);
byte
[]
signContent
=
new
byte
[
hmacDigest
.
length
+
plainText
.
getBytes
().
length
];
System
.
arraycopy
(
hmacDigest
,
0
,
signContent
,
0
,
hmacDigest
.
length
);
System
.
arraycopy
(
plainText
.
getBytes
(),
0
,
signContent
,
hmacDigest
.
length
,
plainText
.
getBytes
().
length
);
return
Base64Encode
(
signContent
).
replaceAll
(
"[\\s*\t\n\r]"
,
""
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
/**
* 生成base64编码
*
* @param binaryData
* @return
*/
public
static
String
Base64Encode
(
byte
[]
binaryData
)
{
String
encodedstr
=
Base64
.
encodeToString
(
binaryData
,
Base64
.
DEFAULT
);
return
encodedstr
;
}
/**
* 生成hmacsha1签名
*
* @param binaryData
* @param key
* @return
* @throws Exception
*/
public
static
byte
[]
HmacSha1
(
byte
[]
binaryData
,
String
key
)
throws
Exception
{
Mac
mac
=
Mac
.
getInstance
(
"HmacSHA1"
);
SecretKeySpec
secretKey
=
new
SecretKeySpec
(
key
.
getBytes
(),
"HmacSHA1"
);
mac
.
init
(
secretKey
);
byte
[]
HmacSha1Digest
=
mac
.
doFinal
(
binaryData
);
return
HmacSha1Digest
;
}
/**
* 生成hmacsha1签名
*
* @param plainText
* @param key
* @return
* @throws Exception
*/
public
static
byte
[]
HmacSha1
(
String
plainText
,
String
key
)
throws
Exception
{
return
HmacSha1
(
plainText
.
getBytes
(),
key
);
}
}
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/ui/dialog/ProtocolDialog.kt
deleted
100644 → 0
View file @
608fb9d5
package
com.yidian.shenghuoquan.newscontent.ui.dialog
import
android.app.Activity
import
android.app.Dialog
import
android.graphics.Color
import
android.os.Bundle
import
android.os.Handler
import
android.text.SpannableString
import
android.text.SpannableStringBuilder
import
android.text.Spanned
import
android.text.TextPaint
import
android.text.method.LinkMovementMethod
import
android.text.style.ClickableSpan
import
android.text.style.ForegroundColorSpan
import
android.view.Gravity
import
android.view.View
import
android.view.WindowManager
import
com.orhanobut.hawk.Hawk
import
com.yidian.bcommon.AppConfig.Companion.privacyPolicyStatement
import
com.yidian.bcommon.AppConfig.Companion.userProtocol
import
com.yidian.bcommon.HawkConfig
import
com.yidian.bcommon.XRouterPathConstants
import
com.yidian.nightmode.widget.YdTextView
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
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
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
)
}
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
,
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
)
}
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
}
}
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/ui/dialog/ProtocolHintDialog.kt
deleted
100644 → 0
View file @
608fb9d5
package
com.yidian.shenghuoquan.newscontent.ui.dialog
import
android.app.Activity
import
android.app.Dialog
import
android.graphics.Color
import
android.os.Bundle
import
android.os.Handler
import
android.text.SpannableString
import
android.text.SpannableStringBuilder
import
android.text.Spanned
import
android.text.TextPaint
import
android.text.method.LinkMovementMethod
import
android.text.style.ClickableSpan
import
android.text.style.ForegroundColorSpan
import
android.view.Gravity
import
android.view.View
import
android.view.WindowManager
import
com.orhanobut.hawk.Hawk
import
com.yidian.bcommon.AppConfig.Companion.privacyPolicyStatement
import
com.yidian.bcommon.HawkConfig
import
com.yidian.bcommon.XRouterPathConstants
import
com.yidian.nightmode.widget.YdTextView
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
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
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
)
}
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
)
}
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
}
}
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/ui/dialog/ShareDialog.kt
deleted
100644 → 0
View file @
608fb9d5
package
com.yidian.shenghuoquan.newscontent.ui.dialog
import
android.app.Activity
import
android.app.Dialog
import
android.content.ClipData
import
android.content.ClipboardManager
import
android.content.Context
import
android.os.Bundle
import
android.util.Log
import
android.view.Gravity
import
android.view.View
import
android.view.WindowManager
import
android.widget.Toast
import
androidx.recyclerview.widget.LinearLayoutManager
import
com.umeng.socialize.ShareAction
import
com.umeng.socialize.UMShareListener
import
com.umeng.socialize.bean.SHARE_MEDIA
import
com.umeng.socialize.media.UMImage
import
com.umeng.socialize.media.UMWeb
import
com.yidian.bcommon.YdBaseApplication
import
com.yidian.bcommon.cardutils.adapter.OnItemClickListener
import
com.yidian.bcommon.utils.CheckApkExistUtil
import
com.yidian.nightmode.widget.YdRecyclerView
import
com.yidian.nightmode.widget.YdTextView
import
com.yidian.shenghuoquan.newscontent.R
import
com.yidian.shenghuoquan.newscontent.adapter.ShareAdapter
import
com.yidian.shenghuoquan.newscontent.bean.SharePlatformBean
class
ShareDialog
(
private
val
activity
:
Activity
,
themeResId
:
Int
)
:
Dialog
(
activity
,
themeResId
)
{
private
lateinit
var
rvSharePlatform
:
YdRecyclerView
private
lateinit
var
tvCancel
:
YdTextView
private
lateinit
var
shareAdapter
:
ShareAdapter
private
lateinit
var
contentLink
:
String
private
lateinit
var
title
:
String
private
val
imageBaseUrl
=
"http://i1.go2yd.com/image.php?url="
private
val
imageParams
=
"&type=thumbnail_200x200"
private
var
imageUrl
:
String
?
=
null
private
lateinit
var
description
:
String
private
val
dataList
:
ArrayList
<
SharePlatformBean
>
by
lazy
{
ArrayList
<
SharePlatformBean
>()
}
private
lateinit
var
wechat
:
SharePlatformBean
private
lateinit
var
wechatMoments
:
SharePlatformBean
private
lateinit
var
sinaWeibo
:
SharePlatformBean
private
lateinit
var
qq
:
SharePlatformBean
private
lateinit
var
copyLink
:
SharePlatformBean
init
{
setDialog
()
}
private
fun
setDialog
()
{
this
.
setCanceledOnTouchOutside
(
true
)
this
.
setContentView
(
R
.
layout
.
share_dialog
)
this
.
setOwnerActivity
(
activity
)
window
?.
setWindowAnimations
(
R
.
style
.
PopupWindow_anim_style
)
rvSharePlatform
=
findViewById
(
R
.
id
.
rv_sharePlatform
)
tvCancel
=
findViewById
(
R
.
id
.
tv_cancel
)
shareAdapter
=
ShareAdapter
()
initPlatform
()
setClickListener
()
}
fun
setData
(
contentLink
:
String
,
title
:
String
,
description
:
String
,
imageUrl
:
String
?)
{
this
.
contentLink
=
contentLink
this
.
title
=
title
this
.
imageUrl
=
imageUrl
this
.
description
=
description
}
private
fun
setClickListener
()
{
tvCancel
.
setOnClickListener
{
dismiss
()
}
shareAdapter
.
setOnItemClickListener
(
object
:
OnItemClickListener
<
SharePlatformBean
>
{
override
fun
onClick
(
view
:
View
?,
position
:
Int
,
item
:
SharePlatformBean
?)
{
when
(
position
)
{
in
0
..
3
->
oneKeyShare
(
position
)
4
->
copyLink
(
contentLink
)
}
}
})
}
private
fun
initPlatform
()
{
wechat
=
SharePlatformBean
(
R
.
mipmap
.
icon_share_wx
,
"微信好友"
,
ShareAdapter
.
normalType
)
wechatMoments
=
SharePlatformBean
(
R
.
mipmap
.
icon_share_pyq
,
"微信朋友圈"
,
ShareAdapter
.
normalType
)
sinaWeibo
=
SharePlatformBean
(
R
.
mipmap
.
icon_share_wb
,
"微博"
,
ShareAdapter
.
normalType
)
qq
=
SharePlatformBean
(
R
.
mipmap
.
icon_share_qq
,
"手机QQ"
,
ShareAdapter
.
normalType
)
copyLink
=
SharePlatformBean
(
R
.
mipmap
.
icon_share_link
,
"复制链接"
,
ShareAdapter
.
footType
)
dataList
.
add
(
wechat
)
dataList
.
add
(
wechatMoments
)
dataList
.
add
(
sinaWeibo
)
dataList
.
add
(
qq
)
dataList
.
add
(
copyLink
)
val
layoutManager
=
LinearLayoutManager
(
activity
)
layoutManager
.
orientation
=
LinearLayoutManager
.
HORIZONTAL
rvSharePlatform
.
layoutManager
=
layoutManager
rvSharePlatform
.
adapter
=
shareAdapter
shareAdapter
.
update
(
dataList
)
}
private
fun
copyLink
(
text
:
String
)
{
val
cmb
=
activity
.
getSystemService
(
Context
.
CLIPBOARD_SERVICE
)
as
ClipboardManager
?
cmb
?.
setPrimaryClip
(
ClipData
.
newPlainText
(
null
,
text
))
Toast
.
makeText
(
activity
,
"复制成功"
,
Toast
.
LENGTH_SHORT
).
show
()
dismiss
()
}
private
fun
oneKeyShare
(
position
:
Int
)
{
val
shareAction
=
ShareAction
(
activity
)
when
(
position
)
{
0
->
{
if
(
CheckApkExistUtil
.
checkApkExist
(
YdBaseApplication
.
context
,
CheckApkExistUtil
.
weChatPkgName
))
{
shareAction
.
platform
=
SHARE_MEDIA
.
WEIXIN
}
else
{
Toast
.
makeText
(
YdBaseApplication
.
context
,
"分享失败,未安装【微信】"
,
Toast
.
LENGTH_SHORT
).
show
()
}
}
1
->
{
if
(
CheckApkExistUtil
.
checkApkExist
(
YdBaseApplication
.
context
,
CheckApkExistUtil
.
weChatPkgName
))
{
shareAction
.
platform
=
SHARE_MEDIA
.
WEIXIN_CIRCLE
}
else
{
Toast
.
makeText
(
YdBaseApplication
.
context
,
"分享失败,未安装【微信】"
,
Toast
.
LENGTH_SHORT
).
show
()
}
}
2
->
{
if
(
CheckApkExistUtil
.
checkApkExist
(
YdBaseApplication
.
context
,
CheckApkExistUtil
.
sinaBlogPkgName
))
{
shareAction
.
platform
=
SHARE_MEDIA
.
SINA
}
else
{
Toast
.
makeText
(
YdBaseApplication
.
context
,
"分享失败,未安装【微博】"
,
Toast
.
LENGTH_SHORT
).
show
()
}
}
3
->
{
if
(
CheckApkExistUtil
.
checkApkExist
(
YdBaseApplication
.
context
,
CheckApkExistUtil
.
mobileQQPkgName
))
{
shareAction
.
platform
=
SHARE_MEDIA
.
QQ
}
else
{
Toast
.
makeText
(
YdBaseApplication
.
context
,
"分享失败,未安装【QQ】"
,
Toast
.
LENGTH_SHORT
).
show
()
}
}
}
val
web
=
UMWeb
(
contentLink
)
web
.
title
=
title
if
(
imageUrl
!=
null
)
{
imageUrl
=
imageBaseUrl
+
imageUrl
+
imageParams
web
.
setThumb
(
UMImage
(
activity
,
imageUrl
))
}
else
{
web
.
setThumb
(
UMImage
(
activity
,
R
.
mipmap
.
ydlogo
))
}
web
.
description
=
description
shareAction
.
setCallback
(
object
:
UMShareListener
{
override
fun
onStart
(
platform
:
SHARE_MEDIA
?)
{
}
override
fun
onResult
(
platform
:
SHARE_MEDIA
?)
{
Toast
.
makeText
(
activity
,
"分享成功"
,
Toast
.
LENGTH_SHORT
).
show
()
}
override
fun
onError
(
platform
:
SHARE_MEDIA
?,
t
:
Throwable
?)
{
Log
.
e
(
"zhb-yd"
,
"失败"
+
t
?.
message
)
}
override
fun
onCancel
(
platform
:
SHARE_MEDIA
?)
{
Toast
.
makeText
(
activity
,
"分享取消"
,
Toast
.
LENGTH_SHORT
).
show
()
}
}).
withMedia
(
web
).
share
()
dismiss
()
}
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/ShareImageDialog.kt
deleted
100644 → 0
View file @
608fb9d5
package
com.yidian.shenghuoquan.newscontent.ui.dialog
import
android.app.Activity
import
android.app.Dialog
import
android.content.ClipData
import
android.content.ClipboardManager
import
android.content.Context
import
android.os.Bundle
import
android.util.Log
import
android.view.Gravity
import
android.view.View
import
android.view.WindowManager
import
android.widget.Toast
import
androidx.recyclerview.widget.LinearLayoutManager
import
com.umeng.socialize.ShareAction
import
com.umeng.socialize.UMShareListener
import
com.umeng.socialize.bean.SHARE_MEDIA
import
com.umeng.socialize.media.UMImage
import
com.yidian.bcommon.YdBaseApplication
import
com.yidian.bcommon.cardutils.adapter.OnItemClickListener
import
com.yidian.bcommon.utils.CheckApkExistUtil
import
com.yidian.nightmode.widget.YdRecyclerView
import
com.yidian.nightmode.widget.YdTextView
import
com.yidian.shenghuoquan.newscontent.R
import
com.yidian.shenghuoquan.newscontent.adapter.ShareAdapter
import
com.yidian.shenghuoquan.newscontent.bean.SharePlatformBean
class
ShareImageDialog
(
private
val
activity
:
Activity
,
themeResId
:
Int
)
:
Dialog
(
activity
,
themeResId
)
{
private
lateinit
var
rvSharePlatform
:
YdRecyclerView
private
lateinit
var
tvCancel
:
YdTextView
private
lateinit
var
shareAdapter
:
ShareAdapter
private
lateinit
var
imageUrl
:
String
private
val
dataList
:
ArrayList
<
SharePlatformBean
>
by
lazy
{
ArrayList
<
SharePlatformBean
>()
}
private
lateinit
var
wechat
:
SharePlatformBean
private
lateinit
var
wechatMoments
:
SharePlatformBean
private
lateinit
var
qq
:
SharePlatformBean
private
lateinit
var
copyLink
:
SharePlatformBean
init
{
setDialog
()
}
private
fun
setDialog
()
{
this
.
setCanceledOnTouchOutside
(
true
)
this
.
setContentView
(
R
.
layout
.
share_dialog
)
this
.
setOwnerActivity
(
activity
)
window
?.
setWindowAnimations
(
R
.
style
.
PopupWindow_anim_style
)
rvSharePlatform
=
findViewById
(
R
.
id
.
rv_sharePlatform
)
tvCancel
=
findViewById
(
R
.
id
.
tv_cancel
)
shareAdapter
=
ShareAdapter
()
initPlatform
()
setClickListener
()
}
fun
setData
(
imageUrl
:
String
)
{
this
.
imageUrl
=
imageUrl
}
private
fun
setClickListener
()
{
tvCancel
.
setOnClickListener
{
dismiss
()
}
shareAdapter
.
setOnItemClickListener
(
object
:
OnItemClickListener
<
SharePlatformBean
>
{
override
fun
onClick
(
view
:
View
?,
position
:
Int
,
item
:
SharePlatformBean
?)
{
when
(
position
)
{
in
0
..
2
->
oneKeyShare
(
position
,
imageUrl
)
3
->
copyLink
(
imageUrl
)
}
}
})
}
private
fun
initPlatform
()
{
wechat
=
SharePlatformBean
(
R
.
mipmap
.
icon_share_wx
,
"微信好友"
,
ShareAdapter
.
normalType
)
wechatMoments
=
SharePlatformBean
(
R
.
mipmap
.
icon_share_pyq
,
"微信朋友圈"
,
ShareAdapter
.
normalType
)
qq
=
SharePlatformBean
(
R
.
mipmap
.
icon_share_qq
,
"手机QQ"
,
ShareAdapter
.
normalType
)
copyLink
=
SharePlatformBean
(
R
.
mipmap
.
icon_share_link
,
"复制链接"
,
ShareAdapter
.
footType
)
dataList
.
add
(
wechat
)
dataList
.
add
(
wechatMoments
)
dataList
.
add
(
qq
)
dataList
.
add
(
copyLink
)
val
layoutManager
=
LinearLayoutManager
(
activity
)
layoutManager
.
orientation
=
LinearLayoutManager
.
HORIZONTAL
rvSharePlatform
.
layoutManager
=
layoutManager
rvSharePlatform
.
adapter
=
shareAdapter
shareAdapter
.
update
(
dataList
)
}
private
fun
copyLink
(
text
:
String
)
{
val
cmb
=
activity
.
getSystemService
(
Context
.
CLIPBOARD_SERVICE
)
as
ClipboardManager
?
cmb
?.
setPrimaryClip
(
ClipData
.
newPlainText
(
null
,
text
))
Toast
.
makeText
(
activity
,
"复制成功"
,
Toast
.
LENGTH_SHORT
).
show
()
dismiss
()
}
private
fun
oneKeyShare
(
position
:
Int
,
imageUrl
:
String
)
{
val
shareAction
=
ShareAction
(
activity
)
when
(
position
)
{
0
->
{
if
(
CheckApkExistUtil
.
checkApkExist
(
YdBaseApplication
.
context
,
CheckApkExistUtil
.
weChatPkgName
))
{
shareAction
.
platform
=
SHARE_MEDIA
.
WEIXIN
}
else
{
Toast
.
makeText
(
YdBaseApplication
.
context
,
"分享失败,未安装【微信】"
,
Toast
.
LENGTH_SHORT
).
show
()
}
}
1
->
{
if
(
CheckApkExistUtil
.
checkApkExist
(
YdBaseApplication
.
context
,
CheckApkExistUtil
.
weChatPkgName
))
{
shareAction
.
platform
=
SHARE_MEDIA
.
WEIXIN_CIRCLE
}
else
{
Toast
.
makeText
(
YdBaseApplication
.
context
,
"分享失败,未安装【微信】"
,
Toast
.
LENGTH_SHORT
).
show
()
}
}
2
->
{
if
(
CheckApkExistUtil
.
checkApkExist
(
YdBaseApplication
.
context
,
CheckApkExistUtil
.
mobileQQPkgName
))
{
shareAction
.
platform
=
SHARE_MEDIA
.
QQ
}
else
{
Toast
.
makeText
(
YdBaseApplication
.
context
,
"分享失败,未安装【QQ】"
,
Toast
.
LENGTH_SHORT
).
show
()
}
}
}
val
image
=
UMImage
(
activity
,
imageUrl
)
val
thumb
=
UMImage
(
activity
,
imageUrl
)
image
.
setThumb
(
thumb
)
shareAction
.
setCallback
(
object
:
UMShareListener
{
override
fun
onStart
(
platform
:
SHARE_MEDIA
?)
{
}
override
fun
onResult
(
platform
:
SHARE_MEDIA
?)
{
Toast
.
makeText
(
activity
,
"分享成功"
,
Toast
.
LENGTH_SHORT
).
show
()
}
override
fun
onError
(
platform
:
SHARE_MEDIA
?,
t
:
Throwable
?)
{
Log
.
e
(
"zhb-yd"
,
"失败"
+
t
?.
message
)
}
override
fun
onCancel
(
platform
:
SHARE_MEDIA
?)
{
Toast
.
makeText
(
activity
,
"分享取消"
,
Toast
.
LENGTH_SHORT
).
show
()
}
}).
withMedia
(
image
).
share
()
dismiss
()
}
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/SharePosterDialog.kt
deleted
100644 → 0
View file @
608fb9d5
package
com.yidian.shenghuoquan.newscontent.ui.dialog
import
android.app.Activity
import
android.app.Dialog
import
android.os.Bundle
import
android.text.TextUtils
import
android.util.Log
import
android.view.Gravity
import
android.view.View
import
android.view.WindowManager
import
android.widget.ImageView
import
android.widget.Toast
import
androidx.recyclerview.widget.GridLayoutManager
import
com.umeng.socialize.ShareAction
import
com.umeng.socialize.UMShareListener
import
com.umeng.socialize.bean.SHARE_MEDIA
import
com.umeng.socialize.media.UMImage
import
com.yidian.bcommon.YdBaseApplication
import
com.yidian.bcommon.cardutils.adapter.OnItemClickListener
import
com.yidian.bcommon.utils.CheckApkExistUtil
import
com.yidian.bcommon.utils.YdFileUtils
import
com.yidian.nightmode.widget.YdRecyclerView
import
com.yidian.nightmode.widget.YdRelativeLayout
import
com.yidian.nightmode.widget.YdTextView
import
com.yidian.shenghuoquan.newscontent.R
import
com.yidian.shenghuoquan.newscontent.adapter.ShareAdapter
import
com.yidian.shenghuoquan.newscontent.bean.SharePlatformBean
class
SharePosterDialog
(
private
val
activity
:
Activity
,
themeResId
:
Int
):
Dialog
(
activity
,
themeResId
)
{
private
lateinit
var
rvSharePlatform
:
YdRecyclerView
private
lateinit
var
tvCancel
:
YdTextView
private
lateinit
var
rlyRoot
:
YdRelativeLayout
private
lateinit
var
rlyPoster
:
YdRelativeLayout
private
lateinit
var
shareAdapter
:
ShareAdapter
private
lateinit
var
contentLink
:
String
private
lateinit
var
poster
:
View
private
val
dataList
:
ArrayList
<
SharePlatformBean
>
by
lazy
{
ArrayList
<
SharePlatformBean
>()
}
private
lateinit
var
saveImage
:
SharePlatformBean
private
lateinit
var
wechat
:
SharePlatformBean
private
lateinit
var
wechatMoments
:
SharePlatformBean
private
lateinit
var
qq
:
SharePlatformBean
init
{
setDialog
()
}
private
fun
setDialog
(){
this
.
setCanceledOnTouchOutside
(
true
)
this
.
setContentView
(
R
.
layout
.
share_image_dialog
)
this
.
setOwnerActivity
(
activity
)
window
?.
setWindowAnimations
(
R
.
style
.
PopupWindow_anim_style
)
rvSharePlatform
=
findViewById
(
R
.
id
.
rv_sharePlatform
)
tvCancel
=
findViewById
(
R
.
id
.
tv_cancel
)
rlyRoot
=
findViewById
(
R
.
id
.
rly_root
)
rlyPoster
=
findViewById
(
R
.
id
.
rly_poster
)
shareAdapter
=
ShareAdapter
()
initPlatform
()
setClickListener
()
}
fun
setData
(
contentLink
:
String
,
poster
:
View
,
ivQRCode
:
ImageView
){
this
.
contentLink
=
contentLink
this
.
poster
=
poster
initPoster
(
ivQRCode
)
}
private
fun
initPoster
(
ivQRCode
:
ImageView
){
val
qrCodeBitmap
=
YdFileUtils
.
createQRCodeBitmap
(
contentLink
,
200
,
200
)
if
(
qrCodeBitmap
!=
null
){
ivQRCode
.
setImageBitmap
(
qrCodeBitmap
)
}
rlyPoster
.
addView
(
poster
)
}
private
fun
initPlatform
(){
saveImage
=
SharePlatformBean
(
R
.
mipmap
.
icon_save_card
,
"保存图片"
,
ShareAdapter
.
headType
)
wechat
=
SharePlatformBean
(
R
.
mipmap
.
icon_share_wx
,
"微信好友"
,
ShareAdapter
.
normalType
)
wechatMoments
=
SharePlatformBean
(
R
.
mipmap
.
icon_share_pyq
,
"微信朋友圈"
,
ShareAdapter
.
normalType
)
qq
=
SharePlatformBean
(
R
.
mipmap
.
icon_share_qq
,
"手机QQ"
,
ShareAdapter
.
normalType
)
dataList
.
add
(
saveImage
)
dataList
.
add
(
wechat
)
dataList
.
add
(
wechatMoments
)
dataList
.
add
(
qq
)
rvSharePlatform
.
layoutManager
=
GridLayoutManager
(
activity
,
4
)
rvSharePlatform
.
adapter
=
shareAdapter
shareAdapter
.
update
(
dataList
)
}
private
fun
setClickListener
(){
tvCancel
.
setOnClickListener
{
dismiss
()
}
shareAdapter
.
setOnItemClickListener
(
object
:
OnItemClickListener
<
SharePlatformBean
>
{
override
fun
onClick
(
view
:
View
?,
position
:
Int
,
item
:
SharePlatformBean
?)
{
when
(
position
)
{
0
->
saveImage
()
in
1
..
3
->
oneKeyShare
(
position
)
}
}
})
rlyRoot
.
setOnClickListener
{
dismiss
()
}
}
private
fun
saveImage
(){
val
bitmap
=
YdFileUtils
.
createBitmap
(
poster
)
val
imagePath
=
YdFileUtils
.
saveImageFromView
(
activity
,
bitmap
)
if
(!
TextUtils
.
isEmpty
(
imagePath
)){
Toast
.
makeText
(
activity
,
"图片保存成功"
,
Toast
.
LENGTH_SHORT
).
show
()
}
dismiss
()
}
private
fun
oneKeyShare
(
position
:
Int
){
val
shareAction
=
ShareAction
(
activity
)
when
(
position
){
1
->
{
if
(
CheckApkExistUtil
.
checkApkExist
(
YdBaseApplication
.
context
,
CheckApkExistUtil
.
weChatPkgName
)){
shareAction
.
platform
=
SHARE_MEDIA
.
WEIXIN
}
else
{
Toast
.
makeText
(
YdBaseApplication
.
context
,
"分享失败,未安装【微信】"
,
Toast
.
LENGTH_SHORT
).
show
()
}
}
2
->
{
if
(
CheckApkExistUtil
.
checkApkExist
(
YdBaseApplication
.
context
,
CheckApkExistUtil
.
weChatPkgName
)){
shareAction
.
platform
=
SHARE_MEDIA
.
WEIXIN_CIRCLE
}
else
{
Toast
.
makeText
(
YdBaseApplication
.
context
,
"分享失败,未安装【微信】"
,
Toast
.
LENGTH_SHORT
).
show
()
}
}
3
->
{
if
(
CheckApkExistUtil
.
checkApkExist
(
YdBaseApplication
.
context
,
CheckApkExistUtil
.
mobileQQPkgName
)){
shareAction
.
platform
=
SHARE_MEDIA
.
QQ
}
else
{
Toast
.
makeText
(
YdBaseApplication
.
context
,
"分享失败,未安装【QQ】"
,
Toast
.
LENGTH_SHORT
).
show
()
}
}
}
val
bitmap
=
YdFileUtils
.
createBitmap
(
poster
)
if
(
bitmap
!=
null
){
val
image
=
UMImage
(
activity
,
bitmap
)
val
thumb
=
UMImage
(
activity
,
bitmap
)
image
.
setThumb
(
thumb
)
shareAction
.
setCallback
(
object
:
UMShareListener
{
override
fun
onStart
(
platform
:
SHARE_MEDIA
?)
{
}
override
fun
onResult
(
platform
:
SHARE_MEDIA
?)
{
Toast
.
makeText
(
activity
,
"分享成功"
,
Toast
.
LENGTH_SHORT
).
show
()
}
override
fun
onError
(
platform
:
SHARE_MEDIA
?,
t
:
Throwable
?)
{
Log
.
e
(
"zhb-yd"
,
"失败"
+
t
?.
message
)
}
override
fun
onCancel
(
platform
:
SHARE_MEDIA
?)
{
Toast
.
makeText
(
activity
,
"分享取消"
,
Toast
.
LENGTH_SHORT
).
show
()
}
}).
withMedia
(
image
).
share
()
}
dismiss
()
}
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/UpdateVersionDialog.kt
deleted
100644 → 0
View file @
608fb9d5
package
com.yidian.shenghuoquan.newscontent.ui.dialog
import
android.app.Activity
import
android.app.Dialog
import
android.os.Bundle
import
android.view.Gravity
import
android.view.KeyEvent
import
android.view.View
import
android.view.WindowManager
import
androidx.recyclerview.widget.LinearLayoutManager
import
com.yidian.bcommon.widget.YdMaxRecyclerView
import
com.yidian.nightmode.widget.YdImageView
import
com.yidian.nightmode.widget.YdTextView
import
com.yidian.shenghuoquan.newscontent.R
import
com.yidian.shenghuoquan.newscontent.adapter.UpdateVersionDesAdapter
import
com.yidian.shenghuoquan.newscontent.bean.IUpdateDialogCallback
import
com.yidian.yac.pm.appupdate.AppUpdateEchoData
import
com.yidian.yac.pm.appupdate.AppUpdateInfo
class
UpdateVersionDialog
(
private
val
activity
:
Activity
,
themeResId
:
Int
,
private
val
updateDialogCallback
:
IUpdateDialogCallback
):
Dialog
(
activity
,
themeResId
)
{
private
lateinit
var
ivUpdateClose
:
YdImageView
private
lateinit
var
tvNewVersion
:
YdTextView
private
lateinit
var
tvDown
:
YdTextView
private
lateinit
var
rvDes
:
YdMaxRecyclerView
private
lateinit
var
updateInfo
:
AppUpdateInfo
<
AppUpdateEchoData
>
private
val
adapter
=
UpdateVersionDesAdapter
()
init
{
setDialog
()
}
private
fun
setDialog
(){
this
.
setCanceledOnTouchOutside
(
false
)
this
.
setContentView
(
R
.
layout
.
update_version_dialog
)
this
.
setOwnerActivity
(
activity
)
ivUpdateClose
=
findViewById
(
R
.
id
.
iv_updateClose
)
tvNewVersion
=
findViewById
(
R
.
id
.
tv_newVersion
)
tvDown
=
findViewById
(
R
.
id
.
tv_down
)
rvDes
=
findViewById
(
R
.
id
.
rv_des
)
rvDes
.
layoutManager
=
LinearLayoutManager
(
activity
)
rvDes
.
adapter
=
adapter
setClickListener
()
}
fun
setData
(
updateInfo
:
AppUpdateInfo
<
AppUpdateEchoData
>){
this
.
updateInfo
=
updateInfo
val
forceUpdate
=
updateInfo
.
echo_data
?.
force_update
if
(
forceUpdate
==
true
){
ivUpdateClose
.
visibility
=
View
.
GONE
}
else
{
ivUpdateClose
.
visibility
=
View
.
VISIBLE
}
val
resultInfo
=
updateInfo
.
result
?.
get
(
0
)
val
versionShow
=
resultInfo
?.
package_version
tvNewVersion
.
text
=
"发现新版本V$versionShow"
var
note
=
resultInfo
?.
note
var
desList
:
ArrayList
<
String
>?
=
null
if
(!
note
.
isNullOrEmpty
()){
if
(
note
.
endsWith
(
";"
)
||
note
.
endsWith
(
";"
)){
note
=
note
.
substring
(
0
,
note
.
length
-
1
)
}
when
{
note
.
contains
(
";"
)
->
{
desList
=
note
.
split
(
";"
)
as
ArrayList
<
String
>
}
note
.
contains
(
";"
)
->
{
desList
=
note
.
split
(
";"
)
as
ArrayList
<
String
>
}
else
->
{
desList
=
ArrayList
()
desList
.
add
(
note
)
}
}
}
if
(
desList
!=
null
){
adapter
.
update
(
desList
)
}
}
private
fun
setClickListener
(){
ivUpdateClose
.
setOnClickListener
{
dismiss
()
}
tvDown
.
setOnClickListener
{
tvDown
.
isEnabled
=
false
tvDown
.
setBackgroundResource
(
R
.
drawable
.
bg_gray_radio
)
tvDown
.
text
=
"下载中..."
updateDialogCallback
.
downloadCallback
(
updateInfo
)
}
setOnKeyListener
{
_
,
keyCode
,
event
->
keyCode
==
KeyEvent
.
KEYCODE_BACK
&&
event
?.
repeatCount
==
0
}
}
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
.
CENTER
}
}
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/ui/idcard/IDCardResultActivity.kt
deleted
100644 → 0
View file @
608fb9d5
package
com.yidian.shenghuoquan.newscontent.ui.idcard
import
android.graphics.BitmapFactory
import
android.os.Bundle
import
com.yidian.bcommon.base.BaseActivity
import
com.yidian.bcommon.utils.ToolsUtil
import
com.yidian.shenghuoquan.newscontent.databinding.ActivityIdcardResultBinding
/**
* Author: sym
* Date: 2021/5/20 6:51 PM
* Describe:
*/
class
IDCardResultActivity
:
BaseActivity
<
ActivityIdcardResultBinding
>()
{
override
fun
createViewBinding
():
ActivityIdcardResultBinding
{
return
ActivityIdcardResultBinding
.
inflate
(
layoutInflater
)
}
override
fun
getXPageName
():
String
{
return
""
}
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
val
intent
=
intent
val
bundle
=
intent
.
extras
val
portraitimg
=
bundle
!!
.
getByteArray
(
"portraitimg_bitmap"
)
val
iDCardImg
=
bundle
.
getByteArray
(
"idcardimg_bitmap"
)
if
(
portraitimg
!=
null
)
{
val
bmpPortraitImg
=
BitmapFactory
.
decodeByteArray
(
portraitimg
,
0
,
portraitimg
.
size
)
viewBind
.
resultFaceImage
.
setImageBitmap
(
bmpPortraitImg
)
}
if
(
iDCardImg
!=
null
)
{
val
bmpIDCardImg
=
BitmapFactory
.
decodeByteArray
(
iDCardImg
,
0
,
iDCardImg
.
size
)
viewBind
.
resultIdcardImage
.
setImageBitmap
(
bmpIDCardImg
)
ToolsUtil
.
saveImage
(
bmpIDCardImg
,
ToolsUtil
.
randomName
()
+
".jpg"
,
this
)
}
}
}
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/ui/idcard/IDCardTestActivity.kt
deleted
100644 → 0
View file @
608fb9d5
package
com.yidian.shenghuoquan.newscontent.ui.idcard
import
android.Manifest
import
android.app.Activity
import
android.content.Intent
import
android.content.pm.PackageManager
import
android.graphics.Bitmap
import
android.graphics.BitmapFactory
import
android.os.Build
import
android.os.Bundle
import
android.util.Log
import
android.widget.Toast
import
com.megvii.demo.activity.IDCardDetectActivity
import
com.megvii.demo.utils.Configuration
import
com.megvii.idcardquality.IDCardQualityLicenseManager
import
com.megvii.licensemanager.Manager
import
com.yidian.bcommon.base.BaseActivity
import
com.yidian.shenghuoquan.newscontent.databinding.ActivityIdcardBinding
import
com.yidian.shenghuoquan.newscontent.http.ApiService
import
com.yidian.shenghuoquan.newscontent.http.httpbean.GetIDCardOCRBean
import
com.yidian.shenghuoquan.newscontent.http.httpbean.IGetIDCardOCRCallback
import
com.yidian.shenghuoquan.newscontent.ui.alive.AliveTestActivity
import
com.yidian.shenghuoquan.newscontent.ui.auth.LifeAccountAuthDataManager
import
com.yidian.shenghuoquan.newscontent.utils.KS3Core
import
com.yidian.utils.ToastUtil
import
java.io.File
import
java.io.FileOutputStream
/**
* Author: sym
* Date: 2021/5/20 4:00 PM
* Describe:
*/
class
IDCardTestActivity
:
BaseActivity
<
ActivityIdcardBinding
>()
{
private
lateinit
var
mIdCardLicenseManager
:
IDCardQualityLicenseManager
private
val
INTO_IDCARDSCAN_PAGE
=
100
private
var
idCardFront
:
Bitmap
?
=
null
private
var
idCardBack
:
Bitmap
?
=
null
private
lateinit
var
idCardFrontObjectKey
:
String
private
lateinit
var
idCardBackObjectKey
:
String
private
lateinit
var
idCardFrontBucket
:
String
private
lateinit
var
idCardBackBucket
:
String
override
fun
createViewBinding
():
ActivityIdcardBinding
{
return
ActivityIdcardBinding
.
inflate
(
layoutInflater
)
}
override
fun
getXPageName
():
String
{
return
""
}
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
viewBind
.
btStart
.
setOnClickListener
{
//1、初始化配置
initConfig
()
//2、请求授权信息
startGetLicense
()
}
viewBind
.
btnOcr
.
setOnClickListener
{
if
(
idCardFront
==
null
||
idCardBack
==
null
)
{
return
@setOnClickListener
}
val
frontFile
=
File
(
externalCacheDir
?.
absolutePath
+
"/ocr/idCardFront.jpg"
)
if
(
frontFile
.
exists
())
{
frontFile
.
delete
()
}
else
{
frontFile
.
parentFile
?.
mkdirs
()
frontFile
.
createNewFile
()
}
val
backFile
=
File
(
externalCacheDir
?.
absolutePath
+
"/ocr/idCardBack.jpg"
)
if
(
backFile
.
exists
())
{
backFile
.
delete
()
}
else
{
backFile
.
parentFile
?.
mkdirs
()
backFile
.
createNewFile
()
}
idCardFront
?.
compress
(
Bitmap
.
CompressFormat
.
JPEG
,
100
,
FileOutputStream
(
frontFile
))
idCardBack
?.
compress
(
Bitmap
.
CompressFormat
.
JPEG
,
100
,
FileOutputStream
(
backFile
))
KS3Core
.
INSTANCE
.
uploadObject
(
frontFile
,
KS3Core
.
ScenarioType
.
ID_CARD
,
object
:
KS3Core
.
OnKS3TaskListener
{
override
fun
onTaskStart
()
{
}
override
fun
onTaskProgress
(
progress
:
Double
)
{
}
override
fun
onTaskFinish
()
{
}
override
fun
onTaskCancel
()
{
}
override
fun
onTaskSuccess
(
bucket
:
String
?,
objectKey
:
String
?)
{
if
(
objectKey
!=
null
)
{
idCardFrontObjectKey
=
objectKey
}
if
(
bucket
!=
null
)
{
idCardFrontBucket
=
bucket
}
KS3Core
.
INSTANCE
.
uploadObject
(
backFile
,
KS3Core
.
ScenarioType
.
ID_CARD
,
object
:
KS3Core
.
OnKS3TaskListener
{
override
fun
onTaskStart
()
{
}
override
fun
onTaskProgress
(
progress
:
Double
)
{
}
override
fun
onTaskFinish
()
{
}
override
fun
onTaskCancel
()
{
}
override
fun
onTaskSuccess
(
bucket
:
String
?,
objectKey
:
String
?)
{
if
(
objectKey
!=
null
)
{
idCardBackObjectKey
=
objectKey
}
if
(
bucket
!=
null
)
{
idCardBackBucket
=
bucket
}
val
requestParams
=
HashMap
<
String
,
String
?>()
requestParams
[
"posit_image_objectid"
]
=
idCardFrontObjectKey
requestParams
[
"back_image_objectid"
]
=
idCardBackObjectKey
requestParams
[
"posit_bucket"
]
=
idCardFrontBucket
requestParams
[
"back_bucket"
]
=
idCardBackBucket
ApiService
.
getIDCardOCR
(
object
:
IGetIDCardOCRCallback
{
override
fun
getIDCardOCRSuccess
(
result
:
GetIDCardOCRBean
.
Response
?)
{
Log
.
d
(
KS3Core
.
TAG
,
"name: ${result?.posit?.name}, id num: ${result?.posit?.idcard_number}"
)
ToastUtil
.
showToast
(
this
@IDCardTestActivity
,
"ocr result, name: ${result?.posit?.name}, number: ${result?.posit?.idcard_number}"
)
// 身份证OCR成功后执行活体检测
val
intent
=
Intent
(
this
@IDCardTestActivity
,
AliveTestActivity
::
class
.
java
)
intent
.
putExtra
(
"idCardName"
,
result
?.
posit
?.
name
)
intent
.
putExtra
(
"idCardNo"
,
result
?.
posit
?.
idcard_number
)
startActivity
(
intent
)
}
override
fun
getIDCardOCRFailure
(
message
:
String
?)
{
}
},
requestParams
)
}
override
fun
onTaskFailure
(
statesCode
:
Int
,
message
:
String
?)
{
}
})
}
override
fun
onTaskFailure
(
statesCode
:
Int
,
message
:
String
?)
{
}
})
}
requestCameraPerm
()
}
private
fun
startGetLicense
()
{
mIdCardLicenseManager
=
IDCardQualityLicenseManager
(
this
)
var
status
:
Long
=
0
try
{
status
=
mIdCardLicenseManager
.
checkCachedLicense
()
}
catch
(
e
:
Throwable
)
{
e
.
printStackTrace
()
}
if
(
status
>
0
)
{
//大于0,已授权或者授权未过期
val
intent
=
Intent
(
this
,
IDCardDetectActivity
::
class
.
java
)
this
.
startActivityForResult
(
intent
,
INTO_IDCARDSCAN_PAGE
)
Toast
.
makeText
(
this
,
"授权成功"
,
Toast
.
LENGTH_SHORT
).
show
()
}
else
{
//需要重新授权
Toast
.
makeText
(
this
,
"没有缓存的授权信息,开始授权"
,
Toast
.
LENGTH_SHORT
).
show
()
Thread
{
try
{
getLicense
()
}
catch
(
e
:
Throwable
)
{
e
.
printStackTrace
()
}
}.
start
()
}
}
private
fun
getLicense
()
{
//参数2 是否使用ipv6
val
manager
=
Manager
(
this
,
true
)
manager
.
registerLicenseManager
(
mIdCardLicenseManager
)
val
uuid
=
Configuration
.
getUUID
(
this
)
val
authMsg
=
mIdCardLicenseManager
.
getContext
(
uuid
)
manager
.
takeLicenseFromNetwork
(
authMsg
)
if
(
mIdCardLicenseManager
.
checkCachedLicense
()
>
0
)
{
//大于0,已授权或者授权未过期
runOnUiThread
{
val
intent
=
Intent
(
this
,
IDCardDetectActivity
::
class
.
java
)
this
.
startActivityForResult
(
intent
,
INTO_IDCARDSCAN_PAGE
)
Toast
.
makeText
(
this
,
"授权成功"
,
Toast
.
LENGTH_SHORT
)
.
show
()
}
}
}
override
fun
onRequestPermissionsResult
(
requestCode
:
Int
,
permissions
:
Array
<
out
String
>,
grantResults
:
IntArray
)
{
super
.
onRequestPermissionsResult
(
requestCode
,
permissions
,
grantResults
)
//@TODO 权限通过后的回调
}
private
fun
initConfig
()
{
if
(
viewBind
.
rbV
.
isChecked
)
{
Configuration
.
setIsVertical
(
this
,
true
)
}
else
{
Configuration
.
setIsVertical
(
this
,
false
)
}
if
(
viewBind
.
rbFront
.
isChecked
)
{
Configuration
.
setCardType
(
this
,
1
)
}
else
{
Configuration
.
setCardType
(
this
,
2
)
}
}
private
fun
requestCameraPerm
()
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
M
)
{
if
(
checkSelfPermission
(
Manifest
.
permission
.
CAMERA
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
requestPermissions
(
arrayOf
(
Manifest
.
permission
.
CAMERA
),
100
)
}
}
}
override
fun
onActivityResult
(
requestCode
:
Int
,
resultCode
:
Int
,
data
:
Intent
?)
{
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
)
if
(
requestCode
==
INTO_IDCARDSCAN_PAGE
&&
resultCode
==
Activity
.
RESULT_OK
)
{
if
(
data
!=
null
)
{
val
bytes
=
data
.
getByteArrayExtra
(
"idcardimg_bitmap"
)
if
(
Configuration
.
getCardType
(
this
)
==
1
)
{
idCardFront
=
BitmapFactory
.
decodeByteArray
(
bytes
,
0
,
bytes
.
size
)
viewBind
.
resultIdcardImageFront
.
setImageBitmap
(
idCardFront
)
}
else
{
idCardBack
=
BitmapFactory
.
decodeByteArray
(
bytes
,
0
,
bytes
.
size
)
viewBind
.
resultIdcardImageBack
.
setImageBitmap
(
idCardBack
)
}
}
}
}
}
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/ui/popwindow/FeedbackDetailPopupWindow.kt
deleted
100644 → 0
View file @
608fb9d5
package
com.yidian.shenghuoquan.newscontent.ui.popwindow
import
android.app.Activity
import
android.graphics.drawable.ColorDrawable
import
android.view.*
import
android.widget.PopupWindow
import
androidx.recyclerview.widget.LinearLayoutManager
import
com.yidian.bcommon.cardutils.adapter.OnItemClickListener
import
com.yidian.bcommon.widget.YdMaxRecyclerView
import
com.yidian.nightmode.widget.YdImageView
import
com.yidian.shenghuoquan.newscontent.R
import
com.yidian.shenghuoquan.newscontent.adapter.FeedbackDetailAdapter
import
com.yidian.shenghuoquan.newscontent.bean.FeedbackBean
import
com.yidian.utils.ToastUtil
class
FeedbackDetailPopupWindow
(
private
val
activity
:
Activity
,
private
val
parent
:
View
,
private
val
feedbackBean
:
FeedbackBean
,
private
val
feedbackType
:
String
)
{
companion
object
{
const
val
SHIELD
=
"shield"
const
val
FEEDBACK
=
"feedback"
}
private
val
view
:
View
=
LayoutInflater
.
from
(
activity
).
inflate
(
R
.
layout
.
feedback_detail_popup_window
,
null
)
private
val
rvContent
=
view
.
findViewById
<
YdMaxRecyclerView
>(
R
.
id
.
rv_content
)
private
val
ivBack
=
view
.
findViewById
<
YdImageView
>(
R
.
id
.
iv_back
)
private
val
mPopUpWindow
=
PopupWindow
(
view
)
private
val
adapter
:
FeedbackDetailAdapter
by
lazy
{
FeedbackDetailAdapter
()
}
init
{
mPopUpWindow
.
isFocusable
=
false
mPopUpWindow
.
isTouchable
=
true
mPopUpWindow
.
isOutsideTouchable
=
true
initView
()
setClickListener
()
}
private
fun
initView
(){
rvContent
.
layoutManager
=
LinearLayoutManager
(
activity
)
rvContent
.
adapter
=
adapter
when
(
feedbackType
){
SHIELD
->
adapter
.
update
(
feedbackBean
.
tag
)
FEEDBACK
->
adapter
.
update
(
feedbackBean
.
reason
)
}
}
private
fun
setClickListener
(){
mPopUpWindow
.
setOnDismissListener
{
val
lp
:
WindowManager
.
LayoutParams
=
activity
.
window
.
attributes
lp
.
alpha
=
1.0f
activity
.
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_DIM_BEHIND
)
activity
.
window
.
attributes
=
lp
}
ivBack
.
setOnClickListener
{
dismiss
()
val
feedbackPopupWindow
=
FeedbackPopupWindow
(
activity
,
parent
,
feedbackBean
)
feedbackPopupWindow
.
show
()
}
adapter
.
setOnItemClickListener
(
object
:
OnItemClickListener
<
String
>
{
override
fun
onClick
(
view
:
View
?,
position
:
Int
,
item
:
String
?)
{
item
?.
let
{
ToastUtil
.
showToast
(
activity
,
"将为您减少此类内容推荐"
)
dismiss
()
}
}
})
}
fun
show
(){
if
(
activity
.
isFinishing
)
{
return
}
mPopUpWindow
.
width
=
ViewGroup
.
LayoutParams
.
MATCH_PARENT
mPopUpWindow
.
height
=
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
mPopUpWindow
.
setBackgroundDrawable
(
ColorDrawable
(
0
x00000000
))
mPopUpWindow
.
isOutsideTouchable
=
true
mPopUpWindow
.
isFocusable
=
true
mPopUpWindow
.
animationStyle
=
R
.
style
.
PopupWindow_anim_style
mPopUpWindow
.
showAtLocation
(
parent
,
Gravity
.
BOTTOM
or
Gravity
.
CENTER_HORIZONTAL
,
0
,
0
)
val
lp
:
WindowManager
.
LayoutParams
=
activity
.
window
.
attributes
lp
.
alpha
=
0.6f
activity
.
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_DIM_BEHIND
)
activity
.
window
.
attributes
=
lp
}
fun
dismiss
()
{
if
(
mPopUpWindow
.
isShowing
)
{
mPopUpWindow
.
dismiss
()
}
}
}
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/ui/popwindow/FeedbackPopupWindow.kt
deleted
100644 → 0
View file @
608fb9d5
package
com.yidian.shenghuoquan.newscontent.ui.popwindow
import
android.app.Activity
import
android.graphics.drawable.ColorDrawable
import
android.view.*
import
android.widget.PopupWindow
import
com.yidian.bcommon.utils.YdToastUtil
import
com.yidian.nightmode.widget.YdLinearLayout
import
com.yidian.shenghuoquan.newscontent.R
import
com.yidian.shenghuoquan.newscontent.bean.FeedbackBean
class
FeedbackPopupWindow
(
private
val
activity
:
Activity
,
private
val
parent
:
View
,
private
val
feedbackBean
:
FeedbackBean
)
{
private
val
view
:
View
=
LayoutInflater
.
from
(
activity
).
inflate
(
R
.
layout
.
feedback_popup_window
,
null
)
private
val
llyUninterested
=
view
.
findViewById
<
YdLinearLayout
>(
R
.
id
.
lly_uninterested
)
private
val
llyShield
=
view
.
findViewById
<
YdLinearLayout
>(
R
.
id
.
lly_shield
)
private
val
llyInferior
=
view
.
findViewById
<
YdLinearLayout
>(
R
.
id
.
lly_inferior
)
private
val
llyBlock
=
view
.
findViewById
<
YdLinearLayout
>(
R
.
id
.
lly_block
)
private
val
mPopUpWindow
=
PopupWindow
(
view
)
init
{
mPopUpWindow
.
isFocusable
=
false
mPopUpWindow
.
isTouchable
=
true
mPopUpWindow
.
isOutsideTouchable
=
true
setClickListener
()
}
private
fun
setClickListener
(){
mPopUpWindow
.
setOnDismissListener
{
val
lp
:
WindowManager
.
LayoutParams
=
activity
.
window
.
attributes
lp
.
alpha
=
1.0f
activity
.
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_DIM_BEHIND
)
activity
.
window
.
attributes
=
lp
}
llyUninterested
.
setOnClickListener
{
val
imgUrl
=
"https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic.90sjimg.com%2Fdesign%2F01%2F40%2F17%2F07%2F58f7227f997dc.png&refer=http%3A%2F%2Fpic.90sjimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1614927945&t=8957cd0434852595d03de955b704416e"
YdToastUtil
.
showToast
(
activity
,
"将为您减少此类内容推荐"
,
imgUrl
)
dismiss
()
}
llyShield
.
setOnClickListener
{
dismiss
()
val
feedbackDetailPopupWindow
=
FeedbackDetailPopupWindow
(
activity
,
parent
,
feedbackBean
,
FeedbackDetailPopupWindow
.
SHIELD
)
feedbackDetailPopupWindow
.
show
()
}
llyInferior
.
setOnClickListener
{
dismiss
()
val
feedbackDetailPopupWindow
=
FeedbackDetailPopupWindow
(
activity
,
parent
,
feedbackBean
,
FeedbackDetailPopupWindow
.
FEEDBACK
)
feedbackDetailPopupWindow
.
show
()
}
llyBlock
.
setOnClickListener
{
YdToastUtil
.
showToast
(
activity
,
"将为您减少此类内容推荐"
)
dismiss
()
}
}
fun
show
(){
if
(
activity
.
isFinishing
)
{
return
}
mPopUpWindow
.
width
=
ViewGroup
.
LayoutParams
.
MATCH_PARENT
mPopUpWindow
.
height
=
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
mPopUpWindow
.
setBackgroundDrawable
(
ColorDrawable
(
0
x00000000
))
mPopUpWindow
.
isOutsideTouchable
=
true
mPopUpWindow
.
isFocusable
=
true
mPopUpWindow
.
animationStyle
=
R
.
style
.
PopupWindow_anim_style
mPopUpWindow
.
showAtLocation
(
parent
,
Gravity
.
BOTTOM
or
Gravity
.
CENTER_HORIZONTAL
,
0
,
0
)
val
lp
:
WindowManager
.
LayoutParams
=
activity
.
window
.
attributes
lp
.
alpha
=
0.6f
activity
.
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_DIM_BEHIND
)
activity
.
window
.
attributes
=
lp
}
fun
dismiss
()
{
if
(
mPopUpWindow
.
isShowing
)
{
mPopUpWindow
.
dismiss
()
}
}
}
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/viewholder/StoreViewHolder.kt
→
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/
ui/store/
viewholder/StoreViewHolder.kt
View file @
5b9af99f
package
com.yidian.shenghuoquan.newscontent.viewholder
package
com.yidian.shenghuoquan.newscontent.
ui.store.
viewholder
import
android.view.View
import
android.widget.TextView
...
...
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/utils/AccountUtil.kt
deleted
100644 → 0
View file @
608fb9d5
package
com.yidian.shenghuoquan.newscontent.utils
import
android.text.TextUtils
import
com.google.gson.Gson
import
com.orhanobut.hawk.Hawk
import
com.yidian.bcommon.HawkConfig
import
com.yidian.bcommon.utils.EncryptUtil
import
com.yidian.framework.mobile.xdiamond.SecretUtil
import
com.yidian.shenghuoquan.newscontent.bean.TokenBean
import
java.util.*
class
AccountUtil
{
companion
object
{
@Synchronized
fun
getGuestUsername
():
String
{
var
username
=
Hawk
.
get
(
HawkConfig
.
GuestAccountUsername
,
""
)
if
(
TextUtils
.
isEmpty
(
username
))
{
username
=
try
{
val
uuid
=
UUID
.
randomUUID
()
"HG_$uuid"
}
catch
(
e
:
Exception
)
{
//做必要的保护
val
r
=
Random
()
val
d
=
Date
()
r
.
setSeed
(
d
.
time
)
val
random
=
r
.
nextInt
(
10000
)
"HG_"
+
System
.
currentTimeMillis
()
+
'-'
+
random
}
}
return
username
}
fun
getPassword
(
username
:
String
):
String
{
val
strLower
=
username
.
toLowerCase
()
val
strMd5
=
EncryptUtil
.
getMD5
(
username
)
val
strTemp
=
strLower
+
strMd5
return
encryptMore
(
strTemp
,
1000
)
}
private
fun
encryptMore
(
str
:
String
,
count
:
Int
):
String
{
val
strTemp
=
EncryptUtil
.
encryptToSHA
(
str
)
val
num
=
count
-
1
return
if
(
num
>
0
)
{
encryptMore
(
strTemp
,
num
)
}
else
{
strTemp
}
}
fun
getToken
(
username
:
String
,
password
:
String
):
String
?
{
val
secret
=
SecretUtil
.
sign
(
username
+
password
)
val
tokenBean
=
TokenBean
(
secret
,
username
,
password
)
val
jsonString
=
Gson
().
toJson
(
tokenBean
)
return
SecretUtil
.
rsaEncrypt
(
jsonString
)
}
}
}
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/utils/FloatWindowPermissionManager.java
deleted
100644 → 0
View file @
608fb9d5
package
com
.
yidian
.
shenghuoquan
.
newscontent
.
utils
;
import
android.Manifest
;
import
android.app.Activity
;
import
android.app.AppOpsManager
;
import
android.content.ActivityNotFoundException
;
import
android.content.ComponentName
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.pm.PackageManager
;
import
android.net.Uri
;
import
android.os.Binder
;
import
android.os.Build
;
import
android.provider.Settings
;
import
android.util.Log
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Method
;
/**
* @author sun on 2018/7/5.
*/
public
class
FloatWindowPermissionManager
{
public
static
final
int
REQUEST_PERMISSION_OVERLAY
=
100
;
public
static
final
String
TAG
=
"FloatWindowParamManager"
;
public
static
boolean
checkPermission
(
Context
context
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
M
)
{
return
Settings
.
canDrawOverlays
(
context
);
}
return
checkOps
(
context
);
}
public
static
boolean
checkOverlayPermission
(
Context
context
)
{
AppOpsManager
appOpsMgr
=
(
AppOpsManager
)
context
.
getSystemService
(
Context
.
APP_OPS_SERVICE
);
try
{
if
(
appOpsMgr
!=
null
)
{
int
mode
=
appOpsMgr
.
checkOpNoThrow
(
"android:system_alert_window"
,
android
.
os
.
Process
.
myUid
(),
context
.
getPackageName
());
if
(
mode
==
0
)
{
return
true
;
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
false
;
}
private
static
boolean
checkOps
(
Context
context
)
{
try
{
Object
object
=
context
.
getSystemService
(
Context
.
APP_OPS_SERVICE
);
if
(
object
==
null
)
{
return
false
;
}
Class
localClass
=
object
.
getClass
();
Class
[]
arrayOfClass
=
new
Class
[
3
];
arrayOfClass
[
0
]
=
Integer
.
TYPE
;
arrayOfClass
[
1
]
=
Integer
.
TYPE
;
arrayOfClass
[
2
]
=
String
.
class
;
Method
method
=
localClass
.
getMethod
(
"checkOp"
,
arrayOfClass
);
if
(
method
==
null
)
{
return
false
;
}
Object
[]
arrayOfObject1
=
new
Object
[
3
];
arrayOfObject1
[
0
]
=
24
;
arrayOfObject1
[
1
]
=
Binder
.
getCallingUid
();
arrayOfObject1
[
2
]
=
context
.
getPackageName
();
int
m
=
(
Integer
)
method
.
invoke
(
object
,
arrayOfObject1
);
return
m
==
AppOpsManager
.
MODE_ALLOWED
||
!
RomUtils
.
isDomesticSpecialRom
();
}
catch
(
Exception
ignore
)
{
}
return
false
;
}
public
static
boolean
tryJumpToPermissionPage
(
Activity
context
)
{
if
(
Build
.
VERSION
.
SDK_INT
<
Build
.
VERSION_CODES
.
M
)
{
switch
(
RomUtils
.
getRomName
())
{
case
RomUtils
.
ROM_MIUI
:
return
applyMiuiPermission
(
context
);
case
RomUtils
.
ROM_EMUI
:
return
applyHuaweiPermission
(
context
);
case
RomUtils
.
ROM_VIVO
:
return
applyVivoPermission
(
context
);
case
RomUtils
.
ROM_OPPO
:
return
applyOppoPermission
(
context
);
case
RomUtils
.
ROM_QIKU
:
return
apply360Permission
(
context
);
case
RomUtils
.
ROM_SMARTISAN
:
return
applySmartisanPermission
(
context
);
case
RomUtils
.
ROM_COOLPAD
:
return
applyCoolpadPermission
(
context
);
case
RomUtils
.
ROM_ZTE
:
return
applyZTEPermission
(
context
);
case
RomUtils
.
ROM_LENOVO
:
return
applyLenovoPermission
(
context
);
case
RomUtils
.
ROM_LETV
:
return
applyLetvPermission
(
context
);
default
:
return
true
;
}
}
else
{
if
(
RomUtils
.
isMeizuRom
())
{
return
getAppDetailSettingIntent
(
context
);
}
else
if
(
RomUtils
.
isVivoRom
())
{
return
applyVivoPermission
(
context
);
}
else
if
(
RomUtils
.
isMiuiRom
())
{
return
applyMiuiPermission
(
context
)
||
getAppDetailSettingIntent
(
context
);
}
else
{
return
applyCommonPermission
(
context
);
}
}
}
private
static
boolean
startActivitySafely
(
Intent
intent
,
Activity
context
)
{
try
{
if
(
isIntentAvailable
(
intent
,
context
))
{
intent
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
context
.
startActivityForResult
(
intent
,
REQUEST_PERMISSION_OVERLAY
);
return
true
;
}
else
{
return
false
;
}
}
catch
(
Exception
e
)
{
Log
.
e
(
TAG
,
"启动Activity失败!!!!!!"
);
return
false
;
}
}
public
static
boolean
isIntentAvailable
(
Intent
intent
,
Activity
context
)
{
return
intent
!=
null
&&
context
.
getPackageManager
().
queryIntentActivities
(
intent
,
PackageManager
.
MATCH_DEFAULT_ONLY
).
size
()
>
0
;
}
private
static
boolean
applyCommonPermission
(
Activity
context
)
{
try
{
Class
clazz
=
Settings
.
class
;
Field
field
=
clazz
.
getDeclaredField
(
"ACTION_MANAGE_OVERLAY_PERMISSION"
);
Intent
intent
=
new
Intent
(
field
.
get
(
null
).
toString
());
intent
.
setData
(
Uri
.
parse
(
"package:"
+
context
.
getPackageName
()));
startActivitySafely
(
intent
,
context
);
return
true
;
}
catch
(
Exception
e
)
{
return
false
;
}
}
private
static
boolean
applyCoolpadPermission
(
Activity
context
)
{
Intent
intent
=
new
Intent
();
intent
.
setClassName
(
"com.yulong.android.seccenter"
,
"com.yulong.android.seccenter.dataprotection.ui.AppListActivity"
);
return
startActivitySafely
(
intent
,
context
);
}
private
static
boolean
applyLenovoPermission
(
Activity
context
)
{
Intent
intent
=
new
Intent
();
intent
.
setClassName
(
"com.lenovo.safecenter"
,
"com.lenovo.safecenter.MainTab.LeSafeMainActivity"
);
return
startActivitySafely
(
intent
,
context
);
}
private
static
boolean
applyZTEPermission
(
Activity
context
)
{
Intent
intent
=
new
Intent
();
intent
.
setAction
(
"com.zte.heartyservice.intent.action.startActivity.PERMISSION_SCANNER"
);
return
startActivitySafely
(
intent
,
context
);
}
private
static
boolean
applyLetvPermission
(
Activity
context
)
{
Intent
intent
=
new
Intent
();
intent
.
setClassName
(
"com.letv.android.letvsafe"
,
"com.letv.android.letvsafe.AppActivity"
);
return
startActivitySafely
(
intent
,
context
);
}
private
static
boolean
applyVivoPermission
(
Activity
context
)
{
Intent
intent
=
new
Intent
();
intent
.
putExtra
(
"packagename"
,
context
.
getPackageName
());
intent
.
setAction
(
"com.vivo.permissionmanager"
);
intent
.
setClassName
(
"com.vivo.permissionmanager"
,
"com.vivo.permissionmanager.activity.SoftPermissionDetailActivity"
);
ComponentName
componentName1
=
intent
.
resolveActivity
(
context
.
getPackageManager
());
if
(
componentName1
!=
null
)
{
return
startActivitySafely
(
intent
,
context
);
}
intent
.
setAction
(
"com.iqoo.secure"
);
intent
.
setClassName
(
"com.iqoo.secure"
,
"com.iqoo.secure.safeguard.SoftPermissionDetailActivity"
);
ComponentName
componentName2
=
intent
.
resolveActivity
(
context
.
getPackageManager
());
if
(
componentName2
!=
null
)
{
return
startActivitySafely
(
intent
,
context
);
}
intent
.
setAction
(
"com.iqoo.secure"
);
intent
.
setClassName
(
"com.iqoo.secure"
,
"com.iqoo.secure.MainActivity"
);
ComponentName
componentName3
=
intent
.
resolveActivity
(
context
.
getPackageManager
());
if
(
componentName3
!=
null
)
{
return
startActivitySafely
(
intent
,
context
);
}
return
startActivitySafely
(
intent
,
context
);
}
private
static
boolean
applyOppoPermission
(
Activity
context
)
{
Intent
intent
=
new
Intent
();
intent
.
putExtra
(
"packageName"
,
context
.
getPackageName
());
intent
.
setAction
(
"com.oppo.safe"
);
intent
.
setClassName
(
"com.oppo.safe"
,
"com.oppo.safe.permission.PermissionAppListActivity"
);
if
(!
startActivitySafely
(
intent
,
context
))
{
intent
.
setAction
(
"com.color.safecenter"
);
intent
.
setClassName
(
"com.color.safecenter"
,
"com.color.safecenter.permission.floatwindow.FloatWindowListActivity"
);
if
(!
startActivitySafely
(
intent
,
context
))
{
intent
.
setAction
(
"com.coloros.safecenter"
);
intent
.
setClassName
(
"com.coloros.safecenter"
,
"com.coloros.safecenter.sysfloatwindow.FloatWindowListActivity"
);
return
startActivitySafely
(
intent
,
context
);
}
else
{
return
true
;
}
}
else
{
return
true
;
}
}
private
static
boolean
apply360Permission
(
Activity
context
)
{
Intent
intent
=
new
Intent
();
intent
.
setClassName
(
"com.android.settings"
,
"com.android.settings.Settings$OverlaySettingsActivity"
);
if
(!
startActivitySafely
(
intent
,
context
))
{
intent
.
setClassName
(
"com.qihoo360.mobilesafe"
,
"com.qihoo360.mobilesafe.ui.index.AppEnterActivity"
);
return
startActivitySafely
(
intent
,
context
);
}
else
{
return
true
;
}
}
private
static
boolean
applyMiuiPermission
(
Activity
context
)
{
Intent
intent
=
new
Intent
();
intent
.
setAction
(
"miui.intent.action.APP_PERM_EDITOR"
);
intent
.
addCategory
(
Intent
.
CATEGORY_DEFAULT
);
intent
.
putExtra
(
"extra_pkgname"
,
context
.
getPackageName
());
return
startActivitySafely
(
intent
,
context
);
}
public
static
boolean
getAppDetailSettingIntent
(
Activity
context
)
{
Intent
localIntent
=
new
Intent
();
localIntent
.
setAction
(
Settings
.
ACTION_APPLICATION_DETAILS_SETTINGS
);
localIntent
.
setData
(
Uri
.
fromParts
(
"package"
,
context
.
getPackageName
(),
null
));
return
startActivitySafely
(
localIntent
,
context
);
}
private
static
boolean
applyMeizuPermission
(
Activity
context
)
{
Intent
intent
=
new
Intent
(
"com.meizu.safe.security.SHOW_APPSEC"
);
intent
.
setClassName
(
"com.meizu.safe"
,
"com.meizu.safe.security.AppSecActivity"
);
intent
.
putExtra
(
"packageName"
,
context
.
getPackageName
());
return
startActivitySafely
(
intent
,
context
);
}
private
static
boolean
applyHuaweiPermission
(
Activity
context
)
{
try
{
Intent
intent
=
new
Intent
();
intent
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
ComponentName
comp
=
new
ComponentName
(
"com.huawei.systemmanager"
,
"com.huawei.systemmanager.addviewmonitor.AddViewMonitorActivity"
);
intent
.
setComponent
(
comp
);
if
(!
startActivitySafely
(
intent
,
context
))
{
comp
=
new
ComponentName
(
"com.huawei.systemmanager"
,
"com.huawei.notificationmanager.ui.NotificationManagmentActivity"
);
intent
.
setComponent
(
comp
);
context
.
startActivity
(
intent
);
return
true
;
}
else
{
return
true
;
}
}
catch
(
SecurityException
e
)
{
try
{
Intent
intent
=
new
Intent
();
intent
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
ComponentName
comp
=
new
ComponentName
(
"com.huawei.systemmanager"
,
"com.huawei.permissionmanager.ui.MainActivity"
);
intent
.
setComponent
(
comp
);
context
.
startActivity
(
intent
);
return
true
;
}
catch
(
Exception
e1
)
{
Log
.
e
(
TAG
,
"Huawei跳转失败1"
+
e1
);
return
getAppDetailSettingIntent
(
context
);
}
}
catch
(
ActivityNotFoundException
e
)
{
try
{
Intent
intent
=
new
Intent
();
intent
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
ComponentName
comp
=
new
ComponentName
(
"com.Android.settings"
,
"com.android.settings.permission.TabItem"
);
intent
.
setComponent
(
comp
);
context
.
startActivity
(
intent
);
return
true
;
}
catch
(
Exception
e2
)
{
Log
.
e
(
TAG
,
"Huawei跳转失败2"
+
e
);
return
getAppDetailSettingIntent
(
context
);
}
}
catch
(
Exception
e
)
{
return
getAppDetailSettingIntent
(
context
);
}
}
private
static
boolean
applySmartisanPermission
(
Activity
context
)
{
Intent
intent
=
new
Intent
(
"com.smartisanos.security.action.SWITCHED_PERMISSIONS_NEW"
);
intent
.
setClassName
(
"com.smartisanos.security"
,
"com.smartisanos.security.SwitchedPermissions"
);
intent
.
putExtra
(
"index"
,
17
);
//有版本差异,不一定定位正确
if
(
startActivitySafely
(
intent
,
context
))
{
return
true
;
}
else
{
intent
=
new
Intent
(
"com.smartisanos.security.action.SWITCHED_PERMISSIONS"
);
intent
.
setClassName
(
"com.smartisanos.security"
,
"com.smartisanos.security.SwitchedPermissions"
);
intent
.
putExtra
(
"permission"
,
new
String
[]{
Manifest
.
permission
.
SYSTEM_ALERT_WINDOW
});
return
startActivitySafely
(
intent
,
context
);
}
}
}
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/utils/HeightProvider.java
deleted
100644 → 0
View file @
608fb9d5
package
com
.
yidian
.
shenghuoquan
.
newscontent
.
utils
;
import
android.app.Activity
;
import
android.graphics.Rect
;
import
android.graphics.drawable.ColorDrawable
;
import
android.view.Gravity
;
import
android.view.View
;
import
android.view.ViewTreeObserver.OnGlobalLayoutListener
;
import
android.view.WindowManager.LayoutParams
;
import
android.widget.PopupWindow
;
public
class
HeightProvider
extends
PopupWindow
implements
OnGlobalLayoutListener
{
private
final
Activity
mActivity
;
private
final
View
rootView
;
private
HeightListener
listener
;
private
static
int
heightMax
;
// 记录popup内容区的最大高度
private
static
int
keyboardHeight
;
// 记录keyboard高
public
HeightProvider
(
Activity
activity
)
{
super
(
activity
);
this
.
mActivity
=
activity
;
// 基础配置
rootView
=
new
View
(
activity
);
setContentView
(
rootView
);
// 监听全局Layout变化
rootView
.
getViewTreeObserver
().
addOnGlobalLayoutListener
(
this
);
setBackgroundDrawable
(
new
ColorDrawable
(
0
));
// 设置宽度为0,高度为全屏
setWidth
(
0
);
setHeight
(
LayoutParams
.
MATCH_PARENT
);
// 设置键盘弹出方式
setSoftInputMode
(
LayoutParams
.
SOFT_INPUT_ADJUST_RESIZE
);
setInputMethodMode
(
PopupWindow
.
INPUT_METHOD_NEEDED
);
}
public
HeightProvider
init
()
{
if
(!
isShowing
())
{
final
View
view
=
mActivity
.
getWindow
().
getDecorView
();
// 延迟加载popupwindow,如果不加延迟就会报错
view
.
post
(()
->
showAtLocation
(
view
,
Gravity
.
NO_GRAVITY
,
0
,
0
));
}
return
this
;
}
public
HeightProvider
setHeightListener
(
HeightListener
listener
)
{
this
.
listener
=
listener
;
return
this
;
}
@Override
public
void
onGlobalLayout
()
{
Rect
rect
=
new
Rect
();
rootView
.
getWindowVisibleDisplayFrame
(
rect
);
if
(
rect
.
bottom
>
heightMax
)
{
heightMax
=
rect
.
bottom
;
}
// 两者的差值就是键盘的高度
keyboardHeight
=
heightMax
-
rect
.
bottom
;
if
(
listener
!=
null
)
{
listener
.
onHeightChanged
(
heightMax
,
keyboardHeight
);
}
}
public
interface
HeightListener
{
void
onHeightChanged
(
int
heightMax
,
int
height
);
}
public
static
boolean
isKeyboardShowing
()
{
return
keyboardHeight
>
heightMax
/
3
;
}
public
static
int
getHeightMax
()
{
return
heightMax
;
}
}
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/utils/RomUtils.java
deleted
100644 → 0
View file @
608fb9d5
package
com
.
yidian
.
shenghuoquan
.
newscontent
.
utils
;
import
android.os.Build
;
import
android.text.TextUtils
;
import
androidx.annotation.StringDef
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.Target
;
/**
* @author sun on 2018/7/5.
*/
public
class
RomUtils
{
private
static
final
String
TAG
=
"RomUtils"
;
static
final
String
ROM_MIUI
=
"MIUI"
;
static
final
String
ROM_EMUI
=
"EMUI"
;
static
final
String
ROM_VIVO
=
"VIVO"
;
static
final
String
ROM_OPPO
=
"OPPO"
;
static
final
String
ROM_FLYME
=
"FLYME"
;
static
final
String
ROM_SMARTISAN
=
"SMARTISAN"
;
static
final
String
ROM_QIKU
=
"QIKU"
;
static
final
String
ROM_LETV
=
"LETV"
;
static
final
String
ROM_LENOVO
=
"LENOVO"
;
static
final
String
ROM_NUBIA
=
"NUBIA"
;
static
final
String
ROM_ZTE
=
"ZTE"
;
static
final
String
ROM_COOLPAD
=
"COOLPAD"
;
static
final
String
ROM_UNKNOWN
=
"UNKNOWN"
;
@StringDef
({
ROM_MIUI
,
ROM_EMUI
,
ROM_VIVO
,
ROM_OPPO
,
ROM_FLYME
,
ROM_SMARTISAN
,
ROM_QIKU
,
ROM_LETV
,
ROM_LENOVO
,
ROM_ZTE
,
ROM_COOLPAD
,
ROM_UNKNOWN
})
@Target
({
ElementType
.
METHOD
})
@Retention
(
RetentionPolicy
.
SOURCE
)
public
@interface
RomName
{
}
private
static
final
String
SYSTEM_VERSION_MIUI
=
"ro.miui.ui.version.name"
;
private
static
final
String
SYSTEM_VERSION_EMUI
=
"ro.build.version.emui"
;
private
static
final
String
SYSTEM_VERSION_VIVO
=
"ro.vivo.os.version"
;
private
static
final
String
SYSTEM_VERSION_OPPO
=
"ro.build.version.opporom"
;
private
static
final
String
SYSTEM_VERSION_FLYME
=
"ro.build.display.id"
;
private
static
final
String
SYSTEM_VERSION_SMARTISAN
=
"ro.smartisan.version"
;
private
static
final
String
SYSTEM_VERSION_LETV
=
"ro.letv.eui"
;
private
static
final
String
SYSTEM_VERSION_LENOVO
=
"ro.lenovo.lvp.version"
;
private
static
String
getSystemProperty
(
String
propName
)
{
return
SystemProperties
.
get
(
propName
,
null
);
}
@RomName
public
static
String
getRomName
()
{
if
(
isMiuiRom
())
{
return
ROM_MIUI
;
}
if
(
isHuaweiRom
())
{
return
ROM_EMUI
;
}
if
(
isVivoRom
())
{
return
ROM_VIVO
;
}
if
(
isOppoRom
())
{
return
ROM_OPPO
;
}
if
(
isMeizuRom
())
{
return
ROM_FLYME
;
}
if
(
isSmartisanRom
())
{
return
ROM_SMARTISAN
;
}
if
(
is360Rom
())
{
return
ROM_QIKU
;
}
if
(
isLetvRom
())
{
return
ROM_LETV
;
}
if
(
isLenovoRom
())
{
return
ROM_LENOVO
;
}
if
(
isZTERom
())
{
return
ROM_ZTE
;
}
if
(
isCoolPadRom
())
{
return
ROM_COOLPAD
;
}
return
ROM_UNKNOWN
;
}
public
static
String
getDeviceManufacture
()
{
if
(
isMiuiRom
())
{
return
"小米"
;
}
if
(
isHuaweiRom
())
{
return
"华为"
;
}
if
(
isVivoRom
())
{
return
ROM_VIVO
;
}
if
(
isOppoRom
())
{
return
ROM_OPPO
;
}
if
(
isMeizuRom
())
{
return
"魅族"
;
}
if
(
isSmartisanRom
())
{
return
"锤子"
;
}
if
(
is360Rom
())
{
return
"奇酷"
;
}
if
(
isLetvRom
())
{
return
"乐视"
;
}
if
(
isLenovoRom
())
{
return
"联想"
;
}
if
(
isZTERom
())
{
return
"中兴"
;
}
if
(
isCoolPadRom
())
{
return
"酷派"
;
}
return
Build
.
MANUFACTURER
;
}
public
static
boolean
isMiuiRom
()
{
return
!
TextUtils
.
isEmpty
(
getSystemProperty
(
SYSTEM_VERSION_MIUI
));
}
public
static
boolean
isHuaweiRom
()
{
return
!
TextUtils
.
isEmpty
(
getSystemProperty
(
SYSTEM_VERSION_EMUI
));
}
public
static
boolean
isVivoRom
()
{
return
!
TextUtils
.
isEmpty
(
getSystemProperty
(
SYSTEM_VERSION_VIVO
));
}
public
static
boolean
isOppoRom
()
{
return
!
TextUtils
.
isEmpty
(
getSystemProperty
(
SYSTEM_VERSION_OPPO
));
}
public
static
boolean
isMeizuRom
()
{
String
meizuFlymeOSFlag
=
getSystemProperty
(
SYSTEM_VERSION_FLYME
);
return
!
TextUtils
.
isEmpty
(
meizuFlymeOSFlag
)
&&
meizuFlymeOSFlag
.
toUpperCase
().
contains
(
ROM_FLYME
);
}
public
static
boolean
isSmartisanRom
()
{
return
!
TextUtils
.
isEmpty
(
getSystemProperty
(
SYSTEM_VERSION_SMARTISAN
));
}
public
static
boolean
is360Rom
()
{
String
manufacturer
=
Build
.
MANUFACTURER
;
return
!
TextUtils
.
isEmpty
(
manufacturer
)
&&
manufacturer
.
toUpperCase
().
contains
(
ROM_QIKU
);
}
public
static
boolean
isLetvRom
()
{
return
!
TextUtils
.
isEmpty
(
getSystemProperty
(
SYSTEM_VERSION_LETV
));
}
public
static
boolean
isLenovoRom
()
{
return
!
TextUtils
.
isEmpty
(
getSystemProperty
(
SYSTEM_VERSION_LENOVO
));
}
public
static
boolean
isCoolPadRom
()
{
String
model
=
Build
.
MODEL
;
String
fingerPrint
=
Build
.
FINGERPRINT
;
return
(!
TextUtils
.
isEmpty
(
model
)
&&
model
.
toLowerCase
().
contains
(
ROM_COOLPAD
))
||
(!
TextUtils
.
isEmpty
(
fingerPrint
)
&&
fingerPrint
.
toLowerCase
().
contains
(
ROM_COOLPAD
));
}
public
static
boolean
isZTERom
()
{
String
manufacturer
=
Build
.
MANUFACTURER
;
String
fingerPrint
=
Build
.
FINGERPRINT
;
boolean
b
=
fingerPrint
.
toLowerCase
().
contains
(
ROM_NUBIA
)
||
fingerPrint
.
toLowerCase
().
contains
(
ROM_ZTE
);
return
(!
TextUtils
.
isEmpty
(
manufacturer
)
&&
b
)
||
(!
TextUtils
.
isEmpty
(
fingerPrint
)
&&
b
);
}
public
static
boolean
isDomesticSpecialRom
()
{
return
RomUtils
.
isMiuiRom
()
||
RomUtils
.
isHuaweiRom
()
||
RomUtils
.
isMeizuRom
()
||
RomUtils
.
is360Rom
()
||
RomUtils
.
isOppoRom
()
||
RomUtils
.
isVivoRom
()
||
RomUtils
.
isLetvRom
()
||
RomUtils
.
isZTERom
()
||
RomUtils
.
isLenovoRom
()
||
RomUtils
.
isCoolPadRom
();
}
public
static
boolean
isSmartisanR1
()
{
return
Build
.
MODEL
.
contains
(
"DE106"
);
}
/**
* Vivo沙雕刘海屏判断
*
* @return
*/
public
static
boolean
isVivoStupidNotch
()
{
return
isVivoX21
()
||
isVivoX21S
()
||
isVivoX23
()
||
isVivoZ1
()
||
isVivoZ3
()
||
isVivoY81s
()
||
isVivoY83
()
||
isVivoY85
()
||
isVivoY93
()
||
isVivoY97
();
}
public
static
boolean
isVivoX21
()
{
return
Build
.
MODEL
.
contains
(
"vivo X21"
);
}
public
static
boolean
isVivoX21S
()
{
return
Build
.
MODEL
.
contains
(
"V1814"
);
}
public
static
boolean
isVivoX23
()
{
//X23普通 幻彩版
return
Build
.
MODEL
.
contains
(
"V1809"
)
||
Build
.
MODEL
.
contains
(
"V1816"
);
}
public
static
boolean
isVivoZ1
()
{
return
Build
.
MODEL
.
contains
(
"V1730"
);
}
public
static
boolean
isVivoZ3
()
{
return
Build
.
MODEL
.
contains
(
"V1813BA"
);
}
public
static
boolean
isVivoY81s
()
{
return
Build
.
MODEL
.
contains
(
"V1732"
);
}
public
static
boolean
isVivoY83
()
{
return
Build
.
MODEL
.
contains
(
"Y83"
);
}
public
static
boolean
isVivoY85
()
{
return
Build
.
MODEL
.
contains
(
"vivo Y85"
);
}
public
static
boolean
isVivoY93
()
{
return
Build
.
MODEL
.
contains
(
"V1818"
);
}
public
static
boolean
isVivoY97
()
{
return
Build
.
MODEL
.
contains
(
"V1813A"
)
||
Build
.
MODEL
.
contains
(
"V1813T"
);
}
public
static
boolean
isHonorV10
()
{
return
Build
.
MODEL
.
contains
(
"BKL-AL00"
);
}
public
static
boolean
isHonor10
()
{
return
Build
.
MODEL
.
contains
(
"COL-AL10"
);
}
public
static
boolean
isMiPad4
()
{
return
TextUtils
.
equals
(
Build
.
MODEL
,
"MI PAD 4"
);
}
}
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/utils/SystemProperties.java
deleted
100644 → 0
View file @
608fb9d5
package
com
.
yidian
.
shenghuoquan
.
newscontent
.
utils
;
import
android.text.TextUtils
;
import
java.lang.reflect.Method
;
/**
* @author sun on 2018/7/5.
*/
public
class
SystemProperties
{
private
static
final
Method
getStringProperty
=
getMethod
(
getClass
(
"android.os.SystemProperties"
));
private
static
Class
<?>
getClass
(
String
name
)
{
try
{
Class
<?>
cls
=
Class
.
forName
(
name
);
if
(
cls
==
null
)
{
throw
new
ClassNotFoundException
();
}
return
cls
;
}
catch
(
ClassNotFoundException
e
)
{
try
{
return
ClassLoader
.
getSystemClassLoader
().
loadClass
(
name
);
}
catch
(
ClassNotFoundException
e1
)
{
return
null
;
}
}
}
private
static
Method
getMethod
(
Class
<?>
clz
)
{
if
(
clz
==
null
)
return
null
;
try
{
return
clz
.
getMethod
(
"get"
,
String
.
class
);
}
catch
(
Exception
e
)
{
return
null
;
}
}
public
static
String
get
(
String
key
)
{
if
(
getStringProperty
!=
null
)
{
try
{
Object
value
=
getStringProperty
.
invoke
(
null
,
key
);
if
(
value
==
null
)
{
return
""
;
}
return
trimToEmpty
(
value
.
toString
());
}
catch
(
Exception
ignored
)
{
}
}
return
""
;
}
public
static
String
get
(
String
key
,
String
def
)
{
if
(
getStringProperty
!=
null
)
{
try
{
String
value
=
(
String
)
getStringProperty
.
invoke
(
null
,
key
);
return
defaultString
(
trimToNull
(
value
),
def
);
}
catch
(
Exception
ignored
)
{
}
}
return
def
;
}
private
static
String
defaultString
(
String
str
,
String
defaultStr
)
{
return
str
==
null
?
defaultStr
:
str
;
}
private
static
String
trimToNull
(
String
str
)
{
String
ts
=
trim
(
str
);
return
TextUtils
.
isEmpty
(
ts
)
?
null
:
ts
;
}
private
static
String
trimToEmpty
(
String
str
)
{
return
str
==
null
?
""
:
str
.
trim
();
}
private
static
String
trim
(
String
str
)
{
return
str
==
null
?
null
:
str
.
trim
();
}
}
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/utils/UploadFileUtils.kt
deleted
100644 → 0
View file @
608fb9d5
package
com.yidian.shenghuoquan.newscontent.utils
import
okhttp3.MediaType.Companion.toMediaTypeOrNull
import
okhttp3.MultipartBody
import
okhttp3.RequestBody.Companion.asRequestBody
import
java.io.File
class
UploadFileUtils
{
companion
object
{
fun
fileToMultipartBodyPart
(
fileKey
:
String
,
file
:
File
):
MultipartBody
.
Part
{
val
requestFile
=
file
.
asRequestBody
(
"multipart/form-data"
.
toMediaTypeOrNull
())
return
MultipartBody
.
Part
.
createFormData
(
fileKey
,
file
.
name
,
requestFile
)
}
}
}
\ No newline at end of file
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/utils/VideoAudioUtil.kt
deleted
100644 → 0
View file @
608fb9d5
package
com.yidian.shenghuoquan.newscontent.utils
import
com.yidian.shenghuoquan.newscontent.audio.AudioPlayerManager
val
audioManager
:
AudioPlayerManager
by
lazy
{
AudioPlayerManager
.
instance
}
\ No newline at end of file
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/widget/ExpandTextView.java
deleted
100644 → 0
View file @
608fb9d5
package
com
.
yidian
.
shenghuoquan
.
newscontent
.
widget
;
import
android.annotation.SuppressLint
;
import
android.content.Context
;
import
android.text.Layout
;
import
android.text.NoCopySpan
;
import
android.text.SpannableString
;
import
android.text.Spanned
;
import
android.text.StaticLayout
;
import
android.text.TextPaint
;
import
android.text.method.LinkMovementMethod
;
import
android.text.style.ClickableSpan
;
import
android.util.AttributeSet
;
import
android.view.View
;
import
androidx.annotation.NonNull
;
import
com.yidian.nightmode.widget.YdTextView
;
import
com.yidian.shenghuoquan.newscontent.R
;
public
class
ExpandTextView
extends
YdTextView
{
private
static
final
String
TAG
=
"ExpandTextView"
;
private
String
originText
=
""
;
//原始内容文本
private
int
initWidth
=
0
;
//TextView可展示宽度
private
int
mMaxLines
=
2
;
//TextView最大显示行数
private
SpannableString
SPAN_CLOSE
=
null
;
//收起的文本(颜色处理和点击监听)
private
SpannableString
SPAN_EXPAND
=
null
;
//展开的文本(颜色处理和点击监听)
private
String
TEXT_EXPAND
=
" 展开"
;
private
String
TEXT_CLOSE
=
" 收起"
;
private
int
SPAN_COLOR
=
R
.
color
.
video_transparent_50
;
private
boolean
isClose
=
true
;
private
boolean
isWidthModify
=
true
;
//用于控件宽高改变时通知重绘的判断,避免循环绘制
private
ExpandClickListener
l
;
public
ExpandTextView
(
Context
context
)
{
super
(
context
);
}
public
ExpandTextView
(
Context
context
,
AttributeSet
attrs
)
{
super
(
context
,
attrs
);
}
public
ExpandTextView
(
Context
context
,
AttributeSet
attrs
,
int
defStyleAttr
)
{
super
(
context
,
attrs
,
defStyleAttr
);
}
@Override
protected
void
onMeasure
(
int
widthMeasureSpec
,
int
heightMeasureSpec
)
{
super
.
onMeasure
(
widthMeasureSpec
,
heightMeasureSpec
);
initWidth
=
getMeasuredWidth
();
if
(
isWidthModify
)
{
notifyRefreshView
();
isWidthModify
=
false
;
}
}
/**
* 初始化"展开"的Span文本,即收起状态的文本尾
*/
private
void
initCloseEnd
(){
String
content
=
TEXT_EXPAND
;
SPAN_CLOSE
=
new
SpannableString
(
content
);
SPAN_CLOSE
.
setSpan
(
new
NoRefCopySpan
()
{
@SuppressLint
(
"ResourceType"
)
@Override
public
void
updateDrawState
(
TextPaint
ds
)
{
ds
.
setColor
(
getResources
().
getColor
(
SPAN_COLOR
));
ds
.
setUnderlineText
(
false
);
}
@Override
public
void
onClick
(
@NonNull
View
widget
)
{
if
(
l
!=
null
){
l
.
onClick
(
true
);
}
ExpandTextView
.
super
.
setMaxLines
(
Integer
.
MAX_VALUE
);
setExpandText
(
originText
);
}
},
0
,
content
.
length
(),
Spanned
.
SPAN_INCLUSIVE_EXCLUSIVE
);
}
/**
* 初始化"收起"的Span文本,即展开状态的文本尾
*/
private
void
initExpandEnd
(){
String
content
=
TEXT_CLOSE
;
SPAN_EXPAND
=
new
SpannableString
(
content
);
SPAN_EXPAND
.
setSpan
(
new
NoRefCopySpan
()
{
@SuppressLint
(
"ResourceType"
)
@Override
public
void
updateDrawState
(
TextPaint
ds
)
{
ds
.
setColor
(
getResources
().
getColor
(
SPAN_COLOR
));
ds
.
setUnderlineText
(
false
);
}
@Override
public
void
onClick
(
@NonNull
View
widget
)
{
if
(
l
!=
null
){
l
.
onClick
(
false
);
}
ExpandTextView
.
super
.
setMaxLines
(
mMaxLines
);
setCloseText
(
originText
);
}
},
0
,
content
.
length
(),
Spanned
.
SPAN_INCLUSIVE_EXCLUSIVE
);
}
/**
* 设置收起状态时的文本
*/
private
void
setCloseText
(
CharSequence
text
)
{
if
(
SPAN_CLOSE
==
null
){
initCloseEnd
();
}
boolean
appendShowAll
=
false
;
//true不需要展开收起功能(文件行数小于或等于最大行),false需要展开收起功能
originText
=
text
.
toString
();
int
maxLines
=
getMaxLines
();
String
workingText
=
originText
;
if
(
maxLines
!=
-
1
)
{
Layout
layout
=
createWorkingLayout
(
workingText
);
if
(
layout
.
getLineCount
()
>
maxLines
)
{
//获取一行显示字符个数,然后截取字符串数
workingText
=
originText
.
substring
(
0
,
layout
.
getLineEnd
(
maxLines
-
1
)).
trim
();
// 收起状态原始文本截取展示的部分
String
showText
=
originText
.
substring
(
0
,
layout
.
getLineEnd
(
maxLines
-
1
)).
trim
()
+
"..."
+
SPAN_CLOSE
;
Layout
layout2
=
createWorkingLayout
(
showText
);
//对workingText进行-1截取,直到展示行数==最大行数,并且添加SPAN_CLOSE后刚好占满最后一行
while
(
layout2
.
getLineCount
()
>
maxLines
)
{
int
lastSpace
=
workingText
.
length
()-
1
;
if
(
lastSpace
==
-
1
)
{
break
;
}
workingText
=
workingText
.
substring
(
0
,
lastSpace
);
layout2
=
createWorkingLayout
(
workingText
+
"..."
+
SPAN_CLOSE
);
}
appendShowAll
=
true
;
workingText
=
workingText
+
"..."
;
}
}
setText
(
workingText
);
if
(
appendShowAll
)
{
// 必须使用append,不能在上面使用+连接,否则spannable会无效
append
(
SPAN_CLOSE
);
setMovementMethod
(
LinkMovementMethod
.
getInstance
());
}
invalidate
();
post
(
this
::
requestLayout
);
}
/**
* 设置展开状态时的文本
*/
@SuppressLint
(
"SetTextI18n"
)
private
void
setExpandText
(
String
text
)
{
if
(
SPAN_EXPAND
==
null
){
initExpandEnd
();
}
Layout
layout1
=
createWorkingLayout
(
text
);
Layout
layout2
=
createWorkingLayout
(
text
+
TEXT_CLOSE
);
// 展示全部原始内容时 如果 TEXT_CLOSE 需要换行才能显示完整,则直接将TEXT_CLOSE展示在下一行
if
(
layout2
.
getLineCount
()
>
layout1
.
getLineCount
()){
setText
(
originText
+
"\n"
);
}
else
{
setText
(
originText
);
}
append
(
SPAN_EXPAND
);
setMovementMethod
(
LinkMovementMethod
.
getInstance
());
invalidate
();
post
(
this
::
requestLayout
);
}
/**
* 返回textview的显示区域的layout,该textview的layout并不会显示出来
* 只是用其宽度来比较要显示的文字是否过长。
*/
private
Layout
createWorkingLayout
(
String
workingText
)
{
return
new
StaticLayout
(
workingText
,
getPaint
(),
initWidth
-
getPaddingLeft
()
-
getPaddingRight
(),
Layout
.
Alignment
.
ALIGN_NORMAL
,
getLineSpacingMultiplier
(),
getLineSpacingExtra
(),
false
);
}
/**
* sdk>=16,可以通过xml进行配置,但16以下必须用该方法配置
*/
@Override
public
void
setMaxLines
(
int
maxLines
)
{
this
.
mMaxLines
=
maxLines
;
super
.
setMaxLines
(
maxLines
);
}
/**
* @param originText 待显示的原文本;
* @param isClose 设置TextView的初始状态是否为收起;
* 设置文本时,需要调用该方法来代替setText。若直接使用setText方法设置文本,
* 该控件只会作为普通TextView显示。
*/
public
void
setText
(
String
originText
,
boolean
isClose
)
{
this
.
originText
=
originText
;
this
.
isClose
=
isClose
;
isWidthModify
=
true
;
notifyRefreshView
();
}
/**
* 修改设置后通知重绘,setText(String originText, Boolean isClose)方法不需要调用
*/
public
void
notifyRefreshView
()
{
if
(
isClose
)
{
ExpandTextView
.
super
.
setMaxLines
(
mMaxLines
);
setCloseText
(
originText
);
}
else
{
ExpandTextView
.
super
.
setMaxLines
(
Integer
.
MAX_VALUE
);
setExpandText
(
originText
);
}
}
/**
* @param colorId 展开和收起时,文本尾的Span文本的颜色;
* 设置展开和收起时文本尾的Span文本的颜色(若不以该方法设置,则默认为R.color.red)。
*/
public
void
setLabelTextColor
(
int
colorId
)
{
SPAN_COLOR
=
colorId
;
initExpandEnd
();
initCloseEnd
();
}
/**
* @param str 收起时,文本尾代表"展开"的Span文本内容;
* 设置文本尾的"展开"Span文本的内容(若不以该方法设置,则默认为"展开")。
*/
public
void
setExpandLabelText
(
String
str
)
{
TEXT_EXPAND
=
str
;
initExpandEnd
();
}
/**
* @param str 展开时,文本尾代表"收起"的Span文本内容;
* 设置文本尾的"收起"Span文本的内容(若不以该方法设置,则默认为"收起")。
*/
public
void
setCLOSELabelText
(
String
str
)
{
TEXT_CLOSE
=
str
;
initCloseEnd
();
}
/**
* 实现NoCopySpan的原因是,为了防止Span在onSaveInstanceState时被复制保存,导致内存泄漏
*/
public
static
class
NoRefCopySpan
extends
ClickableSpan
implements
NoCopySpan
{
@Override
public
void
onClick
(
@NonNull
View
widget
)
{
//等待子类继承
}
@Override
public
void
updateDrawState
(
TextPaint
ds
)
{
super
.
updateDrawState
(
ds
);
}
}
public
void
setOnExpandClickListener
(
ExpandClickListener
listener
){
this
.
l
=
listener
;
}
interface
ExpandClickListener
{
void
onClick
(
boolean
isExpand
);
}
}
\ No newline at end of file
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/widget/ExpandTextViewReal.kt
deleted
100644 → 0
View file @
608fb9d5
package
com.yidian.shenghuoquan.newscontent.widget
import
android.content.Context
import
android.util.AttributeSet
import
com.yidian.nightmode.widget.YdTextView
class
ExpandTextViewReal
@JvmOverloads
constructor
(
context
:
Context
,
attrs
:
AttributeSet
?
=
null
,
defStyle
:
Int
=
0
)
:
YdTextView
(
context
,
attrs
,
defStyle
)
{
}
\ No newline at end of file
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/widget/FloatAudioView.kt
deleted
100644 → 0
View file @
608fb9d5
package
com.yidian.shenghuoquan.newscontent.widget
import
android.content.Context
import
android.util.AttributeSet
import
android.util.Log
import
android.view.View
import
android.widget.FrameLayout
import
android.widget.ImageView
import
android.widget.TextView
import
com.yidian.shenghuoquan.newscontent.R
import
com.yidian.shenghuoquan.newscontent.audio.IAudioControl
import
com.yidian.shenghuoquan.newscontent.audio.IAudioView
import
java.lang.ref.WeakReference
class
FloatAudioView
@JvmOverloads
constructor
(
context
:
Context
,
attrs
:
AttributeSet
?
=
null
)
:
FrameLayout
(
context
,
attrs
)
,
IAudioView
{
private
var
close
:
(()
->
Unit
)?=
null
private
val
TAG
=
"FloatAudioView"
private
lateinit
var
ivPower
:
ImageView
private
lateinit
var
ivPrev
:
ImageView
private
lateinit
var
ivNext
:
ImageView
private
lateinit
var
ivPlay
:
ImageView
private
lateinit
var
tvContent
:
TextView
private
var
audioControl
:
WeakReference
<
IAudioControl
>?=
null
init
{
inflate
(
context
,
R
.
layout
.
float_audio_layout
,
this
)
initView
()
initListener
()
}
private
fun
initListener
()
{
ivPower
.
setOnClickListener
{
Log
.
e
(
TAG
,
"initListener: ivPower =="
)
visibility
=
View
.
GONE
audioControl
?.
get
()
?.
release
()
close
?.
invoke
()
}
ivPrev
.
setOnClickListener
{
Log
.
e
(
TAG
,
"initListener: iv ivPrev"
)
audioControl
?.
get
()
?.
previous
()
}
ivNext
.
setOnClickListener
{
Log
.
e
(
TAG
,
"initListener: iv next"
)
audioControl
?.
get
()
?.
next
()
}
ivPlay
.
setOnClickListener
{
Log
.
e
(
TAG
,
"initListener: iv play"
)
if
(
audioControl
?.
get
()
?.
isPlaying
()
==
true
){
audioControl
?.
get
()
?.
pause
()
updatePlayUi
(
false
)
}
else
{
audioControl
?.
get
()
?.
start
()
updatePlayUi
(
true
)
}
}
}
private
fun
initView
()
{
ivPower
=
findViewById
(
R
.
id
.
iv_power
)
ivPlay
=
findViewById
(
R
.
id
.
iv_audio_play
)
ivPrev
=
findViewById
(
R
.
id
.
iv_prev
)
ivNext
=
findViewById
(
R
.
id
.
iv_next
)
tvContent
=
findViewById
(
R
.
id
.
tv_content
)
}
override
fun
bindAudioControl
(
control
:
IAudioControl
)
{
audioControl
=
WeakReference
(
control
)
}
override
fun
setPrevEnable
(
enable
:
Boolean
)
{
ivPrev
.
isEnabled
=
enable
if
(
enable
){
ivPrev
.
setImageResource
(
R
.
drawable
.
skip_previous
)
}
else
{
ivPrev
.
setImageResource
(
R
.
drawable
.
skip_previous_gray
)
}
}
override
fun
setPlayEnable
(
enable
:
Boolean
)
{
ivPlay
.
isEnabled
=
enable
}
override
fun
setNextEnable
(
enable
:
Boolean
){
ivNext
.
isEnabled
=
enable
if
(
enable
){
ivNext
.
setImageResource
(
R
.
drawable
.
skip_next
)
}
else
{
ivNext
.
setImageResource
(
R
.
drawable
.
skip_next_gray
)
}
}
override
fun
setContent
(
content
:
String
)
{
if
(
::
tvContent
.
isInitialized
){
tvContent
.
text
=
content
}
}
override
fun
updatePlayUi
(
isPlay
:
Boolean
)
{
ivPlay
.
setImageResource
(
if
(
isPlay
)
R
.
drawable
.
audio_start
else
R
.
drawable
.
audio_pause
)
}
fun
setOnCloseListener
(
close
:()->
Unit
){
this
.
close
=
close
}
override
fun
onDetachedFromWindow
()
{
super
.
onDetachedFromWindow
()
audioControl
?.
clear
()
audioControl
=
null
}
}
\ No newline at end of file
Components/newscontent/src/main/manifest/AndroidManifest.xml
View file @
5b9af99f
...
...
@@ -3,47 +3,6 @@
package=
"com.yidian.shenghuoquan.newscontent"
>
<application>
<activity
android:name=
"com.yidian.shenghuoquan.broot.ui.FlashActivity"
android:theme=
"@style/FlashTheme"
>
<intent-filter>
<action
android:name=
"android.intent.action.VIEW"
/>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
<activity
android:name=
".ui.MainActivity"
android:launchMode=
"singleTask"
/>
<activity
android:name=
".ui.DeepLinkActivity"
>
<intent-filter>
<action
android:name=
"android.intent.action.VIEW"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<category
android:name=
"android.intent.category.BROWSABLE"
/>
<data
android:host=
"link_news"
android:scheme=
"ydsubway"
/>
</intent-filter>
</activity>
<activity
android:name=
".ui.NewsContentActivity"
android:configChanges=
"keyboard|keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize|uiMode"
/>
<service
android:name=
".audio.AudioService"
android:enabled=
"true"
android:exported=
"true"
/>
<activity
android:name=
".ui.alive.AliveTestActivity"
android:theme=
"@style/Transparent"
/>
<activity
android:name=
".ui.idcard.IDCardTestActivity"
android:theme=
"@style/Transparent"
/>
<activity
android:name=
".ui.auth.LifeAccountEnterpriseAuthCompleteActivity"
android:theme=
"@style/Transparent"
/>
...
...
@@ -53,60 +12,38 @@
<activity
android:name=
".ui.auth.LifeAccountCreateCompleteActivity"
android:theme=
"@style/Transparent"
/>
<activity
android:name=
".ui.idcard.IDCardResultActivity"
android:theme=
"@style/Transparent"
/>
<activity
android:name=
".ui.ProtocolActivity"
android:theme=
"@style/Transparent"
/>
<activity
android:name=
".ui.ProductSupportActivity"
android:theme=
"@style/Transparent"
/>
<activity
android:name=
".ui.LoginLifeCircleActivity"
/>
<activity
android:name=
".ui.store.StoreManagementActivity"
android:theme=
"@style/Transparent"
/>
<activity
android:name=
".ui.store.EditStoreActivity"
android:theme=
"@style/Transparent"
/>
<activity
android:name=
".ui.store.SelectAddressActivity"
android:theme=
"@style/Transparent"
/>
<activity
android:name=
".ui.store.SearchAddActivity"
android:theme=
"@style/Transparent"
/>
<activity
android:name=
".ui.auth.LifeAccountIdentityActivity"
android:theme=
"@style/Transparent"
/>
<activity
android:name=
".ui.auth.LifeAccountAuthActivity"
android:theme=
"@style/Transparent"
/>
<activity
android:name=
".ui.LifeAccountEnterpriseCertificationActivity"
android:theme=
"@style/Transparent"
/>
<activity
android:name=
".ui.auth.LifeAccountCreateActivity"
android:theme=
"@style/Transparent"
android:windowSoftInputMode=
"stateHidden|adjustResize"
/>
<activity
android:name=
".ui.auth.LifeAccountPersonalAuthActivity"
android:theme=
"@style/Transparent"
/>
<activity
android:name=
".ui.auth.LifeAccountEnterpriseAuthActivity"
android:theme=
"@style/Transparent"
/>
<activity
android:name=
".personnel.ui.MyStaffActivity"
android:launchMode=
"singleTask"
...
...
@@ -129,20 +66,16 @@
<activity
android:name=
".ui.setting.SystemSettingActivity"
android:theme=
"@style/Transparent"
/>
<activity
android:name=
".ui.center.MerchantCenterActivity"
android:theme=
"@style/Transparent"
/>
<activity
android:name=
".ui.center.MerchantInfoActivity"
android:theme=
"@style/Transparent"
/>
<activity
android:name=
".ui.center.LifeAccountModifyNameActivity"
android:theme=
"@style/Transparent"
android:windowSoftInputMode=
"stateVisible"
/>
<activity
android:name=
".ui.center.MerchantAuthInfoActivity"
android:theme=
"@style/Transparent"
/>
...
...
Components/newscontent/src/main/res/layout/item_video_detail.xml
deleted
100644 → 0
View file @
608fb9d5
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
tools:background=
"@color/black"
tools:viewBindingIgnore=
"true"
>
<com.yidian.shenghuoquan.newscontent.widget.CustomCoverVideo
android:id=
"@+id/ccv_detail"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
<FrameLayout
android:id=
"@+id/video_float_ll"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<com.yidian.nightmode.widget.YdLinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_gravity=
"bottom"
android:orientation=
"vertical"
>
<com.yidian.nightmode.widget.YdLinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"76dp"
android:gravity=
"center_vertical"
android:orientation=
"horizontal"
>
<de.hdodenhof.circleimageview.CircleImageView
android:id=
"@+id/iv_author"
android:layout_width=
"30dp"
android:layout_height=
"30dp"
android:padding=
"2dp"
android:background=
"@drawable/circle_white_bg"
android:layout_marginStart=
"20dp"
android:scaleType=
"centerCrop"
/>
<com.yidian.nightmode.widget.YdTextView
android:id=
"@+id/tv_author"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"6dp"
tools:text=
"天王盖地虎"
android:textColor=
"@color/white"
android:textSize=
"14sp"
/>
<com.yidian.shenghuoquan.newscontent.widget.chameleon.SubscribeButton
android:id=
"@+id/sb_subscription"
android:layout_width=
"36dp"
android:layout_height=
"16dp"
android:layout_marginStart=
"6dp"
android:gravity=
"center"
android:background=
"@drawable/yellow_radius_bg"
android:paddingStart=
"3dp"
android:paddingEnd=
"3dp"
android:text=
"@string/subscription"
android:textColor=
"@color/video_subscription"
android:textSize=
"9sp"
tools:ignore=
"SmallSp"
/>
</com.yidian.nightmode.widget.YdLinearLayout>
<com.yidian.shenghuoquan.newscontent.widget.ExpandTextView
android:id=
"@+id/tv_detail_desc"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"20dp"
android:layout_marginTop=
"8dp"
android:layout_marginEnd=
"76dp"
android:maxLines=
"2"
android:layout_marginBottom=
"10dp"
android:textColor=
"@color/white"
android:textSize=
"15sp"
/>
<com.yidian.nightmode.widget.YdLinearLayout
android:id=
"@+id/video_comment_layout"
android:layout_width=
"match_parent"
android:layout_height=
"50dp"
android:background=
"@color/black"
android:layout_marginTop=
"20dp"
android:gravity=
"center_vertical"
>
<com.yidian.nightmode.widget.YdTextView
android:id=
"@+id/tv_comment_bottom"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"5dp"
android:paddingBottom=
"5dp"
android:layout_marginStart=
"20dp"
android:layout_weight=
"1"
android:text=
"写评论"
android:textColor=
"@color/gray_888888"
android:textSize=
"14sp"
/>
<com.yidian.nightmode.widget.YdImageView
android:visibility=
"gone"
android:id=
"@+id/iv_comment_bottom"
android:layout_width=
"24dp"
android:layout_height=
"24dp"
android:layout_marginEnd=
"20dp"
android:scaleType=
"centerCrop"
android:src=
"@mipmap/more_white"
/>
</com.yidian.nightmode.widget.YdLinearLayout>
</com.yidian.nightmode.widget.YdLinearLayout>
<LinearLayout
android:layout_width=
"44dp"
android:layout_height=
"wrap_content"
android:layout_gravity=
"bottom|end"
android:layout_marginEnd=
"12dp"
android:layout_marginBottom=
"84dp"
android:gravity=
"center_horizontal"
android:orientation=
"vertical"
>
<com.yidian.shenghuoquan.newscontent.widget.VideoThumbUpView
android:id=
"@+id/vt_thumb_up"
android:orientation=
"vertical"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
<com.yidian.nightmode.widget.YdImageView
android:id=
"@+id/iv_comment"
android:layout_width=
"44dp"
android:layout_height=
"44dp"
android:layout_marginTop=
"20dp"
android:scaleType=
"centerCrop"
android:src=
"@mipmap/video_comment"
/>
<com.yidian.nightmode.widget.YdTextView
android:id=
"@+id/tv_comment"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"抢首评"
android:textColor=
"@color/white"
android:textSize=
"12sp"
/>
<com.yidian.nightmode.widget.YdImageView
android:id=
"@+id/iv_share"
android:layout_width=
"44dp"
android:layout_height=
"44dp"
android:layout_marginTop=
"20dp"
android:scaleType=
"centerCrop"
android:src=
"@mipmap/video_share"
/>
<com.yidian.nightmode.widget.YdTextView
android:id=
"@+id/tv_share"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"分享"
android:textColor=
"@color/white"
android:textSize=
"12sp"
/>
</LinearLayout>
</FrameLayout>
</FrameLayout>
\ No newline at end of file
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