mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-15 15:00:11 +08:00
@@ -20,6 +20,10 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@Keep
|
||||
public final class AndroidHelper {
|
||||
public static volatile boolean isPipMode = false;
|
||||
|
||||
public static volatile boolean isPipAvailable = false;
|
||||
|
||||
private AndroidHelper() {
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,9 @@ class MainActivity : AudioServiceActivity() {
|
||||
window.attributes.layoutInDisplayCutoutMode =
|
||||
LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
|
||||
}
|
||||
|
||||
AndroidHelper.isPipAvailable =
|
||||
packageManager.hasSystemFeature(PackageManager.FEATURE_PICTURE_IN_PICTURE)
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
@@ -52,8 +55,6 @@ class MainActivity : AudioServiceActivity() {
|
||||
isInPictureInPictureMode: Boolean, newConfig: Configuration?
|
||||
) {
|
||||
super.onPictureInPictureModeChanged(isInPictureInPictureMode, newConfig)
|
||||
MethodChannel(flutterEngine!!.dartExecutor.binaryMessenger, "floating").invokeMethod(
|
||||
"onPipChanged", isInPictureInPictureMode
|
||||
)
|
||||
AndroidHelper.isPipMode = isInPictureInPictureMode
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ import 'package:PiliPlus/plugin/pl_player/models/play_status.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/utils/danmaku_options.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/view/view.dart';
|
||||
import 'package:PiliPlus/services/service_locator.dart';
|
||||
import 'package:PiliPlus/utils/android/bindings.g.dart';
|
||||
import 'package:PiliPlus/utils/extension/size_ext.dart';
|
||||
import 'package:PiliPlus/utils/extension/theme_ext.dart';
|
||||
import 'package:PiliPlus/utils/image_utils.dart';
|
||||
@@ -44,7 +45,6 @@ import 'package:PiliPlus/utils/theme_utils.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:canvas_danmaku/canvas_danmaku.dart';
|
||||
import 'package:floating/floating.dart';
|
||||
import 'package:flutter/foundation.dart' show kDebugMode, clampDouble;
|
||||
import 'package:flutter/material.dart' hide PageView;
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
@@ -194,7 +194,7 @@ class _LiveRoomPageState extends State<LiveRoomPage>
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Widget child;
|
||||
if (Platform.isAndroid && Floating().isPipMode) {
|
||||
if (Platform.isAndroid && AndroidHelper.isPipMode) {
|
||||
child = videoPlayerPanel(
|
||||
isFullScreen,
|
||||
width: maxWidth,
|
||||
|
||||
@@ -7,8 +7,8 @@ import 'package:PiliPlus/plugin/pl_player/controller.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/widgets/common_btn.dart';
|
||||
import 'package:PiliPlus/services/shutdown_timer_service.dart'
|
||||
show shutdownTimerService;
|
||||
import 'package:PiliPlus/utils/android/bindings.g.dart';
|
||||
import 'package:PiliPlus/utils/platform_utils.dart';
|
||||
import 'package:floating/floating.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -159,12 +159,12 @@ class _LiveHeaderControlState extends State<LiveHeaderControl>
|
||||
ComBtn(
|
||||
height: 30,
|
||||
tooltip: '画中画',
|
||||
onTap: () async {
|
||||
onTap: () {
|
||||
if (PlatformUtils.isDesktop) {
|
||||
plPlayerController.toggleDesktopPip();
|
||||
return;
|
||||
}
|
||||
if (await Floating().isPipAvailable) {
|
||||
if (AndroidHelper.isPipAvailable) {
|
||||
plPlayerController.enterPip();
|
||||
}
|
||||
},
|
||||
|
||||
@@ -55,7 +55,6 @@ import 'package:PiliPlus/utils/page_utils.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:PiliPlus/utils/storage_key.dart';
|
||||
import 'package:extended_nested_scroll_view/extended_nested_scroll_view.dart';
|
||||
import 'package:floating/floating.dart';
|
||||
import 'package:flutter/foundation.dart' show kDebugMode, clampDouble;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart' show SystemUiOverlayStyle;
|
||||
@@ -238,17 +237,10 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
}
|
||||
|
||||
if (exitFlag) {
|
||||
// 结束播放退出全屏
|
||||
plPlayerController!.triggerFullScreen(status: false);
|
||||
if (plPlayerController!.controlsLock.value) {
|
||||
plPlayerController!.onLockControl(false);
|
||||
}
|
||||
// 播放完展示控制栏
|
||||
if (Platform.isAndroid) {
|
||||
if (await Floating().pipStatus == PiPStatus.disabled) {
|
||||
plPlayerController!.onLockControl(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ import 'package:PiliPlus/services/shutdown_timer_service.dart'
|
||||
show shutdownTimerService;
|
||||
import 'package:PiliPlus/utils/accounts.dart';
|
||||
import 'package:PiliPlus/utils/accounts/account.dart';
|
||||
import 'package:PiliPlus/utils/android/bindings.g.dart';
|
||||
import 'package:PiliPlus/utils/connectivity_utils.dart';
|
||||
import 'package:PiliPlus/utils/extension/num_ext.dart';
|
||||
import 'package:PiliPlus/utils/extension/string_ext.dart';
|
||||
@@ -54,7 +55,6 @@ import 'package:collection/collection.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:easy_debounce/easy_throttle.dart';
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:floating/floating.dart';
|
||||
import 'package:flutter/foundation.dart' show compute;
|
||||
import 'package:flutter/material.dart' hide showBottomSheet;
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
@@ -1751,12 +1751,12 @@ class HeaderControlState extends State<HeaderControl>
|
||||
child: IconButton(
|
||||
tooltip: '画中画',
|
||||
style: btnStyle,
|
||||
onPressed: () async {
|
||||
onPressed: () {
|
||||
if (PlatformUtils.isDesktop) {
|
||||
plPlayerController.toggleDesktopPip();
|
||||
return;
|
||||
}
|
||||
if (await Floating().isPipAvailable) {
|
||||
if (AndroidHelper.isPipAvailable) {
|
||||
plPlayerController.enterPip();
|
||||
}
|
||||
},
|
||||
|
||||
@@ -24,6 +24,7 @@ import 'package:PiliPlus/plugin/pl_player/models/video_fit_type.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/utils/fullscreen.dart';
|
||||
import 'package:PiliPlus/services/service_locator.dart';
|
||||
import 'package:PiliPlus/utils/accounts.dart';
|
||||
import 'package:PiliPlus/utils/android/bindings.g.dart';
|
||||
import 'package:PiliPlus/utils/device_utils.dart';
|
||||
import 'package:PiliPlus/utils/extension/box_ext.dart';
|
||||
import 'package:PiliPlus/utils/extension/num_ext.dart';
|
||||
@@ -36,7 +37,6 @@ import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
import 'package:PiliPlus/utils/theme_utils.dart';
|
||||
import 'package:archive/archive.dart' show getCrc32;
|
||||
import 'package:canvas_danmaku/canvas_danmaku.dart';
|
||||
import 'package:floating/floating.dart';
|
||||
import 'package:flutter/foundation.dart' show kDebugMode;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart' show HapticFeedback, DeviceOrientation;
|
||||
@@ -193,7 +193,7 @@ class PlPlayerController with BlockConfigMixin {
|
||||
isLive ? _enableShowLiveDanmaku : _enableShowDanmaku;
|
||||
|
||||
bool get isPipMode =>
|
||||
(Platform.isAndroid && Floating().isPipMode) ||
|
||||
(Platform.isAndroid && AndroidHelper.isPipMode) ||
|
||||
(PlatformUtils.isDesktop && isDesktopPip);
|
||||
late bool isDesktopPip = false;
|
||||
late Rect _lastWindowBounds;
|
||||
|
||||
@@ -192,6 +192,33 @@ extension type AndroidHelper._(jni$_.JObject _$this) implements jni$_.JObject {
|
||||
|
||||
/// The type which includes information such as the signature of this class.
|
||||
static const jni$_.JType<AndroidHelper> type = $AndroidHelper$Type$();
|
||||
static final _id_isPipMode = _class.staticFieldId(
|
||||
r'isPipMode',
|
||||
r'Z',
|
||||
);
|
||||
|
||||
/// from: `static public volatile boolean isPipMode`
|
||||
static core$_.bool get isPipMode =>
|
||||
_id_isPipMode.getNullable(_class, jni$_.jboolean.type) as core$_.bool;
|
||||
|
||||
/// from: `static public volatile boolean isPipMode`
|
||||
static set isPipMode(core$_.bool value) =>
|
||||
_id_isPipMode.set(_class, jni$_.jboolean.type, value);
|
||||
|
||||
static final _id_isPipAvailable = _class.staticFieldId(
|
||||
r'isPipAvailable',
|
||||
r'Z',
|
||||
);
|
||||
|
||||
/// from: `static public volatile boolean isPipAvailable`
|
||||
static core$_.bool get isPipAvailable =>
|
||||
_id_isPipAvailable.getNullable(_class, jni$_.jboolean.type)
|
||||
as core$_.bool;
|
||||
|
||||
/// from: `static public volatile boolean isPipAvailable`
|
||||
static set isPipAvailable(core$_.bool value) =>
|
||||
_id_isPipAvailable.set(_class, jni$_.jboolean.type, value);
|
||||
|
||||
static final _id_back = _class.staticMethodId(
|
||||
r'back',
|
||||
r'()V',
|
||||
|
||||
@@ -191,13 +191,13 @@ abstract final class PageUtils {
|
||||
: height > width
|
||||
? const Rational.vertical()
|
||||
: const Rational.landscape();
|
||||
Floating().enable(
|
||||
Floating.enable(
|
||||
isAuto
|
||||
? AutoEnable(aspectRatio: aspectRatio)
|
||||
: EnableManual(aspectRatio: aspectRatio),
|
||||
);
|
||||
} else {
|
||||
Floating().enable(isAuto ? const AutoEnable() : const EnableManual());
|
||||
Floating.enable(isAuto ? const AutoEnable() : const EnableManual());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -563,8 +563,8 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
path: "."
|
||||
ref: version-3
|
||||
resolved-ref: a66ec0b9dabde6b5880a3f4f3425e57842a38e51
|
||||
ref: dev
|
||||
resolved-ref: fdd44a501d9717ebab04e8004fca2818a6bed236
|
||||
url: "https://github.com/bggRGjQaUbCoE/floating.git"
|
||||
source: git
|
||||
version: "3.0.0"
|
||||
|
||||
@@ -84,7 +84,7 @@ dependencies:
|
||||
floating:
|
||||
git:
|
||||
url: https://github.com/bggRGjQaUbCoE/floating.git
|
||||
ref: version-3
|
||||
ref: dev
|
||||
flutter_cache_manager: ^3.4.1
|
||||
flutter_html: ^3.0.0-beta.2
|
||||
flutter_inappwebview: ^6.1.5
|
||||
|
||||
Reference in New Issue
Block a user