Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_freeworld
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
android
android_freeworld
Commits
1e1014b3
Commit
1e1014b3
authored
Jul 28, 2021
by
张释方
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改新人有礼弹框页面逻辑
parent
3ee9de0e
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
154 additions
and
230 deletions
+154
-230
GridBenfitAdapter.kt
...c/main/java/com/mints/street/adapter/GridBenfitAdapter.kt
+58
-0
GridMapAdapter.kt
app/src/main/java/com/mints/street/adapter/GridMapAdapter.kt
+2
-2
OpenvipActivity.kt
...src/main/java/com/mints/street/main/my/OpenvipActivity.kt
+19
-13
ShowBenfitDialog.kt
...n/java/com/mints/street/widget/dialog/ShowBenfitDialog.kt
+21
-13
dialog_showbenfit.xml
app/src/main/res/layout/dialog_showbenfit.xml
+4
-202
item_grid_benfit_adpater.xml
app/src/main/res/layout/item_grid_benfit_adpater.xml
+50
-0
No files found.
app/src/main/java/com/mints/street/adapter/GridBenfitAdapter.kt
0 → 100644
View file @
1e1014b3
package
com.mints.street.adapter
import
android.content.Context
import
android.graphics.Paint
import
com.alibaba.android.vlayout.LayoutHelper
import
com.alibaba.android.vlayout.layout.GridLayoutHelper
import
com.fry.base.adapter.AbstractVLayoutBaseAdapter
import
com.fry.base.adapter.BindingViewHolder
import
com.fry.base.binding.setMargin
import
com.mints.street.R
import
com.mints.street.databinding.ItemGridBenfitAdpaterBinding
import
com.mints.street.databinding.ItemGridPaymentAdpaterBinding
import
me.goldze.mvvmhabit.utils.AppUtils
class
GridBenfitAdapter
(
val
context
:
Context
,
val
list
:
List
<
String
>)
:
AbstractVLayoutBaseAdapter
<
ItemGridBenfitAdpaterBinding
,
List
<
String
>>(
context
,
list
,
3
)
{
private
var
datalist
:
List
<
String
>?
=
list
private
var
mposition
:
Int
=
0
//设置首次进来默认选中第一个
override
fun
onBindViewHolder
(
holder
:
BindingViewHolder
<
ItemGridBenfitAdpaterBinding
>,
position
:
Int
)
{
//设置 view边距
if
(
position
%
3
==
0
)
{
holder
.
binding
.
bg
.
setMargin
(
AppUtils
.
dp2Px
(
context
,
20F
),
AppUtils
.
dp2Px
(
context
,
10F
),
AppUtils
.
dp2Px
(
context
,
10F
),
0
,
null
,
null
,
null
)
}
else
if
(
position
%
3
==
1
)
{
holder
.
binding
.
bg
.
setMargin
(
AppUtils
.
dp2Px
(
context
,
10F
),
AppUtils
.
dp2Px
(
context
,
10F
),
AppUtils
.
dp2Px
(
context
,
10F
),
0
,
null
,
null
,
null
)
}
else
{
holder
.
binding
.
bg
.
setMargin
(
AppUtils
.
dp2Px
(
context
,
10F
),
AppUtils
.
dp2Px
(
context
,
10F
),
AppUtils
.
dp2Px
(
context
,
20F
),
0
,
null
,
null
,
null
)
}
// holder.binding.bg.setMargin(AppUtils.dp2Px(context, 20F), AppUtils.dp2Px(context, 10F),
// 0, 0, null, null, null)
}
override
fun
getItemCount
():
Int
{
return
if
(
datalist
==
null
)
{
0
}
else
{
datalist
!!
.
size
}
}
override
fun
getLayoutId
(
viewType
:
Int
)
=
R
.
layout
.
item_grid_benfit_adpater
fun
getPosition
()
=
mposition
override
fun
onCreateLayoutHelper
():
LayoutHelper
{
val
hp
:
GridLayoutHelper
=
GridLayoutHelper
(
3
)
hp
.
setAutoExpand
(
false
)
return
hp
}
}
app/src/main/java/com/mints/street/adapter/GridMapAdapter.kt
View file @
1e1014b3
...
@@ -29,8 +29,8 @@ class GridMapAdapter(val context: Context, var list: List<VrmapBean.Internal>?)
...
@@ -29,8 +29,8 @@ class GridMapAdapter(val context: Context, var list: List<VrmapBean.Internal>?)
holder
.
binding
.
bg
.
setMargin
(
AppUtils
.
dp2Px
(
context
,
10F
),
AppUtils
.
dp2Px
(
context
,
10F
),
holder
.
binding
.
bg
.
setMargin
(
AppUtils
.
dp2Px
(
context
,
10F
),
AppUtils
.
dp2Px
(
context
,
10F
),
AppUtils
.
dp2Px
(
context
,
5F
),
0
,
null
,
null
,
null
)
AppUtils
.
dp2Px
(
context
,
5F
),
0
,
null
,
null
,
null
)
}
else
{
}
else
{
holder
.
binding
.
bg
.
setMargin
(
AppUtils
.
dp2Px
(
context
,
5F
),
AppUtils
.
dp2Px
(
context
,
10F
),
AppUtils
.
dp2Px
(
context
,
10F
),
holder
.
binding
.
bg
.
setMargin
(
AppUtils
.
dp2Px
(
context
,
5F
),
AppUtils
.
dp2Px
(
context
,
10F
),
0
,
null
,
null
,
null
)
AppUtils
.
dp2Px
(
context
,
10F
),
0
,
null
,
null
,
null
)
}
}
datalist
?.
let
{
datalist
?.
let
{
...
...
app/src/main/java/com/mints/street/main/my/OpenvipActivity.kt
View file @
1e1014b3
...
@@ -40,7 +40,7 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
...
@@ -40,7 +40,7 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
private
var
mAdapter
:
DelegateAdapter
?
=
null
private
var
mAdapter
:
DelegateAdapter
?
=
null
private
var
gridPaymentAdapter
:
GridPaymentAdapter
?
=
null
private
var
gridPaymentAdapter
:
GridPaymentAdapter
?
=
null
private
var
vipList
:
MutableList
<
VipBean
.
ListBean
>?
=
null
private
var
vipList
:
MutableList
<
VipBean
.
ListBean
>?
=
null
private
var
currentPayType
=
""
private
var
currentPayType
=
""
override
fun
initVariableId
()
=
BR
.
viewModel
override
fun
initVariableId
()
=
BR
.
viewModel
override
fun
initContentView
(
savedInstanceState
:
Bundle
?)
=
R
.
layout
.
activity_openvip
override
fun
initContentView
(
savedInstanceState
:
Bundle
?)
=
R
.
layout
.
activity_openvip
...
@@ -51,7 +51,7 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
...
@@ -51,7 +51,7 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
override
fun
initData
()
{
override
fun
initData
()
{
super
.
initData
()
super
.
initData
()
if
(!
TextUtils
.
isEmpty
(
UserManager
.
INSTANCE
.
getUserID
()))
{
if
(!
TextUtils
.
isEmpty
(
UserManager
.
INSTANCE
.
getUserID
()))
{
//获取vip福利信息
//获取vip福利信息
viewModel
.
getVipProductsByType
()
viewModel
.
getVipProductsByType
()
//获取支付方式
//获取支付方式
...
@@ -153,7 +153,7 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
...
@@ -153,7 +153,7 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
viewModel
.
Vipdata
.
observe
(
this
,
Observer
<
VipBean
>
{
viewModel
.
Vipdata
.
observe
(
this
,
Observer
<
VipBean
>
{
vipList
=
it
.
list
as
MutableList
<
VipBean
.
ListBean
>?
vipList
=
it
.
list
as
MutableList
<
VipBean
.
ListBean
>?
//展示 推荐套餐内容
//展示 推荐套餐内容
gridPaymentAdapter
=
GridPaymentAdapter
(
this
,
it
.
list
!!
)
gridPaymentAdapter
=
GridPaymentAdapter
(
this
,
it
.
list
!!
)
mAdapter
?.
addAdapter
(
gridPaymentAdapter
)
mAdapter
?.
addAdapter
(
gridPaymentAdapter
)
})
})
viewModel
.
vippayParams
.
observe
(
this
,
Observer
<
WxPayParamBean
>
{
viewModel
.
vippayParams
.
observe
(
this
,
Observer
<
WxPayParamBean
>
{
...
@@ -172,7 +172,7 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
...
@@ -172,7 +172,7 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
}
}
})
})
viewModel
.
isPaySuc
.
observe
(
this
,
Observer
<
Boolean
>
{
viewModel
.
isPaySuc
.
observe
(
this
,
Observer
<
Boolean
>
{
if
(
it
)
{
if
(
it
)
{
ToastUtils
.
showShort
(
"支付成功"
)
ToastUtils
.
showShort
(
"支付成功"
)
finish
()
finish
()
}
}
...
@@ -187,12 +187,12 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
...
@@ -187,12 +187,12 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
for
(
str
in
it
.
list
!!
)
{
for
(
str
in
it
.
list
!!
)
{
if
(
str
.
equals
(
"WEIXIN"
))
{
if
(
str
.
equals
(
"WEIXIN"
))
{
ly_weixin
.
visibility
=
View
.
VISIBLE
ly_weixin
.
visibility
=
View
.
VISIBLE
currentPayType
=
"WEIXIN"
currentPayType
=
"WEIXIN"
}
}
if
(
str
.
equals
(
"ALIPAY"
))
{
if
(
str
.
equals
(
"ALIPAY"
))
{
ly_alipay
.
visibility
=
View
.
VISIBLE
ly_alipay
.
visibility
=
View
.
VISIBLE
if
(
TextUtils
.
isEmpty
(
currentPayType
))
{
if
(
TextUtils
.
isEmpty
(
currentPayType
))
{
currentPayType
=
"ALIPAY"
currentPayType
=
"ALIPAY"
}
}
}
}
}
}
...
@@ -227,12 +227,12 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
...
@@ -227,12 +227,12 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
R
.
id
.
ly_weixin
->
{
//微信支付
R
.
id
.
ly_weixin
->
{
//微信支付
//设置选中样式
//设置选中样式
setOnChecked
(
1
)
setOnChecked
(
1
)
currentPayType
=
"WEIXIN"
currentPayType
=
"WEIXIN"
}
}
R
.
id
.
ly_alipay
->
{
//支付宝支付
R
.
id
.
ly_alipay
->
{
//支付宝支付
//设置选中样式
//设置选中样式
setOnChecked
(
2
)
setOnChecked
(
2
)
currentPayType
=
"ALIPAY"
currentPayType
=
"ALIPAY"
}
}
R
.
id
.
bt_try
->
{
//点击开通全球会员按钮
R
.
id
.
bt_try
->
{
//点击开通全球会员按钮
payVip
()
payVip
()
...
@@ -240,9 +240,9 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
...
@@ -240,9 +240,9 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
}
}
}
}
private
fun
payVip
(){
private
fun
payVip
()
{
if
(
vipList
!=
null
&&
vipList
!!
.
size
>
0
&&
gridPaymentAdapter
!=
null
)
{
if
(
vipList
!=
null
&&
vipList
!!
.
size
>
0
&&
gridPaymentAdapter
!=
null
)
{
if
(
TextUtils
.
equals
(
"WEIXIN"
,
currentPayType
))
{
if
(
TextUtils
.
equals
(
"WEIXIN"
,
currentPayType
))
{
viewModel
.
getVipPayParams
(
"WEIXIN"
,
vipList
!!
[
gridPaymentAdapter
!!
.
getPosition
()].
pid
)
viewModel
.
getVipPayParams
(
"WEIXIN"
,
vipList
!!
[
gridPaymentAdapter
!!
.
getPosition
()].
pid
)
}
else
{
}
else
{
viewModel
.
getVipPayParams
(
"ALIPAY"
,
vipList
!!
[
gridPaymentAdapter
!!
.
getPosition
()].
pid
)
viewModel
.
getVipPayParams
(
"ALIPAY"
,
vipList
!!
[
gridPaymentAdapter
!!
.
getPosition
()].
pid
)
...
@@ -251,7 +251,13 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
...
@@ -251,7 +251,13 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
}
}
private
fun
backvipDialog
()
{
private
fun
backvipDialog
()
{
/*DialogUtils.showbennfitsDialog(this, object : DialogListener() {
override fun onClick(dialog: Dialog?, v: View?) {
if (dialog != null && dialog.isShowing) {
dialog.dismiss()
}
}
})*/
DialogUtils
.
showbackvipDialog
(
this
,
object
:
DialogListener
()
{
DialogUtils
.
showbackvipDialog
(
this
,
object
:
DialogListener
()
{
override
fun
onClick
(
dialog
:
Dialog
?,
v
:
View
?)
{
override
fun
onClick
(
dialog
:
Dialog
?,
v
:
View
?)
{
if
(
dialog
!=
null
&&
dialog
.
isShowing
)
{
if
(
dialog
!=
null
&&
dialog
.
isShowing
)
{
...
...
app/src/main/java/com/mints/street/widget/dialog/ShowBenfitDialog.kt
View file @
1e1014b3
...
@@ -5,15 +5,20 @@ import android.content.Context
...
@@ -5,15 +5,20 @@ import android.content.Context
import
android.view.Gravity
import
android.view.Gravity
import
android.view.KeyEvent
import
android.view.KeyEvent
import
android.view.WindowManager
import
android.view.WindowManager
import
android.widget.TextView
import
androidx.recyclerview.widget.RecyclerView
import
com.alibaba.android.vlayout.DelegateAdapter
import
com.alibaba.android.vlayout.VirtualLayoutManager
import
com.mints.street.R
import
com.mints.street.R
import
com.mints.street.adapter.GridBenfitAdapter
as
GridBenfitAdapter
class
ShowBenfitDialog
(
context
:
Context
,
private
val
listener
:
DialogListener
)
:
class
ShowBenfitDialog
(
context
:
Context
,
private
val
listener
:
DialogListener
)
:
Dialog
(
context
,
R
.
style
.
dialog
)
{
Dialog
(
context
,
R
.
style
.
dialog
)
{
private
val
lp
:
WindowManager
.
LayoutParams
private
val
lp
:
WindowManager
.
LayoutParams
// private val tv_payment: TextView
private
var
recycleView
:
RecyclerView
?
=
null
// private val tv_close: TextView
private
var
vLayout
:
VirtualLayoutManager
?
=
null
private
var
mAdapter
:
DelegateAdapter
?
=
null
private
var
gridbenfitAdapter
:
GridBenfitAdapter
?
=
null
init
{
init
{
setContentView
(
R
.
layout
.
dialog_showbenfit
)
setContentView
(
R
.
layout
.
dialog_showbenfit
)
...
@@ -30,16 +35,19 @@ class ShowBenfitDialog (context: Context, private val listener: DialogListener)
...
@@ -30,16 +35,19 @@ class ShowBenfitDialog (context: Context, private val listener: DialogListener)
setOnKeyListener
{
_
,
i
,
_
->
setOnKeyListener
{
_
,
i
,
_
->
i
==
KeyEvent
.
KEYCODE_BACK
i
==
KeyEvent
.
KEYCODE_BACK
}
}
/*// 查找View
initView
();
tv_payment = findViewById(R.id.tv_payment)
}
tv_close = findViewById(R.id.tv_close)
private
fun
initView
()
{
recycleView
=
findViewById
(
R
.
id
.
recyclerview
)
//recycleView管理(展示套餐推荐)
vLayout
=
VirtualLayoutManager
(
context
)
mAdapter
=
DelegateAdapter
(
vLayout
,
false
)
recycleView
?.
adapter
=
mAdapter
recycleView
?.
layoutManager
=
vLayout
tv_payment.setOnClickListener {
//展示 推荐套餐内容
listener.onClick(it)
gridbenfitAdapter
=
GridBenfitAdapter
(
context
,
listOf
(
"1"
,
"2"
,
"3"
,
"1"
,
"2"
,
"3"
))
}
mAdapter
?.
addAdapter
(
gridbenfitAdapter
)
tv_close.setOnClickListener {
listener.onClick(it)
}*/
}
}
}
}
\ No newline at end of file
app/src/main/res/layout/dialog_showbenfit.xml
View file @
1e1014b3
This diff is collapsed.
Click to expand it.
app/src/main/res/layout/item_grid_benfit_adpater.xml
0 → 100644
View file @
1e1014b3
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<data>
<variable
name=
"viewModel"
type=
"com.mints.street.adapter.GridBenfitAdapter"
/>
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/bg"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
>
<ImageView
android:id=
"@+id/imageView3"
android:layout_width=
"66dp"
android:layout_height=
"66dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:srcCompat=
"@mipmap/ic_launcher_main"
/>
<ImageView
android:id=
"@+id/imageView4"
android:layout_width=
"16dp"
android:layout_height=
"16dp"
app:layout_constraintBottom_toBottomOf=
"@+id/imageView3"
app:layout_constraintEnd_toEndOf=
"@+id/imageView3"
app:layout_constraintStart_toStartOf=
"@+id/imageView3"
app:layout_constraintTop_toTopOf=
"@+id/imageView3"
app:srcCompat=
"@mipmap/dialog_location_benfit"
/>
<TextView
android:id=
"@+id/textView"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"北京故宫"
android:textColor=
"@color/black"
android:textSize=
"14sp"
app:layout_constraintEnd_toEndOf=
"@+id/imageView3"
app:layout_constraintStart_toStartOf=
"@+id/imageView3"
app:layout_constraintTop_toBottomOf=
"@+id/imageView3"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
\ 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