[Change]
[修复单屏幕,在第二个屏幕启动act]

Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
donghongyu
2022-12-05 10:57:17 +08:00
parent 078cb8a024
commit 85706ada0c

View File

@@ -37,23 +37,23 @@ object MultiDisplayUtils {
* @param launchDisplayId 指定屏幕ID
*/
fun startActWithSecond(context: Context, activity: Class<*>) {
var launchDisplayId = 0;
val launchDisplayId: Int
if (isSupportMultiDisplay(context)) {
if (getMultiDisplay(context).size > 1) {
launchDisplayId = getMultiDisplay(context)[1].displayId
// 要加上Intent.FLAG_ACTIVITY_NEW_TASK
val options = ActivityOptions.makeBasic()
options.launchDisplayId = launchDisplayId
val intent = Intent(context, activity)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
context.startActivity(intent, options.toBundle())
} else {
Log.e(TAG, "当前没有外接屏幕,只有一个屏幕")
}
} else {
Log.e(TAG, "当前设备,不支持多个屏幕交互显示")
}
// 要加上Intent.FLAG_ACTIVITY_NEW_TASK
val options = ActivityOptions.makeBasic()
options.launchDisplayId = launchDisplayId
val intent = Intent(context, activity)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
context.startActivity(intent, options.toBundle())
}
/**