下载视频
This commit is contained in:
@@ -259,12 +259,6 @@ class AlarmLogActivity : AppCompatActivity() {
|
|||||||
"https://media.w3.org/2010/05/sintel/trailer.mp4"
|
"https://media.w3.org/2010/05/sintel/trailer.mp4"
|
||||||
)
|
)
|
||||||
|
|
||||||
Toast.makeText(
|
|
||||||
this,
|
|
||||||
"开始下载",
|
|
||||||
Toast.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
|
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
this,
|
this,
|
||||||
getString(R.string.download_start),
|
getString(R.string.download_start),
|
||||||
@@ -363,6 +357,7 @@ class AlarmLogActivity : AppCompatActivity() {
|
|||||||
url
|
url
|
||||||
)
|
)
|
||||||
.setDestinationUri(Uri.fromFile(targetFile))
|
.setDestinationUri(Uri.fromFile(targetFile))
|
||||||
|
.setNotificationTitle("${"视频名称"}:视频下载")
|
||||||
.registerListener(object : DownloadListener {
|
.registerListener(object : DownloadListener {
|
||||||
|
|
||||||
override fun onDownloadStart() {
|
override fun onDownloadStart() {
|
||||||
@@ -381,21 +376,19 @@ class AlarmLogActivity : AppCompatActivity() {
|
|||||||
)
|
)
|
||||||
|
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
Toast.makeText(
|
ToastUtils.showSuccess(
|
||||||
this@AlarmLogActivity,
|
this@AlarmLogActivity,
|
||||||
"下载成功",
|
"下载成功"
|
||||||
Toast.LENGTH_SHORT
|
)
|
||||||
).show()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDownloadFailed(e: Throwable) {
|
override fun onDownloadFailed(e: Throwable) {
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
Toast.makeText(
|
ToastUtils.showError(
|
||||||
this@AlarmLogActivity,
|
this@AlarmLogActivity,
|
||||||
"下载失败:${e.message}",
|
"下载失败:${e.message}"
|
||||||
Toast.LENGTH_SHORT
|
)
|
||||||
).show()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user