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
f2f27d1f
Commit
f2f27d1f
authored
Oct 17, 2019
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added base deal cards adapter
parent
fb91360f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
136 additions
and
21 deletions
+136
-21
deals.kt
...in/java/com/biganto/visual/roompark/domain/model/deals.kt
+3
-3
Adapter.kt
...visual/roompark/presentation/screen/deals/util/Adapter.kt
+108
-0
FavoritesAdapter.kt
...rk/presentation/screen/favorites/util/FavoritesAdapter.kt
+7
-8
deal_card_viewholder.xml
app/src/main/res/layout/deal_card_viewholder.xml
+17
-8
favorite_card_viewholder.xml
app/src/main/res/layout/favorite_card_viewholder.xml
+1
-2
No files found.
app/src/main/java/com/biganto/visual/roompark/domain/model/deals.kt
View file @
f2f27d1f
...
@@ -9,9 +9,9 @@ data class DealListModel(val deals:List<DealListModel>)
...
@@ -9,9 +9,9 @@ data class DealListModel(val deals:List<DealListModel>)
data class
DealModel
(
data class
DealModel
(
val
id
:
Int
,
val
id
:
Int
,
val
estate_id
:
Int
,
val
estate_id
:
Int
,
val
opportunitySum
:
Floa
t
,
val
opportunitySum
:
In
t
,
val
paymentSum
:
Floa
t
,
val
paymentSum
:
In
t
,
val
amount_pay_sum
:
Floa
t
,
val
amount_pay_sum
:
In
t
,
val
statusId
:
Int
,
val
statusId
:
Int
,
val
managerName
:
String
,
val
managerName
:
String
,
val
estate
:
EstateModel
val
estate
:
EstateModel
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/deals/util/Adapter.kt
0 → 100644
View file @
f2f27d1f
package
com.biganto.visual.roompark.presentation.screen.deals.util
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
android.widget.TextView
import
androidx.recyclerview.widget.RecyclerView
import
butterknife.BindView
import
butterknife.ButterKnife
import
com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.domain.model.CommonInfoModel
import
com.biganto.visual.roompark.domain.model.DealModel
/**
* Created by Vladislav Bogdashkin on 16.10.2019.
*/
class
DealsListAdapter
:
RecyclerView
.
Adapter
<
CamListViewHolder
>()
{
private
var
list
:
MutableList
<
DealModel
>
=
mutableListOf
()
fun
addItems
(
list
:
List
<
DealModel
>){
this
.
list
.
clear
()
this
.
list
.
addAll
(
list
)
notifyDataSetChanged
()
}
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
CamListViewHolder
=
CamListViewHolder
(
LayoutInflater
.
from
(
parent
.
context
)
.
inflate
(
R
.
layout
.
favorite_card_viewholder
,
parent
,
false
)
)
override
fun
getItemCount
():
Int
=
list
.
size
override
fun
onBindViewHolder
(
holder
:
CamListViewHolder
,
position
:
Int
)
{
holder
.
bindModel
(
list
[
position
])
}
}
class
CamListViewHolder
(
itemView
:
View
)
:
RecyclerView
.
ViewHolder
(
itemView
)
{
@BindView
(
R
.
id
.
object_card_title
)
lateinit
var
estateTitle
:
TextView
@BindView
(
R
.
id
.
common_info_block
)
lateinit
var
commonInfo
:
View
@BindView
(
R
.
id
.
start_tour_button
)
lateinit
var
startTour
:
View
@BindView
(
R
.
id
.
info_ceil_1
)
lateinit
var
info1
:
View
@BindView
(
R
.
id
.
info_ceil_2
)
lateinit
var
info2
:
View
@BindView
(
R
.
id
.
info_ceil_3
)
lateinit
var
info3
:
View
@BindView
(
R
.
id
.
info_ceil_4
)
lateinit
var
info4
:
View
@BindView
(
R
.
id
.
deal_sum_value_text_view
)
lateinit
var
dealSum
:
TextView
@BindView
(
R
.
id
.
deal_payed_value_text_view
)
lateinit
var
dealPayed
:
TextView
@BindView
(
R
.
id
.
deal_to_pay_value_text_view
)
lateinit
var
dealSumToPay
:
TextView
fun
typeName
(
type
:
String
)
=
when
(
type
){
"flat"
->
"КВАРТИРА"
"parking"
->
"МАШИНОМЕСТО"
"storage"
->
"КЛАДОВКА"
else
->
"ОБЪЕКТ"
}
init
{
ButterKnife
.
bind
(
this
,
itemView
)
}
fun
bindModel
(
deal
:
DealModel
)
{
val
model
=
deal
.
estate
val
fullObjName
=
"${typeName(model.type)}\n${model.number}"
estateTitle
.
text
=
fullObjName
if
(
model
.
commonInfo
==
null
)
commonInfo
.
visibility
=
View
.
GONE
else
{
commonInfo
.
visibility
=
View
.
VISIBLE
;
renderCommonInfo
(
model
.
commonInfo
)}
if
(
model
.
type
==
"flat"
)
startTour
.
visibility
=
View
.
VISIBLE
else
startTour
.
visibility
=
View
.
GONE
dealSum
.
text
=
deal
.
opportunitySum
.
toRubly
()
dealPayed
.
text
=
deal
.
paymentSum
.
toRubly
()
dealSumToPay
.
text
=
deal
.
amount_pay_sum
.
toRubly
()
}
fun
renderCommonInfo
(
info
:
CommonInfoModel
){
if
(
info
.
building
==
null
)
info1
.
visibility
=
View
.
GONE
else
{
info1
.
title
().
text
=
"Корпус"
;
info1
.
text
().
text
=
info
.
building
.
toString
()}
if
(
info
.
section_begin
==
null
)
info1
.
visibility
=
View
.
GONE
else
{
info2
.
title
().
text
=
"Секция"
;
info2
.
text
().
text
=
info
.
section_begin
.
toString
()}
if
(
info
.
floor
==
null
)
info1
.
visibility
=
View
.
GONE
else
{
info3
.
title
().
text
=
"Этаж"
;
info3
.
text
().
text
=
info
.
floor
.
toString
()}
if
(
info
.
area
==
null
)
info1
.
visibility
=
View
.
GONE
else
{
info4
.
title
().
text
=
"Общая, м²"
;
info4
.
text
().
text
=
info
.
area
.
toString
()}
}
private
fun
View
.
title
()
=
this
.
findViewById
<
TextView
>(
R
.
id
.
info_ceil_header
)
private
fun
View
.
text
()
=
this
.
findViewById
<
TextView
>(
R
.
id
.
info_ceil_content
)
private
fun
Int
.
toRubly
():
String
{
return
String
.
format
(
"%,d \u20BD"
,
this
).
replace
(
','
,
' '
)
}
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/favorites/util/FavoritesAdapter.kt
View file @
f2f27d1f
...
@@ -10,13 +10,12 @@ import butterknife.ButterKnife
...
@@ -10,13 +10,12 @@ import butterknife.ButterKnife
import
com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.domain.model.CommonInfoModel
import
com.biganto.visual.roompark.domain.model.CommonInfoModel
import
com.biganto.visual.roompark.domain.model.EstateModel
import
com.biganto.visual.roompark.domain.model.EstateModel
import
java.text.DecimalFormat
/**
/**
* Created by Vladislav Bogdashkin on 16.10.2019.
* Created by Vladislav Bogdashkin on 16.10.2019.
*/
*/
class
FavoritesListAdapter
:
RecyclerView
.
Adapter
<
CamList
ViewHolder
>()
{
class
FavoritesListAdapter
:
RecyclerView
.
Adapter
<
Deal
ViewHolder
>()
{
private
var
list
:
MutableList
<
EstateModel
>
=
mutableListOf
()
private
var
list
:
MutableList
<
EstateModel
>
=
mutableListOf
()
...
@@ -26,21 +25,21 @@ class FavoritesListAdapter : RecyclerView.Adapter<CamListViewHolder>() {
...
@@ -26,21 +25,21 @@ class FavoritesListAdapter : RecyclerView.Adapter<CamListViewHolder>() {
notifyDataSetChanged
()
notifyDataSetChanged
()
}
}
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
CamList
ViewHolder
=
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
Deal
ViewHolder
=
CamList
ViewHolder
(
Deal
ViewHolder
(
LayoutInflater
.
from
(
parent
.
context
)
LayoutInflater
.
from
(
parent
.
context
)
.
inflate
(
R
.
layout
.
favorite
_card_viewholder
,
parent
,
false
)
.
inflate
(
R
.
layout
.
deal
_card_viewholder
,
parent
,
false
)
)
)
override
fun
getItemCount
():
Int
=
list
.
size
override
fun
getItemCount
():
Int
=
list
.
size
override
fun
onBindViewHolder
(
holder
:
CamList
ViewHolder
,
position
:
Int
)
{
override
fun
onBindViewHolder
(
holder
:
Deal
ViewHolder
,
position
:
Int
)
{
holder
.
bindModel
(
list
[
position
])
holder
.
bindModel
(
list
[
position
])
}
}
}
}
class
CamList
ViewHolder
(
itemView
:
View
)
:
RecyclerView
.
ViewHolder
(
itemView
)
{
class
Deal
ViewHolder
(
itemView
:
View
)
:
RecyclerView
.
ViewHolder
(
itemView
)
{
@BindView
(
R
.
id
.
object_card_title
)
lateinit
var
estateTitle
:
TextView
@BindView
(
R
.
id
.
object_card_title
)
lateinit
var
estateTitle
:
TextView
@BindView
(
R
.
id
.
common_info_block
)
lateinit
var
commonInfo
:
View
@BindView
(
R
.
id
.
common_info_block
)
lateinit
var
commonInfo
:
View
...
@@ -76,7 +75,7 @@ class CamListViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
...
@@ -76,7 +75,7 @@ class CamListViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
else
startTour
.
visibility
=
View
.
GONE
else
startTour
.
visibility
=
View
.
GONE
}
}
fun
renderCommonInfo
(
info
:
CommonInfoModel
){
private
fun
renderCommonInfo
(
info
:
CommonInfoModel
){
if
(
info
.
building
==
null
)
info1
.
visibility
=
View
.
GONE
if
(
info
.
building
==
null
)
info1
.
visibility
=
View
.
GONE
else
{
info1
.
title
().
text
=
"Корпус"
;
info1
.
text
().
text
=
info
.
building
.
toString
()}
else
{
info1
.
title
().
text
=
"Корпус"
;
info1
.
text
().
text
=
info
.
building
.
toString
()}
...
...
app/src/main/res/layout/deal_card_viewholder.xml
View file @
f2f27d1f
...
@@ -34,25 +34,33 @@
...
@@ -34,25 +34,33 @@
android:layout_marginTop=
"8dp"
android:layout_marginTop=
"8dp"
android:orientation=
"horizontal"
>
android:orientation=
"horizontal"
>
<include
layout=
"@layout/info_ceil_view"
<include
android:id=
"@+id/info_ceil_1"
layout=
"@layout/info_ceil_view"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
/>
android:layout_weight=
"1"
/>
<include
layout=
"@layout/info_ceil_view"
<include
android:id=
"@+id/info_ceil_2"
layout=
"@layout/info_ceil_view"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
/>
android:layout_weight=
"1"
/>
<include
layout=
"@layout/info_ceil_view"
<include
android:id=
"@+id/info_ceil_3"
layout=
"@layout/info_ceil_view"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
/>
android:layout_weight=
"1"
/>
<include
layout=
"@layout/info_ceil_view"
<include
android:id=
"@+id/info_ceil_4"
layout=
"@layout/info_ceil_view"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
/>
android:layout_weight=
"1"
/>
</LinearLayout>
</LinearLayout>
...
@@ -162,6 +170,7 @@
...
@@ -162,6 +170,7 @@
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"64dp"
android:layout_height=
"64dp"
android:layout_marginStart=
"16dp"
android:layout_marginStart=
"16dp"
android:layout_marginTop=
"16dp"
android:layout_marginEnd=
"16dp"
/>
android:layout_marginEnd=
"16dp"
/>
<com.google.android.material.card.MaterialCardView
<com.google.android.material.card.MaterialCardView
...
...
app/src/main/res/layout/favorite_card_viewholder.xml
View file @
f2f27d1f
...
@@ -63,8 +63,7 @@
...
@@ -63,8 +63,7 @@
android:id=
"@+id/header_divider"
android:id=
"@+id/header_divider"
layout=
"@layout/horizontal_divider"
layout=
"@layout/horizontal_divider"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"1dp"
android:layout_marginStart=
"16dp"
android:layout_marginTop=
"16dp"
android:layout_marginTop=
"16dp"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
...
...
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