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
f890568a
Commit
f890568a
authored
Dec 25, 2024
by
jyx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
青少年模式添加密码页面
parent
966d068c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
101 additions
and
100 deletions
+101
-100
PswActivity.kt
...c/main/java/com/duben/heliapp/ui/activitys/PswActivity.kt
+6
-14
SettingsActivity.kt
...n/java/com/duben/heliapp/ui/activitys/SettingsActivity.kt
+11
-12
AutoIdentifyView.java
...n/java/com/duben/heliapp/ui/widgets/AutoIdentifyView.java
+12
-4
JuniorDialog.kt
...rc/main/java/com/duben/heliapp/ui/widgets/JuniorDialog.kt
+11
-1
dialog_junior.xml
video/app/src/main/res/layout/dialog_junior.xml
+61
-69
bg_junior.png
video/app/src/main/res/mipmap-xhdpi/bg_junior.png
+0
-0
No files found.
video/app/src/main/java/com/duben/heliapp/ui/activitys/PswActivity.kt
View file @
f890568a
...
...
@@ -66,12 +66,8 @@ class PswActivity : BaseActivity(), View.OnClickListener {
}
else
{
if
(
TextUtils
.
equals
(
str
,
inputPsw
))
{
AppPreferencesManager
.
get
().
put
(
Constant
.
PSW_FLAG
,
inputPsw
)
showToast
(
"暂无青少年内容推荐,请在成年人监护下观看!"
)
Handler
(
Looper
.
getMainLooper
()).
postDelayed
(
{
finish
()
},
1000
)
showToast
(
"青少年内容开启成功!"
)
Handler
(
Looper
.
getMainLooper
()).
postDelayed
({
finish
()
},
1000
)
}
else
{
isFirstSet
=
true
tv_psw
.
text
=
"设置密码"
...
...
@@ -81,16 +77,12 @@ class PswActivity : BaseActivity(), View.OnClickListener {
}
}
else
{
if
(
TextUtils
.
equals
(
str
,
realPsw
))
{
Handler
(
Looper
.
getMainLooper
()).
postDelayed
(
{
showToast
(
"暂无青少年内容推荐,请在成年人监护下观看!"
)
finish
()
},
1000
)
AppPreferencesManager
.
get
().
put
(
Constant
.
PSW_FLAG
,
""
)
showToast
(
"青少年内容关闭成功!"
)
Handler
(
Looper
.
getMainLooper
()).
postDelayed
({
finish
()
},
1000
)
}
else
{
showToast
(
"密码输入错误!"
)
finish
(
)
autoIdentify
.
initIdentifyBoxKeyboard
(
this
)
}
}
...
...
video/app/src/main/java/com/duben/heliapp/ui/activitys/SettingsActivity.kt
View file @
f890568a
...
...
@@ -2,8 +2,6 @@ package com.duben.heliapp.ui.activitys
import
android.annotation.SuppressLint
import
android.app.Dialog
import
android.content.Intent
import
android.net.Uri
import
android.os.Bundle
import
android.os.Handler
import
android.os.Looper
...
...
@@ -51,6 +49,12 @@ class SettingsActivity : BaseActivity(), View.OnClickListener {
}
else
{
btn_switch
.
visibility
=
View
.
GONE
}
if
(
TextUtils
.
isEmpty
(
AppPreferencesManager
.
get
().
getString
(
Constant
.
PSW_FLAG
,
""
)))
{
yangView
!!
.
text
=
"去开启"
}
else
{
yangView
!!
.
text
=
"去关闭"
}
}
@SuppressLint
(
"CutPasteId"
)
...
...
@@ -70,8 +74,6 @@ class SettingsActivity : BaseActivity(), View.OnClickListener {
item_phone
.
setOnClickListener
(
this
)
item_yang
.
setOnClickListener
(
this
)
item_invitedCode
.
findViewById
<
TextView
>(
R
.
id
.
tv_title
).
text
=
"河狸刷剧ID"
val
invitedCode
=
ContextCompat
.
getDrawable
(
this
,
R
.
mipmap
.
icon_settings_invite
)
invitedCode
?.
setBounds
(
0
,
0
,
56
,
56
)
...
...
@@ -90,14 +92,11 @@ class SettingsActivity : BaseActivity(), View.OnClickListener {
.
setCompoundDrawables
(
itemYang
,
null
,
null
,
null
)
yangView
!!
.
visibility
=
View
.
VISIBLE
item_yang
.
findViewById
<
ImageView
>(
R
.
id
.
iv_right
).
visibility
=
View
.
GONE
if
(
TextUtils
.
isEmpty
(
AppPreferencesManager
.
get
().
getString
(
Constant
.
PSW_FLAG
,
""
)
)
)
{
yangView
!!
.
text
=
"去关闭"
}
else
{
yangView
!!
.
text
=
"去开启"
}
// if (TextUtils.isEmpty(AppPreferencesManager.get().getString(Constant.PSW_FLAG, ""))) {
// yangView!!.text = "去开启"
// } else {
// yangView!!.text = "去关闭"
// }
item_phone
.
findViewById
<
TextView
>(
R
.
id
.
tv_title
).
text
=
"手机号"
val
phone
=
ContextCompat
.
getDrawable
(
this
,
R
.
mipmap
.
icon_settings_tel
)
...
...
video/app/src/main/java/com/duben/heliapp/ui/widgets/AutoIdentifyView.java
View file @
f890568a
package
com
.
duben
.
heliapp
.
ui
.
widgets
;
import
android.app.Activity
;
import
android.content.Context
;
import
android.os.Handler
;
import
android.os.Looper
;
import
android.text.Editable
;
import
android.text.InputType
;
import
android.text.TextWatcher
;
import
android.util.AttributeSet
;
import
android.view.LayoutInflater
;
import
android.view.inputmethod.InputMethodManager
;
import
android.widget.EditText
;
import
android.widget.RelativeLayout
;
...
...
@@ -45,6 +49,7 @@ public class AutoIdentifyView extends RelativeLayout {
//让后三个失去焦点,第一个得到焦点
setThirdlyLoseFocusable
();
new
Handler
(
Looper
.
getMainLooper
()).
postDelayed
(()
->
showSoftInput
(),
500
);
}
/**
...
...
@@ -131,7 +136,7 @@ public class AutoIdentifyView extends RelativeLayout {
/**
* 清除验证码,初始化验证码框状态,弹出键盘
*/
public
void
initIdentifyBoxKeyboard
(
Activity
activity
){
public
void
initIdentifyBoxKeyboard
(
Activity
activity
)
{
clearContent
();
setThirdlyLoseFocusable
();
setShowKeyboard
(
activity
);
...
...
@@ -185,7 +190,6 @@ public class AutoIdentifyView extends RelativeLayout {
// //第一个获取焦点
// loseFocusable(identify1, true);
// }
private
void
clearContent
()
{
currentCode
=
""
;
identify1
.
setText
(
""
);
...
...
@@ -213,12 +217,16 @@ public class AutoIdentifyView extends RelativeLayout {
// identify3.setInputType(InputType.TYPE_CLASS_TEXT);
// identify4.setInputType(InputType.TYPE_CLASS_TEXT);
// }
public
String
getCurrentCode
()
{
return
currentCode
;
}
public
void
showSoftInput
()
{
identify1
.
requestFocus
();
InputMethodManager
inputManager
=
(
InputMethodManager
)
identify1
.
getContext
().
getSystemService
(
Context
.
INPUT_METHOD_SERVICE
);
inputManager
.
showSoftInput
(
identify1
,
0
);
}
private
void
setCurrentCode
(
String
currentCode
)
{
this
.
currentCode
=
currentCode
;
}
...
...
video/app/src/main/java/com/duben/heliapp/ui/widgets/JuniorDialog.kt
View file @
f890568a
...
...
@@ -2,11 +2,15 @@ package com.duben.heliapp.ui.widgets
import
android.app.Dialog
import
android.content.Context
import
android.text.TextUtils
import
android.view.Gravity
import
android.view.KeyEvent
import
android.view.View
import
android.view.WindowManager
import
android.widget.TextView
import
com.duben.heliapp.R
import
com.duben.heliapp.common.Constant
import
com.duben.heliapp.utils.AppPreferencesManager
class
JuniorDialog
(
private
val
context
:
Context
,
private
val
listener
:
DialogListener
...
...
@@ -15,7 +19,7 @@ class JuniorDialog(
private
val
lp
:
WindowManager
.
LayoutParams
private
val
view_close
:
View
private
val
view_done
:
View
private
val
view_open
:
View
private
val
view_open
:
Text
View
init
{
setContentView
(
R
.
layout
.
dialog_junior
)
...
...
@@ -38,6 +42,12 @@ class JuniorDialog(
view_done
=
findViewById
(
R
.
id
.
view_done
)
view_open
=
findViewById
(
R
.
id
.
view_open
)
if
(
TextUtils
.
isEmpty
(
AppPreferencesManager
.
get
().
getString
(
Constant
.
PSW_FLAG
,
""
)))
{
view_open
.
text
=
"开启青少年模式 >"
}
else
{
view_open
.
text
=
"关闭青少年模式 >"
}
listener
.
setDialog
(
this
)
view_open
.
setOnClickListener
{
listener
.
onClick
(
this
@JuniorDialog
,
view_open
)
...
...
video/app/src/main/res/layout/dialog_junior.xml
View file @
f890568a
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
android:layout_height=
"380dp"
android:background=
"@mipmap/bg_junior"
android:orientation=
"horizontal"
>
<LinearLayout
android:id=
"@+id/ll_content"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:
layout_centerInParent=
"true
"
android:
background=
"@drawable/shape_banner_write
"
a
ndroid:orientation=
"vertical
"
>
android:
gravity=
"center_horizontal
"
android:
orientation=
"vertical
"
a
pp:layout_constraintBottom_toBottomOf=
"parent
"
>
<
RelativeLayout
android:layout_width=
"
match_par
ent"
<
TextView
android:layout_width=
"
wrap_cont
ent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
>
android:text=
"青少年模式"
android:textColor=
"#0C0D19"
android:textSize=
"22sp"
android:textStyle=
"bold"
/>
<ImageView
android:id=
"@+id/view_close"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignParentEnd=
"true"
android:padding=
"10dp"
android:src=
"@mipmap/ic_activity_quit"
/>
<LinearLayout
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"60dp"
android:gravity=
"center_horizontal"
android:orientation=
"vertical"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"青少年模式"
android:textColor=
"#0C0D19"
android:textSize=
"20sp"
android:textStyle=
"bold"
/>
<TextView
android:id=
"@+id/tv_phone_dialog_phone"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:layout_marginStart=
"20dp"
android:layout_marginTop=
"20dp"
android:layout_marginEnd=
"20dp"
android:text=
"1、开启青年少模式后,将自动开始时间锁,每天使用时长最多为40分钟\n2、根据年龄段分级,更精细地推荐更多丰富内容,帮助青少年健康成长"
android:textColor=
"@color/gray"
android:textSize=
"14sp"
android:textStyle=
"bold"
/>
<TextView
android:id=
"@+id/view_open"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"20dp"
android:text=
"开启青少年模式 >"
android:textColor=
"#0C0D19"
android:textSize=
"16sp"
android:textStyle=
"bold"
/>
<TextView
android:id=
"@+id/view_done"
android:layout_width=
"200dp"
android:layout_height=
"40dp"
android:layout_gravity=
"center_horizontal"
android:layout_marginTop=
"20dp"
android:layout_marginBottom=
"30dp"
android:background=
"@drawable/shape_red"
android:gravity=
"center"
android:text=
"我知道了"
android:textColor=
"@color/white"
android:textSize=
"14sp"
/>
</LinearLayout>
</RelativeLayout>
<TextView
android:id=
"@+id/tv_phone_dialog_phone"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:layout_marginStart=
"20dp"
android:layout_marginTop=
"20dp"
android:layout_marginEnd=
"20dp"
android:text=
"1、开启青年少模式后,将自动开始时间锁,每天使用时长最多为40分钟\n2、根据年龄段分级,更精细地推荐更多丰富内容,帮助青少年健康成长"
android:textColor=
"@color/gray"
android:textSize=
"14sp"
android:textStyle=
"bold"
/>
<TextView
android:id=
"@+id/view_open"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"20dp"
android:text=
"开启青少年模式 >"
android:textColor=
"#0C0D19"
android:textSize=
"18sp"
android:textStyle=
"bold"
/>
<TextView
android:id=
"@+id/view_done"
android:layout_width=
"200dp"
android:layout_height=
"40dp"
android:layout_gravity=
"center_horizontal"
android:layout_marginTop=
"20dp"
android:layout_marginBottom=
"30dp"
android:background=
"@drawable/shape_red"
android:gravity=
"center"
android:text=
"我知道了"
android:textColor=
"@color/white"
android:textSize=
"14sp"
/>
</LinearLayout>
</RelativeLayout>
<ImageView
android:id=
"@+id/view_close"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_above=
"@id/ll_content"
android:layout_alignParentEnd=
"true"
android:layout_marginBottom=
"10dp"
android:padding=
"10dp"
android:src=
"@mipmap/ic_activity_quit"
app:layout_constraintBottom_toTopOf=
"@id/ll_content"
app:layout_constraintEnd_toEndOf=
"parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
video/app/src/main/res/mipmap-xhdpi/bg_junior.png
0 → 100644
View file @
f890568a
31.3 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