Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
T
tx_player_fork
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
蒋俊
tx_player_fork
Commits
6709e6c4
提交
6709e6c4
authored
12月 24, 2024
作者:
kongdywang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix the problem that Android Picture-in-Picture cannot launch applications on some systems
上级
d09b4b6f
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
31 行增加
和
13 行删除
+31
-13
AndroidManifest.xml
Flutter/android/src/main/AndroidManifest.xml
+1
-0
FTXEvent.java
...droid/src/main/java/com/tencent/vod/flutter/FTXEvent.java
+1
-0
FlutterPipImplActivity.java
...va/com/tencent/vod/flutter/ui/FlutterPipImplActivity.java
+29
-13
没有找到文件。
Flutter/android/src/main/AndroidManifest.xml
浏览文件 @
6709e6c4
...
...
@@ -20,6 +20,7 @@
<action
android:name=
"com.tencent.flutter.startPip"
/>
<action
android:name=
"com.tencent.flutter.exitPip"
/>
<action
android:name=
"com.tencent.flutter.updatePip"
/>
<action
android:name=
"com.tencent.flutter.doExitPip"
/>
</intent-filter>
</activity>
...
...
Flutter/android/src/main/java/com/tencent/vod/flutter/FTXEvent.java
浏览文件 @
6709e6c4
...
...
@@ -133,6 +133,7 @@ public class FTXEvent {
// 画中画界面恢复,即点击放大按钮
public
static
final
int
EVENT_PIP_MODE_RESTORE_UI
=
5
;
public
static
final
String
PIP_ACTION_DO_EXIT
=
"com.tencent.flutter.doExitPip"
;
// Start PIP.
// 启动画中画
public
static
final
String
PIP_ACTION_START
=
"com.tencent.flutter.startPip"
;
...
...
Flutter/android/src/main/java/com/tencent/vod/flutter/ui/FlutterPipImplActivity.java
浏览文件 @
6709e6c4
...
...
@@ -340,6 +340,14 @@ public class FlutterPipImplActivity extends Activity implements TextureView.Surf
PipParams
pipParams
=
data
.
getParcelable
(
FTXEvent
.
EXTRA_NAME_PARAMS
);
updatePip
(
pipParams
);
}
}
else
if
(
TextUtils
.
equals
(
action
,
FTXEvent
.
PIP_ACTION_DO_EXIT
))
{
overridePendingTransition
(
0
,
0
);
if
(
VERSION
.
SDK_INT
>=
VERSION_CODES
.
LOLLIPOP
)
{
FlutterPipImplActivity
.
this
.
finishAndRemoveTask
();
}
else
{
FlutterPipImplActivity
.
this
.
finish
();
}
mIsPipFinishing
=
false
;
}
else
{
LiteavLog
.
e
(
TAG
,
"unknown pip action:"
+
action
);
}
...
...
@@ -355,17 +363,17 @@ public class FlutterPipImplActivity extends Activity implements TextureView.Surf
}
}
/**
* move task to from。Prevent the issue of picture-in-picture windows failing to launch the app in certain cases.
*/
public
void
movePreActToFront
()
{
if
(
VERSION
.
SDK_INT
==
VERSION_CODES
.
Q
)
{
Activity
activity
=
TXFlutterEngineHolder
.
getInstance
().
getPreActivity
();
if
(
null
!=
activity
)
{
Intent
intent
=
new
Intent
(
FlutterPipImplActivity
.
this
,
activity
.
getClass
());
intent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_REORDER_TO_FRONT
);
startActivity
(
intent
);
}
Activity
activity
=
TXFlutterEngineHolder
.
getInstance
().
getPreActivity
();
if
(
null
!=
activity
)
{
Intent
intent
=
new
Intent
(
FlutterPipImplActivity
.
this
,
activity
.
getClass
());
intent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_REORDER_TO_FRONT
);
intent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_CLEAR_TOP
);
startActivity
(
intent
);
}
}
...
...
@@ -373,15 +381,16 @@ public class FlutterPipImplActivity extends Activity implements TextureView.Surf
* move task to from。Prevent the issue of picture-in-picture windows failing to launch the app in certain cases.
*/
public
void
moveCurActToFront
()
{
mPipContainer
.
post
Delayed
(
new
Runnable
()
{
mPipContainer
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
Activity
activity
=
FlutterPipImplActivity
.
this
;
Intent
intent
=
new
Intent
(
FlutterPipImplActivity
.
this
,
activity
.
getClass
());
intent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_REORDER_TO_FRONT
);
intent
.
setAction
(
FTXEvent
.
PIP_ACTION_DO_EXIT
);
startActivity
(
intent
);
}
}
,
2000
);
});
}
/**
...
...
@@ -408,16 +417,23 @@ public class FlutterPipImplActivity extends Activity implements TextureView.Surf
mMainHandler
.
postDelayed
(
new
Runnable
()
{
@Override
public
void
run
()
{
/*
The PiP window can launch its own Activity. Therefore,
we can initiate our own here. By executing the termination code during the launch,
we can bring our own Activity back to the original AppTask and launch the original app.
Subsequently, when we end the Picture-in-Picture page,
it can display back to the original page.
*/
moveCurActToFront
();
overridePendingTransition
(
0
,
0
);
if
(
VERSION
.
SDK_INT
>=
VERSION_CODES
.
LOLLIPOP
)
{
finishAndRemoveTask
();
FlutterPipImplActivity
.
this
.
finishAndRemoveTask
();
}
else
{
finish
();
FlutterPipImplActivity
.
this
.
finish
();
}
mIsPipFinishing
=
false
;
movePreActToFront
();
}
},
6
00
);
},
8
00
);
}
else
{
overridePendingTransition
(
0
,
0
);
if
(
VERSION
.
SDK_INT
>=
VERSION_CODES
.
LOLLIPOP
)
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论