|
|
@@ -117,6 +117,7 @@ import { BreakpointType, BreakpointTypeEnum } from '../common/util/BreakpointSys
|
|
|
import { resourceManager } from '@kit.LocalizationKit';
|
|
|
import { deviceInfo } from '@kit.BasicServicesKit';
|
|
|
import '../common/network/RemoteCacheRegistry';
|
|
|
+import { shouldWrapLocalMusicMenuInScroll } from '../common/util/LocalMusicMenuScrollHelper';
|
|
|
import { ServerLogUtil } from '../common/util/ServerLogUtil';
|
|
|
import { lyricService, SongData } from '../common/service/LyricService';
|
|
|
import { shouldResolveRemoteLyricOnPlay, tryResolveRemotePlaybackLyric } from '../common/util/RemotePlaybackLyricUtil';
|
|
|
@@ -6541,11 +6542,11 @@ export struct LocalMusic {
|
|
|
.width('100%')
|
|
|
.clickEffect({ level: ClickEffectLevel.LIGHT, scale: 0.9 })
|
|
|
|
|
|
- .bindContextMenu(this.MenuBuilder(item, index, item.filePath), ResponseType.LongPress,
|
|
|
+ .bindContextMenu(this.ContextMenuBuilder(item, index, item.filePath), ResponseType.LongPress,
|
|
|
{
|
|
|
preview: MenuPreviewMode.IMAGE
|
|
|
})
|
|
|
- .bindContextMenu(this.MenuBuilder(item, index, item.filePath), ResponseType.RightClick,
|
|
|
+ .bindContextMenu(this.ContextMenuBuilder(item, index, item.filePath), ResponseType.RightClick,
|
|
|
{
|
|
|
preview: MenuPreviewMode.IMAGE
|
|
|
})
|
|
|
@@ -6951,11 +6952,11 @@ export struct LocalMusic {
|
|
|
this.MusicItemGrid(item, index)
|
|
|
}
|
|
|
}
|
|
|
- .bindContextMenu(this.MenuBuilder(item, index, item.filePath), ResponseType.LongPress,
|
|
|
+ .bindContextMenu(this.ContextMenuBuilder(item, index, item.filePath), ResponseType.LongPress,
|
|
|
{
|
|
|
preview: MenuPreviewMode.IMAGE
|
|
|
})
|
|
|
- .bindContextMenu(this.MenuBuilder(item, index, item.filePath), ResponseType.RightClick,
|
|
|
+ .bindContextMenu(this.ContextMenuBuilder(item, index, item.filePath), ResponseType.RightClick,
|
|
|
{
|
|
|
preview: MenuPreviewMode.IMAGE
|
|
|
})
|
|
|
@@ -7286,20 +7287,16 @@ export struct LocalMusic {
|
|
|
}
|
|
|
@State isShowDetail:boolean = false
|
|
|
@State longItemFilePathDetail:string =''
|
|
|
- @Builder
|
|
|
- MenuBuilder(item: VideoItem, index: number, filePath: string) {
|
|
|
- if(
|
|
|
- ((this.modeType===2||this.modeType==3)&&!this.isCanBack)
|
|
|
- ||(item.name === LocalMusic.STR_LOCK_VIDEO || item.name === LocalMusic.STR_FAC_VIDEO ||
|
|
|
- item.name === LocalMusic.STR_HISTORY_MUSIC)
|
|
|
- ){
|
|
|
- //如果是专辑和艺术家的首页,不能长按
|
|
|
- //如果是我的收藏 最近播放等也不能长按
|
|
|
- }else{
|
|
|
+ private canShowItemContextMenu(item: VideoItem): boolean {
|
|
|
+ return !(((this.modeType===2||this.modeType==3)&&!this.isCanBack)
|
|
|
+ ||(item.name === LocalMusic.STR_LOCK_VIDEO || item.name === LocalMusic.STR_FAC_VIDEO ||
|
|
|
+ item.name === LocalMusic.STR_HISTORY_MUSIC))
|
|
|
+ }
|
|
|
|
|
|
- Scroll() {
|
|
|
- Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
|
|
|
- Menu() {
|
|
|
+ @Builder
|
|
|
+ private LocalMusicMenuContent(item: VideoItem, index: number, filePath: string) {
|
|
|
+ Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
|
|
|
+ Menu() {
|
|
|
MenuItem({
|
|
|
symbolStartIcon: new SymbolGlyphModifier(Utility.getIsFav(this.favList, item) ?
|
|
|
$r('sys.symbol.heart_fill') : $r('sys.symbol.heart')),
|
|
|
@@ -7529,16 +7526,42 @@ export struct LocalMusic {
|
|
|
this.longItemFilePath = ''
|
|
|
})
|
|
|
|
|
|
- }
|
|
|
- .font({ size: 14, weight: FontWeight.Normal })
|
|
|
- }
|
|
|
- .width(180)
|
|
|
}
|
|
|
- .height('auto')
|
|
|
- .enableScrollInteraction(true)
|
|
|
- .scrollBar(this.isGridMusic?BarState.On:BarState.Off)
|
|
|
+ .font({ size: 14, weight: FontWeight.Normal })
|
|
|
+ }
|
|
|
+ .width(180)
|
|
|
+ }
|
|
|
+
|
|
|
+ @Builder
|
|
|
+ MenuBuilder(item: VideoItem, index: number, filePath: string) {
|
|
|
+ if (this.canShowItemContextMenu(item)) {
|
|
|
+ if (shouldWrapLocalMusicMenuInScroll(false)) {
|
|
|
+ Scroll() {
|
|
|
+ this.LocalMusicMenuContent(item, index, filePath)
|
|
|
+ }
|
|
|
+ .height('auto')
|
|
|
+ .enableScrollInteraction(true)
|
|
|
+ .scrollBar(this.isGridMusic?BarState.On:BarState.Off)
|
|
|
+ } else {
|
|
|
+ this.LocalMusicMenuContent(item, index, filePath)
|
|
|
+ }
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
+ @Builder
|
|
|
+ ContextMenuBuilder(item: VideoItem, index: number, filePath: string) {
|
|
|
+ if (this.canShowItemContextMenu(item)) {
|
|
|
+ if (shouldWrapLocalMusicMenuInScroll(true)) {
|
|
|
+ Scroll() {
|
|
|
+ this.LocalMusicMenuContent(item, index, filePath)
|
|
|
+ }
|
|
|
+ .height('auto')
|
|
|
+ .enableScrollInteraction(true)
|
|
|
+ .scrollBar(this.isGridMusic?BarState.On:BarState.Off)
|
|
|
+ } else {
|
|
|
+ this.LocalMusicMenuContent(item, index, filePath)
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
private listMaxScrollOffsetY: number = 0
|
|
|
private selectedIndex: number = -1
|