|
|
@@ -140,8 +140,7 @@ import {
|
|
|
import {
|
|
|
PlaylistPlayRequest,
|
|
|
consumePendingPlaylistPlay,
|
|
|
- clearPendingPlaylistPlay,
|
|
|
- setPlaylistPlayConsumerReady
|
|
|
+ clearPendingPlaylistPlay
|
|
|
} from '../common/util/PlaylistPlayRequestStore';
|
|
|
|
|
|
import { HSBColorPicker, HSBColorPickerLayout } from '@keke/color-picker'
|
|
|
@@ -1098,7 +1097,6 @@ export struct LocalMusic {
|
|
|
|
|
|
Logger.error('heanup eventPlaylistPlay: 接收到无效的数据结构')
|
|
|
});
|
|
|
- setPlaylistPlayConsumerReady(true);
|
|
|
Promise.resolve().then(async (): Promise<void> => {
|
|
|
const pendingPlaylistRequest = consumePendingPlaylistPlay();
|
|
|
if (!pendingPlaylistRequest) {
|
|
|
@@ -1307,7 +1305,7 @@ export struct LocalMusic {
|
|
|
ToastUtil.showToast('当前播放列表为空,请先导入音乐。');
|
|
|
return
|
|
|
}
|
|
|
- this.setShowPlayTrue(true)
|
|
|
+ this.setShowPlayTrue()
|
|
|
this.showPlayerView();
|
|
|
});
|
|
|
this.getUIContext().getHostContext()!.eventHub.on('dismissPlayerView', () => {
|
|
|
@@ -2288,7 +2286,6 @@ export struct LocalMusic {
|
|
|
this.knockController?.immersiveDisableListening();
|
|
|
this.curIndex = 0
|
|
|
this.isAppForeground = false;
|
|
|
- setPlaylistPlayConsumerReady(false);
|
|
|
emitter.off(EventConstants.EVENT_AUDIO_OPEN);
|
|
|
emitter.off(EventConstants.EVENT_SCAN_UPDATE);
|
|
|
emitter.off(EventConstants.EVENT_SWIPE_BACK_UPDATE);
|
|
|
@@ -3811,9 +3808,7 @@ export struct LocalMusic {
|
|
|
|
|
|
build() {
|
|
|
Stack() {
|
|
|
- if (this.mType === 0) {
|
|
|
- this.ContentBuild()
|
|
|
- }
|
|
|
+ this.ContentBuild()
|
|
|
Stack() {
|
|
|
Column()
|
|
|
.bindSheet($$this.isShowSheet, this.PlayListSheet(), {
|
|
|
@@ -3829,16 +3824,12 @@ export struct LocalMusic {
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
- if (this.isShowPlay) {
|
|
|
- Stack() {
|
|
|
- this.MusicPlayBuilder()
|
|
|
- }
|
|
|
- .width('100%')
|
|
|
- .height('100%')
|
|
|
- .zIndex(99)
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
+ .bindContentCover($$this.isShowPlay, this.MusicPlayBuilder(), {
|
|
|
+ modalTransition: ModalTransition.DEFAULT,
|
|
|
+ onWillDisappear: () => {
|
|
|
+ this.setShowPlayFalse()
|
|
|
+ },
|
|
|
+ })
|
|
|
}
|
|
|
.alignContent(Alignment.Bottom)
|
|
|
.width('100%')
|
|
|
@@ -9119,54 +9110,24 @@ export struct LocalMusic {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
- setShowPlayTrue(fromMiniBar: boolean = false){
|
|
|
- this.clearPlayDismissTimer()
|
|
|
- this.clearPlayOpenTimer()
|
|
|
- if (this.isShowPlay) {
|
|
|
- return
|
|
|
- }
|
|
|
- if (fromMiniBar) {
|
|
|
- this.preparePlayerViewOpenFromMiniBar()
|
|
|
- } else {
|
|
|
- this.resetMusicPlayDismissState()
|
|
|
- }
|
|
|
- this.isShowPlay = true;
|
|
|
- this.showCoverScaleGuideIfNeeded()
|
|
|
- }
|
|
|
-
|
|
|
- private closePlayerViewWithMiniBarAnimation(): void {
|
|
|
- if (!this.isShowPlay || this.playDismissOpacity < 1) {
|
|
|
- return
|
|
|
- }
|
|
|
- const target = this.resolveMiniBarDismissTarget()
|
|
|
-
|
|
|
- this.clearPlayDismissTimer()
|
|
|
- this.clearPlayOpenTimer()
|
|
|
+ setShowPlayTrue(){
|
|
|
this.getUIContext()?.animateTo({
|
|
|
- duration: this.playDismissContentDuration + 40,
|
|
|
- curve: Curve.Sharp
|
|
|
+ duration: 500,
|
|
|
+ curve: Curve.Friction
|
|
|
}, () => {
|
|
|
- this.translateY = target.translateY
|
|
|
- this.playDismissTranslateX = 0
|
|
|
- this.playDismissScale = 0.9
|
|
|
- this.playDismissScaleY = 0.8
|
|
|
- this.playDismissOpacity = 0.04
|
|
|
- this.playDismissBorderRadius = 48
|
|
|
- this.playDismissProxySize = 0
|
|
|
- this.playDismissProxyOpacity = 0
|
|
|
- this.playDragUiOpacity = 0
|
|
|
- this.scaleValueImage = 0.8
|
|
|
- this.scaleValueText = 0.86
|
|
|
- })
|
|
|
- this.playDismissTimer = setTimeout(() => {
|
|
|
- this.playDismissTimer = -1
|
|
|
- this.isShowPlay = false
|
|
|
- this.isShowCoverScaleGuide = false
|
|
|
- }, this.playDismissContentDuration + 56)
|
|
|
+ this.isShowPlay = true;
|
|
|
+ this.showCoverScaleGuideIfNeeded()
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
setShowPlayFalse(){
|
|
|
- this.closePlayerViewWithMiniBarAnimation()
|
|
|
+ this.getUIContext()?.animateTo({
|
|
|
+ duration: 500,
|
|
|
+ curve: Curve.Friction
|
|
|
+ }, () => {
|
|
|
+ this.isShowPlay = false;
|
|
|
+ });
|
|
|
+ this.isShowCoverScaleGuide = false
|
|
|
}
|
|
|
//打开播放页
|
|
|
showPlayerView() {
|
|
|
@@ -12353,47 +12314,35 @@ export struct LocalMusic {
|
|
|
|
|
|
@Builder
|
|
|
MusicPlayBuilder() {
|
|
|
- Stack({ alignContent: Alignment.Center }) {
|
|
|
- Column() {
|
|
|
- this.IjkMusicPlayerView()
|
|
|
- }
|
|
|
- .visualEffect(deviceInfo.sdkApiVersion>=20&&this.bgController&&this.playDismissOpacity>=1
|
|
|
- && this.playDismissProxySize<=0 && this.playDismissBorderRadius<=0 ?
|
|
|
- new hdsEffect.HdsEffectBuilder()
|
|
|
- .shaderEffect({
|
|
|
- effectType: hdsEffect.EffectType.UV_BACKGROUND_FLOW_LIGHT,
|
|
|
- animation: {
|
|
|
- duration: 10000,
|
|
|
- iterations: -1,
|
|
|
- autoPlay: true,
|
|
|
- onFinish: ()=> {
|
|
|
- console.info('Succeeded in finishing');
|
|
|
- }
|
|
|
- },
|
|
|
- controller: this.bgController,
|
|
|
- })
|
|
|
- .buildEffect():null)
|
|
|
-
|
|
|
- .height('100%')
|
|
|
- .width('100%')
|
|
|
- .borderRadius(this.playDismissBorderRadius)
|
|
|
- .clip(true)
|
|
|
- .translate({ x: this.playDismissTranslateX, y: this.translateY })
|
|
|
- .scale({ x: this.playDismissScale, y: this.playDismissScaleY })
|
|
|
- .opacity(this.playDismissOpacity)
|
|
|
-
|
|
|
- if (this.playDismissProxySize > 0) {
|
|
|
- this.MusicPlayDismissProxyDot()
|
|
|
- }
|
|
|
- }
|
|
|
+ Column() {
|
|
|
+ this.IjkMusicPlayerView()
|
|
|
+ }
|
|
|
+ .transition(TransitionEffect.asymmetric(
|
|
|
+ TransitionEffect.opacity(1),
|
|
|
+ TransitionEffect.OPACITY
|
|
|
+ ))
|
|
|
+ .visualEffect(deviceInfo.sdkApiVersion>=20&&this.bgController?
|
|
|
+ new hdsEffect.HdsEffectBuilder()
|
|
|
+ .shaderEffect({
|
|
|
+ effectType: hdsEffect.EffectType.UV_BACKGROUND_FLOW_LIGHT,
|
|
|
+ animation: {
|
|
|
+ duration: 10000,
|
|
|
+ iterations: -1,
|
|
|
+ autoPlay: true,
|
|
|
+ onFinish: ()=> {
|
|
|
+ console.info('Succeeded in finishing');
|
|
|
+ }
|
|
|
+ },
|
|
|
+ controller: this.bgController,
|
|
|
+ })
|
|
|
+ .buildEffect():null)
|
|
|
.height('100%')
|
|
|
.width('100%')
|
|
|
- .onAppear(() => {
|
|
|
- this.startPlayerViewOpenAnimationIfNeeded()
|
|
|
- })
|
|
|
.onDisAppear(() => {
|
|
|
- this.resetMusicPlayDismissState()
|
|
|
+ this.translateY = 0;
|
|
|
+ this.playDragUiOpacity = 1
|
|
|
})
|
|
|
+ .translate({ y: this.translateY })
|
|
|
.gesture(
|
|
|
PanGesture(this.panOption)
|
|
|
.onActionUpdate((event?: GestureEvent) => {
|
|
|
@@ -12420,7 +12369,7 @@ export struct LocalMusic {
|
|
|
duration: 500,
|
|
|
curve: Curve.Sharp
|
|
|
}, () => {
|
|
|
- this.scaleValueImage = Math.min(1, Math.max(0.46, 1 - this.translateY / 900));
|
|
|
+ this.scaleValueImage = Math.min(1, Math.max(0.5, 1 - this.translateY / 880));
|
|
|
console.info('onecold scaleValueImage:', this.scaleValueImage)
|
|
|
this.scaleValueText = Math.min(1, Math.max(0.88, 1 - this.translateY / 2000));
|
|
|
this.playDragUiOpacity = Math.min(1, Math.max(0, 1 - this.translateY / 300));
|
|
|
@@ -12457,7 +12406,17 @@ export struct LocalMusic {
|
|
|
const shouldClose = this.translateY > minDistance || velocity > minVelocity;
|
|
|
|
|
|
if (shouldClose) {
|
|
|
- this.closePlayerViewWithMiniBarAnimation()
|
|
|
+ // 添加关闭动画
|
|
|
+ this.getUIContext().animateTo({
|
|
|
+ duration: 600,
|
|
|
+ curve: Curve.Friction
|
|
|
+ }, () => {
|
|
|
+ this.isShowPlay = false;
|
|
|
+ this.scaleValueImage = 1
|
|
|
+ this.scaleValueText = 1
|
|
|
+ this.playDragUiOpacity = 1
|
|
|
+ this.translateY = 0;
|
|
|
+ })
|
|
|
} else {
|
|
|
// 回弹动画
|
|
|
this.getUIContext().animateTo({
|