|
|
@@ -1,5 +1,5 @@
|
|
|
import TitleBar from './TitleBar'
|
|
|
-import { Animator, curves, display, PromptAction, promptAction, router, window } from '@kit.ArkUI';
|
|
|
+import { Animator, curves, display, PromptAction, promptAction, router, SymbolGlyphModifier, window } from '@kit.ArkUI';
|
|
|
import { VideoItem } from '../viewmodel/VideoItem';
|
|
|
import {
|
|
|
AppUtil,
|
|
|
@@ -2896,8 +2896,10 @@ export struct LocalMusic {
|
|
|
})
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ @State longItemFilePath:string=''
|
|
|
@Builder
|
|
|
- private MusicItemGrid(item: VideoItem, index?: number) {
|
|
|
+ private MusicItemGrid(item: VideoItem, index: number) {
|
|
|
|
|
|
Stack() {
|
|
|
|
|
|
@@ -2934,17 +2936,19 @@ export struct LocalMusic {
|
|
|
Column(){
|
|
|
Text(`${this.artistMap.get(item.name)?.length ?? 0}首`)
|
|
|
.fontSize(11)
|
|
|
- .visibility(this.modeType===2?Visibility.Visible:Visibility.None)
|
|
|
+ .visibility(this.modeType===2&&!this.isCanBack?Visibility.Visible:Visibility.None)
|
|
|
.fontColor($r('app.color.text_color'))
|
|
|
Text(`${this.albumMap.get(item.name)?.length ?? 0}首`)
|
|
|
.fontSize(11)
|
|
|
- .visibility(this.modeType===3?Visibility.Visible:Visibility.None)
|
|
|
+ .visibility(this.modeType===3&&!this.isCanBack?Visibility.Visible:Visibility.None)
|
|
|
.fontColor($r('app.color.text_color'))
|
|
|
Text(StrUtil.isEmpty(item.artist) ? 'Unknown' : item.artist )
|
|
|
.fontSize(11)
|
|
|
.maxLines(1)
|
|
|
.margin({top:2})
|
|
|
- .visibility(item.type==CommonConstants.TYPE_IS_DIR?Visibility.None:Visibility.Visible)
|
|
|
+ .visibility(item.type==CommonConstants.TYPE_IS_ARTIST
|
|
|
+ ||item.type==CommonConstants.TYPE_IS_ALBUM
|
|
|
+ ||item.type==CommonConstants.TYPE_IS_DIR?Visibility.None:Visibility.Visible)
|
|
|
.fontWeight(FontWeight.Medium)
|
|
|
.fontColor(this.currentSong?.filePath === item.filePath ? $r('app.color.title_bar_bg_text') :
|
|
|
$r('app.color.text_color'))
|
|
|
@@ -2953,6 +2957,29 @@ export struct LocalMusic {
|
|
|
.alignItems(HorizontalAlign.Center) // 关键:使内容水平居中
|
|
|
|
|
|
}
|
|
|
+ .bindPopup(this.longItemFilePath === item.filePath, {
|
|
|
+ builder: this.MenuBuilder(item,index,item.filePath),
|
|
|
+ placement: Placement.Top,
|
|
|
+ autoCancel: true,
|
|
|
+ mask: {color:'#33000000'},
|
|
|
+ // popupColor: Color.Yellow,
|
|
|
+ enableArrow: false,//是否显示箭头
|
|
|
+ showInSubWindow: true,
|
|
|
+ onStateChange: (e) => {
|
|
|
+ if (!e.isVisible) {
|
|
|
+ this.longItemFilePath = ''
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ .gesture(LongPressGesture()
|
|
|
+ .onAction(() => {
|
|
|
+ this.longItemFilePath = item.filePath
|
|
|
+ })
|
|
|
+ .onActionEnd((event: GestureEvent) => {
|
|
|
+
|
|
|
+ })
|
|
|
+ )
|
|
|
.height(50)
|
|
|
.width(150)
|
|
|
.justifyContent(FlexAlign.Center)
|
|
|
@@ -2999,6 +3026,85 @@ export struct LocalMusic {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ @Builder
|
|
|
+ MenuBuilder(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')),
|
|
|
+ // startIcon: Utility.getIsFav(this.favList,item)?$r('app.media.add_fac_light2'):$r('app.media.add_fac')
|
|
|
+ content: '收藏' })
|
|
|
+ .onClick(() => {
|
|
|
+ if(item){
|
|
|
+ this.doFav(item)
|
|
|
+ }
|
|
|
+ this.longItemFilePath = ''
|
|
|
+
|
|
|
+ })
|
|
|
+ MenuItem({ symbolStartIcon: new SymbolGlyphModifier($r('sys.symbol.forward_end_fill')),
|
|
|
+ content: '下一首播放' })
|
|
|
+ .onClick(() => {
|
|
|
+ this.addToNextPlay(item);
|
|
|
+ this.longItemFilePath = ''
|
|
|
+ })
|
|
|
+
|
|
|
+ MenuItem({
|
|
|
+ symbolStartIcon: new SymbolGlyphModifier($r('sys.symbol.picture_2')),
|
|
|
+ content: $r('app.string.copy')
|
|
|
+ })
|
|
|
+ .visibility(item.type === CommonConstants.TYPE_IS_DIR ? Visibility.None : Visibility.Visible)
|
|
|
+ .onClick(() => {
|
|
|
+ this.showCopyDialog(false, item, index, filePath + 'copy');
|
|
|
+ this.longItemFilePath = ''
|
|
|
+ })
|
|
|
+ MenuItem({
|
|
|
+ symbolStartIcon: new SymbolGlyphModifier($r('sys.symbol.cut')),
|
|
|
+ content: $r('app.string.cut')
|
|
|
+ })
|
|
|
+ .visibility(item.type === CommonConstants.TYPE_IS_DIR ? Visibility.None : Visibility.Visible)
|
|
|
+ .onClick(() => {
|
|
|
+ this.showCutDialog(false, item, index, filePath);
|
|
|
+ this.longItemFilePath = ''
|
|
|
+ })
|
|
|
+ MenuItem({
|
|
|
+ symbolStartIcon: new SymbolGlyphModifier($r('sys.symbol.rename')),
|
|
|
+ content: $r('app.string.rename')
|
|
|
+ })
|
|
|
+ .visibility(item.type === CommonConstants.TYPE_IS_DIR ?
|
|
|
+ (item.name === LocalMusic.STR_LOCK_VIDEO || item.name === LocalMusic.STR_FAC_VIDEO ||
|
|
|
+ item.name === LocalMusic.STR_HISTORY_MUSIC ? Visibility.None : Visibility.Visible) : Visibility.Visible)
|
|
|
+ .onClick(() => {
|
|
|
+ this.showReNameDialog(item, index + '', filePath)
|
|
|
+ this.longItemFilePath = ''
|
|
|
+ })
|
|
|
+ MenuItem({
|
|
|
+ symbolStartIcon: new SymbolGlyphModifier($r('sys.symbol.trash')),
|
|
|
+ content: $r('app.string.delete')
|
|
|
+ })
|
|
|
+ .visibility(item.type === CommonConstants.TYPE_IS_DIR ?
|
|
|
+ (item.name === LocalMusic.STR_LOCK_VIDEO || item.name === LocalMusic.STR_FAC_VIDEO ||
|
|
|
+ item.name === LocalMusic.STR_HISTORY_MUSIC ? Visibility.None : Visibility.Visible) : Visibility.Visible)
|
|
|
+ .onClick(() => {
|
|
|
+ this.showWarnIsDeleteFile(item, index + '', filePath)
|
|
|
+ this.longItemFilePath = ''
|
|
|
+ })
|
|
|
+ MenuItem({
|
|
|
+ symbolStartIcon: new SymbolGlyphModifier($r('sys.symbol.share')),
|
|
|
+ content: $r('app.string.share')
|
|
|
+ })
|
|
|
+ .visibility(item.type === CommonConstants.TYPE_IS_DIR ? Visibility.None : Visibility.Visible)
|
|
|
+ .onClick(() => {
|
|
|
+ Utility.doShareMusic(item, getContext(this) as common.UIAbilityContext)
|
|
|
+ this.longItemFilePath = ''
|
|
|
+ })
|
|
|
+ }.font({ size: 15, weight: FontWeight.Normal })
|
|
|
+ }
|
|
|
+ .width(180)
|
|
|
+ .height('40%')
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
@Builder
|
|
|
getListView() {
|
|
|
|