Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_goodmoney
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_goodmoney
Commits
b1f4adc7
Commit
b1f4adc7
authored
Jan 25, 2021
by
mengcuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
56a54c9a
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
41 deletions
+17
-41
RingtoneHelper.java
...ava/com/mints/goodmoney/call/business/RingtoneHelper.java
+1
-1
KylVedioActivity.kt
...java/com/mints/goodmoney/ui/activitys/KylVedioActivity.kt
+15
-38
activity_detail.xml
GoodMoney/app/src/main/res/layout/activity_detail.xml
+0
-1
activity_kyl_vedio.xml
GoodMoney/app/src/main/res/layout/activity_kyl_vedio.xml
+1
-1
No files found.
GoodMoney/app/src/main/java/com/mints/goodmoney/call/business/RingtoneHelper.java
View file @
b1f4adc7
...
...
@@ -80,6 +80,6 @@ public class RingtoneHelper {
}
RingtoneManager
.
setActualDefaultRingtoneUri
(
context
,
RingtoneManager
.
TYPE_RINGTONE
,
newUri
);
ToastUtil
.
show
(
context
,
"设置来电铃声成功!"
);
//
ToastUtil.show(context,"设置来电铃声成功!");
}
}
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/KylVedioActivity.kt
View file @
b1f4adc7
package
com.mints.goodmoney.ui.activitys
import
android.Manifest
import
android.media.MediaPlayer
import
android.os.Bundle
import
android.text.TextUtils
import
android.view.View
import
cn.jzvd.Jzvd
import
android.widget.VideoView
import
com.downloader.Error
import
com.downloader.OnDownloadListener
import
com.downloader.PRDownloader
...
...
@@ -41,6 +42,7 @@ class KylVedioActivity : BaseActivity(), View.OnClickListener, KylVedioView {
private
var
downloadId
:
Int
=
-
1
//vedio下载id
private
var
downloadVedioSucFlag
=
false
// 下载视频成功
private
var
vedioName
=
""
override
fun
getContentViewLayoutID
()
=
R
.
layout
.
activity_kyl_vedio
...
...
@@ -65,41 +67,28 @@ class KylVedioActivity : BaseActivity(), View.OnClickListener, KylVedioView {
}
private
fun
loadVedio
(
vedioUrl
:
String
)
{
jzvdStd
?.
setUp
(
vedioUrl
,
""
)
jzvdStd
?.
startVideo
()
// jzvdStd.setVedioRestart(false)
// jzvdStd.setJzVedioStatusListener(object : JZVideoPlayerStandardLoopVideo.JZVedioStatusListener {
// override fun jzVedioPlaying() {
// }
// })
jzvdStd
?.
setOnPreparedListener
{
mp
:
MediaPlayer
->
mp
.
start
()
mp
.
isLooping
=
true
}
override
fun
onBackPressed
()
{
if
(
Jzvd
.
backPress
())
{
return
}
super
.
onBackPressed
()
jzvdStd
?.
setVideoPath
(
vedioUrl
)
jzvdStd
?.
start
()
}
override
fun
onResume
()
{
super
.
onResume
()
if
(!
isFinishing
())
{
Jzvd
.
goOnPlayOnResume
()
}
jzvdStd
.
resume
()
}
override
fun
onPause
()
{
super
.
onPause
()
Jzvd
.
goOnPlayOnP
ause
()
jzvdStd
.
p
ause
()
}
override
fun
onDestroy
()
{
super
.
onDestroy
()
Jzvd
.
releaseAllVideos
()
jzvdStd
?.
removeAllViews
()
if
(
downloadId
!=
-
1
)
{
PRDownloader
.
cancel
(
downloadId
)
}
...
...
@@ -123,41 +112,32 @@ class KylVedioActivity : BaseActivity(), View.OnClickListener, KylVedioView {
.
subscribe
{
granted
:
Boolean
->
if
(
granted
)
{
downloadVedioToCacheFile
()
awardVedio
()
}
else
{
showMissingPermissionDialog
(
"存储"
)
}
}
// awardVedio()
}
}
}
private
fun
downloadVedioToCacheFile
()
{
showLoading
(
"加载中..."
)
downloadVedioSucFlag
=
false
var
vedioPath
=
""
try
{
vedioPath
=
getExternalFilesDir
(
null
)
!!
.
absolutePath
+
"/video/"
}
catch
(
e
:
java
.
lang
.
Exception
)
{
vedioPath
=
filesDir
.
absolutePath
+
"/video/"
}
v
al
v
edioName
=
MD5
.
GetMD5Code
(
System
.
currentTimeMillis
().
toString
()
+
UserManager
.
getInstance
().
userID
+
vedioUrl
)
+
".mp4"
vedioName
=
MD5
.
GetMD5Code
(
System
.
currentTimeMillis
().
toString
()
+
UserManager
.
getInstance
().
userID
+
vedioUrl
)
+
".mp4"
downloadId
=
PRDownloader
.
download
(
vedioUrl
,
vedioPath
,
vedioName
)
.
build
()
.
start
(
object
:
OnDownloadListener
{
override
fun
onDownloadComplete
()
{
runOnUiThread
{
hideLoading
()
// downloadVedioSucFlag = true
val
vedioName
=
vedioPath
+
vedioName
DetailActivity
.
startSelf
(
this
@KylVedioActivity
,
vedioName
)
}
downloadVedioSucFlag
=
true
}
override
fun
onError
(
error
:
Error
)
{
runOnUiThread
{
showToast
(
"加载失败"
)
hideLoading
()
}
}
})
}
...
...
@@ -219,10 +199,7 @@ class KylVedioActivity : BaseActivity(), View.OnClickListener, KylVedioView {
private
fun
vedioAdingSuccess
(
adType
:
String
)
{
if
(
downloadVedioSucFlag
)
{
try
{
}
catch
(
e
:
Exception
)
{
e
.
printStackTrace
()
}
DetailActivity
.
startSelf
(
this
@KylVedioActivity
,
vedioName
)
}
}
}
GoodMoney/app/src/main/res/layout/activity_detail.xml
View file @
b1f4adc7
...
...
@@ -9,7 +9,6 @@
android:layout_height=
"match_parent"
/>
<TextView
android:visibility=
"gone"
android:id=
"@+id/set_show_tv"
android:layout_width=
"match_parent"
android:layout_height=
"40dp"
...
...
GoodMoney/app/src/main/res/layout/activity_kyl_vedio.xml
View file @
b1f4adc7
...
...
@@ -6,7 +6,7 @@
android:layout_height=
"match_parent"
android:background=
"@color/black"
>
<com.mints.goodmoney.
ui.widgets.JZVideoPlayerStandardLoopVideo
<com.mints.goodmoney.
call.widget.CustomVideoView
android:id=
"@+id/jzvdStd"
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