Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YDL-Component-Medical
Overview
Overview
Details
Activity
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
杨凯
YDL-Component-Medical
Commits
e22086b1
Commit
e22086b1
authored
Jul 15, 2022
by
fengquan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 非wifi状态下播放视频弹框
parent
83a495c5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
9 deletions
+51
-9
BasePhotoFragment.kt
m-consultant/src/main/java/com/yidianling/consultant/preview/BasePhotoFragment.kt
+51
-9
No files found.
m-consultant/src/main/java/com/yidianling/consultant/preview/BasePhotoFragment.kt
View file @
e22086b1
package
com.yidianling.consultant.preview
import
android.content.Context
import
android.graphics.Color
import
android.graphics.drawable.Drawable
import
android.net.Uri
...
...
@@ -17,6 +18,8 @@ import androidx.fragment.app.Fragment
import
com.dou361.ijkplayer.widget.IjkVideoView
import
com.ydl.ydlcommon.ui.Loading.close
import
com.ydl.ydlcommon.ui.Loading.show
import
com.ydl.ydlcommon.view.dialog.CommonDialog
import
com.yidianling.common.tools.RxNetTool
import
com.yidianling.common.tools.ToastUtil
import
com.yidianling.consultant.R
import
com.yidianling.consultant.preview.SmoothImageView.*
...
...
@@ -49,6 +52,8 @@ class BasePhotoFragment : Fragment() {
private
var
isPrepared
=
false
private
var
ivImg
:
ImageView
?
=
null
private
val
keySp
=
"check_network_continue"
@Volatile
private
var
isTouch
=
false
private
var
isCompletion
=
false
...
...
@@ -242,15 +247,7 @@ class BasePhotoFragment : Fragment() {
true
}
ivPlay
!!
.
setOnClickListener
{
if
(!
isPrepared
)
{
loading
!!
.
visibility
=
VISIBLE
}
ivImg
!!
.
visibility
=
GONE
ivPlay
!!
.
visibility
=
GONE
startTiming
()
videoView
?.
visibility
=
VISIBLE
videoView
!!
.
start
()
isCompletion
=
false
checkNetwork
()
}
videoContainer
!!
.
setOnClickListener
{
if
(
videoView
!!
.
isPlaying
)
{
...
...
@@ -329,6 +326,51 @@ class BasePhotoFragment : Fragment() {
imageView
!!
.
setTransformOutListener
{
(
activity
as
GPreviewActivity
?)
!!
.
transformOut
()
}
}
internal
fun
checkNetwork
()
{
val
lastCheck
=
context
?.
getSharedPreferences
(
"temp_test"
,
Context
.
MODE_PRIVATE
)
?.
getLong
(
keySp
,
0
)
val
duration
=
System
.
currentTimeMillis
()
-
lastCheck
!!
if
(!
RxNetTool
.
isWifi
(
requireActivity
()
!!
)
&&
duration
>
24
*
60
*
60
*
1000
)
{
val
dialog
=
CommonDialog
.
create
(
context
)
.
setTitle
(
"提示"
)
.
setMessage
(
"当前处于非wifi环境下,播放会消耗流量,确定继续播放?"
)
.
setLeftOnclick
(
"继续播放"
)
{
if
(!
isPrepared
)
{
loading
!!
.
visibility
=
VISIBLE
}
ivImg
!!
.
visibility
=
GONE
ivPlay
!!
.
visibility
=
GONE
startTiming
()
videoView
?.
visibility
=
VISIBLE
videoView
!!
.
start
()
isCompletion
=
false
context
?.
getSharedPreferences
(
"temp_test"
,
Context
.
MODE_PRIVATE
)
?.
edit
()
?.
putLong
(
keySp
,
System
.
currentTimeMillis
())
?.
apply
()
}
.
setLeftButton_color
(
R
.
color
.
platform_but_text_color_selected
)
.
setRightButton_color
(
R
.
color
.
platform_text_bright_color
)
.
setRightClick
(
"取消"
)
{
}
.
setCancelAble
(
true
)
dialog
.
setOnCancelListener
{
dialog
.
dismiss
()
}
dialog
.
show
()
}
else
{
if
(!
isPrepared
)
{
loading
!!
.
visibility
=
VISIBLE
}
ivImg
!!
.
visibility
=
GONE
ivPlay
!!
.
visibility
=
GONE
startTiming
()
videoView
?.
visibility
=
VISIBLE
videoView
!!
.
start
()
isCompletion
=
false
}
}
fun
transformIn
()
{
assert
(
imageView
!=
null
)
imageView
!!
.
transformIn
{
rootView
!!
.
setBackgroundColor
(
Color
.
BLACK
)
}
...
...
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