From dec706216657a947ae91a1986e391e4c2e11961b Mon Sep 17 00:00:00 2001 From: klosw Date: Thu, 7 Mar 2024 09:50:22 +0800 Subject: [PATCH] =?UTF-8?q?mod=20=E7=94=BB=E4=B8=AD=E7=94=BB=E9=83=A8?= =?UTF-8?q?=E5=88=86=E4=BB=A3=E7=A0=81=20SDK=20=E7=89=88=E6=9C=AC=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tvbox/osc/ui/activity/DetailActivity.java | 14 +++++++------- .../tvbox/osc/ui/activity/PlayActivity.java | 18 +++++++++--------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/com/github/tvbox/osc/ui/activity/DetailActivity.java b/app/src/main/java/com/github/tvbox/osc/ui/activity/DetailActivity.java index 41dc64c540..27d9fce989 100644 --- a/app/src/main/java/com/github/tvbox/osc/ui/activity/DetailActivity.java +++ b/app/src/main/java/com/github/tvbox/osc/ui/activity/DetailActivity.java @@ -1125,20 +1125,20 @@ public void onUserLeaveHint() { } else { ratio = new Rational(16, 9); } - //此处需要大于23 版本才能执行 - if (Build.VERSION.SDK_INT > Build.VERSION_CODES.O) { - List actions = new ArrayList<>(); + List actions = new ArrayList<>(); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { actions.add(generateRemoteAction(android.R.drawable.ic_media_previous, BROADCAST_ACTION_PREV, "Prev", "Play Previous")); actions.add(generateRemoteAction(android.R.drawable.ic_media_play, BROADCAST_ACTION_PLAYPAUSE, "Play", "Play/Pause")); actions.add(generateRemoteAction(android.R.drawable.ic_media_next, BROADCAST_ACTION_NEXT, "Next", "Play Next")); - PictureInPictureParams params = new PictureInPictureParams.Builder() - .setAspectRatio(ratio) - .setActions(actions).build(); - enterPictureInPictureMode(params); } + PictureInPictureParams params = new PictureInPictureParams.Builder() + .setAspectRatio(ratio) + .setActions(actions).build(); if (!fullWindows) { toggleFullPreview(); } + enterPictureInPictureMode(params); + playFragment.getVodController().hideBottom(); playFragment.getPlayer().postDelayed(() -> { if (!playFragment.getPlayer().isPlaying()) { diff --git a/app/src/main/java/com/github/tvbox/osc/ui/activity/PlayActivity.java b/app/src/main/java/com/github/tvbox/osc/ui/activity/PlayActivity.java index 10e6a5ff1a..caf16d32d3 100644 --- a/app/src/main/java/com/github/tvbox/osc/ui/activity/PlayActivity.java +++ b/app/src/main/java/com/github/tvbox/osc/ui/activity/PlayActivity.java @@ -1142,16 +1142,18 @@ public void onUserLeaveHint() { } else { ratio = new Rational(16, 9); } - if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.O) { - List actions = new ArrayList<>(); + + List actions = new ArrayList<>(); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { actions.add(generateRemoteAction(android.R.drawable.ic_media_previous, BROADCAST_ACTION_PREV, "Prev", "Play Previous")); actions.add(generateRemoteAction(android.R.drawable.ic_media_play, BROADCAST_ACTION_PLAYPAUSE, "Play/Pause", "Play or Pause")); actions.add(generateRemoteAction(android.R.drawable.ic_media_next, BROADCAST_ACTION_NEXT, "Next", "Play Next")); - PictureInPictureParams params = new PictureInPictureParams.Builder() - .setAspectRatio(ratio) - .setActions(actions).build(); - enterPictureInPictureMode(params); } + PictureInPictureParams params = new PictureInPictureParams.Builder() + .setAspectRatio(ratio) + .setActions(actions).build(); + enterPictureInPictureMode(params); + mController.hideBottom(); mVideoView.postDelayed(() -> { if (!mVideoView.isPlaying()) { @@ -1209,9 +1211,7 @@ protected void onPause() { @RequiresApi(api = Build.VERSION_CODES.O) private android.app.RemoteAction generateRemoteAction(int iconResId, int actionCode, String title, String desc) { - - final PendingIntent intent = - PendingIntent.getBroadcast( + final PendingIntent intent = PendingIntent.getBroadcast( PlayActivity.this, actionCode, new Intent(BROADCAST_ACTION).putExtra("action", actionCode),