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
75faabca
Commit
75faabca
authored
Sep 18, 2023
by
mengcuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
首页开发
parent
41edb128
Changes
19
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
534 additions
and
520 deletions
+534
-520
AppConfig.java
.../src/main/java/com/duben/dayplaylet/common/AppConfig.java
+5
-0
Constant.kt
...app/src/main/java/com/duben/dayplaylet/common/Constant.kt
+3
-10
CheckVersion.java
...ain/java/com/duben/dayplaylet/mvp/model/CheckVersion.java
+0
-107
SignInfoBean.java
...ain/java/com/duben/dayplaylet/mvp/model/SignInfoBean.java
+75
-0
HomePresenter.kt
...java/com/duben/dayplaylet/mvp/presenters/HomePresenter.kt
+17
-4
HomeView.kt
.../src/main/java/com/duben/dayplaylet/mvp/views/HomeView.kt
+1
-0
LoanService.java
...p/src/main/java/com/duben/dayplaylet/net/LoanService.java
+9
-0
FollowVideoFragment.kt
...a/com/duben/dayplaylet/ui/fragment/FollowVideoFragment.kt
+0
-134
MainFragment.kt
...ain/java/com/duben/dayplaylet/ui/fragment/MainFragment.kt
+242
-180
DialogUtils.kt
.../main/java/com/duben/dayplaylet/ui/widgets/DialogUtils.kt
+2
-1
SignDialog.kt
...c/main/java/com/duben/dayplaylet/ui/widgets/SignDialog.kt
+99
-27
SignDrawDialog.kt
...in/java/com/duben/dayplaylet/ui/widgets/SignDrawDialog.kt
+18
-10
FormatUtil.kt
...pp/src/main/java/com/duben/dayplaylet/utils/FormatUtil.kt
+25
-0
StringUtil.kt
...pp/src/main/java/com/duben/dayplaylet/utils/StringUtil.kt
+0
-44
dialog_sign.xml
video/app/src/main/res/layout/dialog_sign.xml
+15
-0
fragment_main.xml
video/app/src/main/res/layout/fragment_main.xml
+23
-3
bg_no_sign.png
video/app/src/main/res/mipmap-xhdpi/bg_no_sign.png
+0
-0
bg_sign.png
video/app/src/main/res/mipmap-xhdpi/bg_sign.png
+0
-0
bg_sign_green.png
video/app/src/main/res/mipmap-xhdpi/bg_sign_green.png
+0
-0
No files found.
video/app/src/main/java/com/duben/dayplaylet/common/AppConfig.java
View file @
75faabca
...
...
@@ -13,4 +13,9 @@ public class AppConfig {
public
static
int
awardRedpkg
=
0
;
public
static
int
awardYuanbao
=
0
;
public
static
int
csjAdRate
=
100
;
public
static
double
signCash1
=
0.0
;
public
static
double
signCash2
=
0.0
;
}
video/app/src/main/java/com/duben/dayplaylet/common/Constant.kt
View file @
75faabca
...
...
@@ -5,7 +5,6 @@ object Constant {
const
val
PAGE_SIZE
=
12
const
val
LOCAL_VEDIO
=
"LOCAL_VEDIO"
const
val
VEDIO_BEAN
=
"VEDIO_BEAN"
const
val
RECOMMEND_BEAN
=
"RECOMMEND_BEAN"
const
val
VEDIO_NEXT
=
"VEDIO_NEXT"
const
val
VEDIO_THIRD
=
"VEDIO_THIRD"
...
...
@@ -15,25 +14,19 @@ object Constant {
const
val
LOAN_PERMISSION_FLAG
=
"loan_permission_flag"
const
val
FIRST_SPLASH
=
"first_splash"
const
val
IS_FIRST_AGREE_BTN
=
"is_first_agree_btn"
const
val
IS_FIRST_VIP_BTN
=
"is_first_agree_btn"
const
val
IS_FIRST_VEDIO
=
"is_first_vedio"
const
val
TAG_NAME
=
"SUN"
const
val
MINTS_APP_NAME
=
"每日小短剧"
const
val
MINTS_PKG_NAME
=
"com.duben.dayplaylet"
const
val
ACTION_EXIT_APP
=
"package.exit"
const
val
LUCKY_FLAG
=
"LUCKY_FLAG"
const
val
LUCKY_COMPLETE
=
"LUCKY_COMPLETE"
const
val
LUCKY_NEED
=
"LUCKY_NEED"
const
val
LUCKY_MY_FIRST
=
"LUCKY_MY_FIRST"
const
val
MAIN_FIRST_RECOMMEND
=
"MAIN_FIRST_RECOMMEND"
const
val
MAIN_TWO_RECOMMEND
=
"MAIN_TWO_RECOMMEND"
const
val
VEDIO_AD_COUNT
=
"VEDIO_AD_COUNT"
const
val
CARRIERTYPE_CSJ_VEDIO
=
"VEDIO_UNLOCK"
const
val
CARRIERTYPE_TX_VEDIO
=
"VEDIO_UNLOCK"
const
val
CARRIERTYPE_REWARD_FIRST
=
"REWARD_FIRST"
//新人红包视频
const
val
CARRIERTYPE_SIGN
=
"REWARD_FIRST"
//签到
const
val
CARRIERTYPE_SIGN
=
"FORCASH_SIGN"
//签到
const
val
CARRIERTYPE_SIGN_DRAW
=
"FORCASH_SIGN_MORE"
//签到第二次提现
const
val
CARRIERTYPE_SIGN_7
=
"FORCASH_SIGN_AFTER7"
//签到7天后的视频
const
val
FRAGMENT_CLICK_ONE
=
0
...
...
video/app/src/main/java/com/duben/dayplaylet/mvp/model/CheckVersion.java
deleted
100644 → 0
View file @
41edb128
package
com
.
duben
.
dayplaylet
.
mvp
.
model
;
import
java.io.Serializable
;
import
java.util.LinkedList
;
/**
* 描述:版本信息
* 作者:孟崔广
* 时间:2019/10/29 18:42
* 邮箱:mengcga@163.com
*/
public
class
CheckVersion
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
7241422035310338721L
;
/**
* upgrades : [{"updateid":"583ab0df6b4744ae986afcff0d1e45a4","version":"1.0.1","updatemsg":"cj","script":null,"forceflag":1,"updatenum":1,"createtime":1483169915000,"updatetime":1483169918000}]
* forceUpgrade : true
*/
private
boolean
upgrade
;
private
LinkedList
<
UpgradesBean
>
upgradeMsg
;
public
boolean
isForceUpgrade
()
{
return
upgrade
;
}
public
void
setForceUpgrade
(
boolean
forceUpgrade
)
{
this
.
upgrade
=
forceUpgrade
;
}
public
LinkedList
<
UpgradesBean
>
getUpgrades
()
{
return
upgradeMsg
;
}
public
void
setUpgrades
(
LinkedList
<
UpgradesBean
>
upgrades
)
{
this
.
upgradeMsg
=
upgrades
;
}
public
class
UpgradesBean
implements
Serializable
{
/**
* updateid : 583ab0df6b4744ae986afcff0d1e45a4
* version : 1.0.1
* updatemsg : cj
* script : null
* forceflag : 1
* updatenum : 1
* createtime : 1483169915000
* updatetime : 1483169918000
*/
private
String
updateid
;
private
String
version
;
private
String
updatemsg
;
private
String
url
;
private
int
forceflag
;
private
int
updatenum
;
public
String
getUpdateid
()
{
return
updateid
;
}
public
void
setUpdateid
(
String
updateid
)
{
this
.
updateid
=
updateid
;
}
public
String
getVersion
()
{
return
version
;
}
public
void
setVersion
(
String
version
)
{
this
.
version
=
version
;
}
public
String
getUpdatemsg
()
{
return
updatemsg
;
}
public
void
setUpdatemsg
(
String
updatemsg
)
{
this
.
updatemsg
=
updatemsg
;
}
public
String
getUrl
()
{
return
url
;
}
public
void
setUrl
(
String
url
)
{
this
.
url
=
url
;
}
public
int
getForceflag
()
{
return
forceflag
;
}
public
void
setForceflag
(
int
forceflag
)
{
this
.
forceflag
=
forceflag
;
}
public
int
getUpdatenum
()
{
return
updatenum
;
}
public
void
setUpdatenum
(
int
updatenum
)
{
this
.
updatenum
=
updatenum
;
}
}
}
video/app/src/main/java/com/duben/dayplaylet/mvp/model/SignInfoBean.java
0 → 100644
View file @
75faabca
package
com
.
duben
.
dayplaylet
.
mvp
.
model
;
import
java.io.Serializable
;
import
java.util.ArrayList
;
public
class
SignInfoBean
implements
Serializable
{
private
SignMsgBean
signMsg
;
public
SignMsgBean
getSignMsg
()
{
return
signMsg
;
}
public
void
setSignMsg
(
SignMsgBean
signMsg
)
{
this
.
signMsg
=
signMsg
;
}
public
class
SignMsgBean
implements
Serializable
{
private
double
surCash
;
//余额
private
double
cashCashFirst
;
//第一次奖励0.01元
private
double
cashCashSecond
;
//第二次奖励0.01元
private
int
sumCash
;
//标题余额
private
int
signDay
;
private
ArrayList
<
Integer
>
signWeekCashArr
;
//前7天展示
public
double
getSurCash
()
{
return
surCash
;
}
public
void
setSurCash
(
double
surCash
)
{
this
.
surCash
=
surCash
;
}
public
double
getCashCashFirst
()
{
return
cashCashFirst
;
}
public
void
setCashCashFirst
(
double
cashCashFirst
)
{
this
.
cashCashFirst
=
cashCashFirst
;
}
public
double
getCashCashSecond
()
{
return
cashCashSecond
;
}
public
void
setCashCashSecond
(
double
cashCashSecond
)
{
this
.
cashCashSecond
=
cashCashSecond
;
}
public
int
getSumCash
()
{
return
sumCash
;
}
public
void
setSumCash
(
int
sumCash
)
{
this
.
sumCash
=
sumCash
;
}
public
int
getSignDay
()
{
return
signDay
;
}
public
void
setSignDay
(
int
signDay
)
{
this
.
signDay
=
signDay
;
}
public
ArrayList
<
Integer
>
getSignWeekCashArr
()
{
return
signWeekCashArr
;
}
public
void
setSignWeekCashArr
(
ArrayList
<
Integer
>
signWeekCashArr
)
{
this
.
signWeekCashArr
=
signWeekCashArr
;
}
}
}
video/app/src/main/java/com/duben/dayplaylet/mvp/presenters/HomePresenter.kt
View file @
75faabca
...
...
@@ -5,10 +5,7 @@ import com.duben.dayplaylet.common.DeviceInfo
import
com.duben.dayplaylet.manager.AppHttpManager
import
com.duben.dayplaylet.manager.ShumeiManager
import
com.duben.dayplaylet.manager.UserManager
import
com.duben.dayplaylet.mvp.model.BannerList
import
com.duben.dayplaylet.mvp.model.BaseResponse
import
com.duben.dayplaylet.mvp.model.HotStyleTypesList
import
com.duben.dayplaylet.mvp.model.UserBean
import
com.duben.dayplaylet.mvp.model.*
import
com.duben.dayplaylet.mvp.views.HomeView
import
com.duben.dayplaylet.utils.DeviceUuidFactory
import
com.duben.library.net.neterror.BaseSubscriber
...
...
@@ -33,6 +30,22 @@ class HomePresenter : BasePresenter<HomeView>() {
})
}
fun
getSignInfo
()
{
AppHttpManager
.
getInstance
(
loanApplication
)
.
call
(
loanService
.
getSignInfo
(),
object
:
BaseSubscriber
<
BaseResponse
<
SignInfoBean
>>()
{
override
fun
onCompleted
()
{}
override
fun
onError
(
e
:
Throwable
)
{}
override
fun
onNext
(
baseResponse
:
BaseResponse
<
SignInfoBean
>)
{
when
(
baseResponse
.
status
)
{
200
->
{
view
.
getSignInfoSuc
(
baseResponse
.
data
)
}
}
}
})
}
fun
getHomeV1Types
()
{
AppHttpManager
.
getInstance
(
loanApplication
)
.
call
(
loanService
.
homeV1Types
,
...
...
video/app/src/main/java/com/duben/dayplaylet/mvp/views/HomeView.kt
View file @
75faabca
...
...
@@ -9,4 +9,5 @@ interface HomeView : BaseView {
fun
ordersSuc
(
data
:
BannerList
?)
fun
getUserSuc
(
data
:
UserBean
)
fun
getSignInfoSuc
(
data
:
SignInfoBean
?)
}
video/app/src/main/java/com/duben/dayplaylet/net/LoanService.java
View file @
75faabca
...
...
@@ -3,6 +3,7 @@ package com.duben.dayplaylet.net;
import
android.content.Context
;
import
android.text.TextUtils
;
import
com.duben.dayplaylet.mvp.model.SignInfoBean
;
import
com.google.gson.JsonObject
;
import
com.duben.dayplaylet.BuildConfig
;
import
com.duben.dayplaylet.mvp.model.BannerList
;
...
...
@@ -225,6 +226,14 @@ public interface LoanService {
@POST
(
"api/reportAddCoinMsg"
)
Observable
<
BaseResponse
<
JsonObject
>>
reportAddCoinMsg
(
@Body
Map
<
String
,
Object
>
vo
);
/**
* 签到信息
*
* @return
*/
@POST
(
"api/reward/rdSignMsg"
)
Observable
<
BaseResponse
<
SignInfoBean
>>
getSignInfo
();
/**
* 默认http工厂
*/
...
...
video/app/src/main/java/com/duben/dayplaylet/ui/fragment/FollowVideoFragment.kt
deleted
100644 → 0
View file @
41edb128
package
com.duben.dayplaylet.ui.fragment
import
android.os.Bundle
import
android.view.LayoutInflater
import
android.view.View
import
androidx.fragment.app.Fragment
import
androidx.recyclerview.widget.GridLayoutManager
import
com.duben.dayplaylet.R
import
com.duben.dayplaylet.manager.LocalVedioManager
import
com.duben.dayplaylet.mvp.model.BannerList
import
com.duben.dayplaylet.mvp.model.VedioBean
import
com.duben.dayplaylet.mvp.presenters.FollowPresenter
import
com.duben.dayplaylet.mvp.views.FollowView
import
com.duben.dayplaylet.ui.activitys.MainActivity
import
com.duben.dayplaylet.ui.adapter.FollowAdapter
import
com.duben.dayplaylet.ui.fragment.base.BaseFragment
import
kotlinx.android.synthetic.main.fragment_follow_video.*
/**
* @author Assen
* @date 2023/7/5
* @desc 主页 -> 推荐 —> 追剧
*/
class
FollowVideoFragment
:
BaseFragment
(),
FollowView
{
private
val
followPresenter
by
lazy
{
FollowPresenter
()
}
private
val
datas
=
arrayListOf
<
VedioBean
>()
private
var
followAdapter
:
FollowAdapter
?
=
null
companion
object
{
fun
newInstance
():
Fragment
{
val
args
=
Bundle
()
val
fragment
=
FollowVideoFragment
()
fragment
.
arguments
=
args
return
fragment
}
}
override
fun
onResume
()
{
super
.
onResume
()
followPresenter
.
getCollectList
()
}
override
fun
initViewsAndEvents
()
{
followPresenter
.
attachView
(
this
)
initRecy
()
}
override
fun
getContentViewLayoutID
()
=
R
.
layout
.
fragment_follow_video
private
fun
initRecy
()
{
val
emptyView
=
LayoutInflater
.
from
(
requireContext
()).
inflate
(
R
.
layout
.
item_follow_empty
,
null
)
emptyView
.
findViewById
<
View
>(
R
.
id
.
btn
).
setOnClickListener
{
// 去剧场
// (requireActivity() as MainActivity).changeRecommendTab(1)
}
rv_follow
.
layoutManager
=
GridLayoutManager
(
requireContext
(),
3
)
followAdapter
=
FollowAdapter
(
requireActivity
())
followAdapter
?.
setEmptyView
(
emptyView
)
followAdapter
?.
setNewInstance
(
datas
)
followAdapter
?.
setOnItemLongClickListener
{
adapter
,
view
,
position
->
datas
[
position
].
isChecked
=
true
followAdapter
?.
setEditStyle
(
true
)
showEditView
(
false
)
return
@setOnItemLongClickListener
false
}
followAdapter
?.
setOnItemClickListener
{
adapter
,
view
,
position
->
if
(
followAdapter
?.
getEditStyle
()
==
true
)
return
@setOnItemClickListener
LocalVedioManager
.
startVedioDetailActivityForType
(
requireActivity
(),
datas
[
position
]
)
}
rv_follow
.
adapter
=
followAdapter
}
fun
getAdapter
():
FollowAdapter
?
{
return
followAdapter
}
override
fun
onDetach
()
{
super
.
onDetach
()
followPresenter
.
detachView
()
}
private
fun
showEditView
(
show
:
Boolean
)
{
// (requireActivity() as MainActivity).showEditView(show)
}
private
fun
hideEditView
(
hide
:
Boolean
)
{
// (requireActivity() as MainActivity).hideEditView(hide)
}
override
fun
getCollectListSuc
(
bannerList
:
BannerList
)
{
datas
.
clear
()
if
(
bannerList
.
list
.
isNotEmpty
())
{
datas
.
addAll
(
bannerList
.
list
)
followAdapter
?.
setNewInstance
(
datas
)
showEditView
(
true
)
}
else
{
hideEditView
(
true
)
}
followAdapter
?.
setEditStyle
(
false
)
}
override
fun
getCollectListFail
()
{
showEditView
(
false
)
}
override
fun
cancelCollectSuc
()
{
followPresenter
.
getCollectList
()
// (requireActivity() as MainActivity).showEditView(true)
}
override
fun
cancelCollectFail
()
{
}
fun
delete
()
{
followAdapter
?.
let
{
val
strArr
=
arrayListOf
<
String
>()
for
(
datum
in
it
.
data
)
{
if
(
datum
.
isChecked
)
{
strArr
.
add
(
""
+
datum
.
vedioId
)
}
}
followPresenter
.
cancelCollect
(
strArr
)
}
}
}
\ No newline at end of file
video/app/src/main/java/com/duben/dayplaylet/ui/fragment/MainFragment.kt
View file @
75faabca
This diff is collapsed.
Click to expand it.
video/app/src/main/java/com/duben/dayplaylet/ui/widgets/DialogUtils.kt
View file @
75faabca
...
...
@@ -6,6 +6,7 @@ import android.content.Context
import
android.text.Spannable
import
android.view.Gravity
import
android.view.View
import
com.duben.dayplaylet.mvp.model.SignInfoBean
import
java.lang.ref.WeakReference
object
DialogUtils
{
...
...
@@ -126,7 +127,7 @@ object DialogUtils {
/**
* 签到弹框
*/
fun
showSignDialog
(
ctx
:
Context
,
dialogListener
:
DialogListener
,
signDay
:
Int
)
{
fun
showSignDialog
(
ctx
:
Context
,
dialogListener
:
DialogListener
,
signDay
:
SignInfoBean
.
SignMsgBean
)
{
val
weakReference
=
WeakReference
<
Context
>(
ctx
)
val
signDialog
=
SignDialog
(
weakReference
.
get
()
!!
,
dialogListener
,
signDay
)
signDialog
.
show
()
...
...
video/app/src/main/java/com/duben/dayplaylet/ui/widgets/SignDialog.kt
View file @
75faabca
...
...
@@ -5,16 +5,19 @@ import android.content.Context
import
android.os.Handler
import
android.view.Gravity
import
android.view.KeyEvent
import
android.view.View
import
android.view.WindowManager
import
androidx.core.content.ContextCompat
import
com.daimajia.androidanimations.library.Techniques
import
com.daimajia.androidanimations.library.YoYo
import
com.duben.dayplaylet.R
import
com.duben.dayplaylet.mvp.model.SignInfoBean
import
com.duben.dayplaylet.utils.BubbleUtils
import
com.duben.dayplaylet.utils.SpanUtils
import
kotlinx.android.synthetic.main.dialog_sign.*
class
SignDialog
(
context
:
Context
,
listener
:
DialogListener
,
sign
Day
:
Int
)
:
class
SignDialog
(
context
:
Context
,
listener
:
DialogListener
,
sign
Msg
:
SignInfoBean
.
SignMsgBean
)
:
Dialog
(
context
,
R
.
style
.
dialog
)
{
private
var
rope
:
YoYo
.
YoYoString
?
=
null
...
...
@@ -41,7 +44,26 @@ class SignDialog(context: Context, listener: DialogListener, signDay: Int) :
tv_sign_withdraw
.
setOnClickListener
(
listener
)
tv_sign_rule
.
setOnClickListener
(
listener
)
setLayoutStyle
(
signDay
)
tv_sign_title
.
text
=
SpanUtils
()
.
append
(
"签到7天领"
)
.
setForegroundColor
(
context
.
resources
.
getColor
(
R
.
color
.
apk_uninstalled
))
.
append
(
signMsg
.
sumCash
.
toString
())
.
setFontSize
(
BubbleUtils
.
sp2px
(
30
))
.
setForegroundColor
(
context
.
resources
.
getColor
(
R
.
color
.
red
))
.
append
(
"元红包"
)
.
setForegroundColor
(
context
.
resources
.
getColor
(
R
.
color
.
apk_uninstalled
))
.
create
()
val
cashList
=
signMsg
.
signWeekCashArr
for
(
i
in
1
until
8
)
{
if
(
i
<
signMsg
.
signDay
)
{
setEverydayStatus
(
i
,
1
,
cashList
[
i
-
1
])
}
else
if
(
i
==
signMsg
.
signDay
)
{
setEverydayStatus
(
i
,
0
,
cashList
[
i
-
1
])
}
else
{
setEverydayStatus
(
i
,
2
,
cashList
[
i
-
1
])
}
}
Handler
().
postDelayed
({
rope
=
YoYo
.
with
(
Techniques
.
Pulse
).
duration
(
500
).
repeat
(-
1
).
playOn
(
tv_sign_withdraw
)
...
...
@@ -54,65 +76,115 @@ class SignDialog(context: Context, listener: DialogListener, signDay: Int) :
rope
=
null
}
private
fun
setLayoutStyle
(
signDay
:
Int
)
{
tv_sign_title
.
text
=
SpanUtils
()
.
append
(
"签到7天领"
)
.
setForegroundColor
(
context
.
resources
.
getColor
(
R
.
color
.
apk_uninstalled
))
.
append
(
"88"
)
.
setFontSize
(
BubbleUtils
.
sp2px
(
30
))
.
setForegroundColor
(
context
.
resources
.
getColor
(
R
.
color
.
red
))
.
append
(
"元红包"
)
.
setForegroundColor
(
context
.
resources
.
getColor
(
R
.
color
.
apk_uninstalled
))
.
create
()
/**
* status 0-可领取 1-已领取 2-未领取
*/
private
fun
setEverydayStatus
(
signDay
:
Int
,
status
:
Int
,
cash
:
Int
)
{
// 3
when
(
signDay
)
{
1
->
{
if
(
true
)
{
if
(
status
==
0
)
{
tv_sign_status1
.
text
=
"可领取"
tv_sign_money1
.
setTextColor
(
ContextCompat
.
getColor
(
context
,
R
.
color
.
red
))
ll_sign_status1
.
setBackgroundResource
(
R
.
mipmap
.
bg_no_sign
)
}
else
if
(
status
==
1
)
{
tv_sign_status1
.
visibility
=
View
.
GONE
tv_sign_money1
.
visibility
=
View
.
GONE
ll_sign_status1
.
setBackgroundResource
(
R
.
mipmap
.
bg_sign
)
}
else
{
tv_sign_status1
.
text
=
"已领取"
ll_sign_status1
.
setBackgroundResource
(
R
.
mipmap
.
bg_sign_green
)
tv_sign_status1
.
text
=
"第${signDay}天"
tv_sign_money1
.
text
=
"${cash}元"
}
}
2
->
{
if
(
true
)
{
if
(
status
==
0
)
{
tv_sign_status2
.
text
=
"可领取"
tv_sign_money2
.
setTextColor
(
ContextCompat
.
getColor
(
context
,
R
.
color
.
red
))
ll_sign_status2
.
setBackgroundResource
(
R
.
mipmap
.
bg_no_sign
)
}
else
if
(
status
==
1
)
{
tv_sign_status2
.
visibility
=
View
.
GONE
tv_sign_money2
.
visibility
=
View
.
GONE
ll_sign_status2
.
setBackgroundResource
(
R
.
mipmap
.
bg_sign
)
}
else
{
tv_sign_status2
.
text
=
"已领取"
ll_sign_status2
.
setBackgroundResource
(
R
.
mipmap
.
bg_sign_green
)
tv_sign_status2
.
text
=
"第${signDay}天"
tv_sign_money2
.
text
=
"${cash}元"
}
}
3
->
{
if
(
true
)
{
if
(
status
==
0
)
{
tv_sign_status3
.
text
=
"可领取"
tv_sign_money3
.
setTextColor
(
ContextCompat
.
getColor
(
context
,
R
.
color
.
red
))
ll_sign_status3
.
setBackgroundResource
(
R
.
mipmap
.
bg_no_sign
)
}
else
if
(
status
==
1
)
{
tv_sign_status3
.
visibility
=
View
.
GONE
tv_sign_money3
.
visibility
=
View
.
GONE
ll_sign_status3
.
setBackgroundResource
(
R
.
mipmap
.
bg_sign
)
}
else
{
tv_sign_status3
.
text
=
"已领取"
ll_sign_status3
.
setBackgroundResource
(
R
.
mipmap
.
bg_sign_green
)
tv_sign_status3
.
text
=
"第${signDay}天"
tv_sign_money3
.
text
=
"${cash}元"
}
}
4
->
{
if
(
true
)
{
if
(
status
==
0
)
{
tv_sign_status4
.
text
=
"可领取"
tv_sign_money4
.
setTextColor
(
ContextCompat
.
getColor
(
context
,
R
.
color
.
red
))
ll_sign_status4
.
setBackgroundResource
(
R
.
mipmap
.
bg_no_sign
)
}
else
if
(
status
==
1
)
{
tv_sign_status4
.
visibility
=
View
.
GONE
tv_sign_money4
.
visibility
=
View
.
GONE
ll_sign_status4
.
setBackgroundResource
(
R
.
mipmap
.
bg_sign
)
}
else
{
tv_sign_status4
.
text
=
"已领取"
ll_sign_status4
.
setBackgroundResource
(
R
.
mipmap
.
bg_sign_green
)
tv_sign_status4
.
text
=
"第${signDay}天"
tv_sign_money4
.
text
=
"${cash}元"
}
}
5
->
{
if
(
true
)
{
if
(
status
==
0
)
{
tv_sign_status5
.
text
=
"可领取"
tv_sign_money5
.
setTextColor
(
ContextCompat
.
getColor
(
context
,
R
.
color
.
red
))
ll_sign_status5
.
setBackgroundResource
(
R
.
mipmap
.
bg_no_sign
)
}
else
if
(
status
==
1
)
{
tv_sign_status5
.
visibility
=
View
.
GONE
tv_sign_money5
.
visibility
=
View
.
GONE
ll_sign_status5
.
setBackgroundResource
(
R
.
mipmap
.
bg_sign
)
}
else
{
tv_sign_status5
.
text
=
"已领取"
ll_sign_status5
.
setBackgroundResource
(
R
.
mipmap
.
bg_sign_green
)
tv_sign_status5
.
text
=
"第${signDay}天"
tv_sign_money5
.
text
=
"${cash}元"
}
}
6
->
{
if
(
true
)
{
if
(
status
==
0
)
{
tv_sign_status6
.
text
=
"可领取"
tv_sign_money6
.
setTextColor
(
ContextCompat
.
getColor
(
context
,
R
.
color
.
red
))
ll_sign_status6
.
setBackgroundResource
(
R
.
mipmap
.
bg_no_sign
)
}
else
if
(
status
==
1
)
{
tv_sign_status6
.
visibility
=
View
.
GONE
tv_sign_money6
.
visibility
=
View
.
GONE
ll_sign_status6
.
setBackgroundResource
(
R
.
mipmap
.
bg_sign
)
}
else
{
tv_sign_status6
.
text
=
"已领取"
ll_sign_status6
.
setBackgroundResource
(
R
.
mipmap
.
bg_sign_green
)
tv_sign_status6
.
text
=
"第${signDay}天"
tv_sign_money6
.
text
=
"${cash}元"
}
}
7
->
{
if
(
true
)
{
if
(
status
==
0
)
{
tv_sign_status7
.
text
=
"可领取"
tv_sign_money7
.
setTextColor
(
ContextCompat
.
getColor
(
context
,
R
.
color
.
red
))
ll_sign_status7
.
setBackgroundResource
(
R
.
mipmap
.
bg_no_sign
)
}
else
if
(
status
==
1
)
{
tv_sign_status7
.
visibility
=
View
.
GONE
tv_sign_money7
.
visibility
=
View
.
GONE
ll_sign_status7
.
setBackgroundResource
(
R
.
mipmap
.
bg_sign
)
}
else
{
tv_sign_status7
.
text
=
"已领取"
ll_sign_status7
.
setBackgroundResource
(
R
.
mipmap
.
bg_sign_green
)
tv_sign_status7
.
text
=
"第${signDay}天"
tv_sign_money7
.
text
=
"${cash}元"
}
}
}
...
...
video/app/src/main/java/com/duben/dayplaylet/ui/widgets/SignDrawDialog.kt
View file @
75faabca
...
...
@@ -7,25 +7,29 @@ import android.view.Gravity
import
android.view.KeyEvent
import
android.view.WindowManager
import
com.duben.dayplaylet.R
import
com.duben.dayplaylet.mvp.model.SignInfoBean
import
com.duben.dayplaylet.ui.widgets.countdowntimer.CountDownTimerSupport
import
com.duben.dayplaylet.ui.widgets.countdowntimer.OnCountDownTimerListener
import
com.duben.dayplaylet.utils.BubbleUtils
import
com.duben.dayplaylet.utils.SpanUtils
import
kotlinx.android.synthetic.main.dialog_sign_draw.*
class
SignDrawDialog
(
private
val
context
:
Context
,
private
val
isTimer
:
Boolean
)
:
class
SignDrawDialog
(
private
val
context
:
Context
,
val
times
:
Int
,
signMsg
:
SignInfoBean
.
SignMsgBean
)
:
Dialog
(
context
,
R
.
style
.
dialog
)
{
private
val
lp
:
WindowManager
.
LayoutParams
var
timer
:
CountDownTimerSupport
?
=
null
private
var
isClickBtn
=
false
private
var
adListener
:
AdListener
?
=
null
interface
AdListener
{
fun
showAd
()
fun
click
()
fun
close
()
}
fun
setAdListener
(
listener
:
AdListener
?)
{
...
...
@@ -54,15 +58,22 @@ class SignDrawDialog(private val context: Context, private val isTimer: Boolean)
adListener
?.
click
()
}
iv_close
.
setOnClickListener
{
adListener
?.
close
()
}
tv_sign_draw_cash
.
text
=
SpanUtils
()
.
append
(
"¥"
)
.
append
(
"2.92"
)
.
setFontSize
(
BubbleUtils
.
sp2px
(
40
))
.
create
()
Handler
().
postDelayed
({
startTimer
()
},
200
)
if
(
times
==
0
)
{
Handler
().
postDelayed
({
startTimer
()
},
200
)
}
}
override
fun
dismiss
()
{
...
...
@@ -79,7 +90,7 @@ class SignDrawDialog(private val context: Context, private val isTimer: Boolean)
timer
!!
.
stop
()
timer
=
null
}
timer
=
CountDownTimerSupport
(
4
000
,
1000
)
timer
=
CountDownTimerSupport
(
3
000
,
1000
)
timer
!!
.
setOnCountDownTimerListener
(
object
:
OnCountDownTimerListener
{
override
fun
onTick
(
millisUntilFinished
:
Long
)
{
if
(
isShowing
)
{
...
...
@@ -88,9 +99,6 @@ class SignDrawDialog(private val context: Context, private val isTimer: Boolean)
}
override
fun
onFinish
()
{
if
(
isShowing
&&
!
isClickBtn
)
{
adListener
?.
showAd
()
}
}
})
timer
!!
.
start
()
...
...
video/app/src/main/java/com/duben/dayplaylet/utils/FormatUtil.kt
0 → 100644
View file @
75faabca
package
com.duben.dayplaylet.utils
import
java.math.BigDecimal
object
FormatUtil
{
fun
getCashFormaet
(
rewardCoin
:
Int
):
String
{
val
sumCoin
=
rewardCoin
.
toString
()
val
allcoinBig
=
BigDecimal
(
sumCoin
)
val
rateBig
=
BigDecimal
(
"10000"
)
val
cashStr
=
allcoinBig
.
divide
(
rateBig
).
setScale
(
2
,
BigDecimal
.
ROUND_DOWN
).
toString
()
return
cashStr
}
/**
* 相减
*/
fun
sub
(
d1
:
Double
,
d2
:
Double
):
Double
{
val
bd1
=
BigDecimal
(
java
.
lang
.
Double
.
toString
(
d1
))
val
bd2
=
BigDecimal
(
java
.
lang
.
Double
.
toString
(
d2
))
return
bd1
.
subtract
(
bd2
).
toDouble
()
// val temp= bd1.subtract(bd2)
// return temp.setScale(2, BigDecimal.ROUND_HALF_UP).toDouble()
}
}
\ No newline at end of file
video/app/src/main/java/com/duben/dayplaylet/utils/StringUtil.kt
deleted
100644 → 0
View file @
41edb128
package
com.duben.dayplaylet.utils
import
android.content.Context
import
android.content.pm.PackageManager
import
android.text.TextUtils
import
java.math.BigDecimal
object
StringUtil
{
/**
* 获取application中指定的meta-data
*
* @return 如果没有获取成功(没有对应值 , 或者异常),则返回值为空
*/
fun
getAppMetaData
(
ctx
:
Context
?,
key
:
String
):
String
{
if
(
ctx
==
null
||
TextUtils
.
isEmpty
(
key
))
{
return
""
}
var
resultData
=
""
try
{
val
packageManager
=
ctx
.
packageManager
if
(
packageManager
!=
null
)
{
val
applicationInfo
=
packageManager
.
getApplicationInfo
(
ctx
.
packageName
,
PackageManager
.
GET_META_DATA
)
if
(
applicationInfo
!=
null
)
{
if
(
applicationInfo
.
metaData
!=
null
)
{
resultData
=
applicationInfo
.
metaData
.
getString
(
key
)
!!
}
}
}
}
catch
(
e
:
PackageManager
.
NameNotFoundException
)
{
e
.
printStackTrace
()
return
""
}
return
resultData
}
fun
getCashFormaet
(
rewardCoin
:
Int
):
String
{
val
sumCoin
=
rewardCoin
.
toString
()
val
allcoinBig
=
BigDecimal
(
sumCoin
)
val
rateBig
=
BigDecimal
(
"10000"
)
val
cashStr
=
allcoinBig
.
divide
(
rateBig
).
setScale
(
2
,
BigDecimal
.
ROUND_DOWN
).
toString
()
return
cashStr
}
}
\ No newline at end of file
video/app/src/main/res/layout/dialog_sign.xml
View file @
75faabca
...
...
@@ -31,11 +31,13 @@
android:orientation=
"horizontal"
>
<LinearLayout
android:id=
"@+id/ll_sign_status1"
android:layout_width=
"0dp"
android:layout_height=
"50dp"
android:layout_marginLeft=
"4dp"
android:layout_marginRight=
"4dp"
android:layout_weight=
"1"
android:background=
"@mipmap/bg_no_sign"
android:gravity=
"center_horizontal"
android:orientation=
"vertical"
android:paddingLeft=
"10dp"
...
...
@@ -57,11 +59,13 @@
</LinearLayout>
<LinearLayout
android:id=
"@+id/ll_sign_status2"
android:layout_width=
"0dp"
android:layout_height=
"50dp"
android:layout_marginLeft=
"4dp"
android:layout_marginRight=
"4dp"
android:layout_weight=
"1"
android:background=
"@mipmap/bg_no_sign"
android:gravity=
"center_horizontal"
android:orientation=
"vertical"
android:paddingLeft=
"10dp"
...
...
@@ -83,11 +87,13 @@
</LinearLayout>
<LinearLayout
android:id=
"@+id/ll_sign_status3"
android:layout_width=
"0dp"
android:layout_height=
"50dp"
android:layout_marginLeft=
"4dp"
android:layout_marginRight=
"4dp"
android:layout_weight=
"1"
android:background=
"@mipmap/bg_no_sign"
android:gravity=
"center_horizontal"
android:orientation=
"vertical"
android:paddingLeft=
"10dp"
...
...
@@ -109,11 +115,13 @@
</LinearLayout>
<LinearLayout
android:id=
"@+id/ll_sign_status4"
android:layout_width=
"0dp"
android:layout_height=
"50dp"
android:layout_marginLeft=
"4dp"
android:layout_marginRight=
"4dp"
android:layout_weight=
"1"
android:background=
"@mipmap/bg_no_sign"
android:gravity=
"center_horizontal"
android:orientation=
"vertical"
android:paddingLeft=
"10dp"
...
...
@@ -136,16 +144,19 @@
</LinearLayout>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
>
<LinearLayout
android:id=
"@+id/ll_sign_status5"
android:layout_width=
"0dp"
android:layout_height=
"50dp"
android:layout_marginLeft=
"4dp"
android:layout_marginRight=
"4dp"
android:layout_weight=
"1"
android:background=
"@mipmap/bg_no_sign"
android:gravity=
"center_horizontal"
android:orientation=
"vertical"
android:paddingLeft=
"10dp"
...
...
@@ -167,11 +178,13 @@
</LinearLayout>
<LinearLayout
android:id=
"@+id/ll_sign_status6"
android:layout_width=
"0dp"
android:layout_height=
"50dp"
android:layout_marginLeft=
"4dp"
android:layout_marginRight=
"4dp"
android:layout_weight=
"1"
android:background=
"@mipmap/bg_no_sign"
android:gravity=
"center_horizontal"
android:orientation=
"vertical"
android:paddingLeft=
"10dp"
...
...
@@ -193,11 +206,13 @@
</LinearLayout>
<RelativeLayout
android:id=
"@+id/ll_sign_status7"
android:layout_width=
"0dp"
android:layout_height=
"50dp"
android:layout_marginLeft=
"4dp"
android:layout_marginRight=
"4dp"
android:layout_weight=
"2"
android:background=
"@mipmap/bg_no_sign"
android:gravity=
"center_horizontal"
android:paddingLeft=
"10dp"
android:paddingRight=
"10dp"
>
...
...
video/app/src/main/res/layout/fragment_main.xml
View file @
75faabca
...
...
@@ -171,15 +171,35 @@
</LinearLayout>
<
ImageView
<
FrameLayout
android:id=
"@+id/iv_main_sign"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"400dp"
android:layout_marginRight=
"20dp"
android:src=
"@mipmap/ic_main_sign"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
app:layout_constraintTop_toTopOf=
"parent"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"10dp"
android:src=
"@mipmap/ic_main_sign"
/>
<TextView
android:id=
"@+id/tv_main_signcash"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:background=
"@drawable/shape_red"
android:paddingLeft=
"5dp"
android:paddingTop=
"2dp"
android:paddingRight=
"5dp"
android:paddingBottom=
"3dp"
android:text=
"88元"
android:textColor=
"@color/white"
android:textSize=
"13sp"
/>
</FrameLayout>
<ImageView
android:id=
"@+id/iv_main_tempanim"
...
...
video/app/src/main/res/mipmap-xhdpi/bg_no_sign.png
0 → 100644
View file @
75faabca
6.99 KB
video/app/src/main/res/mipmap-xhdpi/bg_sign.png
0 → 100644
View file @
75faabca
6.99 KB
video/app/src/main/res/mipmap-xhdpi/bg_sign_green.png
0 → 100644
View file @
75faabca
6.99 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