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
43f74098
Commit
43f74098
authored
Oct 11, 2023
by
mengcuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
39b113e4
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
455 additions
and
7 deletions
+455
-7
AndroidManifest.xml
video/app/src/main/AndroidManifest.xml
+5
-0
GiftPresenter.kt
...ava/com/duben/xixiplaylet/mvp/presenters/GiftPresenter.kt
+95
-0
HomePresenter.kt
...ava/com/duben/xixiplaylet/mvp/presenters/HomePresenter.kt
+31
-0
GiftView.kt
...src/main/java/com/duben/xixiplaylet/mvp/views/GiftView.kt
+8
-0
HomeView.kt
...src/main/java/com/duben/xixiplaylet/mvp/views/HomeView.kt
+1
-0
LoanService.java
.../src/main/java/com/duben/xixiplaylet/net/LoanService.java
+6
-0
AboutusActivity.kt
...ava/com/duben/xixiplaylet/ui/activitys/AboutusActivity.kt
+1
-1
GiftActivity.kt
...n/java/com/duben/xixiplaylet/ui/activitys/GiftActivity.kt
+153
-0
MainFragment.kt
...in/java/com/duben/xixiplaylet/ui/fragment/MainFragment.kt
+10
-5
activity_gift.xml
video/app/src/main/res/layout/activity_gift.xml
+145
-0
activity_mobile_login.xml
video/app/src/main/res/layout/activity_mobile_login.xml
+0
-1
No files found.
video/app/src/main/AndroidManifest.xml
View file @
43f74098
...
...
@@ -149,6 +149,11 @@
android:exported=
"false"
android:theme=
"@style/TransparentTheme"
/>
<activity
android:name=
".ui.activitys.GiftActivity"
android:exported=
"false"
android:theme=
"@style/TransparentTheme"
/>
<activity
android:name=
".ui.activitys.RecommendActivity"
android:exported=
"false"
...
...
video/app/src/main/java/com/duben/xixiplaylet/mvp/presenters/GiftPresenter.kt
0 → 100644
View file @
43f74098
package
com.duben.xixiplaylet.mvp.presenters
import
com.duben.library.net.neterror.BaseSubscriber
import
com.duben.library.net.neterror.Throwable
import
com.duben.xixiplaylet.common.DeviceInfo
import
com.duben.xixiplaylet.manager.AppHttpManager
import
com.duben.xixiplaylet.mvp.model.BaseResponse
import
com.duben.xixiplaylet.mvp.model.UserBean
import
com.duben.xixiplaylet.mvp.views.GiftView
import
com.duben.xixiplaylet.utils.DeviceUuidFactory
class
GiftPresenter
:
BasePresenter
<
GiftView
>()
{
/**
* 手机验证码
*
* @param mobile
*/
fun
sendMobileCode
(
mobile
:
String
)
{
view
.
showLoading
(
""
)
val
vo
=
HashMap
<
String
,
Any
>()
vo
[
"mobile"
]
=
mobile
vo
[
"type"
]
=
1
AppHttpManager
.
getInstance
(
loanApplication
)
.
call
(
loanService
.
sendMobileCode
(
vo
),
object
:
BaseSubscriber
<
BaseResponse
<
Any
>>()
{
override
fun
onCompleted
()
{
if
(
isLinkView
)
return
view
.
hideLoading
()
}
override
fun
onError
(
e
:
Throwable
)
{
if
(
isLinkView
)
return
view
.
hideLoading
()
view
.
showToast
(
e
.
message
)
}
override
fun
onNext
(
baseResponse
:
BaseResponse
<
Any
>)
{
if
(
isLinkView
)
return
view
.
hideLoading
()
val
code
:
Int
=
baseResponse
.
getStatus
()
val
message
:
String
=
baseResponse
.
getMessage
()
when
(
code
)
{
200
->
{
}
else
->
{
view
.
showToast
(
message
)
}
}
}
})
}
/**
* 登录
*/
fun
login
(
mobile
:
String
,
smsCode
:
String
)
{
view
.
showLoading
(
"加载中..."
)
val
vo
=
HashMap
<
String
,
Any
>()
vo
[
"mobile"
]
=
mobile
vo
[
"smsCode"
]
=
smsCode
vo
[
"device"
]
=
DeviceUuidFactory
().
deviceUuid
.
toString
()
val
macAddress
:
String
=
DeviceInfo
.
instance
.
getMacAddress
()
vo
[
"mac"
]
=
macAddress
.
replace
(
":"
,
""
)
AppHttpManager
.
getInstance
(
loanApplication
)
.
call
(
loanService
.
login
(
vo
),
object
:
BaseSubscriber
<
BaseResponse
<
UserBean
>>()
{
override
fun
onCompleted
()
{
if
(
isLinkView
)
return
view
.
hideLoading
()
}
override
fun
onError
(
e
:
Throwable
)
{
if
(
isLinkView
)
return
view
.
hideLoading
()
view
.
showToast
(
e
.
message
)
}
override
fun
onNext
(
baseResponse
:
BaseResponse
<
UserBean
>)
{
if
(
isLinkView
)
return
view
.
hideLoading
()
val
code
=
baseResponse
.
getStatus
()
val
message
=
baseResponse
.
getMessage
()
val
data
:
UserBean
?
=
baseResponse
.
getData
()
when
(
code
)
{
200
->
if
(
data
!=
null
)
{
view
.
loginSuc
()
}
else
->
view
.
showToast
(
message
)
}
}
})
}
}
\ No newline at end of file
video/app/src/main/java/com/duben/xixiplaylet/mvp/presenters/HomePresenter.kt
View file @
43f74098
...
...
@@ -11,6 +11,7 @@ import com.duben.xixiplaylet.utils.AppPreferencesManager
import
com.duben.xixiplaylet.utils.DeviceUuidFactory
import
com.duben.library.net.neterror.BaseSubscriber
import
com.duben.library.net.neterror.Throwable
import
com.google.gson.JsonObject
import
java.util.HashMap
class
HomePresenter
:
BasePresenter
<
HomeView
>()
{
...
...
@@ -277,4 +278,34 @@ class HomePresenter : BasePresenter<HomeView>() {
}
})
}
fun
getGift
()
{
AppHttpManager
.
getInstance
(
loanApplication
)
.
call
(
loanService
.
getGift
(),
object
:
BaseSubscriber
<
BaseResponse
<
JsonObject
>>()
{
override
fun
onCompleted
()
{
if
(
isLinkView
)
return
}
override
fun
onError
(
e
:
Throwable
)
{
if
(
isLinkView
)
return
}
override
fun
onNext
(
baseResponse
:
BaseResponse
<
JsonObject
>)
{
if
(
isLinkView
)
return
val
code
=
baseResponse
.
status
val
message
=
baseResponse
.
message
when
(
code
)
{
200
->
{
view
.
giftSuc
(
false
)
}
else
->
{
view
.
showToast
(
message
)
}
}
}
})
}
}
\ No newline at end of file
video/app/src/main/java/com/duben/xixiplaylet/mvp/views/GiftView.kt
0 → 100644
View file @
43f74098
package
com.duben.xixiplaylet.mvp.views
interface
GiftView
:
BaseView
{
/**
* 登录成功
*/
fun
loginSuc
()
}
\ No newline at end of file
video/app/src/main/java/com/duben/xixiplaylet/mvp/views/HomeView.kt
View file @
43f74098
...
...
@@ -9,6 +9,7 @@ interface HomeView : BaseView {
fun
ordersSuc
(
data
:
BannerList
?)
fun
getSoltVedioSuc
(
data
:
IndexList
?)
fun
getRecommendVedioSuc
(
data
:
RecoBean
?)
fun
giftSuc
(
data
:
Boolean
)
fun
showTurnSuc
(
data
:
NineShowBean
)
}
video/app/src/main/java/com/duben/xixiplaylet/net/LoanService.java
View file @
43f74098
...
...
@@ -310,6 +310,12 @@ public interface LoanService {
@POST
(
"api/vedio/showTurn"
)
Observable
<
BaseResponse
<
NineShowBean
>>
showTurn
();
/**
* 是否展示礼物
*/
@POST
(
"api/vedio/showTurn"
)
Observable
<
BaseResponse
<
JsonObject
>>
getGift
();
/**
* 默认http工厂
*/
...
...
video/app/src/main/java/com/duben/xixiplaylet/ui/activitys/AboutusActivity.kt
View file @
43f74098
...
...
@@ -62,7 +62,7 @@ class AboutusActivity : BaseActivity(), View.OnClickListener {
// object : TTMediationTestTool.ImageCallBack {
// override fun loadImage(imageView: ImageView?, s: String?) {}
// })
// readyGo(NinePay
Activity::class.java)
readyGo
(
Gift
Activity
::
class
.
java
)
// VoiceRedEnvelopeManager.load(23,23)
true
}
...
...
video/app/src/main/java/com/duben/xixiplaylet/ui/activitys/GiftActivity.kt
0 → 100644
View file @
43f74098
package
com.duben.xixiplaylet.ui.activitys
import
android.os.Handler
import
android.os.Looper
import
android.text.TextUtils
import
android.view.KeyEvent
import
android.view.View
import
com.duben.library.utils.nodoubleclick.AntiShake
import
com.duben.xixiplaylet.R
import
com.duben.xixiplaylet.manager.UserManager
import
com.duben.xixiplaylet.mvp.presenters.GiftPresenter
import
com.duben.xixiplaylet.mvp.views.GiftView
import
com.duben.xixiplaylet.ui.activitys.base.BaseActivity
import
com.duben.xixiplaylet.utils.BackInputUtil
import
com.duben.xixiplaylet.utils.LogUtil
import
kotlinx.android.synthetic.main.activity_gift.*
/**
* 描述:领券
* 作者:孟崔广
* 时间:2023/10/11 14:21
*/
class
GiftActivity
:
BaseActivity
(),
GiftView
,
View
.
OnClickListener
{
private
val
giftPresenter
by
lazy
{
GiftPresenter
()
}
private
var
mobile
:
String
?
=
null
override
fun
initViewsAndEvents
()
{
giftPresenter
.
attachView
(
this
)
initView
()
initListener
()
}
override
fun
getContentViewLayoutID
()
=
R
.
layout
.
activity_gift
override
fun
toggleOverridePendingTransition
()
=
true
override
fun
getOverridePendingTransitionMode
()
=
TransitionMode
.
FADE
override
fun
isApplyKitKatTranslucency
()
=
false
override
fun
onDestroy
()
{
super
.
onDestroy
()
giftPresenter
.
detachView
()
}
override
fun
onKeyDown
(
keyCode
:
Int
,
event
:
KeyEvent
):
Boolean
{
return
if
(
keyCode
==
KeyEvent
.
KEYCODE_BACK
)
{
true
}
else
super
.
onKeyDown
(
keyCode
,
event
)
}
override
fun
finish
()
{
super
.
finish
()
//关闭窗体动画显示
overridePendingTransition
(
0
,
R
.
anim
.
push_bottom_out
)
}
override
fun
onClick
(
v
:
View
?)
{
if
(
AntiShake
.
check
(
v
?.
id
))
return
when
(
v
?.
id
)
{
R
.
id
.
iv_left_icon
->
{
finish
()
}
R
.
id
.
tvLoginSendcode
->
{
var
mobile
=
etLoginMobile
.
text
.
toString
().
trim
()
if
(
mobile
.
length
<
13
)
{
showToast
(
"请输入手机号"
)
return
}
sendCodeThread
()
mobile
=
mobile
.
replace
(
" "
.
toRegex
(),
""
)
giftPresenter
.
sendMobileCode
(
mobile
)
}
R
.
id
.
tvLoginNext
->
{
var
mobile
=
etLoginMobile
.
text
.
toString
().
trim
()
if
(
mobile
.
length
<
13
)
{
showToast
(
"请输入手机号"
)
return
}
val
code
=
etLoginCode
.
text
.
toString
().
trim
()
if
(
code
.
length
<
4
)
{
showToast
(
"请输入验证码"
)
return
}
mobile
=
mobile
.
replace
(
" "
.
toRegex
(),
""
)
giftPresenter
.
login
(
mobile
,
code
)
}
}
}
override
fun
loginSuc
()
{
if
(
isFinishing
)
return
showToast
(
"领取成功"
)
Handler
(
Looper
.
getMainLooper
()).
postDelayed
({
if
(
isFinishing
)
return
@postDelayed
finish
()
},
500
)
}
private
fun
initView
()
{
BackInputUtil
.
phoneNumAddSpace
(
etLoginMobile
)
mobile
=
UserManager
.
getInstance
().
mobile
if
(!
TextUtils
.
isEmpty
(
mobile
))
{
etLoginMobile
.
setText
(
mobile
)
etLoginMobile
.
setSelection
(
mobile
!!
.
length
+
2
)
}
}
private
fun
initListener
()
{
tvLoginSendcode
.
setOnClickListener
(
this
)
tvLoginNext
.
setOnClickListener
(
this
)
}
var
num
=
0
var
run
:
Runnable
?
=
null
fun
sendCodeThread
()
{
num
=
60
tvLoginSendcode
?.
let
{
it
.
isEnabled
=
false
it
.
text
=
"($num)重新获取"
run
=
object
:
Runnable
{
override
fun
run
()
{
num
--
LogUtil
.
d
(
"login"
,
"login num:$num"
)
if
(
num
==
0
)
{
it
.
text
=
"重新获取"
it
.
isEnabled
=
true
}
else
{
it
.
text
=
"($num)重新获取"
it
.
postDelayed
(
this
,
1000
)
}
}
}
it
.
postDelayed
(
run
,
1000
)
}
}
}
\ No newline at end of file
video/app/src/main/java/com/duben/xixiplaylet/ui/fragment/MainFragment.kt
View file @
43f74098
...
...
@@ -26,10 +26,6 @@ import com.duben.xixiplaylet.manager.UserManager
import
com.duben.xixiplaylet.mvp.model.*
import
com.duben.xixiplaylet.mvp.presenters.HomePresenter
import
com.duben.xixiplaylet.mvp.views.HomeView
import
com.duben.xixiplaylet.ui.activitys.NineActivity
import
com.duben.xixiplaylet.ui.activitys.NinePayActivity
import
com.duben.xixiplaylet.ui.activitys.RecommendActivity
import
com.duben.xixiplaylet.ui.activitys.VipActivity
import
com.duben.xixiplaylet.ui.adapter.HomeVideoPageAdapter
import
com.duben.xixiplaylet.ui.adapter.ImageTitleAdapter
import
com.duben.xixiplaylet.ui.adapter.TopAdapter
...
...
@@ -39,6 +35,7 @@ import com.duben.xixiplaylet.utils.SpanUtils
import
com.duben.library.utils.GlideUtils
import
com.duben.library.utils.json.JsonUtil
import
com.duben.library.utils.nodoubleclick.AntiShake
import
com.duben.xixiplaylet.ui.activitys.*
import
kotlinx.android.synthetic.main.fragment_main.*
import
java.lang.reflect.Field
import
java.util.*
...
...
@@ -61,6 +58,7 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
private
var
vpAdapter
:
HomeVideoPageAdapter
?
=
null
private
var
topAdapter
:
TopAdapter
?
=
null
private
var
recommendVedioBean
:
RecoBean
?
=
null
private
var
isShowGiftAct
=
false
private
val
homePresenter
by
lazy
{
HomePresenter
()
}
...
...
@@ -108,7 +106,7 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
val
bundle
=
Bundle
()
bundle
.
putBoolean
(
VipActivity
.
IS_MAIN
,
true
)
readyGo
(
VipActivity
::
class
.
java
,
bundle
)
}
else
{
}
else
{
homePresenter
.
getSoltVedio
()
}
}
...
...
@@ -140,6 +138,7 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
}
else
{
homePresenter
.
topTabs
()
homePresenter
.
orders
()
homePresenter
.
getGift
()
TrackManager
.
getInstance
().
getMyInfo
()
showRecommendAct
(
recommendVedioBean
)
}
...
...
@@ -355,6 +354,12 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
this
.
recommendVedioBean
=
data
}
override
fun
giftSuc
(
flag
:
Boolean
)
{
if
(
flag
&&
!
isShowGiftAct
)
{
isShowGiftAct
=
true
readyGo
(
GiftActivity
::
class
.
java
)
}
}
override
fun
showTurnSuc
(
data
:
NineShowBean
)
{
AppPreferencesManager
.
get
().
put
(
Constant
.
LUCKY_FLAG
,
data
.
isShow
)
...
...
video/app/src/main/res/layout/activity_gift.xml
0 → 100644
View file @
43f74098
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"#90000000"
android:orientation=
"vertical"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_centerInParent=
"true"
android:orientation=
"vertical"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<androidx.constraintlayout.widget.Guideline
android:id=
"@+id/guideline22"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
app:layout_constraintGuide_percent=
"0.95"
/>
<androidx.constraintlayout.widget.Guideline
android:id=
"@+id/guideline21"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
app:layout_constraintGuide_percent=
"0.05"
/>
<LinearLayout
android:id=
"@+id/ly_mobile"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"10dp"
android:background=
"@drawable/shape_bg_mobile"
android:elevation=
"5dp"
android:orientation=
"horizontal"
app:layout_constraintEnd_toEndOf=
"@+id/ly_code"
app:layout_constraintStart_toStartOf=
"@+id/ly_code"
app:layout_constraintTop_toTopOf=
"parent"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"10dp"
android:background=
"@mipmap/ic_mobile"
/>
<com.duben.xixiplaylet.ui.widgets.ClearEditText
android:id=
"@+id/etLoginMobile"
android:layout_width=
"match_parent"
android:layout_height=
"50dp"
android:layout_marginLeft=
"20dp"
android:layout_marginRight=
"30dp"
android:background=
"@null"
android:gravity=
"center_vertical"
android:hint=
"请输入您的手机号"
android:inputType=
"number"
android:maxLength=
"13"
android:maxLines=
"1"
android:textColor=
"#172B54"
android:textColorHint=
"#BEC2CC"
android:textSize=
"12sp"
/>
</LinearLayout>
<LinearLayout
android:id=
"@+id/ly_code"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"10dp"
android:layout_marginBottom=
"30dp"
android:background=
"@drawable/shape_bg_mobile"
android:elevation=
"5dp"
android:orientation=
"horizontal"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toStartOf=
"@+id/guideline22"
app:layout_constraintStart_toStartOf=
"@+id/guideline21"
app:layout_constraintTop_toBottomOf=
"@+id/ly_mobile"
tools:ignore=
"MissingConstraints"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"10dp"
android:background=
"@mipmap/ic_code"
android:gravity=
"center_horizontal"
/>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"50dp"
android:layout_marginLeft=
"20dp"
android:layout_marginRight=
"30dp"
>
<com.duben.xixiplaylet.ui.widgets.ClearEditText
android:id=
"@+id/etLoginCode"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_centerVertical=
"true"
android:layout_marginRight=
"100dp"
android:background=
"@null"
android:hint=
"输入手机验证码"
android:inputType=
"number"
android:maxLength=
"4"
android:maxLines=
"1"
android:textColor=
"#172B54"
android:textColorHint=
"#BEC2CC"
android:textSize=
"12sp"
/>
<TextView
android:id=
"@+id/tvLoginSendcode"
android:layout_width=
"wrap_content"
android:layout_height=
"30dp"
android:layout_alignParentRight=
"true"
android:layout_centerVertical=
"true"
android:gravity=
"center"
android:text=
"获取验证码"
android:textColor=
"@color/tv_message_recente_money"
android:textSize=
"12sp"
/>
</RelativeLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id=
"@+id/tvLoginNext"
android:layout_width=
"match_parent"
android:layout_height=
"50dp"
android:layout_gravity=
"center_horizontal"
android:layout_marginLeft=
"40dp"
android:layout_marginTop=
"20dp"
android:layout_marginRight=
"40dp"
android:background=
"@drawable/shape_red"
android:gravity=
"center"
android:text=
"绑定手机号"
android:textColor=
"@color/white"
android:textSize=
"20sp"
/>
</LinearLayout>
</RelativeLayout>
\ No newline at end of file
video/app/src/main/res/layout/activity_mobile_login.xml
View file @
43f74098
...
...
@@ -17,7 +17,6 @@
android:layout_marginTop=
"20dp"
android:src=
"@mipmap/ic_launcher_main"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
...
...
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