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
fcf66628
Commit
fcf66628
authored
May 31, 2021
by
zhenghongbin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add 身份选择页面逻辑
parent
7a6599b8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
34 deletions
+53
-34
LifeAccountIdentityAdapter.kt
...huoquan/newscontent/adapter/LifeAccountIdentityAdapter.kt
+14
-13
AccountItemBean.kt
...shenghuoquan/newscontent/http/httpbean/AccountItemBean.kt
+8
-8
LifeAccountIdentityActivity.kt
...henghuoquan/newscontent/ui/LifeAccountIdentityActivity.kt
+31
-13
No files found.
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/adapter/LifeAccountIdentityAdapter.kt
View file @
fcf66628
...
...
@@ -7,6 +7,7 @@ import androidx.recyclerview.widget.RecyclerView
import
com.yidian.common.cardutils.adapter.OnItemClickListener
import
com.yidian.shenghuoquan.newscontent.R
import
com.yidian.shenghuoquan.newscontent.bean.LifeAccountIdentityBean
import
com.yidian.shenghuoquan.newscontent.http.httpbean.AccountItemBean
import
kotlinx.android.synthetic.main.item_life_account_identity.view.*
/**
...
...
@@ -17,9 +18,9 @@ import kotlinx.android.synthetic.main.item_life_account_identity.view.*
class
LifeAccountIdentityAdapter
:
RecyclerView
.
Adapter
<
LifeAccountIdentityAdapter
.
LifeAccountIdentityViewHolder
>()
{
private
val
mData
:
ArrayList
<
LifeAccountIdentityBean
>
by
lazy
{
ArrayList
<
LifeAccountIdentityBean
>()
}
private
lateinit
var
mListener
:
OnItemClickListener
<
LifeAccountIdentityBean
>
private
lateinit
var
mLastSelectItem
:
View
private
val
mData
:
ArrayList
<
AccountItemBean
.
Response
>
by
lazy
{
ArrayList
<
AccountItemBean
.
Response
>()
}
private
lateinit
var
mListener
:
OnItemClickListener
<
AccountItemBean
.
Response
>
private
var
mLastSelectItem
:
View
?
=
null
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
...
...
@@ -32,16 +33,16 @@ class LifeAccountIdentityAdapter :
}
override
fun
onBindViewHolder
(
holder
:
LifeAccountIdentityViewHolder
,
position
:
Int
)
{
if
(
position
==
0
)
{
// 默认选中第一个身份
mLastSelectItem
=
holder
.
itemView
holder
.
itemView
.
isSelected
=
true
}
val
data
=
mData
[
position
]
holder
.
itemView
.
tv_life_account
.
text
=
data
.
account
holder
.
itemView
.
tv_life_identity
.
text
=
data
.
identity
holder
.
itemView
.
tv_life_account
.
text
=
data
.
life_account_name
if
(
data
.
role_type
==
1
){
holder
.
itemView
.
tv_life_identity
.
text
=
"超级管理员"
}
else
{
holder
.
itemView
.
tv_life_identity
.
text
=
"普通管理员"
}
holder
.
itemView
.
setOnClickListener
{
mLastSelectItem
.
isSelected
=
false
mLastSelectItem
?
.
isSelected
=
false
mLastSelectItem
=
holder
.
itemView
holder
.
itemView
.
isSelected
=
true
mListener
.
onClick
(
it
,
position
,
data
)
...
...
@@ -55,7 +56,7 @@ class LifeAccountIdentityAdapter :
/**
* 更新数据
*/
fun
updateData
(
data
:
List
<
LifeAccountIdentityBean
>)
{
fun
updateData
(
data
:
List
<
AccountItemBean
.
Response
>)
{
data
.
let
{
mData
.
clear
()
mData
.
addAll
(
it
)
...
...
@@ -63,7 +64,7 @@ class LifeAccountIdentityAdapter :
}
}
fun
setOnItemClickListener
(
listener
:
OnItemClickListener
<
LifeAccountIdentityBean
>)
{
fun
setOnItemClickListener
(
listener
:
OnItemClickListener
<
AccountItemBean
.
Response
>)
{
mListener
=
listener
}
...
...
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/http/httpbean/AccountItemBean.kt
View file @
fcf66628
...
...
@@ -2,13 +2,13 @@ package com.yidian.shenghuoquan.newscontent.http.httpbean
class
AccountItemBean
(
var
response
:
Response
)
{
data class
Response
(
va
l
create_time
:
String
,
va
l
enterprise_audit_status
:
Int
,
va
l
life_account_auth_status
:
Int
,
va
l
life_account_id
:
Long
,
va
l
life_account_name
:
String
,
va
l
life_account_status
:
Int
,
va
l
life_account_type
:
Int
,
va
l
role_type
:
Int
va
r
create_time
:
String
?
,
va
r
enterprise_audit_status
:
Int
?
,
va
r
life_account_auth_status
:
Int
?
,
va
r
life_account_id
:
Long
?
,
va
r
life_account_name
:
String
?
,
va
r
life_account_status
:
Int
?
,
va
r
life_account_type
:
Int
?
,
va
r
role_type
:
Int
?
)
}
\ No newline at end of file
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/ui/LifeAccountIdentityActivity.kt
View file @
fcf66628
package
com.yidian.shenghuoquan.newscontent.ui
import
android.graphics.Rect
import
android.os.Bundle
import
android.view.View
import
androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.RecyclerView
import
com.google.gson.Gson
import
com.google.gson.reflect.TypeToken
import
com.yidian.common.XRouterPathConstants
import
com.yidian.common.base.BaseActivity
import
com.yidian.common.cardutils.adapter.OnItemClickListener
import
com.yidian.shenghuoquan.newscontent.R
import
com.yidian.shenghuoquan.newscontent.adapter.LifeAccountIdentityAdapter
import
com.yidian.shenghuoquan.newscontent.bean.LifeAccountIdentityBean
import
com.yidian.shenghuoquan.newscontent.databinding.ActivityLifeAccountIdentityBinding
import
com.yidian.shenghuoquan.newscontent.http.httpbean.AccountItemBean
import
com.yidian.xpage.XPageManager
import
com.yidian.yac.core.zap.ZapTicket
import
org.json.JSONObject
/**
* author: yinjiacheng
* date: 5/19/21 4:47 PM
* description: 生活号身份选择
*/
class
LifeAccountIdentityActivity
:
BaseActivity
<
ActivityLifeAccountIdentityBinding
>(),
OnItemClickListener
<
LifeAccountIdentityBean
>
{
class
LifeAccountIdentityActivity
:
BaseActivity
<
ActivityLifeAccountIdentityBinding
>(),
OnItemClickListener
<
AccountItemBean
.
Response
>
{
private
var
accountMap
:
HashMap
<
String
,
Any
?>?
=
null
private
var
lastSelectedIndex
=
-
1
override
fun
createViewBinding
():
ActivityLifeAccountIdentityBinding
{
return
ActivityLifeAccountIdentityBinding
.
inflate
(
layoutInflater
)
...
...
@@ -43,6 +43,7 @@ class LifeAccountIdentityActivity : BaseActivity<ActivityLifeAccountIdentityBind
LinearLayoutManager
(
this
,
RecyclerView
.
VERTICAL
,
false
)
viewBind
.
rvLifeAccountIdentity
.
adapter
=
LifeAccountIdentityAdapter
()
(
viewBind
.
rvLifeAccountIdentity
.
adapter
as
LifeAccountIdentityAdapter
).
setOnItemClickListener
(
this
)
setLoginButtonStatus
(
false
)
}
private
fun
initData
()
{
...
...
@@ -52,12 +53,12 @@ class LifeAccountIdentityActivity : BaseActivity<ActivityLifeAccountIdentityBind
val
accountList
=
paramsMap
[
"accountList"
]
}
val
data
:
List
<
LifeAccountIdentityBean
>
=
val
data
:
List
<
AccountItemBean
.
Response
>
=
listOf
(
LifeAccountIdentityBean
(
"一点网娱商业化大佬们的生活号还有更多文字可以换行"
,
"超级管理员"
),
LifeAccountIdentityBean
(
"一点资讯"
,
"普通管理员"
),
LifeAccountIdentityBean
(
"简网科技生活号"
,
"普通管理员"
),
LifeAccountIdentityBean
(
"生活圈"
,
"普通管理员"
)
AccountItemBean
.
Response
(
null
,
20
,
2
,
666
,
"一点资讯生活圈"
,
1
,
2
,
1
),
AccountItemBean
.
Response
(
null
,
10
,
1
,
777
,
"简网科技生活号"
,
2
,
1
,
2
),
AccountItemBean
.
Response
(
null
,
20
,
2
,
888
,
"一点资讯生活圈"
,
1
,
2
,
2
),
AccountItemBean
.
Response
(
null
,
10
,
1
,
999
,
"简网科技生活号"
,
2
,
1
,
2
)
)
(
viewBind
.
rvLifeAccountIdentity
.
adapter
as
LifeAccountIdentityAdapter
).
updateData
(
data
)
}
...
...
@@ -67,11 +68,28 @@ class LifeAccountIdentityActivity : BaseActivity<ActivityLifeAccountIdentityBind
XPageManager
.
pop
(
null
)
}
viewBind
.
tvEnterLifeAccount
.
setOnClickListener
{
if
(
accountMap
!=
null
){
// XPageManager.push(XRouterPathConstants.NEWS_CONTENT, accountMap)
}
}
}
override
fun
onClick
(
view
:
View
?,
position
:
Int
,
item
:
AccountItemBean
.
Response
?)
{
if
(
position
!=
lastSelectedIndex
){
setLoginButtonStatus
(
true
)
val
itemJson
=
Gson
().
toJson
(
item
)
accountMap
=
Gson
().
fromJson
<
HashMap
<
String
,
Any
?>>(
itemJson
,
object
:
TypeToken
<
HashMap
<
String
,
Any
?
>>(){}.
type
)
lastSelectedIndex
=
position
}
}
override
fun
onClick
(
view
:
View
?,
position
:
Int
,
item
:
LifeAccountIdentityBean
?)
{
// TODO: 5/19/21 选中某个身份
private
fun
setLoginButtonStatus
(
flag
:
Boolean
){
if
(
flag
){
viewBind
.
tvEnterLifeAccount
.
alpha
=
1.0f
viewBind
.
tvEnterLifeAccount
.
isEnabled
=
true
}
else
{
viewBind
.
tvEnterLifeAccount
.
alpha
=
0.32f
viewBind
.
tvEnterLifeAccount
.
isEnabled
=
false
}
}
}
\ 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