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
322a3838
Commit
322a3838
authored
Dec 12, 2024
by
mengcuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加青少年弹窗
parent
fcc0dcdf
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
142 additions
and
23 deletions
+142
-23
build.gradle
video/app/build.gradle
+2
-2
AppConfig.java
...app/src/main/java/com/duben/heliapp/common/AppConfig.java
+1
-0
Constant.kt
video/app/src/main/java/com/duben/heliapp/common/Constant.kt
+1
-0
SettingsActivity.kt
...n/java/com/duben/heliapp/ui/activitys/SettingsActivity.kt
+57
-8
VipActivity.kt
...c/main/java/com/duben/heliapp/ui/activitys/VipActivity.kt
+1
-0
MainFragment.kt
...c/main/java/com/duben/heliapp/ui/fragment/MainFragment.kt
+59
-13
TimeRender.kt
...o/app/src/main/java/com/duben/heliapp/utils/TimeRender.kt
+17
-0
activity_settings.xml
video/app/src/main/res/layout/activity_settings.xml
+4
-0
No files found.
video/app/build.gradle
View file @
322a3838
...
@@ -10,8 +10,8 @@ android {
...
@@ -10,8 +10,8 @@ android {
applicationId
"com.duben.heliapp"
applicationId
"com.duben.heliapp"
minSdkVersion
rootProject
.
ext
.
androidMinSdkVersion
minSdkVersion
rootProject
.
ext
.
androidMinSdkVersion
targetSdkVersion
rootProject
.
ext
.
androidTargetSdkVersion
targetSdkVersion
rootProject
.
ext
.
androidTargetSdkVersion
versionCode
72
7
versionCode
72
8
versionName
"7.2.
7
"
versionName
"7.2.
8
"
flavorDimensions
"default"
flavorDimensions
"default"
// dex突破65535的限制
// dex突破65535的限制
...
...
video/app/src/main/java/com/duben/heliapp/common/AppConfig.java
View file @
322a3838
...
@@ -31,4 +31,5 @@ public class AppConfig {
...
@@ -31,4 +31,5 @@ public class AppConfig {
public
static
long
splashTime
=
0L
;
public
static
long
splashTime
=
0L
;
public
static
double
firstVipPrice
=
0.0
;
public
static
double
firstVipPrice
=
0.0
;
public
static
boolean
yangVipFlag
=
false
;
}
}
video/app/src/main/java/com/duben/heliapp/common/Constant.kt
View file @
322a3838
...
@@ -17,6 +17,7 @@ object Constant {
...
@@ -17,6 +17,7 @@ object Constant {
*/
*/
const
val
LOAN_PERMISSION_FLAG
=
"loan_permission_flag"
const
val
LOAN_PERMISSION_FLAG
=
"loan_permission_flag"
const
val
FIRST_SPLASH
=
"first_splash"
const
val
FIRST_SPLASH
=
"first_splash"
const
val
YANG_FLAG
=
"yang_flag"
const
val
IS_FIRST_AGREE_BTN
=
"is_first_agree_btn"
const
val
IS_FIRST_AGREE_BTN
=
"is_first_agree_btn"
const
val
IS_FIRST_VEDIO
=
"is_first_vedio"
const
val
IS_FIRST_VEDIO
=
"is_first_vedio"
const
val
MINTS_APP_NAME
=
"河狸刷剧"
const
val
MINTS_APP_NAME
=
"河狸刷剧"
...
...
video/app/src/main/java/com/duben/heliapp/ui/activitys/SettingsActivity.kt
View file @
322a3838
...
@@ -28,29 +28,28 @@ import java.util.*
...
@@ -28,29 +28,28 @@ import java.util.*
class
SettingsActivity
:
BaseActivity
(),
View
.
OnClickListener
{
class
SettingsActivity
:
BaseActivity
(),
View
.
OnClickListener
{
var
yangView
:
TextView
?
=
null
private
val
userManager
by
lazy
{
UserManager
.
getInstance
()
}
private
val
userManager
by
lazy
{
UserManager
.
getInstance
()
}
override
fun
getContentViewLayoutID
()
=
R
.
layout
.
activity_settings
override
fun
isApplyKitKatTranslucency
()
=
false
override
fun
initViewsAndEvents
()
{
override
fun
initViewsAndEvents
()
{
initLayout
()
initLayout
()
}
}
override
fun
onResume
()
{
override
fun
onResume
()
{
super
.
onResume
()
super
.
onResume
()
// if (userManager.vipFlag) {
// if (userManager.vipFlag) {
// item_back.visibility = View.VISIBLE
// item_back.visibility = View.VISIBLE
// } else {
// } else {
// item_back.visibility = View.GONE
// item_back.visibility = View.GONE
// }
// }
if
(
userManager
.
userIsLogin
())
{
if
(
userManager
.
userIsLogin
())
{
btn_switch
.
visibility
=
View
.
VISIBLE
btn_switch
.
visibility
=
View
.
VISIBLE
}
else
{
}
else
{
btn_switch
.
visibility
=
View
.
GONE
btn_switch
.
visibility
=
View
.
GONE
}
}
}
}
@SuppressLint
(
"CutPasteId"
)
@SuppressLint
(
"CutPasteId"
)
...
@@ -68,6 +67,9 @@ class SettingsActivity : BaseActivity(), View.OnClickListener {
...
@@ -68,6 +67,9 @@ class SettingsActivity : BaseActivity(), View.OnClickListener {
btn_switch
.
setOnClickListener
(
this
)
btn_switch
.
setOnClickListener
(
this
)
item_back
.
setOnClickListener
(
this
)
item_back
.
setOnClickListener
(
this
)
item_phone
.
setOnClickListener
(
this
)
item_phone
.
setOnClickListener
(
this
)
item_yang
.
setOnClickListener
(
this
)
item_invitedCode
.
findViewById
<
TextView
>(
R
.
id
.
tv_title
).
text
=
"河狸刷剧ID"
item_invitedCode
.
findViewById
<
TextView
>(
R
.
id
.
tv_title
).
text
=
"河狸刷剧ID"
val
invitedCode
=
ContextCompat
.
getDrawable
(
this
,
R
.
mipmap
.
icon_settings_invite
)
val
invitedCode
=
ContextCompat
.
getDrawable
(
this
,
R
.
mipmap
.
icon_settings_invite
)
...
@@ -79,6 +81,20 @@ class SettingsActivity : BaseActivity(), View.OnClickListener {
...
@@ -79,6 +81,20 @@ class SettingsActivity : BaseActivity(), View.OnClickListener {
item_invitedCode
.
findViewById
<
TextView
>(
R
.
id
.
tv_right
).
text
=
item_invitedCode
.
findViewById
<
TextView
>(
R
.
id
.
tv_right
).
text
=
userManager
.
codeId
userManager
.
codeId
yangView
=
item_yang
.
findViewById
<
TextView
>(
R
.
id
.
tv_right
)
item_yang
.
findViewById
<
TextView
>(
R
.
id
.
tv_title
).
text
=
"青少年模式"
val
itemYang
=
ContextCompat
.
getDrawable
(
this
,
R
.
mipmap
.
icon_settings_privacy
)
itemYang
?.
setBounds
(
0
,
0
,
56
,
56
)
item_yang
.
findViewById
<
TextView
>(
R
.
id
.
tv_title
)
.
setCompoundDrawables
(
itemYang
,
null
,
null
,
null
)
yangView
!!
.
visibility
=
View
.
VISIBLE
item_yang
.
findViewById
<
ImageView
>(
R
.
id
.
iv_right
).
visibility
=
View
.
GONE
if
(
AppPreferencesManager
.
get
().
getBoolean
(
Constant
.
YANG_FLAG
,
false
))
{
yangView
!!
.
text
=
"去关闭"
}
else
{
yangView
!!
.
text
=
"去开启"
}
item_phone
.
findViewById
<
TextView
>(
R
.
id
.
tv_title
).
text
=
"手机号"
item_phone
.
findViewById
<
TextView
>(
R
.
id
.
tv_title
).
text
=
"手机号"
val
phone
=
ContextCompat
.
getDrawable
(
this
,
R
.
mipmap
.
icon_settings_tel
)
val
phone
=
ContextCompat
.
getDrawable
(
this
,
R
.
mipmap
.
icon_settings_tel
)
phone
?.
setBounds
(
0
,
0
,
56
,
56
)
phone
?.
setBounds
(
0
,
0
,
56
,
56
)
...
@@ -143,14 +159,14 @@ class SettingsActivity : BaseActivity(), View.OnClickListener {
...
@@ -143,14 +159,14 @@ class SettingsActivity : BaseActivity(), View.OnClickListener {
item_back
.
findViewById
<
ImageView
>(
R
.
id
.
iv_right
).
visibility
=
View
.
VISIBLE
item_back
.
findViewById
<
ImageView
>(
R
.
id
.
iv_right
).
visibility
=
View
.
VISIBLE
}
}
override
fun
getContentViewLayoutID
()
=
R
.
layout
.
activity_settings
override
fun
isApplyKitKatTranslucency
()
=
false
override
fun
onClick
(
v
:
View
?)
{
override
fun
onClick
(
v
:
View
?)
{
if
(
AntiShake
.
check
(
v
?.
id
))
return
if
(
AntiShake
.
check
(
v
?.
id
))
return
when
(
v
?.
id
)
{
when
(
v
?.
id
)
{
R
.
id
.
item_yang
->
{
yangDialog
()
}
R
.
id
.
item_cleanCache
->
{
R
.
id
.
item_cleanCache
->
{
clearDialog
()
clearDialog
()
}
}
...
@@ -264,4 +280,37 @@ class SettingsActivity : BaseActivity(), View.OnClickListener {
...
@@ -264,4 +280,37 @@ class SettingsActivity : BaseActivity(), View.OnClickListener {
cdaa
.
setRight
(
"确定"
)
cdaa
.
setRight
(
"确定"
)
cdaa
.
show
()
cdaa
.
show
()
}
}
private
fun
yangDialog
()
{
val
cdaa
=
CustomDialogAsApple
(
context
,
object
:
DialogListener
()
{
override
fun
onClick
(
dialog
:
Dialog
?,
v
:
View
?)
{
dialog
?.
dismiss
()
when
(
v
?.
id
)
{
R
.
id
.
dialog_btn_left
->
{
//开着 显示去关闭
yangView
!!
.
text
=
"去开启"
AppPreferencesManager
.
get
().
put
(
Constant
.
YANG_FLAG
,
false
)
showToast
(
"已关闭"
)
}
R
.
id
.
dialog_btn_right
->
{
//关闭 显示去打开
yangView
!!
.
text
=
"去关闭"
AppPreferencesManager
.
get
().
put
(
Constant
.
YANG_FLAG
,
true
)
showToast
(
"已开启"
)
}
}
}
})
cdaa
.
setTitle
(
"青少年模式"
)
// cdaa.setContent("1、开启青年少模式后,将自动开始时间锁,每天使用时长最多为40分钟\n2、在青年少模式内,充值将被关闭\n3、根据年龄段分级,更精细地推荐更多丰富内容,帮助青少年健康成长")
cdaa
.
setContent
(
"1、开启青年少模式后,将自动开始时间锁,每天使用时长最多为40分钟\n2、根据年龄段分级,更精细地推荐更多丰富内容,帮助青少年健康成长"
)
if
(
AppPreferencesManager
.
get
().
getBoolean
(
Constant
.
YANG_FLAG
,
false
))
{
cdaa
.
setLeft
(
"关闭"
)
}
else
{
cdaa
.
setRight
(
"开启"
)
}
cdaa
.
show
()
}
}
}
\ No newline at end of file
video/app/src/main/java/com/duben/heliapp/ui/activitys/VipActivity.kt
View file @
322a3838
...
@@ -126,6 +126,7 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
...
@@ -126,6 +126,7 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
vipPresenter
.
orders
()
vipPresenter
.
orders
()
AppConfig
.
enterVipAct
=
true
AppConfig
.
enterVipAct
=
true
AppConfig
.
yangVipFlag
=
true
initListener
()
initListener
()
}
}
...
...
video/app/src/main/java/com/duben/heliapp/ui/fragment/MainFragment.kt
View file @
322a3838
...
@@ -14,39 +14,38 @@ import androidx.core.content.ContextCompat
...
@@ -14,39 +14,38 @@ import androidx.core.content.ContextCompat
import
androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.RecyclerView
import
androidx.recyclerview.widget.RecyclerView
import
androidx.viewpager2.widget.ViewPager2
import
androidx.viewpager2.widget.ViewPager2
import
com.duben.library.net.neterror.BaseSubscriber
import
com.duben.library.net.neterror.Throwable
import
com.google.android.material.tabs.TabLayout
import
com.google.android.material.tabs.TabLayoutMediator
import
com.scwang.smartrefresh.layout.api.RefreshLayout
import
com.scwang.smartrefresh.layout.listener.OnRefreshListener
import
com.duben.heliapp.R
import
com.duben.heliapp.R
import
com.duben.heliapp.ad.AdManager
import
com.duben.heliapp.ad.AdManager
import
com.duben.heliapp.ad.banner.BannerManager
import
com.duben.heliapp.ad.banner.BannerManager
import
com.duben.heliapp.common.AppConfig
import
com.duben.heliapp.common.AppConfig
import
com.duben.heliapp.common.Constant
import
com.duben.heliapp.common.Constant
import
com.duben.heliapp.manager.AppHttpManager
import
com.duben.heliapp.manager.LocalVedioManager
import
com.duben.heliapp.manager.LocalVedioManager
import
com.duben.heliapp.manager.TrackManager
import
com.duben.heliapp.manager.TrackManager
import
com.duben.heliapp.manager.UserManager
import
com.duben.heliapp.manager.UserManager
import
com.duben.heliapp.mvp.model.*
import
com.duben.heliapp.mvp.model.*
import
com.duben.heliapp.mvp.presenters.HomePresenter
import
com.duben.heliapp.mvp.presenters.HomePresenter
import
com.duben.heliapp.mvp.views.HomeView
import
com.duben.heliapp.mvp.views.HomeView
import
com.duben.heliapp.ui.activitys.*
import
com.duben.heliapp.ui.adapter.HomeVideoPageAdapter
import
com.duben.heliapp.ui.adapter.HomeVideoPageAdapter
import
com.duben.heliapp.ui.adapter.ImageTitleAdapter
import
com.duben.heliapp.ui.adapter.ImageTitleAdapter
import
com.duben.heliapp.ui.adapter.TopAdapter
import
com.duben.heliapp.ui.adapter.TopAdapter
import
com.duben.heliapp.ui.fragment.base.LazyLoadBaseFragment
import
com.duben.heliapp.ui.fragment.base.LazyLoadBaseFragment
import
com.duben.heliapp.ui.widgets.CustomDialogAsApple
import
com.duben.heliapp.ui.widgets.DialogListener
import
com.duben.heliapp.ui.widgets.DialogUtils
import
com.duben.heliapp.utils.AppPreferencesManager
import
com.duben.heliapp.utils.AppPreferencesManager
import
com.duben.heliapp.utils.SpanUtils
import
com.duben.heliapp.utils.SpanUtils
import
com.duben.heliapp.utils.TimeRender
import
com.duben.library.net.neterror.BaseSubscriber
import
com.duben.library.net.neterror.Throwable
import
com.duben.library.utils.GlideUtils
import
com.duben.library.utils.GlideUtils
import
com.duben.library.utils.json.JsonUtil
import
com.duben.library.utils.nodoubleclick.AntiShake
import
com.duben.library.utils.nodoubleclick.AntiShake
import
com.duben.heliapp.MintsApplication
import
com.google.android.material.tabs.TabLayout
import
com.duben.heliapp.manager.AppHttpManager
import
com.google.android.material.tabs.TabLayoutMediator
import
com.duben.heliapp.ui.activitys.*
import
com.duben.heliapp.ui.widgets.DialogListener
import
com.duben.heliapp.ui.widgets.DialogUtils
import
com.duben.heliapp.utils.ToastUtil
import
com.google.gson.JsonObject
import
com.google.gson.JsonObject
import
com.scwang.smartrefresh.layout.api.RefreshLayout
import
com.scwang.smartrefresh.layout.listener.OnRefreshListener
import
kotlinx.android.synthetic.main.activity_order_record.*
import
kotlinx.android.synthetic.main.activity_order_record.*
import
kotlinx.android.synthetic.main.fragment_main.*
import
kotlinx.android.synthetic.main.fragment_main.*
import
kotlinx.android.synthetic.main.header_layout.*
import
kotlinx.android.synthetic.main.header_layout.*
...
@@ -72,6 +71,7 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
...
@@ -72,6 +71,7 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
private
var
topAdapter
:
TopAdapter
?
=
null
private
var
topAdapter
:
TopAdapter
?
=
null
private
var
recommendVedioBean
:
RecoBean
?
=
null
private
var
recommendVedioBean
:
RecoBean
?
=
null
private
var
mAgreementDTO
:
OrderRecordBean
.
AgreementDTO
?
=
null
private
var
mAgreementDTO
:
OrderRecordBean
.
AgreementDTO
?
=
null
private
var
yangMainFlag
=
false
private
val
homePresenter
by
lazy
{
HomePresenter
()
}
private
val
homePresenter
by
lazy
{
HomePresenter
()
}
...
@@ -160,6 +160,19 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
...
@@ -160,6 +160,19 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
}
else
{
}
else
{
iv_sign_main
.
visibility
=
View
.
GONE
iv_sign_main
.
visibility
=
View
.
GONE
}
}
// 非vip用户且未展示过弹窗-->展示青少年弹窗
if
(
AppConfig
.
yangVipFlag
&&
!
yangMainFlag
)
{
// 判断当前时间是否在下午8点到下午12点之间
// if (TimeRender.isTimeInRange(8, 0, 18, 0)) {
if
(
TimeRender
.
isTimeInRange
(
20
,
0
,
24
,
0
))
{
if
(!
AppPreferencesManager
.
get
().
getBoolean
(
Constant
.
YANG_FLAG
,
false
))
{
AppConfig
.
yangVipFlag
=
false
yangMainFlag
=
true
yangDialog
()
}
}
}
}
}
}
}
...
@@ -603,4 +616,37 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
...
@@ -603,4 +616,37 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
}
catch
(
ignore
:
java
.
lang
.
Exception
)
{
}
catch
(
ignore
:
java
.
lang
.
Exception
)
{
}
}
}
}
private
fun
yangDialog
()
{
val
cdaa
=
CustomDialogAsApple
(
context
,
object
:
DialogListener
()
{
override
fun
onClick
(
dialog
:
Dialog
?,
v
:
View
?)
{
dialog
?.
dismiss
()
when
(
v
?.
id
)
{
R
.
id
.
dialog_btn_left
->
{
}
R
.
id
.
dialog_btn_right
->
{
if
(
AppPreferencesManager
.
get
().
getBoolean
(
Constant
.
YANG_FLAG
,
false
))
{
AppPreferencesManager
.
get
().
put
(
Constant
.
YANG_FLAG
,
false
)
showToast
(
"已关闭"
)
}
else
{
AppPreferencesManager
.
get
().
put
(
Constant
.
YANG_FLAG
,
true
)
showToast
(
"已开启"
)
}
}
}
}
})
cdaa
.
setTitle
(
"青少年模式"
)
// cdaa.setContent("1、开启青年少模式后,将自动开始时间锁,每天使用时长最多为40分钟\n2、在青年少模式内,充值将被关闭\n3、根据年龄段分级,更精细地推荐更多丰富内容,帮助青少年健康成长")
cdaa
.
setContent
(
"1、开启青年少模式后,将自动开始时间锁,每天使用时长最多为40分钟\n2、根据年龄段分级,更精细地推荐更多丰富内容,帮助青少年健康成长"
)
cdaa
.
setLeft
(
"取消"
)
if
(
AppPreferencesManager
.
get
().
getBoolean
(
Constant
.
YANG_FLAG
,
false
))
{
cdaa
.
setRight
(
"关闭"
)
}
else
{
cdaa
.
setRight
(
"开启"
)
}
cdaa
.
show
()
}
}
}
\ No newline at end of file
video/app/src/main/java/com/duben/heliapp/utils/TimeRender.kt
View file @
322a3838
...
@@ -308,4 +308,21 @@ object TimeRender {
...
@@ -308,4 +308,21 @@ object TimeRender {
return
time
>
outMin
&&
adPreLoadTime
>
0
return
time
>
outMin
&&
adPreLoadTime
>
0
}
}
fun
isTimeInRange
(
startHour
:
Int
,
startMinute
:
Int
,
endHour
:
Int
,
endMinute
:
Int
):
Boolean
{
val
now
=
Calendar
.
getInstance
()
val
startTime
=
Calendar
.
getInstance
()
val
endTime
=
Calendar
.
getInstance
()
startTime
[
Calendar
.
HOUR_OF_DAY
]
=
startHour
startTime
[
Calendar
.
MINUTE
]
=
startMinute
startTime
[
Calendar
.
SECOND
]
=
0
startTime
[
Calendar
.
MILLISECOND
]
=
0
endTime
[
Calendar
.
HOUR_OF_DAY
]
=
endHour
endTime
[
Calendar
.
MINUTE
]
=
endMinute
endTime
[
Calendar
.
SECOND
]
=
0
endTime
[
Calendar
.
MILLISECOND
]
=
0
// 如果当前时间在开始时间之后且在结束时间之前,则返回true
return
now
.
after
(
startTime
)
&&
now
.
before
(
endTime
)
}
}
}
\ No newline at end of file
video/app/src/main/res/layout/activity_settings.xml
View file @
322a3838
...
@@ -16,6 +16,10 @@
...
@@ -16,6 +16,10 @@
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
android:orientation=
"vertical"
>
<include
android:id=
"@+id/item_yang"
layout=
"@layout/item_settings"
/>
<include
<include
android:id=
"@+id/item_invitedCode"
android:id=
"@+id/item_invitedCode"
layout=
"@layout/item_settings"
/>
layout=
"@layout/item_settings"
/>
...
...
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