Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_goodmoney
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_goodmoney
Commits
14bb5679
Commit
14bb5679
authored
Nov 24, 2020
by
mengcuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
需求优化
parent
a0de7dff
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
172 additions
and
133 deletions
+172
-133
DrawcashBean.java
...main/java/com/mints/goodmoney/mvp/model/DrawcashBean.java
+10
-1
DrawcashAdapter.kt
...in/java/com/mints/goodmoney/ui/adapter/DrawcashAdapter.kt
+10
-0
HorizChannelFragment.kt
...a/com/mints/goodmoney/ui/fragment/HorizChannelFragment.kt
+114
-115
MainFragment.kt
...main/java/com/mints/goodmoney/ui/fragment/MainFragment.kt
+2
-2
CountDownVedioView.java
...va/com/mints/goodmoney/ui/widgets/CountDownVedioView.java
+16
-5
CountDownView.java
...in/java/com/mints/goodmoney/ui/widgets/CountDownView.java
+1
-1
ForegroundOrBackground.java
...ava/com/mints/goodmoney/utils/ForegroundOrBackground.java
+2
-2
fragment_horiz_channel.xml
GoodMoney/app/src/main/res/layout/fragment_horiz_channel.xml
+1
-1
fragment_main_first.xml
GoodMoney/app/src/main/res/layout/fragment_main_first.xml
+1
-1
item_rv_drawcash.xml
GoodMoney/app/src/main/res/layout/item_rv_drawcash.xml
+10
-1
view_countdown_vedio.xml
GoodMoney/app/src/main/res/layout/view_countdown_vedio.xml
+5
-4
No files found.
GoodMoney/app/src/main/java/com/mints/goodmoney/mvp/model/DrawcashBean.java
View file @
14bb5679
...
...
@@ -60,9 +60,10 @@ public class DrawcashBean implements Serializable {
this
.
cashOutMoneyArr
=
cashOutMoneyArr
;
}
public
class
CashOutMoneyArrBean
implements
Serializable
{
public
class
CashOutMoneyArrBean
implements
Serializable
{
private
double
money
;
private
boolean
canCashOut
;
private
String
remark
;
public
double
getMoney
()
{
return
money
;
...
...
@@ -79,5 +80,13 @@ public class DrawcashBean implements Serializable {
public
void
setCanCashOut
(
boolean
canCashOut
)
{
this
.
canCashOut
=
canCashOut
;
}
public
String
getRemark
()
{
return
remark
;
}
public
void
setRemark
(
String
remark
)
{
this
.
remark
=
remark
;
}
}
}
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/adapter/DrawcashAdapter.kt
View file @
14bb5679
package
com.mints.goodmoney.ui.adapter
import
android.content.Context
import
android.text.TextUtils
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
...
...
@@ -34,6 +35,7 @@ class DrawcashAdapter(val priceList: MutableList<DrawcashBean.CashOutMoneyArrBea
inner
class
ViewHolder
(
view
:
View
)
:
RecyclerView
.
ViewHolder
(
view
)
{
val
llDrawItem
:
LinearLayout
=
view
.
findViewById
(
R
.
id
.
llDrawItem
)
val
tvDrawItemHint
:
TextView
=
view
.
findViewById
(
R
.
id
.
tvDrawItemHint
)
val
tvDrawItemCash
:
TextView
=
view
.
findViewById
(
R
.
id
.
tvDrawItemCash
)
val
tvDrawItemGold
:
TextView
=
view
.
findViewById
(
R
.
id
.
tvDrawItemGold
)
}
...
...
@@ -52,6 +54,12 @@ class DrawcashAdapter(val priceList: MutableList<DrawcashBean.CashOutMoneyArrBea
}
else
{
holder
.
tvDrawItemCash
.
text
=
"${priceBean.money}元"
}
if
(
TextUtils
.
isEmpty
(
priceBean
.
remark
))
{
holder
.
tvDrawItemHint
.
visibility
=
View
.
GONE
}
else
{
holder
.
tvDrawItemHint
.
visibility
=
View
.
VISIBLE
holder
.
tvDrawItemHint
.
text
=
priceBean
.
remark
}
holder
.
tvDrawItemGold
.
text
=
"约${String.format("
%.
0f
", priceBean.money * 10000)}金币"
holder
.
llDrawItem
.
setOnClickListener
{
...
...
@@ -72,10 +80,12 @@ class DrawcashAdapter(val priceList: MutableList<DrawcashBean.CashOutMoneyArrBea
//当前选中
if
(
getPosition
()
==
position
)
{
holder
.
tvDrawItemCash
.
setTextColor
(
ContextCompat
.
getColor
(
context
,
R
.
color
.
white
))
holder
.
tvDrawItemHint
.
setTextColor
(
ContextCompat
.
getColor
(
context
,
R
.
color
.
white
))
holder
.
tvDrawItemGold
.
setTextColor
(
ContextCompat
.
getColor
(
context
,
R
.
color
.
white
))
holder
.
llDrawItem
.
setBackgroundResource
(
R
.
drawable
.
shape_vip_adapter_none
)
}
else
{
holder
.
tvDrawItemCash
.
setTextColor
(
ContextCompat
.
getColor
(
context
,
R
.
color
.
black
))
holder
.
tvDrawItemHint
.
setTextColor
(
ContextCompat
.
getColor
(
context
,
R
.
color
.
gray
))
holder
.
tvDrawItemGold
.
setTextColor
(
ContextCompat
.
getColor
(
context
,
R
.
color
.
gray
))
holder
.
llDrawItem
.
setBackgroundResource
(
R
.
drawable
.
shape_vip_adapter
)
}
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/fragment/HorizChannelFragment.kt
View file @
14bb5679
...
...
@@ -48,8 +48,66 @@ class HorizChannelFragment : BaseFragment(), HorizChannelView, View.OnClickListe
initListener
()
}
private
fun
initListener
()
{
cdvvYilanTime
.
setOnClickListener
(
this
)
override
fun
getContentViewLayoutID
()
=
R
.
layout
.
fragment_horiz_channel
override
fun
setUserVisibleHint
(
isVisibleToUser
:
Boolean
)
{
super
.
setUserVisibleHint
(
isVisibleToUser
)
channelFragment
?.
userVisibleHint
=
isVisibleToUser
}
override
fun
onHiddenChanged
(
hidden
:
Boolean
)
{
if
(
hidden
)
{
onPause
()
}
else
{
onResume
()
}
super
.
onHiddenChanged
(
hidden
)
channelFragment
?.
onHiddenChanged
(
hidden
)
}
override
fun
onResume
()
{
super
.
onResume
()
if
(
AppConfig
.
fragmentClickFlag
==
Constant
.
FRAGMENT_CLICK_CHANNEL
)
{
// 调用金币视频信息接口
horizChannelPresenter
.
getSmallHomeVedioBaseMsg
()
registerPlayerCallBack
()
channelFragment
?.
onResume
()
}
}
override
fun
onPause
()
{
super
.
onPause
()
if
(
AppConfig
.
fragmentClickFlag
==
Constant
.
FRAGMENT_CLICK_CHANNEL
)
{
YLPlayerConfig
.
config
().
unRegisterPlayerCallback
()
}
pauseDownloadTime
()
channelFragment
?.
onPause
()
}
override
fun
onDestroy
()
{
super
.
onDestroy
()
cdvvYilanTime
?.
onDestory
()
cdvvYilanTime
?.
setCountDownVedioListener
(
null
)
horizChannelPresenter
.
detachView
()
}
override
fun
onClick
(
v
:
View
?)
{
when
(
v
?.
id
)
{
R
.
id
.
cdvvYilanTime
->
{
if
(
isAward
&&
isToCreateReward
)
{
isAward
=
false
val
bundle
=
Bundle
()
bundle
.
putInt
(
Constant
.
MAIN_CUR_COIN
,
rewardCoin
)
bundle
.
putString
(
Constant
.
MAIN_CARRIER_TYPE
,
Constant
.
CARRIER_SMALLHOMEVEDIO
)
bundle
.
putString
(
Constant
.
MAIN_EXTRA_ID
,
rewardDoubleCoin
.
toString
())
readyGo
(
AwardActivity
::
class
.
java
,
bundle
)
}
}
}
}
override
fun
getHomeVedioMsgSuc
(
data
:
MainVedioMsgBean
)
{
...
...
@@ -67,7 +125,7 @@ class HorizChannelFragment : BaseFragment(), HorizChannelView, View.OnClickListe
// 防止界面切换 重置倒计时
// 第一次能过 isFirstLoadVedio 判断好兔先加载视频
if
(!
isFirstLoadVideo
&&
!
cdvvYilanTime
.
isPlaying
&&
!
isAward
)
{
cdvvYilanTime
.
setRedpkgImg
(
R
.
mipmap
.
ic_main_grey
)
cdvvYilanTime
?.
stopRedbox
(
)
cdvvYilanTime
?.
reset
()
cdvvYilanTime
?.
start
()
}
...
...
@@ -76,6 +134,34 @@ class HorizChannelFragment : BaseFragment(), HorizChannelView, View.OnClickListe
}
}
/**
* 红包倒计时初始化
*/
private
fun
initTimeView
()
{
cdvvYilanTime
.
setCountDownVedioListener
{
if
(
isFirstWatchVideo
)
{
// 第一次观看完视频提醒用户
val
vs
=
vs_tips
.
inflate
()
Handler
(
Looper
.
getMainLooper
()).
postDelayed
({
vs
.
visibility
=
View
.
GONE
},
3000
)
isFirstWatchVideo
=
false
}
// 转满一圈,可领金币标记
isAward
=
true
cdvvYilanTime
?.
showRedbox
()
stopDownloadTime
()
}
val
videoTime
=
ps
.
getInt
(
Constant
.
MAIN_VEDIO_TIME
,
30
)
cdvvYilanTime
.
setTime
(
videoTime
)
cdvvYilanTime
.
start
()
}
private
fun
initListener
()
{
cdvvYilanTime
.
setOnClickListener
(
this
)
}
private
fun
initChannelFragment
()
{
val
transaction
:
FragmentTransaction
=
childFragmentManager
.
beginTransaction
()
if
(
channelFragment
==
null
)
{
...
...
@@ -89,6 +175,31 @@ class HorizChannelFragment : BaseFragment(), HorizChannelView, View.OnClickListe
}
/**
* 倒计时红包暂停
*/
private
fun
pauseDownloadTime
()
{
cdvvYilanTime
?.
pause
()
}
/**
*用户主动暂时或网络异常结束后 重新加载倒计时红包
*/
private
fun
resumeDownloadTime
(
id
:
String
)
{
if
(!
TextUtils
.
isEmpty
(
id
))
{
if
(!
isAward
)
{
cdvvYilanTime
?.
resume
()
}
}
}
/**
* 停止转动
*/
private
fun
stopDownloadTime
()
{
cdvvYilanTime
?.
stop
()
}
private
fun
registerPlayerCallBack
()
{
// 设置点击的item播放状态,callback返回true标识用户已经处理了event,返回false,标识使用播放器内部逻辑处理event。
YLPlayerConfig
.
config
().
registerPlayerCallBack
(
object
:
OnPlayerCallBack
{
...
...
@@ -135,116 +246,4 @@ class HorizChannelFragment : BaseFragment(), HorizChannelView, View.OnClickListe
})
}
override
fun
getContentViewLayoutID
()
=
R
.
layout
.
fragment_horiz_channel
override
fun
onClick
(
v
:
View
?)
{
when
(
v
?.
id
)
{
R
.
id
.
cdvvYilanTime
->
{
if
(
isAward
&&
isToCreateReward
)
{
isAward
=
false
val
bundle
=
Bundle
()
bundle
.
putInt
(
Constant
.
MAIN_CUR_COIN
,
rewardCoin
)
bundle
.
putString
(
Constant
.
MAIN_CARRIER_TYPE
,
Constant
.
CARRIER_SMALLHOMEVEDIO
)
bundle
.
putString
(
Constant
.
MAIN_EXTRA_ID
,
rewardDoubleCoin
.
toString
())
readyGo
(
AwardActivity
::
class
.
java
,
bundle
)
}
}
}
}
override
fun
setUserVisibleHint
(
isVisibleToUser
:
Boolean
)
{
super
.
setUserVisibleHint
(
isVisibleToUser
)
channelFragment
?.
userVisibleHint
=
isVisibleToUser
}
override
fun
onHiddenChanged
(
hidden
:
Boolean
)
{
if
(
hidden
)
{
onPause
()
}
else
{
onResume
()
}
super
.
onHiddenChanged
(
hidden
)
channelFragment
?.
onHiddenChanged
(
hidden
)
}
override
fun
onResume
()
{
super
.
onResume
()
if
(
AppConfig
.
fragmentClickFlag
==
Constant
.
FRAGMENT_CLICK_CHANNEL
)
{
// 调用金币视频信息接口
horizChannelPresenter
.
getSmallHomeVedioBaseMsg
()
registerPlayerCallBack
()
channelFragment
?.
onResume
()
}
}
override
fun
onPause
()
{
super
.
onPause
()
if
(
AppConfig
.
fragmentClickFlag
==
Constant
.
FRAGMENT_CLICK_CHANNEL
)
{
YLPlayerConfig
.
config
().
unRegisterPlayerCallback
()
}
pauseDownloadTime
()
channelFragment
?.
onPause
()
}
/**
* 倒计时红包暂停
*/
private
fun
pauseDownloadTime
()
{
cdvvYilanTime
?.
pause
()
}
/**
*用户主动暂时或网络异常结束后 重新加载倒计时红包
*/
private
fun
resumeDownloadTime
(
id
:
String
)
{
if
(!
TextUtils
.
isEmpty
(
id
))
{
if
(!
isAward
)
{
cdvvYilanTime
?.
resume
()
}
}
}
/**
* 停止转动
*/
private
fun
stopDownloadTime
()
{
cdvvYilanTime
?.
stop
()
}
/**
* 红包倒计时初始化
*/
private
fun
initTimeView
()
{
cdvvYilanTime
.
setCountDownVedioListener
{
if
(
isFirstWatchVideo
)
{
// 第一次观看完视频提醒用户
val
vs
=
vs_tips
.
inflate
()
Handler
(
Looper
.
getMainLooper
()).
postDelayed
({
vs
.
visibility
=
View
.
GONE
},
3000
)
isFirstWatchVideo
=
false
}
cdvvYilanTime
.
setRedpkgImg
(
R
.
mipmap
.
ic_main_red
)
// 转满一圈,可领金币标记
isAward
=
true
cdvvYilanTime
?.
showRedbox
()
stopDownloadTime
()
}
val
videoTime
=
ps
.
getInt
(
Constant
.
MAIN_VEDIO_TIME
,
30
)
cdvvYilanTime
.
setTime
(
videoTime
)
cdvvYilanTime
.
start
()
}
override
fun
onDestroy
()
{
super
.
onDestroy
()
cdvvYilanTime
?.
setCountDownVedioListener
(
null
)
horizChannelPresenter
.
detachView
()
}
}
\ No newline at end of file
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/fragment/MainFragment.kt
View file @
14bb5679
...
...
@@ -133,6 +133,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
override
fun
onDestroy
()
{
super
.
onDestroy
()
cdvvYilanTime
?.
onDestory
()
cdvvYilanTime
?.
setCountDownVedioListener
(
null
)
// 广告回调解绑
YLUIConfig
.
getInstance
().
unRegisterAdListener
()
...
...
@@ -195,7 +196,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
// 防止界面切换 重置倒计时
// 好兔视频已加载 且 红包已转满 且 奖励已领过
if
(!
isFirstLoadVedio
&&
!
cdvvYilanTime
.
isPlaying
&&
!
isAward
)
{
cdvvYilanTime
.
setRedpkgImg
(
R
.
mipmap
.
ic_main_grey
)
cdvvYilanTime
?.
stopRedbox
(
)
cdvvYilanTime
?.
reset
()
cdvvYilanTime
?.
start
()
}
...
...
@@ -404,7 +405,6 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
isFirstWatchVideo
=
false
}
cdvvYilanTime
.
setRedpkgImg
(
R
.
mipmap
.
ic_main_red
)
// 转满一圈,可领金币标记
isAward
=
true
cdvvYilanTime
?.
showRedbox
()
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/widgets/CountDownVedioView.java
View file @
14bb5679
...
...
@@ -22,6 +22,7 @@ public class CountDownVedioView extends LinearLayout {
private
ImageView
ivCountVedioRedbox
;
private
boolean
isPlaying
=
false
;
private
YoYo
.
YoYoString
rope
;
public
CountDownVedioView
(
Context
context
)
{
this
(
context
,
null
);
...
...
@@ -92,7 +93,7 @@ public class CountDownVedioView extends LinearLayout {
cdCountVedioView
.
setTime
(
time
);
}
public
void
setRedpkgImg
(
int
img
){
public
void
setRedpkgImg
(
int
img
)
{
ivCountVedioRedbox
.
setImageResource
(
img
);
}
...
...
@@ -109,10 +110,20 @@ public class CountDownVedioView extends LinearLayout {
*/
public
void
showRedbox
()
{
if
(
ivCountVedioRedbox
!=
null
)
{
// ivCountVedioRedbox.setVisibility(VISIBLE);
YoYo
.
with
(
Techniques
.
Tada
).
duration
(
2000
)
.
repeat
(
2
)
.
playOn
(
ivCountVedioRedbox
);
rope
=
YoYo
.
with
(
Techniques
.
Tada
).
duration
(
2000
).
repeat
(-
1
).
playOn
(
ivCountVedioRedbox
);
}
}
public
void
stopRedbox
()
{
if
(
ivCountVedioRedbox
!=
null
&&
rope
!=
null
)
{
rope
.
stop
();
}
}
public
void
onDestory
()
{
if
(
rope
!=
null
)
{
rope
.
stop
();
rope
=
null
;
}
}
}
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/widgets/CountDownView.java
View file @
14bb5679
...
...
@@ -61,7 +61,7 @@ public class CountDownView extends View {
TypedArray
array
=
context
.
obtainStyledAttributes
(
attrs
,
R
.
styleable
.
CountDownView
);
mRetreatType
=
array
.
getInt
(
R
.
styleable
.
CountDownView_cd_retreat_type
,
1
);
location
=
array
.
getInt
(
R
.
styleable
.
CountDownView_cd_location
,
1
);
mCircleRadius
=
(
int
)
array
.
getDimension
(
R
.
styleable
.
CountDownView_cd_circle_radius
,
dip2px
(
context
,
25
));
//默认25dp
mCircleRadius
=
(
int
)
array
.
getDimension
(
R
.
styleable
.
CountDownView_cd_circle_radius
,
dip2px
(
context
,
3
));
//默认25dp
mPaintArcWidth
=
array
.
getDimension
(
R
.
styleable
.
CountDownView_cd_arc_width
,
dip2px
(
context
,
3
));
//默认3dp
mPaintArcColor
=
array
.
getColor
(
R
.
styleable
.
CountDownView_cd_arc_color
,
mPaintArcColor
);
mTextSize
=
(
int
)
array
.
getDimension
(
R
.
styleable
.
CountDownView_cd_text_size
,
dip2px
(
context
,
14
));
//默认14sp
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/utils/ForegroundOrBackground.java
View file @
14bb5679
...
...
@@ -83,8 +83,8 @@ public class ForegroundOrBackground implements Application.ActivityLifecycleCall
if
(
count
==
0
)
{
// LogUtil.d("ForegroundOrBackground", System.currentTimeMillis() - leaveTime + " onActivityStarted");
//
3
0秒后打开应用 显示开屏广告
if
(
System
.
currentTimeMillis
()
-
leaveTime
>=
3
0000
)
{
//
6
0秒后打开应用 显示开屏广告
if
(
System
.
currentTimeMillis
()
-
leaveTime
>=
6
0000
)
{
if
(
intent
==
null
)
{
intent
=
new
Intent
(
activity
,
SplashADActivity
.
class
);
}
...
...
GoodMoney/app/src/main/res/layout/fragment_horiz_channel.xml
View file @
14bb5679
...
...
@@ -41,7 +41,7 @@
android:id=
"@+id/cdvvYilanTime"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"
10
0dp"
/>
android:layout_marginBottom=
"
3
0dp"
/>
</LinearLayout>
</LinearLayout>
...
...
GoodMoney/app/src/main/res/layout/fragment_main_first.xml
View file @
14bb5679
...
...
@@ -12,7 +12,7 @@
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"end|bottom"
android:layout_marginEnd=
"
8
dp"
android:layout_marginEnd=
"
4
dp"
android:orientation=
"horizontal"
>
<ViewStub
...
...
GoodMoney/app/src/main/res/layout/item_rv_drawcash.xml
View file @
14bb5679
...
...
@@ -13,13 +13,22 @@
android:layout_marginTop=
"6dp"
android:layout_marginBottom=
"6dp"
>
<TextView
android:id=
"@+id/tvDrawItemHint"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"8dp"
android:visibility=
"gone"
android:layout_marginBottom=
"-4dp"
android:textSize=
"12sp"
/>
<TextView
android:id=
"@+id/tvDrawItemCash"
android:layout_width=
"wrap_content"
android:layout_marginTop=
"8dp"
android:layout_height=
"wrap_content"
android:text=
"0.3元"
android:textStyle=
"bold"
android:layout_marginTop=
"8dp"
android:textSize=
"22sp"
/>
<TextView
...
...
GoodMoney/app/src/main/res/layout/view_countdown_vedio.xml
View file @
14bb5679
...
...
@@ -4,6 +4,7 @@
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:background=
"@drawable/shape_write"
>
<com.mints.goodmoney.ui.widgets.CountDownView
...
...
@@ -16,7 +17,7 @@
app:cd_arc_color=
"@color/main_mints"
app:cd_arc_width=
"3dp"
app:cd_bg_color=
"#20FF9837"
app:cd_circle_radius=
"2
2
dp"
app:cd_circle_radius=
"2
5
dp"
app:cd_location=
"top"
app:cd_retreat_type=
"forward"
app:cd_text_color=
"#00000000"
...
...
@@ -24,8 +25,8 @@
<ImageView
android:id=
"@+id/iv_count_redbox"
android:layout_width=
"2
4
dp"
android:layout_height=
"
28
dp"
android:layout_width=
"2
6
dp"
android:layout_height=
"
30
dp"
android:layout_gravity=
"center"
android:src=
"@mipmap/ic_main_
grey
"
/>
android:src=
"@mipmap/ic_main_
red
"
/>
</FrameLayout>
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