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
7eaad204
Commit
7eaad204
authored
Nov 05, 2019
by
徐健
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复FM播放动画在页面onResume的时候出现的异常
parent
3f39fc79
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
38 deletions
+40
-38
build.gradle
app/build.gradle
+2
-2
FMDetailActivity.java
m-fm/src/main/java/com/yidianling/fm/FMDetailActivity.java
+5
-1
FMSurfaceView.kt
m-fm/src/main/java/com/yidianling/fm/widget/FMSurfaceView.kt
+33
-35
No files found.
app/build.gradle
View file @
7eaad204
...
...
@@ -168,13 +168,13 @@ dependencies {
if
(
rootProject
.
ext
.
dev_mode
)
{
//开发模式
api
project
(
':m-user'
)
//
api project(':m-fm')
api
project
(
':m-fm'
)
api
project
(
':m-tests'
)
api
project
(
':m-consultant'
)
api
(
project
(
':ydl-platform'
)){
transitive
=
true
}
implementation
project
(
':ydl-webview'
)
//
implementation project(':ydl-webview')
implementation
project
(
':ydl-media'
)
}
else
{
//发布模式
...
...
m-fm/src/main/java/com/yidianling/fm/FMDetailActivity.java
View file @
7eaad204
...
...
@@ -555,7 +555,11 @@ public class FMDetailActivity extends BaseActivity implements View.OnClickListen
@Override
protected
void
onResume
()
{
super
.
onResume
();
fmSurfaceView
.
surfaceCreated
(
null
);
if
(
AudioPlayer
.
Companion
.
get
().
isPlaying
())
{
fmSurfaceView
.
playTimer
();
}
else
{
fmSurfaceView
.
stopTimer
();
}
if
(
PlayerFloatHelper
.
Companion
.
isShow
(
this
))
{
PlayerFloatHelper
.
Companion
.
removeView
(
this
);
...
...
m-fm/src/main/java/com/yidianling/fm/widget/FMSurfaceView.kt
View file @
7eaad204
...
...
@@ -86,42 +86,40 @@ class FMSurfaceView(context: Context?, attrs: AttributeSet?) : SurfaceView(conte
}
private
fun
drawAnimate
()
{
synchronized
(
this
)
{
mHolder
?.
let
{
canvas
=
mHolder
?.
lockCanvas
()
canvas
?.
let
{
//清空画布,进行重绘
canvas
?.
drawColor
(
Color
.
TRANSPARENT
,
PorterDuff
.
Mode
.
CLEAR
)
//重置最小六边形半径
resetPresentRadius
()
paint
?.
style
=
Paint
.
Style
.
FILL
//设置画笔为填充模式
//绘制四个变化的六边形
drawMinHexagon
()
drawMiddleHexagon
()
drawMaxHexagon
()
drawMMaxHexagon
()
//绘制图片外面包围的一层圆
canvas
?.
let
{
paint
?.
strokeWidth
=
ringWidth
+
0.5f
paint
?.
style
=
Paint
.
Style
.
STROKE
//设置画笔为线模式
paint
?.
color
=
Color
.
parseColor
(
"#D0FFFFFF"
)
paint
?.
setShadowLayer
(
ringWidth
,
1F
,
1F
,
Color
.
parseColor
(
"#D0FFFFFF"
))
canvas
!!
.
drawCircle
((
canvas
?.
width
!!
/
2
).
toFloat
(),
(
canvas
?.
height
!!
/
2
).
toFloat
(),
ringRadius
+
0.5f
,
paint
!!
)
paint
?.
setShadowLayer
(
0F
,
0F
,
0F
,
Color
.
WHITE
)
}
presentRadius
+=
presentRadiusChangeNumber
//每次循环presentRadius+presentRadiusChangeNumber
}
//这里有些机型上面会出现异常,暴力try一次,也可以用 mHolder?.surface?.isValid先进行一次判断后进行try
try
{
mHolder
?.
unlockCanvasAndPost
(
canvas
)
// android 4.3 会有IllegalArgumentException
}
catch
(
e
:
Exception
)
{
}
mHolder
?.
let
{
canvas
=
mHolder
?.
lockCanvas
()
canvas
?.
let
{
//清空画布,进行重绘
canvas
?.
drawColor
(
Color
.
TRANSPARENT
,
PorterDuff
.
Mode
.
CLEAR
)
//重置最小六边形半径
resetPresentRadius
()
paint
?.
style
=
Paint
.
Style
.
FILL
//设置画笔为填充模式
//绘制四个变化的六边形
drawMinHexagon
()
drawMiddleHexagon
()
drawMaxHexagon
()
drawMMaxHexagon
()
//绘制图片外面包围的一层圆
canvas
?.
let
{
paint
?.
strokeWidth
=
ringWidth
+
0.5f
paint
?.
style
=
Paint
.
Style
.
STROKE
//设置画笔为线模式
paint
?.
color
=
Color
.
parseColor
(
"#D0FFFFFF"
)
paint
?.
setShadowLayer
(
ringWidth
,
1F
,
1F
,
Color
.
parseColor
(
"#D0FFFFFF"
))
canvas
!!
.
drawCircle
((
canvas
?.
width
!!
/
2
).
toFloat
(),
(
canvas
?.
height
!!
/
2
).
toFloat
(),
ringRadius
+
0.5f
,
paint
!!
)
paint
?.
setShadowLayer
(
0F
,
0F
,
0F
,
Color
.
WHITE
)
}
presentRadius
+=
presentRadiusChangeNumber
//每次循环presentRadius+presentRadiusChangeNumber
}
//这里有些机型上面会出现异常,暴力try一次,也可以用 mHolder?.surface?.isValid先进行一次判断后进行try
try
{
mHolder
?.
unlockCanvasAndPost
(
canvas
)
// android 4.3 会有IllegalArgumentException
}
catch
(
e
:
Exception
)
{
}
}
}
...
...
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