|
|
@@ -65,6 +65,11 @@ import { hdsEffect } from '@kit.UIDesignKit';
|
|
|
import {
|
|
|
resolveMiniPlayerMorphTarget,
|
|
|
} from '../common/util/PlayerDismissHelper';
|
|
|
+import {
|
|
|
+ MiniPlayerOrbTapAction,
|
|
|
+ resolveMiniPlayerOrbTapAction,
|
|
|
+ shouldTriggerMiniPlayerOrbSingleTap
|
|
|
+} from '../common/util/MiniPlayerOrbTapHelper';
|
|
|
|
|
|
// import { FFmpeg, FFProgressMessageParser } from '@sj/ffmpeg';
|
|
|
|
|
|
@@ -203,6 +208,8 @@ struct NewIndex {
|
|
|
private miniPlayerModeAnimationTimer: number = -1;
|
|
|
private miniPlayerModeSettleTimer: number = -1;
|
|
|
private miniPlayerModeCompleteTimer: number = -1;
|
|
|
+ private miniPlayerOrbTapTimer: number = -1;
|
|
|
+ private lastMiniPlayerOrbTapAt: number = 0;
|
|
|
private readonly miniPlayerMorphDuration: number = 240;
|
|
|
private readonly miniPlayerDotDuration: number = 190;
|
|
|
private readonly miniPlayerShakeFirstDuration: number = 110;
|
|
|
@@ -210,6 +217,7 @@ struct NewIndex {
|
|
|
private readonly miniPlayerShakeSettleDuration: number = 170;
|
|
|
private readonly miniPlayerModeDuration: number = 360;
|
|
|
private readonly miniPlayerModeBounceDuration: number = 220;
|
|
|
+ private readonly miniPlayerOrbDoubleTapWindowMs: number = 240;
|
|
|
private isMiniPlayerModeTransitioning: boolean = false;
|
|
|
//当胶囊按钮的选择发生变化时调用此函数
|
|
|
tabSelectedIndexesChanged() {
|
|
|
@@ -541,28 +549,27 @@ struct NewIndex {
|
|
|
this.currentSongListName = ''
|
|
|
this.modeType = 0
|
|
|
this.tabSelectedIndexes = [0]
|
|
|
- setTimeout(()=>{
|
|
|
- if(this.defalut_home_type==1){
|
|
|
- this.mType = 0
|
|
|
- this.modeType = 1
|
|
|
- }else if(this.defalut_home_type==2){//如果是网盘的话
|
|
|
- this.tabSelectedIndexes = [2]
|
|
|
- if (configuredAccount) {
|
|
|
- this.selectedAccount = configuredAccount
|
|
|
- }
|
|
|
- this.mType = this.isRemoteMusicAccount(configuredAccount) ? 7 : 6
|
|
|
- }else if(this.defalut_home_type==3){
|
|
|
- this.mType = 0
|
|
|
- this.modeType = 2
|
|
|
- }else if(this.defalut_home_type==4){
|
|
|
- this.mType = 0
|
|
|
- this.modeType = 3
|
|
|
- }else if(this.defalut_home_type==5){
|
|
|
- this.enterFindPage()
|
|
|
- } else {
|
|
|
- this.mType = 0
|
|
|
+ this.mType = 0
|
|
|
+
|
|
|
+ if(this.defalut_home_type==1){
|
|
|
+ this.mType = 0
|
|
|
+ this.modeType = 1
|
|
|
+ }else if(this.defalut_home_type==2){//如果是网盘的话
|
|
|
+ this.tabSelectedIndexes = [2]
|
|
|
+ if (configuredAccount) {
|
|
|
+ this.selectedAccount = configuredAccount
|
|
|
}
|
|
|
- },150)
|
|
|
+ this.mType = this.isRemoteMusicAccount(configuredAccount) ? 7 : 6
|
|
|
+ }else if(this.defalut_home_type==3){
|
|
|
+ this.mType = 0
|
|
|
+ this.modeType = 2
|
|
|
+ }else if(this.defalut_home_type==4){
|
|
|
+ this.mType = 0
|
|
|
+ this.modeType = 3
|
|
|
+ }else if(this.defalut_home_type==5){
|
|
|
+ this.enterFindPage()
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -642,9 +649,48 @@ struct NewIndex {
|
|
|
clearTimeout(this.miniPlayerModeCompleteTimer)
|
|
|
this.miniPlayerModeCompleteTimer = -1
|
|
|
}
|
|
|
+ this.clearMiniPlayerOrbTapTimer()
|
|
|
this.isMiniPlayerModeTransitioning = false
|
|
|
}
|
|
|
|
|
|
+ private clearMiniPlayerOrbTapTimer(): void {
|
|
|
+ if (this.miniPlayerOrbTapTimer >= 0) {
|
|
|
+ clearTimeout(this.miniPlayerOrbTapTimer)
|
|
|
+ this.miniPlayerOrbTapTimer = -1
|
|
|
+ }
|
|
|
+ this.lastMiniPlayerOrbTapAt = 0
|
|
|
+ }
|
|
|
+
|
|
|
+ private scheduleMiniPlayerOrbSingleTap(triggerAt: number): void {
|
|
|
+ this.clearMiniPlayerOrbTapTimer()
|
|
|
+ this.lastMiniPlayerOrbTapAt = triggerAt
|
|
|
+ this.miniPlayerOrbTapTimer = setTimeout(() => {
|
|
|
+ this.miniPlayerOrbTapTimer = -1
|
|
|
+ if (!shouldTriggerMiniPlayerOrbSingleTap(this.lastMiniPlayerOrbTapAt, Date.now(),
|
|
|
+ this.miniPlayerOrbDoubleTapWindowMs)) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.lastMiniPlayerOrbTapAt = 0
|
|
|
+ this.expandMiniPlayerFromOrb()
|
|
|
+ }, this.miniPlayerOrbDoubleTapWindowMs)
|
|
|
+ }
|
|
|
+
|
|
|
+ private handleMiniPlayerOrbTap(): void {
|
|
|
+ const now = Date.now()
|
|
|
+ const action = resolveMiniPlayerOrbTapAction(
|
|
|
+ this.miniPlayerOrbTapTimer >= 0,
|
|
|
+ this.lastMiniPlayerOrbTapAt,
|
|
|
+ now,
|
|
|
+ this.miniPlayerOrbDoubleTapWindowMs
|
|
|
+ )
|
|
|
+ if (action === MiniPlayerOrbTapAction.TRIGGER_DOUBLE_TAP) {
|
|
|
+ this.clearMiniPlayerOrbTapTimer()
|
|
|
+ this.setShowPlayTrue()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.scheduleMiniPlayerOrbSingleTap(now)
|
|
|
+ }
|
|
|
+
|
|
|
// 窗口尺寸、断点或显示设备切换时,重新同步播放条表面尺寸。
|
|
|
// 这样从手机态切到 HiCar 横屏后,surface 会立即按当前显示环境重新拉伸。
|
|
|
private onMiniPlayerLayoutContextChange(): void {
|
|
|
@@ -982,7 +1028,7 @@ struct NewIndex {
|
|
|
}
|
|
|
.width('100%')
|
|
|
.height('100%')
|
|
|
- .visibility(this.mType === 0 || this.isShowPlay ? Visibility.Visible : Visibility.None)
|
|
|
+ .visibility(this.mType === 0 || this.isShowPlay ? Visibility.Visible : Visibility.Hidden)
|
|
|
.zIndex(this.isShowPlay ? 100 : 0)
|
|
|
// 本地音乐内容区
|
|
|
if(this.mType === 1 ){
|
|
|
@@ -1234,7 +1280,7 @@ struct NewIndex {
|
|
|
.scale({ x: this.miniPlayerOrbScale, y: this.miniPlayerOrbScale, centerX: '50%', centerY: '50%' })
|
|
|
.translate({ x: this.miniPlayerOrbTranslateX })
|
|
|
.onClick((): void => {
|
|
|
- this.expandMiniPlayerFromOrb()
|
|
|
+ this.handleMiniPlayerOrbTap()
|
|
|
})
|
|
|
}
|
|
|
|