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
199e898c
Commit
199e898c
authored
Nov 21, 2024
by
mengcuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
2cae5664
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
219 additions
and
21 deletions
+219
-21
build.gradle
video/app/build.gradle
+2
-2
AndroidManifest.xml
video/app/src/main/AndroidManifest.xml
+6
-0
AlipayTimeActivity.kt
...com/duben/loveplayletu/ui/activitys/AlipayTimeActivity.kt
+60
-0
MainFragment.kt
...n/java/com/duben/loveplayletu/ui/fragment/MainFragment.kt
+2
-19
SimpleCountDownTimer.java
...m/duben/loveplayletu/ui/widgets/SimpleCountDownTimer.java
+123
-0
activity_alipaytime.xml
video/app/src/main/res/layout/activity_alipaytime.xml
+26
-0
No files found.
video/app/build.gradle
View file @
199e898c
...
...
@@ -10,8 +10,8 @@ android {
applicationId
"com.duben.loveplayletu"
minSdkVersion
rootProject
.
ext
.
androidMinSdkVersion
targetSdkVersion
rootProject
.
ext
.
androidTargetSdkVersion
versionCode
72
3
versionName
"7.2.
3
"
versionCode
72
5
versionName
"7.2.
5
"
flavorDimensions
"default"
// dex突破65535的限制
...
...
video/app/src/main/AndroidManifest.xml
View file @
199e898c
...
...
@@ -188,6 +188,12 @@
android:hardwareAccelerated=
"true"
android:screenOrientation=
"portrait"
/>
<activity
android:name=
".ui.activities.AlipayTimeActivity"
android:exported=
"false"
android:screenOrientation=
"portrait"
android:theme=
"@style/TransparentTheme"
/>
<activity
android:name=
".video.tx.newrecommend.NewTxVideoActivity"
android:exported=
"false"
...
...
video/app/src/main/java/com/duben/loveplayletu/ui/activitys/AlipayTimeActivity.kt
0 → 100644
View file @
199e898c
package
com.duben.loveplayletu.ui.activitys
import
android.view.KeyEvent
import
android.view.View
import
com.duben.library.utils.nodoubleclick.AntiShake
import
com.duben.loveplayletu.R
import
com.duben.loveplayletu.ui.activitys.base.BaseActivity
import
com.duben.loveplayletu.ui.widgets.SimpleCountDownTimer
import
kotlinx.android.synthetic.main.activity_alipaytime.*
/**
* 描述:支付倒计时
* 作者:孟崔广
*/
class
AlipayTimeActivity
:
BaseActivity
(),
View
.
OnClickListener
{
private
var
countDownTimer
:
SimpleCountDownTimer
?
=
null
override
fun
getContentViewLayoutID
()
=
R
.
layout
.
activity_alipaytime
override
fun
isApplyKitKatTranslucency
()
=
false
override
fun
toggleOverridePendingTransition
()
=
true
override
fun
getOverridePendingTransitionMode
()
=
TransitionMode
.
SCALE
override
fun
initViewsAndEvents
()
{
countDownTimer
=
SimpleCountDownTimer
(
5000
,
tv_alipaytime
).
setOnFinishListener
{
showToast
(
"11111"
)
}.
start
()
as
SimpleCountDownTimer
?
}
override
fun
finish
()
{
super
.
finish
()
overridePendingTransition
(
0
,
R
.
anim
.
scale_out
)
}
override
fun
onDestroy
()
{
super
.
onDestroy
()
countDownTimer
?.
cancel
()
}
override
fun
onKeyDown
(
keyCode
:
Int
,
event
:
KeyEvent
):
Boolean
{
return
if
(
keyCode
==
KeyEvent
.
KEYCODE_BACK
)
{
true
}
else
super
.
onKeyDown
(
keyCode
,
event
)
}
override
fun
onClick
(
v
:
View
)
{
if
(
AntiShake
.
check
(
v
.
id
))
return
// when (v.id) {
// R.id.ivAwardBack -> {
// finish()
// }
// }
}
}
\ No newline at end of file
video/app/src/main/java/com/duben/loveplayletu/ui/fragment/MainFragment.kt
View file @
199e898c
...
...
@@ -89,21 +89,6 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
* 跳转到主页面
*/
private
fun
goToMainActivity
()
{
// if (UserManager.getInstance().newFlag && !UserManager.getInstance().vipFlag) {
// homePresenter.getRecommendVedio()
//
// val bundle = Bundle()
// bundle.putBoolean(VipActivity.IS_MAIN, true)
// readyGo(VipActivity::class.java, bundle)
// } else {
// homePresenter.getSoltVedio()
// }
// if (UserManager.getInstance().newFlag && !UserManager.getInstance().vipFlag) {
// val bundle = Bundle()
// bundle.putBoolean(VipActivity.IS_MAIN, true)
// readyGo(VipActivity::class.java, bundle)
// }
homePresenter
.
getSoltVedio
()
}
...
...
@@ -116,9 +101,6 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
if
(
AppConfig
.
fragmentClickFlag
==
Constant
.
FRAGMENT_CLICK_ONE
)
{
if
(
AntiShake
.
check
(
banner
?.
id
))
return
// if (!UserManager.getInstance().vipFlag) {
// BannerManager.loadAd(requireActivity(), fl_main_banner)
// }
BannerManager
.
loadAd
(
requireActivity
(),
fl_main_banner
)
if
(
AppConfig
.
exitLoginMainRefresh
)
{
...
...
@@ -167,7 +149,8 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
if
(
AntiShake
.
check
(
v
?.
id
))
return
when
(
v
?.
id
)
{
R
.
id
.
iv_kefu_main
->
{
(
requireActivity
()
as
MainActivity
).
backPhoneDialog
()
// (requireActivity() as MainActivity).backPhoneDialog()
readyGo
(
AlipayTimeActivity
::
class
.
java
)
}
R
.
id
.
iv_main_watching_close
->
{
LocalVedioManager
.
closeCacheVedio
()
...
...
video/app/src/main/java/com/duben/loveplayletu/ui/widgets/SimpleCountDownTimer.java
0 → 100644
View file @
199e898c
package
com
.
duben
.
loveplayletu
.
ui
.
widgets
;
import
android.os.CountDownTimer
;
import
android.widget.TextView
;
/**
* 简单 时,分,秒,毫秒倒计时
*
* @author Luo Guowen Email:<a href="#">luoguowen123@qq.com</a>
* <p>
* 精确到毫秒
*/
public
class
SimpleCountDownTimer
extends
CountDownTimer
{
// 默认倒计时间隔
private
static
final
long
DEFAULT_INTERVAL
=
100L
;
/**
* 秒,分,时对应的毫秒数
*/
private
int
sec
=
1000
,
min
=
sec
*
60
,
hr
=
min
*
60
;
/**
* 显示时间的视图
*/
private
TextView
tvDisplay
;
/**
* 结束监听
*/
private
static
OnFinishListener
onFinishListener
;
/**
* @param millisInFuture 倒计时总时间 单位:毫秒
* The number of millis in the future from the call
* to {@link #start()} until the countdown is done and {@link #onFinish()}
* is called.
* @param countDownInterval 倒计时间隔 单位:毫秒
* The interval along the way to receive
* {@link #onTick(long)} callbacks.
* @param tvDisplay 显示时间的视图
*/
public
SimpleCountDownTimer
(
long
millisInFuture
,
long
countDownInterval
,
TextView
tvDisplay
)
{
super
(
millisInFuture
,
countDownInterval
);
this
.
tvDisplay
=
tvDisplay
;
}
/**
* @param millisInFuture 倒计时总时间 单位:毫秒
* The number of millis in the future from the call
* to {@link #start()} until the countdown is done and {@link #onFinish()}
* is called.
* @param tvDisplay 显示时间的视图
*/
public
SimpleCountDownTimer
(
long
millisInFuture
,
TextView
tvDisplay
)
{
super
(
millisInFuture
,
DEFAULT_INTERVAL
);
this
.
tvDisplay
=
tvDisplay
;
}
/**
* 每一次间隔时间到后调用
*
* @param millisUntilFinished 剩余总时间 单位:毫秒
*/
@Override
public
void
onTick
(
long
millisUntilFinished
)
{
// 剩余的小时,分钟,秒,毫秒
long
lHr
=
millisUntilFinished
/
hr
;
long
lMin
=
(
millisUntilFinished
-
lHr
*
hr
)
/
min
;
long
lSec
=
(
millisUntilFinished
-
lHr
*
hr
-
lMin
*
min
)
/
sec
;
long
lMs
=
millisUntilFinished
-
lHr
*
hr
-
lMin
*
min
-
lSec
*
sec
;
String
strLHr
=
getTime
(
lHr
);
String
strLMin
=
getTime
(
lMin
);
String
strLSec
=
getTime
(
lSec
);
String
strLMs
=
getMs
(
lMs
);
// 依次拼接时间 时:分:秒:毫秒
tvDisplay
.
setText
(
strLHr
+
":"
+
strLMin
+
":"
+
strLSec
+
":"
+
strLMs
);
}
/**
* 根据毫秒换算成相应单位后是否大于10来返回相应时间
*/
private
String
getTime
(
long
time
)
{
return
time
>
10
?
String
.
valueOf
(
time
)
:
"0"
+
time
;
}
/**
* 获取毫秒
*/
private
String
getMs
(
long
time
)
{
String
strMs
=
String
.
valueOf
(
time
);
return
time
>
100
?
strMs
.
substring
(
0
,
strMs
.
length
()
-
1
)
:
"00"
;
}
/**
* 结束监听,可以在倒计时结束时做一些事
*/
public
interface
OnFinishListener
{
void
onFinish
();
}
/**
* 设置结束监听
*
* @param onFinishListener 结束监听对象
*/
public
SimpleCountDownTimer
setOnFinishListener
(
OnFinishListener
onFinishListener
)
{
SimpleCountDownTimer
.
onFinishListener
=
onFinishListener
;
return
this
;
}
/**
* 倒计时结束时调用
*/
@Override
public
void
onFinish
()
{
tvDisplay
.
setText
(
"00:00:00"
);
if
(
onFinishListener
!=
null
)
onFinishListener
.
onFinish
();
}
}
video/app/src/main/res/layout/activity_alipaytime.xml
0 → 100644
View file @
199e898c
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/full_transparent"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
<ImageView
android:layout_width=
"200dp"
android:layout_height=
"200dp"
android:layout_gravity=
"center"
android:src=
"@mipmap/ic_my_new"
></ImageView>
<TextView
android:id=
"@+id/tv_alipaytime"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:textColor=
"@color/red"
></TextView>
</LinearLayout>
</ScrollView>
\ No newline at end of file
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