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
Hide 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 {
...
@@ -80,6 +80,6 @@ public class RingtoneHelper {
}
}
RingtoneManager
.
setActualDefaultRingtoneUri
(
context
,
RingtoneManager
.
TYPE_RINGTONE
,
newUri
);
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
package
com.mints.goodmoney.ui.activitys
import
android.Manifest
import
android.Manifest
import
android.media.MediaPlayer
import
android.os.Bundle
import
android.os.Bundle
import
android.text.TextUtils
import
android.text.TextUtils
import
android.view.View
import
android.view.View
import
cn.jzvd.Jzvd
import
android.widget.VideoView
import
com.downloader.Error
import
com.downloader.Error
import
com.downloader.OnDownloadListener
import
com.downloader.OnDownloadListener
import
com.downloader.PRDownloader
import
com.downloader.PRDownloader
...
@@ -41,6 +42,7 @@ class KylVedioActivity : BaseActivity(), View.OnClickListener, KylVedioView {
...
@@ -41,6 +42,7 @@ class KylVedioActivity : BaseActivity(), View.OnClickListener, KylVedioView {
private
var
downloadId
:
Int
=
-
1
//vedio下载id
private
var
downloadId
:
Int
=
-
1
//vedio下载id
private
var
downloadVedioSucFlag
=
false
// 下载视频成功
private
var
downloadVedioSucFlag
=
false
// 下载视频成功
private
var
vedioName
=
""
override
fun
getContentViewLayoutID
()
=
R
.
layout
.
activity_kyl_vedio
override
fun
getContentViewLayoutID
()
=
R
.
layout
.
activity_kyl_vedio
...
@@ -65,41 +67,28 @@ class KylVedioActivity : BaseActivity(), View.OnClickListener, KylVedioView {
...
@@ -65,41 +67,28 @@ class KylVedioActivity : BaseActivity(), View.OnClickListener, KylVedioView {
}
}
private
fun
loadVedio
(
vedioUrl
:
String
)
{
private
fun
loadVedio
(
vedioUrl
:
String
)
{
jzvdStd
?.
setUp
(
vedioUrl
,
""
)
jzvdStd
?.
setOnPreparedListener
{
mp
:
MediaPlayer
->
jzvdStd
?.
startVideo
()
mp
.
start
()
// jzvdStd.setVedioRestart(false)
mp
.
isLooping
=
true
// jzvdStd.setJzVedioStatusListener(object : JZVideoPlayerStandardLoopVideo.JZVedioStatusListener {
// override fun jzVedioPlaying() {
// }
// })
}
override
fun
onBackPressed
()
{
if
(
Jzvd
.
backPress
())
{
return
}
}
super
.
onBackPressed
()
jzvdStd
?.
setVideoPath
(
vedioUrl
)
jzvdStd
?.
start
()
}
}
override
fun
onResume
()
{
override
fun
onResume
()
{
super
.
onResume
()
super
.
onResume
()
if
(!
isFinishing
())
{
jzvdStd
.
resume
()
Jzvd
.
goOnPlayOnResume
()
}
}
}
override
fun
onPause
()
{
override
fun
onPause
()
{
super
.
onPause
()
super
.
onPause
()
Jzvd
.
goOnPlayOnP
ause
()
jzvdStd
.
p
ause
()
}
}
override
fun
onDestroy
()
{
override
fun
onDestroy
()
{
super
.
onDestroy
()
super
.
onDestroy
()
Jzvd
.
releaseAllVideos
()
jzvdStd
?.
removeAllViews
()
if
(
downloadId
!=
-
1
)
{
if
(
downloadId
!=
-
1
)
{
PRDownloader
.
cancel
(
downloadId
)
PRDownloader
.
cancel
(
downloadId
)
}
}
...
@@ -123,41 +112,32 @@ class KylVedioActivity : BaseActivity(), View.OnClickListener, KylVedioView {
...
@@ -123,41 +112,32 @@ class KylVedioActivity : BaseActivity(), View.OnClickListener, KylVedioView {
.
subscribe
{
granted
:
Boolean
->
.
subscribe
{
granted
:
Boolean
->
if
(
granted
)
{
if
(
granted
)
{
downloadVedioToCacheFile
()
downloadVedioToCacheFile
()
awardVedio
()
}
else
{
}
else
{
showMissingPermissionDialog
(
"存储"
)
showMissingPermissionDialog
(
"存储"
)
}
}
}
}
// awardVedio()
}
}
}
}
}
}
private
fun
downloadVedioToCacheFile
()
{
private
fun
downloadVedioToCacheFile
()
{
showLoading
(
"加载中..."
)
downloadVedioSucFlag
=
false
var
vedioPath
=
""
var
vedioPath
=
""
try
{
try
{
vedioPath
=
getExternalFilesDir
(
null
)
!!
.
absolutePath
+
"/video/"
vedioPath
=
getExternalFilesDir
(
null
)
!!
.
absolutePath
+
"/video/"
}
catch
(
e
:
java
.
lang
.
Exception
)
{
}
catch
(
e
:
java
.
lang
.
Exception
)
{
vedioPath
=
filesDir
.
absolutePath
+
"/video/"
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
)
downloadId
=
PRDownloader
.
download
(
vedioUrl
,
vedioPath
,
vedioName
)
.
build
()
.
build
()
.
start
(
object
:
OnDownloadListener
{
.
start
(
object
:
OnDownloadListener
{
override
fun
onDownloadComplete
()
{
override
fun
onDownloadComplete
()
{
runOnUiThread
{
downloadVedioSucFlag
=
true
hideLoading
()
// downloadVedioSucFlag = true
val
vedioName
=
vedioPath
+
vedioName
DetailActivity
.
startSelf
(
this
@KylVedioActivity
,
vedioName
)
}
}
}
override
fun
onError
(
error
:
Error
)
{
override
fun
onError
(
error
:
Error
)
{
runOnUiThread
{
showToast
(
"加载失败"
)
hideLoading
()
}
}
}
})
})
}
}
...
@@ -219,10 +199,7 @@ class KylVedioActivity : BaseActivity(), View.OnClickListener, KylVedioView {
...
@@ -219,10 +199,7 @@ class KylVedioActivity : BaseActivity(), View.OnClickListener, KylVedioView {
private
fun
vedioAdingSuccess
(
adType
:
String
)
{
private
fun
vedioAdingSuccess
(
adType
:
String
)
{
if
(
downloadVedioSucFlag
)
{
if
(
downloadVedioSucFlag
)
{
try
{
DetailActivity
.
startSelf
(
this
@KylVedioActivity
,
vedioName
)
}
catch
(
e
:
Exception
)
{
e
.
printStackTrace
()
}
}
}
}
}
}
}
GoodMoney/app/src/main/res/layout/activity_detail.xml
View file @
b1f4adc7
...
@@ -9,7 +9,6 @@
...
@@ -9,7 +9,6 @@
android:layout_height=
"match_parent"
/>
android:layout_height=
"match_parent"
/>
<TextView
<TextView
android:visibility=
"gone"
android:id=
"@+id/set_show_tv"
android:id=
"@+id/set_show_tv"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"40dp"
android:layout_height=
"40dp"
...
...
GoodMoney/app/src/main/res/layout/activity_kyl_vedio.xml
View file @
b1f4adc7
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/black"
>
android:background=
"@color/black"
>
<com.mints.goodmoney.
ui.widgets.JZVideoPlayerStandardLoopVideo
<com.mints.goodmoney.
call.widget.CustomVideoView
android:id=
"@+id/jzvdStd"
android:id=
"@+id/jzvdStd"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"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