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
839517aa
Commit
839517aa
authored
Jul 03, 2023
by
jyx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
748a830d
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
58 additions
and
25 deletions
+58
-25
.gitignore
video/.gitignore
+2
-1
compiler.xml
video/.idea/compiler.xml
+1
-1
BaseActivity.java
...com/mints/wisdomclean/ui/activitys/base/BaseActivity.java
+13
-3
JzvdStdTikTok.kt
...rc/main/java/com/mints/wisdomclean/video/JzvdStdTikTok.kt
+14
-2
OnRecyViewListener.kt
...in/java/com/mints/wisdomclean/video/OnRecyViewListener.kt
+1
-1
RecyViewLayoutManager.kt
...java/com/mints/wisdomclean/video/RecyViewLayoutManager.kt
+1
-0
VideoActivity.kt
...rc/main/java/com/mints/wisdomclean/video/VideoActivity.kt
+9
-3
VideoAdapter.kt
...src/main/java/com/mints/wisdomclean/video/VideoAdapter.kt
+15
-12
VideoBean.kt
...pp/src/main/java/com/mints/wisdomclean/video/VideoBean.kt
+1
-1
item_video.xml
video/app/src/main/res/layout/item_video.xml
+1
-1
No files found.
video/.gitignore
View file @
839517aa
...
...
@@ -9,4 +9,5 @@
app/build
picture_library/build
ucrop/build
\ No newline at end of file
ucrop/build
videocache/build
\ No newline at end of file
video/.idea/compiler.xml
View file @
839517aa
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"CompilerConfiguration"
>
<bytecodeTargetLevel
target=
"1
1
"
/>
<bytecodeTargetLevel
target=
"1
5
"
/>
</component>
</project>
\ No newline at end of file
video/app/src/main/java/com/mints/wisdomclean/ui/activitys/base/BaseActivity.java
View file @
839517aa
...
...
@@ -6,9 +6,12 @@ import android.content.DialogInterface;
import
android.content.Intent
;
import
android.content.IntentFilter
;
import
android.content.pm.ActivityInfo
;
import
android.graphics.Color
;
import
android.os.Build
;
import
android.os.Bundle
;
import
androidx.core.content.ContextCompat
;
import
android.text.TextUtils
;
import
android.view.KeyEvent
;
import
android.view.MotionEvent
;
...
...
@@ -41,18 +44,25 @@ public abstract class BaseActivity extends BaseAppCompatActivity implements Base
try
{
if
(
TextUtils
.
equals
(
getClass
().
getSimpleName
(),
"SplashActivity"
)
||
TextUtils
.
equals
(
getClass
().
getSimpleName
(),
"GuideActivity"
)
)
{
TextUtils
.
equals
(
getClass
().
getSimpleName
(),
"GuideActivity"
))
{
getWindow
().
setFlags
(
WindowManager
.
LayoutParams
.
FLAG_FULLSCREEN
,
WindowManager
.
LayoutParams
.
FLAG_FULLSCREEN
);
}
else
if
(
TextUtils
.
equals
(
getClass
().
getSimpleName
(),
"VideoActivity"
))
{
StatusBarUtil
.
transparencyBar
(
this
);
//设置状态栏全透明
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
Q
)
{
getWindow
().
setNavigationBarColor
(
Color
.
BLACK
);
}
}
else
{
StatusBarUtil
.
transparencyBar
(
this
);
//设置状态栏全透明
StatusBarUtil
.
StatusBarLightMode
(
this
);
//设置白底黑字
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
Q
)
{
getWindow
().
setNavigationBarColor
(
Color
.
TRANSPARENT
);
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
if
(
isApplyKitKatTranslucency
())
{
setSystemBarTintDrawable
(
ContextCompat
.
getDrawable
(
getContext
(),
R
.
drawable
.
sr_primary
));
}
...
...
@@ -256,7 +266,7 @@ public abstract class BaseActivity extends BaseAppCompatActivity implements Base
filter
.
addAction
(
Constant
.
ACTION_EXIT_APP
);
filter
.
addCategory
(
Intent
.
CATEGORY_DEFAULT
);
MintsApplication
.
getLocalBroadcastManager
().
unregisterReceiver
(
mExitReceiver
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
}
...
...
video/app/src/main/java/com/mints/wisdomclean/video/JzvdStdTikTok.kt
View file @
839517aa
package
com.
cwj.updownshort
video
package
com.
mints.wisdomclean.
video
import
android.content.Context
import
android.util.AttributeSet
...
...
@@ -6,7 +6,6 @@ import android.util.Log
import
android.view.View
import
android.widget.ImageView
import
android.widget.Toast
import
cn.jzvd.JZUtils
import
cn.jzvd.Jzvd
import
cn.jzvd.JzvdStd
import
com.mints.wisdomclean.R
...
...
@@ -126,6 +125,7 @@ class JzvdStdTikTok : JzvdStd {
override
fun
onCompletion
()
{
// RxBus.INSTANCE.post(RXCmCWJ(121))
onVideoCompletion
?.
onVideoCompletion
()
}
...
...
@@ -146,4 +146,16 @@ class JzvdStdTikTok : JzvdStd {
replayTextView
.
visibility
=
View
.
GONE
}
}
fun
setOnVideoCompletion
(
onVideoCompletion
:
OnVideoCompletion
?)
{
this
.
onVideoCompletion
=
onVideoCompletion
}
private
var
onVideoCompletion
:
OnVideoCompletion
?
=
null
interface
OnVideoCompletion
{
fun
onVideoCompletion
()
}
}
video/app/src/main/java/com/mints/wisdomclean/video/OnRecyViewListener.kt
View file @
839517aa
package
com.
cwj.updownshort
video
package
com.
mints.wisdomclean.
video
/**
* author : ChenWenJie
...
...
video/app/src/main/java/com/mints/wisdomclean/video/RecyViewLayoutManager.kt
View file @
839517aa
...
...
@@ -5,6 +5,7 @@ import android.view.View
import
androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.PagerSnapHelper
import
androidx.recyclerview.widget.RecyclerView
import
com.mints.wisdomclean.video.OnRecyViewListener
/**
* author : ChenWenJie
...
...
video/app/src/main/java/com/mints/wisdomclean/video/VideoActivity.kt
View file @
839517aa
...
...
@@ -25,7 +25,7 @@ class VideoActivity : BaseActivity() {
override
fun
isApplyKitKatTranslucency
()
=
false
fun
initView
()
{
va
r
recyViewLayoutManager
=
RecyViewLayoutManager
(
va
l
recyViewLayoutManager
=
RecyViewLayoutManager
(
this
,
OrientationHelper
.
VERTICAL
)
recy
.
layoutManager
=
recyViewLayoutManager
...
...
@@ -36,11 +36,18 @@ class VideoActivity : BaseActivity() {
//指定位置其他页面跳转过来。直接定位指定posion 这里不需要。
// recy.scrollToPosition(postion);
adapter
.
setOnVideoCompletion
(
object
:
JzvdStdTikTok
.
OnVideoCompletion
{
override
fun
onVideoCompletion
()
{
recy
.
smoothScrollToPosition
(
mCurrentPosition
+
1
)
}
})
recyViewLayoutManager
.
setOnViewPagerListener
(
object
:
OnRecyViewListener
{
override
fun
onInitComplete
()
{
mCurrentPosition
=
0
//初始化 自动播放
autoPlayVideo
()
}
override
fun
onPageRelease
(
isNext
:
Boolean
,
position
:
Int
)
{
...
...
@@ -155,7 +162,6 @@ class VideoActivity : BaseActivity() {
if
(
player
!=
null
)
{
player
.
startVideoAfterPreloading
()
//播放开始,进行倒计时
}
}
...
...
video/app/src/main/java/com/mints/wisdomclean/video/VideoAdapter.kt
View file @
839517aa
package
com.
cwj.updownshort
video
package
com.
mints.wisdomclean.
video
import
android.app.Activity
import
android.net.Uri
import
android.util.Log
import
android.widget.ImageView
import
cn.jzvd.JZUtils
import
cn.jzvd.Jzvd
import
cn.jzvd.JzvdStd
import
com.bumptech.glide.Glide
...
...
@@ -33,23 +30,22 @@ class VideoAdapter(var activity: Activity) :
holder
.
setText
(
R
.
id
.
usertitle_tv
,
item
.
video_title
)
//缩略图
Glide
.
with
(
activity
).
load
(
item
.
video_image
)
.
into
(
holder
?.
getView
<
JzvdStdTikTok
>(
R
.
id
.
jz_video
)
!!
.
posterImageView
)
.
into
(
holder
.
getView
<
JzvdStdTikTok
>(
R
.
id
.
jz_video
)
.
posterImageView
)
//声明 代理服务缓存
val
proxy
=
MintsApplication
.
StaticParams
.
getProxy
()
//这个缓存下一个
if
(
holder
?.
layoutPosition
!!
+
1
<
itemCount
)
{
var
item1
=
getItem
(
holder
?.
layoutPosition
!!
+
1
)
if
(
holder
.
layoutPosition
+
1
<
itemCount
)
{
var
item1
=
getItem
(
holder
.
layoutPosition
+
1
)
//缓存下一个 10秒
proxy
!!
.
preLoad
(
item1
!!
.
video_path
,
10
)
proxy
!!
.
preLoad
(
item1
.
video_path
,
10
)
}
//缓存当前,播放当前
var
proxyUrl
=
proxy
?.
getProxyUrl
(
item
.
video_path
).
toString
()
//设置视
var
proxyUrl
=
proxy
?.
getProxyUrl
(
item
.
video_path
).
toString
()
//设置视
setPlay
(
holder
.
getView
(
R
.
id
.
jz_video
),
proxyUrl
)
setPlay
(
holder
.
getView
(
R
.
id
.
jz_video
),
proxyUrl
)
}
...
...
@@ -61,8 +57,15 @@ class VideoAdapter(var activity: Activity) :
Jzvd
.
WIFI_TIP_DIALOG_SHOWED
=
true
// 清除某个URL进度
//JZUtils.clearSavedProgress(activity, path)
jzvdStdTikTok
!!
.
setUp
(
path
,
""
,
JzvdStd
.
SCREEN_FULLSCREEN
)
jzvdStdTikTok
.
setUp
(
path
,
""
,
JzvdStd
.
SCREEN_FULLSCREEN
)
jzvdStdTikTok
.
setOnVideoCompletion
(
onVideoCompletion
)
}
private
var
onVideoCompletion
:
JzvdStdTikTok
.
OnVideoCompletion
?
=
null
fun
setOnVideoCompletion
(
onVideoCompletion
:
JzvdStdTikTok
.
OnVideoCompletion
?)
{
this
.
onVideoCompletion
=
onVideoCompletion
}
}
...
...
video/app/src/main/java/com/mints/wisdomclean/video/VideoBean.kt
View file @
839517aa
package
com.
cwj.updownshort
video
package
com.
mints.wisdomclean.
video
/**
* author : ChenWenJie
...
...
video/app/src/main/res/layout/item_video.xml
View file @
839517aa
...
...
@@ -6,7 +6,7 @@
android:layout_height=
"match_parent"
android:background=
"#77090909"
>
<com.
cwj.updownshort
video.JzvdStdTikTok
<com.
mints.wisdomclean.
video.JzvdStdTikTok
android:id=
"@+id/jz_video"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
...
...
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