Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Room Park Android
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
Vladislav Bogdashkin
Room Park Android
Commits
70dbb7df
Commit
70dbb7df
authored
Jan 14, 2020
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more decomposition and refactor
parent
e8fbbfcc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
29 deletions
+29
-29
Adapter.kt
...visual/roompark/presentation/screen/deals/util/Adapter.kt
+29
-29
No files found.
app/src/main/java/com/biganto/visual/roompark/presentation/screen/deals/util/Adapter.kt
View file @
70dbb7df
...
...
@@ -88,12 +88,8 @@ class DealViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
dealPayed
.
text
=
deal
.
dealPayout
.
toRubly
()
dealSumToPay
.
text
=
deal
.
dealToPay
.
toRubly
()
createStatusView
(
statusContainer
,
deal
.
statusList
,
deal
.
statusNo
,
false
)
statusContainer
.
deployProgressView
(
deal
.
statusList
,
deal
.
statusNo
,
false
)
val
currentStatusText
=
LayoutInflater
.
from
(
itemView
.
context
)
.
inflate
(
R
.
layout
.
status_title_textview
,
statusContainer
,
false
)
as
MaterialTextView
...
...
@@ -122,36 +118,40 @@ class DealViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
}
fun
createStatusView
(
container
:
ViewGroup
,
private
fun
LinearLayout
.
deployProgressView
(
list
:
List
<
StatusModel
>,
currentStatus
:
Int
,
isVertical
:
Boolean
){
this
.
removeAllViews
()
this
.
weightSum
=
list
.
size
.
toFloat
()
list
.
sortedBy
{
it
.
orderId
}.
forEach
{
this
.
addView
(
createStatusView
(
this
,
isVertical
,
it
.
orderId
,
list
.
size
,
currentStatus
))
}
this
.
invalidate
()
}
container
.
removeAllViews
()
fun
createStatusView
(
container
:
ViewGroup
,
isVertical
:
Boolean
,
position
:
Int
,
statusCount
:
Int
,
lastStatusPassed
:
Int
):
StatusProgressCeil
{
val
scale
=
container
.
resources
.
displayMetrics
.
density
.
toDouble
()
val
param24dp
=
kotlin
.
math
.
ceil
(
24
*
scale
).
toInt
()
val
wrapContent
=
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
(
container
as
LinearLayout
).
weightSum
=
list
.
size
.
toFloat
()
list
.
sortedBy
{
it
.
orderId
}.
forEach
{
val
ceil
=
LayoutInflater
.
from
(
container
.
context
)
.
inflate
(
R
.
layout
.
status_view
,
container
,
false
)
as
StatusProgressCeil
ceil
.
layoutParams
.
height
=
if
(
isVertical
)
wrapContent
else
param24dp
ceil
.
layoutParams
.
width
=
if
(
isVertical
)
param24dp
else
wrapContent
(
ceil
.
layoutParams
as
LinearLayout
.
LayoutParams
).
weight
=
1f
(
ceil
.
layoutParams
as
LinearLayout
.
LayoutParams
).
gravity
=
Gravity
.
BOTTOM
ceil
.
setHasEnd
(
it
.
orderId
!=
list
.
size
)
ceil
.
setHasStart
(
it
.
orderId
>
1
)
ceil
.
setIsEnabled
(
it
.
orderId
<=
currentStatus
)
ceil
.
setNext
(
it
.
orderId
<
currentStatus
)
if
(
it
.
orderId
>
currentStatus
)
ceil
.
setAnimState
(
StatusProgressAnimationState
.
DISABLE
)
ceil
.
invalidate
()
container
.
addView
(
ceil
)
}
container
.
invalidate
()
val
ceil
=
LayoutInflater
.
from
(
container
.
context
)
.
inflate
(
R
.
layout
.
status_view
,
container
,
false
)
as
StatusProgressCeil
ceil
.
layoutParams
.
height
=
if
(
isVertical
)
wrapContent
else
param24dp
ceil
.
layoutParams
.
width
=
if
(
isVertical
)
param24dp
else
wrapContent
(
ceil
.
layoutParams
as
LinearLayout
.
LayoutParams
).
weight
=
1f
(
ceil
.
layoutParams
as
LinearLayout
.
LayoutParams
).
gravity
=
Gravity
.
BOTTOM
ceil
.
setHasEnd
(
position
!=
statusCount
)
ceil
.
setHasStart
(
position
>
1
)
ceil
.
setIsEnabled
(
position
<=
lastStatusPassed
)
ceil
.
setNext
(
position
<
lastStatusPassed
)
if
(
position
>
lastStatusPassed
)
ceil
.
setAnimState
(
StatusProgressAnimationState
.
DISABLE
)
ceil
.
invalidate
()
return
ceil
}
\ 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