Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
T
tx_player_fork
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
蒋俊
tx_player_fork
Commits
cfbf7243
提交
cfbf7243
authored
6月 30, 2023
作者:
kongdywang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix pip enter UI error on some harmony devices & fix pip toggle UI error on some oppo devices
上级
85fb979b
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
41 行增加
和
10 行删除
+41
-10
FlutterPipImplActivity.java
...va/com/tencent/vod/flutter/ui/FlutterPipImplActivity.java
+40
-9
styles.xml
Flutter/android/src/main/res/values/styles.xml
+1
-1
没有找到文件。
Flutter/android/src/main/java/com/tencent/vod/flutter/ui/FlutterPipImplActivity.java
浏览文件 @
cfbf7243
...
...
@@ -3,6 +3,7 @@
package
com
.
tencent
.
vod
.
flutter
.
ui
;
import
android.app.Activity
;
import
android.app.ActivityManager
;
import
android.app.PictureInPictureParams
;
import
android.app.PictureInPictureUiState
;
import
android.content.BroadcastReceiver
;
...
...
@@ -42,6 +43,9 @@ import com.tencent.vod.flutter.R;
import
com.tencent.vod.flutter.model.PipResult
;
import
com.tencent.vod.flutter.model.VideoModel
;
import
java.util.List
;
import
java.util.Set
;
public
class
FlutterPipImplActivity
extends
Activity
implements
Callback
,
ITXVodPlayListener
,
ITXLivePlayListener
,
ServiceConnection
{
...
...
@@ -101,6 +105,13 @@ public class FlutterPipImplActivity extends Activity implements Callback, ITXVod
super
.
onCreate
(
savedInstanceState
);
mMainHandler
=
new
Handler
(
getMainLooper
());
bindAndroid12BugServiceIfNeed
();
registerPipBroadcast
();
setContentView
(
R
.
layout
.
activity_flutter_pip_impl
);
mVodPlayer
=
new
TXVodPlayer
(
this
);
mLivePlayer
=
new
TXLivePlayer
(
this
);
mVideoSurface
=
findViewById
(
R
.
id
.
sv_video_container
);
mVideoProgress
=
findViewById
(
R
.
id
.
pb_video_progress
);
mVideoSurface
.
getHolder
().
addCallback
(
this
);
Intent
intent
=
getIntent
();
PipParams
params
=
intent
.
getParcelableExtra
(
FTXEvent
.
EXTRA_NAME_PARAMS
);
if
(
null
==
params
)
{
...
...
@@ -114,13 +125,6 @@ public class FlutterPipImplActivity extends Activity implements Callback, ITXVod
configPipMode
(
null
);
}
}
registerPipBroadcast
();
setContentView
(
R
.
layout
.
activity_flutter_pip_impl
);
mVodPlayer
=
new
TXVodPlayer
(
this
);
mLivePlayer
=
new
TXLivePlayer
(
this
);
mVideoSurface
=
findViewById
(
R
.
id
.
sv_video_container
);
mVideoProgress
=
findViewById
(
R
.
id
.
pb_video_progress
);
mVideoSurface
.
getHolder
().
addCallback
(
this
);
setVodPlayerListener
();
setLivePlayerListener
();
handleIntent
(
intent
);
...
...
@@ -199,6 +203,9 @@ public class FlutterPipImplActivity extends Activity implements Callback, ITXVod
}
private
void
configPipMode
(
PictureInPictureParams
params
)
{
mVideoSurface
.
postDelayed
(
new
Runnable
()
{
@Override
public
void
run
()
{
if
(
VERSION
.
SDK_INT
>=
VERSION_CODES
.
N
)
{
if
(
VERSION
.
SDK_INT
>=
VERSION_CODES
.
O
)
{
enterPictureInPictureMode
(
params
);
...
...
@@ -207,6 +214,8 @@ public class FlutterPipImplActivity extends Activity implements Callback, ITXVod
}
}
}
},
200
);
}
private
void
registerPipBroadcast
()
{
if
(!
mIsRegisterReceiver
)
{
...
...
@@ -272,10 +281,30 @@ public class FlutterPipImplActivity extends Activity implements Callback, ITXVod
}
}
/**
* move task to from。Prevent the issue of picture-in-picture windows failing to launch the app in certain cases.
*/
public
void
moveAppToFront
()
{
if
(
Build
.
VERSION
.
SDK_INT
<
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
return
;
}
ActivityManager
activityManager
=
(
ActivityManager
)
getApplicationContext
().
getSystemService
(
Context
.
ACTIVITY_SERVICE
);
final
List
<
ActivityManager
.
AppTask
>
appTasks
=
activityManager
.
getAppTasks
();
for
(
ActivityManager
.
AppTask
task
:
appTasks
)
{
final
Intent
baseIntent
=
task
.
getTaskInfo
().
baseIntent
;
final
Set
<
String
>
categories
=
baseIntent
.
getCategories
();
if
(
categories
!=
null
&&
categories
.
contains
(
Intent
.
CATEGORY_LAUNCHER
))
{
task
.
moveToFront
();
return
;
}
}
}
/**
* 关闭画中画,使用finish当前界面的方式,关闭画中画
*
* @param closeImmediately 立刻关闭,不执行延迟,
在android 12以上,如果画中画处于非当前app界面下,立刻关闭可能会造成无法返回app问题
* @param closeImmediately 立刻关闭,不执行延迟,
一般关闭画中画为true,还原画中画为false。
*/
private
void
exitPip
(
boolean
closeImmediately
)
{
if
(!
isDestroyed
())
{
...
...
@@ -301,7 +330,9 @@ public class FlutterPipImplActivity extends Activity implements Callback, ITXVod
}
}
}
if
(
closeImmediately
)
{
moveAppToFront
();
}
}
private
void
startPipVideoFromIntent
(
Intent
intent
)
{
...
...
Flutter/android/src/main/res/values/styles.xml
浏览文件 @
cfbf7243
<?xml version="1.0" encoding="utf-8"?>
<resources
xmlns:tools=
"http://schemas.android.com/tools"
>
<!-- 取消界面转场动画使用-->
<style
name=
"Theme"
parent=
"android:Theme.
Translucent.NoTitleBar.Fullscreen
"
>
<style
name=
"Theme"
parent=
"android:Theme.
Holo.NoActionBar
"
>
<item
name=
"android:windowAnimationStyle"
>
@style/Animation
</item>
<item
name=
"android:background"
>
@android:color/transparent
</item>
<item
name=
"android:windowIsTranslucent"
>
true
</item>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论