mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-08 12:04:50 +08:00
@@ -9,6 +9,7 @@ import android.view.WindowManager;
|
|||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
|
import androidx.core.view.WindowCompat;
|
||||||
import androidx.core.view.WindowInsetsControllerCompat;
|
import androidx.core.view.WindowInsetsControllerCompat;
|
||||||
|
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
@@ -64,6 +65,9 @@ public class SystemChrome {
|
|||||||
private static void setSystemChromeEnabledSystemUIOverlays(Activity activity, List<SystemUiOverlay> overlaysToShow) {
|
private static void setSystemChromeEnabledSystemUIOverlays(Activity activity, List<SystemUiOverlay> overlaysToShow) {
|
||||||
// Start by assuming we want to hide all system overlays (like an immersive
|
// Start by assuming we want to hide all system overlays (like an immersive
|
||||||
// game).
|
// game).
|
||||||
|
|
||||||
|
disableEdgeToEdge(activity);
|
||||||
|
|
||||||
int enabledOverlays =
|
int enabledOverlays =
|
||||||
DEFAULT_SYSTEM_UI
|
DEFAULT_SYSTEM_UI
|
||||||
| View.SYSTEM_UI_FLAG_FULLSCREEN
|
| View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||||
@@ -136,6 +140,7 @@ public class SystemChrome {
|
|||||||
|
|
||||||
|
|
||||||
private static int mEnabledOverlays;
|
private static int mEnabledOverlays;
|
||||||
|
private static boolean isEdgeToEdge = false;
|
||||||
private static SystemChromeStyle currentTheme;
|
private static SystemChromeStyle currentTheme;
|
||||||
|
|
||||||
|
|
||||||
@@ -176,6 +181,12 @@ public class SystemChrome {
|
|||||||
private static void setSystemChromeEnabledSystemUIMode(Activity activity, SystemUiMode systemUiMode) {
|
private static void setSystemChromeEnabledSystemUIMode(Activity activity, SystemUiMode systemUiMode) {
|
||||||
int enabledOverlays;
|
int enabledOverlays;
|
||||||
|
|
||||||
|
// If we were previously in edge-to-edge mode and are switching to a different mode,
|
||||||
|
// restore the default window inset behavior.
|
||||||
|
if (systemUiMode != SystemUiMode.EDGE_TO_EDGE) {
|
||||||
|
disableEdgeToEdge(activity);
|
||||||
|
}
|
||||||
|
|
||||||
if (systemUiMode == SystemUiMode.LEAN_BACK) {
|
if (systemUiMode == SystemUiMode.LEAN_BACK) {
|
||||||
// LEAN BACK
|
// LEAN BACK
|
||||||
// Available starting at Android SDK 4.1 (API 16).
|
// Available starting at Android SDK 4.1 (API 16).
|
||||||
@@ -258,10 +269,12 @@ public class SystemChrome {
|
|||||||
// SDK 29 and up will apply a translucent body scrim behind 2/3 button navigation bars
|
// SDK 29 and up will apply a translucent body scrim behind 2/3 button navigation bars
|
||||||
// to ensure contrast with buttons on the nav and status bars, unless the contrast is not
|
// to ensure contrast with buttons on the nav and status bars, unless the contrast is not
|
||||||
// enforced in the overlay styling.
|
// enforced in the overlay styling.
|
||||||
enabledOverlays =
|
isEdgeToEdge = true;
|
||||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
enableEdgeToEdge(activity);
|
||||||
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
if (currentTheme != null) {
|
||||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
|
setSystemChromeSystemUIOverlayStyle(activity, currentTheme);
|
||||||
|
}
|
||||||
|
return;
|
||||||
} else {
|
} else {
|
||||||
// When none of the conditions are matched, return without updating the system UI overlays.
|
// When none of the conditions are matched, return without updating the system UI overlays.
|
||||||
return;
|
return;
|
||||||
@@ -273,12 +286,29 @@ public class SystemChrome {
|
|||||||
|
|
||||||
|
|
||||||
public static void updateSystemUiOverlays(Activity activity) {
|
public static void updateSystemUiOverlays(Activity activity) {
|
||||||
|
if (isEdgeToEdge) {
|
||||||
|
// In edge-to-edge mode, re-apply the modern API instead of using deprecated
|
||||||
|
// setSystemUiVisibility(), which could interfere with WindowCompat on API < 30.
|
||||||
|
enableEdgeToEdge(activity);
|
||||||
|
} else {
|
||||||
activity.getWindow().getDecorView().setSystemUiVisibility(mEnabledOverlays);
|
activity.getWindow().getDecorView().setSystemUiVisibility(mEnabledOverlays);
|
||||||
|
}
|
||||||
if (currentTheme != null) {
|
if (currentTheme != null) {
|
||||||
setSystemChromeSystemUIOverlayStyle(activity, currentTheme);
|
setSystemChromeSystemUIOverlayStyle(activity, currentTheme);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void enableEdgeToEdge(Activity activity) {
|
||||||
|
activity.getWindow().getDecorView().setSystemUiVisibility(0);
|
||||||
|
WindowCompat.setDecorFitsSystemWindows(activity.getWindow(), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void disableEdgeToEdge(Activity activity) {
|
||||||
|
if (isEdgeToEdge) {
|
||||||
|
isEdgeToEdge = false;
|
||||||
|
WindowCompat.setDecorFitsSystemWindows(activity.getWindow(), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void setSystemChromeSystemUIOverlayStyle(Activity activity, SystemChromeStyle systemChromeStyle) {
|
private static void setSystemChromeSystemUIOverlayStyle(Activity activity, SystemChromeStyle systemChromeStyle) {
|
||||||
Window window = activity.getWindow();
|
Window window = activity.getWindow();
|
||||||
|
|||||||
@@ -1546,16 +1546,16 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
Positioned(
|
Positioned(
|
||||||
left: 0,
|
left: 0,
|
||||||
right: 0,
|
right: 0,
|
||||||
bottom: 0.75,
|
bottom: 0,
|
||||||
child: SegmentProgressBar(
|
child: SegmentProgressBar(
|
||||||
|
height: 1.5,
|
||||||
segments: videoDetailController.segmentProgressList,
|
segments: videoDetailController.segmentProgressList,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (videoDetailController.viewPointList.isNotEmpty &&
|
if (videoDetailController.viewPointList.isNotEmpty &&
|
||||||
videoDetailController.showVP.value)
|
videoDetailController.showVP.value)
|
||||||
Padding(
|
ViewPointSegmentProgressBar(
|
||||||
padding: const .only(bottom: 4.25),
|
height: 1.5,
|
||||||
child: ViewPointSegmentProgressBar(
|
|
||||||
segments: videoDetailController.viewPointList,
|
segments: videoDetailController.viewPointList,
|
||||||
onSeek: PlatformUtils.isMobile
|
onSeek: PlatformUtils.isMobile
|
||||||
? (position) => plPlayerController.seekTo(
|
? (position) => plPlayerController.seekTo(
|
||||||
@@ -1564,7 +1564,6 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user