Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
X
xxsq
Project
Project
Details
Activity
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王雪伟
xxsq
Commits
93821478
Commit
93821478
authored
May 26, 2022
by
maxiaoliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改1
parent
6314c153
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
92 additions
and
18 deletions
+92
-18
JgqQyEntity.kt
cms/src/main/java/com/zxhl/cms/net/model/qy/JgqQyEntity.kt
+1
-0
CardVoucherActivity.kt
.../java/com/zxbw/modulemain/activity/CardVoucherActivity.kt
+11
-3
CardAdapter.kt
.../src/main/java/com/zxbw/modulemain/adapter/CardAdapter.kt
+15
-5
CardVoucherContract.kt
.../java/com/zxbw/modulemain/contract/CardVoucherContract.kt
+3
-1
CardVoucherPresenter.kt
...ava/com/zxbw/modulemain/presenter/CardVoucherPresenter.kt
+15
-0
item_layout_card.xml
moduleMain/src/main/res/layout/item_layout_card.xml
+47
-9
No files found.
cms/src/main/java/com/zxhl/cms/net/model/qy/JgqQyEntity.kt
View file @
93821478
...
...
@@ -9,4 +9,5 @@ class JgqQyEntity {
var
brand
:
String
?
=
""
var
sort
:
String
?
=
""
var
icon
:
String
?
=
""
var
maxDiscount
:
String
?
=
""
}
\ No newline at end of file
moduleMain/src/main/java/com/zxbw/modulemain/activity/CardVoucherActivity.kt
View file @
93821478
...
...
@@ -8,11 +8,12 @@ import com.zxbw.modulemain.contract.CardVoucherContract
import
com.zxbw.modulemain.presenter.CardVoucherPresenter
import
com.zxhl.cms.AppContext
import
com.zxhl.cms.common.base.BaseActivity
import
com.zxhl.cms.net.model.qy.JgqQyEntity
import
com.zxhl.cms.utils.JumpUtils
import
com.zxhl.cms.utils.OnRecycleItemClickListener
import
kotlinx.android.synthetic.main.activity_layout_card_voucher.*
class
CardVoucherActivity
:
BaseActivity
(),
CardVoucherContract
.
View
,
OnRecycleItemClickListener
<
An
y
>{
class
CardVoucherActivity
:
BaseActivity
(),
CardVoucherContract
.
View
,
OnRecycleItemClickListener
<
JgqQyEntit
y
>{
private
var
mPresenter
:
CardVoucherPresenter
?=
null
private
var
mAdapter
:
CardAdapter
?=
null
override
fun
onClick
(
v
:
View
?)
{
...
...
@@ -37,13 +38,20 @@ class CardVoucherActivity:BaseActivity(),CardVoucherContract.View ,OnRecycleItem
id_refresh_layout
?.
setOnRefreshListener
{
mPresenter
?.
getCardList
()
}
mPresenter
?.
getCardList
()
}
override
fun
setData
()
{
override
fun
setData
(
result
:
List
<
JgqQyEntity
>?)
{
id_refresh_layout
?.
isRefreshing
=
false
mAdapter
?.
clear
()
mAdapter
?.
appendToList
(
result
)
mAdapter
?.
notifyDataSetChanged
()
}
override
fun
onItemClick
(
view
:
View
?,
position
:
Int
,
data
:
An
y
?)
{
override
fun
onItemClick
(
view
:
View
?,
position
:
Int
,
data
:
JgqQyEntit
y
?)
{
showToast
(
""
+
position
)
JumpUtils
.
CardDetailJump
()
}
...
...
moduleMain/src/main/java/com/zxbw/modulemain/adapter/CardAdapter.kt
View file @
93821478
package
com.zxbw.modulemain.adapter
import
android.app.Activity
import
android.graphics.Paint
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
...
...
@@ -10,30 +11,35 @@ import androidx.recyclerview.widget.RecyclerView
import
com.zxbw.modulemain.R
import
com.zxhl.cms.AppContext
import
com.zxhl.cms.common.base.BaseRecyclerAdapter
import
com.zxhl.cms.net.model.qy.JgqQyEntity
import
com.zxhl.cms.utils.OnRecycleItemClickListener
import
com.zxhl.cms.widget.RecycleImageView
class
CardAdapter
:
BaseRecyclerAdapter
<
An
y
,
CardAdapter
.
ViewHolder
>
{
class
CardAdapter
:
BaseRecyclerAdapter
<
JgqQyEntit
y
,
CardAdapter
.
ViewHolder
>
{
private
var
mContext
:
Activity
?
=
null
private
val
listener
:
OnRecycleItemClickListener
<
An
y
>
private
val
listener
:
OnRecycleItemClickListener
<
JgqQyEntit
y
>
constructor
(
content
:
Activity
?,
listener
:
OnRecycleItemClickListener
<
An
y
>
listener
:
OnRecycleItemClickListener
<
JgqQyEntit
y
>
)
:
super
()
{
mContext
=
content
this
.
listener
=
listener
}
override
fun
onBindViewHolder
(
holder
:
ViewHolder
,
position
:
Int
)
{
var
bean
=
mList
[
position
]
holder
.
id_tv_cards_name
?.
text
=
"${bean.brand}"
holder
.
id_goods_icon
?.
setLoadImageUrl
(
bean
.
icon
,
false
)
holder
.
id_goods_yuan_jia
?.
text
=
""
holder
.
id_tv_guanfang_price
?.
getPaint
()
?.
setFlags
(
Paint
.
STRIKE_THRU_TEXT_FLAG
)
//中划线
holder
.
id_ll_item
?.
setOnClickListener
{
listener
.
onItemClick
(
it
,
position
,
null
)
}
}
override
fun
getItemCount
():
Int
{
return
23
return
mList
.
size
}
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
ViewHolder
{
...
...
@@ -46,7 +52,9 @@ class CardAdapter : BaseRecyclerAdapter<Any, CardAdapter.ViewHolder> {
class
ViewHolder
:
RecyclerView
.
ViewHolder
{
var
id_ll_item
:
LinearLayout
?
var
id_img_cards
:
RecycleImageView
?
var
id_goods_icon
:
RecycleImageView
?
var
id_tv_cards_name
:
TextView
?
var
id_goods_yuan_jia
:
TextView
?
var
id_tv_card_discount
:
TextView
?
var
id_tv_card_price
:
TextView
?
var
id_tv_guanfang_price
:
TextView
?
...
...
@@ -58,7 +66,9 @@ class CardAdapter : BaseRecyclerAdapter<Any, CardAdapter.ViewHolder> {
id_ll_item
=
itemView
.
findViewById
<
LinearLayout
>(
R
.
id
.
id_ll_item
)
id_img_cards
=
itemView
.
findViewById
<
RecycleImageView
>(
R
.
id
.
id_img_cards
)
id_goods_icon
=
itemView
.
findViewById
<
RecycleImageView
>(
R
.
id
.
id_goods_icon
)
id_tv_cards_name
=
itemView
.
findViewById
<
TextView
>(
R
.
id
.
id_tv_cards_name
)
id_goods_yuan_jia
=
itemView
.
findViewById
<
TextView
>(
R
.
id
.
id_goods_yuan_jia
)
id_tv_card_discount
=
itemView
.
findViewById
<
TextView
>(
R
.
id
.
id_tv_card_discount
)
id_tv_card_price
=
itemView
.
findViewById
<
TextView
>(
R
.
id
.
id_tv_card_price
)
id_tv_guanfang_price
=
itemView
.
findViewById
<
TextView
>(
R
.
id
.
id_tv_guanfang_price
)
...
...
moduleMain/src/main/java/com/zxbw/modulemain/contract/CardVoucherContract.kt
View file @
93821478
package
com.zxbw.modulemain.contract
import
com.zxhl.cms.net.model.qy.JgqQyEntity
class
CardVoucherContract
{
interface
View
{
fun
setData
()
fun
setData
(
result
:
List
<
JgqQyEntity
>?
)
}
interface
Presenter
{
...
...
moduleMain/src/main/java/com/zxbw/modulemain/presenter/CardVoucherPresenter.kt
View file @
93821478
package
com.zxbw.modulemain.presenter
import
com.zxbw.modulemain.contract.CardVoucherContract
import
com.zxhl.cms.net.ApiClient
import
com.zxhl.cms.net.RxSchedulers
import
com.zxhl.cms.net.callback.BaseObserver
import
com.zxhl.cms.net.model.qy.JgqQyEntity
class
CardVoucherPresenter
:
CardVoucherContract
.
Presenter
{
private
val
mView
:
CardVoucherContract
.
View
...
...
@@ -10,6 +14,17 @@ class CardVoucherPresenter : CardVoucherContract.Presenter {
}
override
fun
getCardList
()
{
ApiClient
.
homeApi
.
getQyJgqCardList
().
compose
(
RxSchedulers
.
observableIO2Main
())
.
subscribe
(
object
:
BaseObserver
<
List
<
JgqQyEntity
>>()
{
override
fun
onSuccess
(
result
:
List
<
JgqQyEntity
>?)
{
if
(!
result
.
isNullOrEmpty
()){
mView
.
setData
(
result
)
}
}
override
fun
onFailure
(
e
:
Throwable
?,
code
:
String
?,
errorMsg
:
String
?)
{
}
})
}
}
\ No newline at end of file
moduleMain/src/main/res/layout/item_layout_card.xml
View file @
93821478
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:id=
"@+id/id_ll_item"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"16dp"
android:layout_marginTop=
"10dp"
android:layout_marginRight=
"16dp"
android:background=
"@drawable/shape_ffffff_r10"
android:id=
"@+id/id_ll_item"
android:orientation=
"horizontal"
>
<
com.zxhl.cms.widget.RecycleImageView
android:id=
"@+id/id_
img_cards
"
<
RelativeLayout
android:id=
"@+id/id_
rl_bg
"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_margin=
"10dp"
android:background=
"@drawable/img_daijinquan"
/>
android:padding=
"10dp"
>
<com.zxhl.cms.widget.RecycleImageView
android:id=
"@+id/id_img_cards"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:background=
"@drawable/img_daijinquan"
/>
<com.zxhl.cms.widget.RecycleImageView
android:id=
"@+id/id_goods_icon"
android:layout_width=
"12dp"
android:layout_height=
"12dp"
android:layout_margin=
"8dp"
android:src=
"@drawable/icon_huangse"
/>
<LinearLayout
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignBottom=
"@+id/id_img_cards"
android:layout_marginLeft=
"50dp"
android:layout_marginBottom=
"8dp"
android:orientation=
"horizontal"
>
<TextView
android:id=
"@+id/id_goods_yuan_jia"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"0"
android:textColor=
"@color/white"
android:textSize=
"16sp"
android:textStyle=
"bold"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"元"
android:textColor=
"@color/white"
android:textSize=
"10sp"
android:textStyle=
"bold"
/>
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:layout_width=
"match_parent"
...
...
@@ -26,8 +64,8 @@
android:id=
"@+id/id_tv_cards_name"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"猫眼电影5元代金券"
android:layout_marginTop=
"9dp"
android:text=
"猫眼电影5元代金券"
android:textColor=
"@color/color_333333"
android:textSize=
"14sp"
/>
...
...
@@ -35,9 +73,9 @@
android:id=
"@+id/id_tv_card_discount"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:background=
"@drawable/shape_edd49d_r4"
android:layout_marginBottom=
"8dp"
android:layout_marginTop=
"4dp"
android:layout_marginBottom=
"8dp"
android:background=
"@drawable/shape_edd49d_r4"
android:paddingLeft=
"6dp"
android:paddingTop=
"2dp"
android:paddingRight=
"6dp"
...
...
@@ -73,8 +111,8 @@
android:id=
"@+id/id_tv_guanfang_price"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"官方价 ¥5元"
android:layout_marginLeft=
"10dp"
android:text=
"官方价 ¥5元"
android:textColor=
"@color/color_999999"
android:textSize=
"10sp"
/>
</LinearLayout>
...
...
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