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
69c52606
Commit
69c52606
authored
Feb 24, 2021
by
jyx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
处理VideoView内存泄漏
parent
4637c22f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
29 deletions
+18
-29
InitAppService.kt
...y/app/src/main/java/com/mints/goodmoney/InitAppService.kt
+0
-1
DrawNativeVideoActivity.kt
...m/mints/goodmoney/ui/activitys/DrawNativeVideoActivity.kt
+16
-0
DrawVideoAdapter.kt
...n/java/com/mints/goodmoney/ui/adapter/DrawVideoAdapter.kt
+2
-2
FullScreenVideoView.java
...a/com/mints/goodmoney/ui/widgets/FullScreenVideoView.java
+0
-26
No files found.
GoodMoney/app/src/main/java/com/mints/goodmoney/InitAppService.kt
View file @
69c52606
...
...
@@ -10,7 +10,6 @@ import com.downloader.PRDownloader
import
com.downloader.PRDownloaderConfig
import
com.mints.goodmoney.manager.BxmManager.initBxm
import
com.mob.MobSDK
import
com.tencent.mm.opensdk.openapi.WXAPIFactory
/**
* 子线程初始化SDK
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/DrawNativeVideoActivity.kt
View file @
69c52606
package
com.mints.goodmoney.ui.activitys
import
android.Manifest
import
android.content.Context
import
android.content.ContextWrapper
import
android.media.MediaPlayer
import
android.os.Bundle
import
android.text.TextUtils
...
...
@@ -469,4 +471,18 @@ class DrawNativeVideoActivity : BaseActivity(),
showToast
(
"加载失败,请稍候再试"
)
finish
()
}
override
fun
attachBaseContext
(
newBase
:
Context
?)
{
super
.
attachBaseContext
(
newBase
)
// 处理VideoView setVideoPath方法中 AudioManager对Activity持有强引用,导致内存泄漏
object
:
ContextWrapper
(
newBase
)
{
override
fun
getSystemService
(
name
:
String
):
Any
{
if
(
Context
.
AUDIO_SERVICE
==
name
)
return
applicationContext
.
getSystemService
(
name
)
return
super
.
getSystemService
(
name
)
}
}
}
}
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/adapter/DrawVideoAdapter.kt
View file @
69c52606
...
...
@@ -8,10 +8,10 @@ import android.view.ViewGroup
import
android.widget.*
import
androidx.recyclerview.widget.RecyclerView
import
com.mints.goodmoney.R
import
com.mints.goodmoney.call.widget.CustomVideoView
import
com.mints.goodmoney.mvp.model.DrawVideoBean
import
com.mints.goodmoney.ui.activitys.DrawNativeVideoActivity
import
com.mints.goodmoney.ui.adapter.listener.OnItemClickListener
import
com.mints.goodmoney.ui.widgets.FullScreenVideoView
import
com.mints.library.utils.GlideUtils
class
DrawVideoAdapter
(
context
:
Context
,
datas
:
List
<
DrawVideoBean
>)
:
RecyclerView
.
Adapter
<
RecyclerView
.
ViewHolder
>()
{
...
...
@@ -62,7 +62,7 @@ class DrawVideoAdapter(context: Context, datas: List<DrawVideoBean>) : RecyclerV
}
private
fun
getView
():
View
{
val
videoView
=
FullScreen
VideoView
(
mContext
)
val
videoView
=
Custom
VideoView
(
mContext
)
val
layoutParams
=
FrameLayout
.
LayoutParams
(
FrameLayout
.
LayoutParams
.
MATCH_PARENT
,
FrameLayout
.
LayoutParams
.
MATCH_PARENT
)
videoView
.
layoutParams
=
layoutParams
return
videoView
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/widgets/FullScreenVideoView.java
deleted
100644 → 0
View file @
4637c22f
package
com
.
mints
.
goodmoney
.
ui
.
widgets
;
import
android.content.Context
;
import
android.util.AttributeSet
;
import
android.widget.VideoView
;
public
class
FullScreenVideoView
extends
VideoView
{
public
FullScreenVideoView
(
Context
context
)
{
super
(
context
);
}
public
FullScreenVideoView
(
Context
context
,
AttributeSet
attrs
)
{
super
(
context
,
attrs
);
}
public
FullScreenVideoView
(
Context
context
,
AttributeSet
attrs
,
int
defStyleAttr
)
{
super
(
context
,
attrs
,
defStyleAttr
);
}
@Override
protected
void
onMeasure
(
int
widthMeasureSpec
,
int
heightMeasureSpec
)
{
int
width
=
getDefaultSize
(
0
,
widthMeasureSpec
);
int
height
=
getDefaultSize
(
0
,
heightMeasureSpec
);
setMeasuredDimension
(
width
,
height
);
}
}
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