Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_vedio
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_vedio
Commits
fb02ae21
Commit
fb02ae21
authored
Aug 24, 2023
by
jyx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加取消订阅弹窗
parent
06bbf1b6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
97 additions
and
14 deletions
+97
-14
MainActivity.kt
.../java/com/duben/happyplaylet/ui/activitys/MainActivity.kt
+95
-9
dialog_cancel_order.xml
video/app/src/main/res/layout/dialog_cancel_order.xml
+1
-1
float_app.xml
video/app/src/main/res/layout/float_app.xml
+1
-4
ic_cancel_order.png
video/app/src/main/res/mipmap-xhdpi/ic_cancel_order.png
+0
-0
No files found.
video/app/src/main/java/com/duben/happyplaylet/ui/activitys/MainActivity.kt
View file @
fb02ae21
package
com.duben.happyplaylet.ui.activitys
import
android.app.Dialog
import
android.content.Context
import
android.content.Intent
import
android.media.AudioManager
...
...
@@ -16,13 +17,20 @@ import com.duben.happyplaylet.MintsApplication
import
com.duben.happyplaylet.R
import
com.duben.happyplaylet.common.AppConfig
import
com.duben.happyplaylet.common.Constant
import
com.duben.happyplaylet.manager.AppHttpManager
import
com.duben.happyplaylet.manager.UserManager
import
com.duben.happyplaylet.mvp.model.BaseResponse
import
com.duben.happyplaylet.ui.activitys.base.BaseActivity
import
com.duben.happyplaylet.ui.fragment.MainFragment
import
com.duben.happyplaylet.ui.fragment.MyFragment
import
com.duben.happyplaylet.ui.fragment.RecommendFragment
import
com.duben.happyplaylet.ui.widgets.CancelOrderDialog
import
com.duben.happyplaylet.ui.widgets.DialogListener
import
com.duben.happyplaylet.ui.widgets.PhoneDialog
import
com.duben.happyplaylet.video.csj.DPHolderManager
import
com.duben.library.net.neterror.BaseSubscriber
import
com.duben.library.net.neterror.Throwable
import
com.google.gson.JsonObject
import
com.lzf.easyfloat.EasyFloat
import
com.lzf.easyfloat.anim.AppFloatDefaultAnimator
import
com.lzf.easyfloat.anim.DefaultAnimator
...
...
@@ -56,7 +64,7 @@ class MainActivity : BaseActivity(), View.OnClickListener {
}
override
fun
initViewsAndEvents
()
{
DPHolderManager
.
initDpSdk
(
MintsApplication
.
getContext
())
;
DPHolderManager
.
initDpSdk
(
MintsApplication
.
getContext
())
audioManager
=
getSystemService
(
Context
.
AUDIO_SERVICE
)
as
AudioManager
...
...
@@ -85,12 +93,22 @@ class MainActivity : BaseActivity(), View.OnClickListener {
initEditView
()
initEasyFloat
()
initRefundEasyFloat
()
}
override
fun
isApplyKitKatTranslucency
():
Boolean
{
return
false
}
override
fun
onResume
()
{
super
.
onResume
()
if
(
UserManager
.
getInstance
().
vipFlag
)
{
EasyFloat
.
show
(
this
,
"refund"
)
}
else
{
EasyFloat
.
hide
(
this
,
"refund"
)
}
}
override
fun
onDestroy
()
{
super
.
onDestroy
()
currentFragment
=
null
...
...
@@ -157,7 +175,7 @@ class MainActivity : BaseActivity(), View.OnClickListener {
tabIvRecommend
!!
.
isSelected
=
false
tabIvMy
!!
.
isSelected
=
false
changeBottomTabColor
(
false
)
EasyFloat
.
show
(
this
)
EasyFloat
.
show
(
this
,
"contact"
)
}
/**
...
...
@@ -173,7 +191,7 @@ class MainActivity : BaseActivity(), View.OnClickListener {
tabIvRecommend
!!
.
isSelected
=
true
tabIvMy
!!
.
isSelected
=
false
changeBottomTabColor
(
mShowBlack
)
EasyFloat
.
show
(
this
)
EasyFloat
.
show
(
this
,
"contact"
)
}
/**
...
...
@@ -189,7 +207,7 @@ class MainActivity : BaseActivity(), View.OnClickListener {
tabIvRecommend
!!
.
isSelected
=
false
tabIvMy
!!
.
isSelected
=
true
changeBottomTabColor
(
true
,
isMyPage
=
true
)
EasyFloat
.
hide
(
this
)
EasyFloat
.
hide
(
this
,
"contact"
)
}
...
...
@@ -278,27 +296,68 @@ class MainActivity : BaseActivity(), View.OnClickListener {
private
fun
changeBottomTabColor
(
showBlack
:
Boolean
,
isMyPage
:
Boolean
=
false
)
{
if
(
showBlack
)
{
if
(
isMyPage
)
{
tabIvMy
?.
setTextColor
(
ContextCompat
.
getColorStateList
(
context
,
R
.
color
.
item_text_sel2
))
tabIvMy
?.
setTextColor
(
ContextCompat
.
getColorStateList
(
context
,
R
.
color
.
item_text_sel2
)
)
}
else
{
tabIvRecommend
?.
setTextColor
(
ContextCompat
.
getColorStateList
(
context
,
R
.
color
.
item_text_sel2
))
tabIvRecommend
?.
setTextColor
(
ContextCompat
.
getColorStateList
(
context
,
R
.
color
.
item_text_sel2
)
)
}
ll_bottom_tab
.
background
=
ContextCompat
.
getDrawable
(
context
,
R
.
color
.
black
)
}
else
{
if
(
isMyPage
)
{
tabIvMy
?.
setTextColor
(
ContextCompat
.
getColorStateList
(
context
,
R
.
color
.
item_text_sel
))
tabIvMy
?.
setTextColor
(
ContextCompat
.
getColorStateList
(
context
,
R
.
color
.
item_text_sel
)
)
}
else
{
tabIvRecommend
?.
setTextColor
(
ContextCompat
.
getColorStateList
(
context
,
R
.
color
.
item_text_sel
))
tabIvRecommend
?.
setTextColor
(
ContextCompat
.
getColorStateList
(
context
,
R
.
color
.
item_text_sel
)
)
}
ll_bottom_tab
.
background
=
ContextCompat
.
getDrawable
(
context
,
R
.
color
.
white
)
}
}
private
fun
initRefundEasyFloat
()
{
EasyFloat
.
with
(
this
)
// 设置浮窗xml布局文件,并可设置详细信息
.
setLayout
(
R
.
layout
.
float_app
)
{
val
view
=
it
.
findViewById
<
TextView
>(
R
.
id
.
tv_float
)
view
.
setBackgroundResource
(
R
.
mipmap
.
ic_cancel_order
)
view
.
setOnClickListener
{
showCancelListener
()
}
}
// 设置浮窗的标签,用于区分多个浮窗
.
setTag
(
"refund"
)
// 设置吸附方式,共15种模式,详情参考SidePattern
.
setSidePattern
(
SidePattern
.
RESULT_RIGHT
)
// 设置浮窗的对齐方式和坐标偏移量
.
setGravity
(
Gravity
.
END
or
Gravity
.
CENTER_VERTICAL
,
0
,
500
)
.
show
()
}
private
fun
initEasyFloat
()
{
EasyFloat
.
with
(
this
)
// 设置浮窗xml布局文件,并可设置详细信息
.
setLayout
(
R
.
layout
.
float_app
)
{
it
.
findViewById
<
TextView
>(
R
.
id
.
tv_float
).
setOnClickListener
{
backPhoneDialog
()
}
}
// 设置浮窗的标签,用于区分多个浮窗
.
setTag
(
"contact"
)
// 设置吸附方式,共15种模式,详情参考SidePattern
.
setSidePattern
(
SidePattern
.
RESULT_LEFT
)
// 设置浮窗是否可拖拽,默认可拖拽
...
...
@@ -306,7 +365,7 @@ class MainActivity : BaseActivity(), View.OnClickListener {
// 系统浮窗是否包含EditText,仅针对系统浮窗,默认不包含
.
hasEditText
(
false
)
// 设置浮窗的对齐方式和坐标偏移量
.
setGravity
(
Gravity
.
CENTER_VERTICAL
,
0
,
500
)
.
setGravity
(
Gravity
.
CENTER_VERTICAL
or
Gravity
.
START
,
0
,
500
)
// 设置宽高是否充满父布局,直接在xml设置match_parent属性无效
.
setMatchParent
(
widthMatch
=
false
,
heightMatch
=
false
)
// 设置Activity浮窗的出入动画,可自定义,实现相应接口即可(策略模式),无需动画直接设置为null
...
...
@@ -340,4 +399,31 @@ class MainActivity : BaseActivity(), View.OnClickListener {
}
.
show
()
}
private
fun
showCancelListener
()
{
CancelOrderDialog
(
this
,
object
:
DialogListener
()
{
override
fun
onClick
(
dialog
:
Dialog
?,
v
:
View
?)
{
super
.
onClick
(
dialog
,
v
)
dialog
?.
dismiss
()
unSign
()
}
}).
show
()
}
private
fun
unSign
()
{
AppHttpManager
.
getInstance
(
baseApplication
)
.
call
(
baseApplication
.
loanService
.
unSign
(),
object
:
BaseSubscriber
<
BaseResponse
<
JsonObject
>>()
{
override
fun
onError
(
e
:
Throwable
)
{}
override
fun
onNext
(
t
:
BaseResponse
<
JsonObject
>)
{
if
(
t
.
status
==
200
)
{
showToast
(
"成功取消自动订阅"
)
}
else
{
showToast
(
t
.
message
)
}
}
})
}
}
\ No newline at end of file
video/app/src/main/res/layout/dialog_cancel_order.xml
View file @
fb02ae21
...
...
@@ -13,7 +13,7 @@
android:layout_marginTop=
"40dp"
android:layout_marginBottom=
"20dp"
android:gravity=
"center"
android:text=
"
会员到期
后将无法享受服\n务,是否取消订阅?"
android:text=
"
主动取消
后将无法享受服\n务,是否取消订阅?"
android:textColor=
"@color/black"
android:textSize=
"18sp"
android:textStyle=
"bold"
/>
...
...
video/app/src/main/res/layout/float_app.xml
View file @
fb02ae21
...
...
@@ -4,7 +4,4 @@
android:layout_width=
"30dp"
android:layout_height=
"90dp"
android:background=
"@mipmap/ic_contact_kefu"
android:elevation=
"2dp"
android:gravity=
"center"
>
</TextView>
\ No newline at end of file
android:elevation=
"2dp"
/>
\ No newline at end of file
video/app/src/main/res/mipmap-xhdpi/ic_cancel_order.png
0 → 100644
View file @
fb02ae21
6.78 KB
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