|
@@ -132,6 +132,7 @@ interface GeneratedObjectLiteralInterface_1 {
|
|
|
drmScheme: string;
|
|
drmScheme: string;
|
|
|
}
|
|
}
|
|
|
const ITEM_HEIGHT: number = 58; // 列表项高度
|
|
const ITEM_HEIGHT: number = 58; // 列表项高度
|
|
|
|
|
+const ITEM_HEIGHT_BIG: number = 78; // 列表项高度
|
|
|
//功能强大的音乐播放器
|
|
//功能强大的音乐播放器
|
|
|
@Preview
|
|
@Preview
|
|
|
@Component
|
|
@Component
|
|
@@ -176,6 +177,7 @@ export struct LocalMusic {
|
|
|
@State isShowHistory:boolean = true //是否显示最近播放
|
|
@State isShowHistory:boolean = true //是否显示最近播放
|
|
|
@State isCustomizeBg: boolean = false //自定义背景界面
|
|
@State isCustomizeBg: boolean = false //自定义背景界面
|
|
|
@State isGridMusic: boolean = false //是否网格布局
|
|
@State isGridMusic: boolean = false //是否网格布局
|
|
|
|
|
+ @State isGridCoverBig: boolean = true //是否网格布局
|
|
|
@State isScrollHide: boolean = false //是否滚动隐藏
|
|
@State isScrollHide: boolean = false //是否滚动隐藏
|
|
|
@State isSameTimePlay: boolean = false //是否和其他app同时播放
|
|
@State isSameTimePlay: boolean = false //是否和其他app同时播放
|
|
|
@State isStartAutoPlay: boolean = false //启动后自动播放
|
|
@State isStartAutoPlay: boolean = false //启动后自动播放
|
|
@@ -452,9 +454,12 @@ export struct LocalMusic {
|
|
|
} else if (event.hintType === InterruptHintType.INTERRUPT_HINT_STOP) {
|
|
} else if (event.hintType === InterruptHintType.INTERRUPT_HINT_STOP) {
|
|
|
this.stop();
|
|
this.stop();
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
this.mIjkMediaPlayer.on('audioInterrupt', event);
|
|
this.mIjkMediaPlayer.on('audioInterrupt', event);
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
this.makeWorker()
|
|
this.makeWorker()
|
|
|
|
|
|
|
|
|
|
|
|
@@ -530,7 +535,7 @@ export struct LocalMusic {
|
|
|
this.sortType = PreferencesUtil.getNumberSync(SettingPage.SORT_TYPE, 4)
|
|
this.sortType = PreferencesUtil.getNumberSync(SettingPage.SORT_TYPE, 4)
|
|
|
this.isCustomizeBg = PreferencesUtil.getBooleanSync(SettingPage.IS_CUSTOMIZE_BG, false)
|
|
this.isCustomizeBg = PreferencesUtil.getBooleanSync(SettingPage.IS_CUSTOMIZE_BG, false)
|
|
|
this.customizeBgPath = PreferencesUtil.getStringSync(SettingPage.IS_CUSTOMIZE_BG_PATH, '')
|
|
this.customizeBgPath = PreferencesUtil.getStringSync(SettingPage.IS_CUSTOMIZE_BG_PATH, '')
|
|
|
- this.isGridMusic = PreferencesUtil.getBooleanSync(SettingPage.IS_GRID_MUSIC, false)
|
|
|
|
|
|
|
+ this.isGridMusic = PreferencesUtil.getBooleanSync(SettingPage.IS_GRID_MUSIC, true)
|
|
|
this.isScrollHide = PreferencesUtil.getBooleanSync(SettingPage.IS_SCROLL_HIDE, false)
|
|
this.isScrollHide = PreferencesUtil.getBooleanSync(SettingPage.IS_SCROLL_HIDE, false)
|
|
|
this.isSameTimePlay = PreferencesUtil.getBooleanSync(SettingPage.IS_SAMETIME_PLAY, false)
|
|
this.isSameTimePlay = PreferencesUtil.getBooleanSync(SettingPage.IS_SAMETIME_PLAY, false)
|
|
|
this.isSavePlayMode = PreferencesUtil.getBooleanSync(SettingPage.iS_SAVE_PLAY_MODE, true)
|
|
this.isSavePlayMode = PreferencesUtil.getBooleanSync(SettingPage.iS_SAVE_PLAY_MODE, true)
|
|
@@ -540,6 +545,7 @@ export struct LocalMusic {
|
|
|
this.isMemoryLastPlay = PreferencesUtil.getBooleanSync(SettingPage.iS_MEMORY_LAST_PLAY, false)
|
|
this.isMemoryLastPlay = PreferencesUtil.getBooleanSync(SettingPage.iS_MEMORY_LAST_PLAY, false)
|
|
|
this.isShowTitleBar = PreferencesUtil.getBooleanSync(SettingPage.IS_SHOW_TITLTBAR, true)
|
|
this.isShowTitleBar = PreferencesUtil.getBooleanSync(SettingPage.IS_SHOW_TITLTBAR, true)
|
|
|
this.isShowAllBar = PreferencesUtil.getBooleanSync(SettingPage.IS_SHOW_ALLBAR, true)
|
|
this.isShowAllBar = PreferencesUtil.getBooleanSync(SettingPage.IS_SHOW_ALLBAR, true)
|
|
|
|
|
+ this.isGridCoverBig = PreferencesUtil.getBooleanSync(SettingPage.IS_GRID_COVERBIG, true)
|
|
|
if (this.isSavePlayMode) {
|
|
if (this.isSavePlayMode) {
|
|
|
this.playType = PreferencesUtil.getNumberSync('musicPlayType', 0)
|
|
this.playType = PreferencesUtil.getNumberSync('musicPlayType', 0)
|
|
|
}
|
|
}
|
|
@@ -2290,9 +2296,8 @@ export struct LocalMusic {
|
|
|
Row() {
|
|
Row() {
|
|
|
Image(this.modeType !== 0 && StrUtil.isNotEmpty(item.pixelMapPath) ? item.pixelMapPath :
|
|
Image(this.modeType !== 0 && StrUtil.isNotEmpty(item.pixelMapPath) ? item.pixelMapPath :
|
|
|
$r('app.media.music_group'))
|
|
$r('app.media.music_group'))
|
|
|
- // SymbolGlyph($r('sys.symbol.identify_song'))
|
|
|
|
|
- .height(33)
|
|
|
|
|
- .width(33)
|
|
|
|
|
|
|
+ .height(this.isGridCoverBig?48:35)
|
|
|
|
|
+ .width(this.isGridCoverBig?48:35)
|
|
|
.fillColor(this.themeColor)
|
|
.fillColor(this.themeColor)
|
|
|
// .fontSize(33)
|
|
// .fontSize(33)
|
|
|
.alt($r('app.media.music_group'))
|
|
.alt($r('app.media.music_group'))
|
|
@@ -2348,7 +2353,7 @@ export struct LocalMusic {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
.backgroundColor(Color.Transparent)
|
|
.backgroundColor(Color.Transparent)
|
|
|
- .height(ITEM_HEIGHT)
|
|
|
|
|
|
|
+ .height(this.isGridCoverBig?ITEM_HEIGHT_BIG:ITEM_HEIGHT)
|
|
|
.width('100%')
|
|
.width('100%')
|
|
|
.visibility(this.isShowDir(item.name)?Visibility.Visible:Visibility.None)
|
|
.visibility(this.isShowDir(item.name)?Visibility.Visible:Visibility.None)
|
|
|
.opacity(this.opacityItem) // 绑定透明度
|
|
.opacity(this.opacityItem) // 绑定透明度
|
|
@@ -2383,8 +2388,8 @@ export struct LocalMusic {
|
|
|
|
|
|
|
|
Image(StrUtil.isEmpty(item.pixelMapPath) ? $r('app.media.music_red') : item.pixelMapPath)
|
|
Image(StrUtil.isEmpty(item.pixelMapPath) ? $r('app.media.music_red') : item.pixelMapPath)
|
|
|
.fillColor(this.themeColor)
|
|
.fillColor(this.themeColor)
|
|
|
- .height(33)
|
|
|
|
|
- .width(33)
|
|
|
|
|
|
|
+ .height(this.isGridCoverBig?48:35)
|
|
|
|
|
+ .width(this.isGridCoverBig?48:35)
|
|
|
.alt($r('app.media.music_red'))
|
|
.alt($r('app.media.music_red'))
|
|
|
.borderRadius('100%')
|
|
.borderRadius('100%')
|
|
|
.clip(true)
|
|
.clip(true)
|
|
@@ -2466,7 +2471,7 @@ export struct LocalMusic {
|
|
|
}
|
|
}
|
|
|
.backgroundColor(Color.Transparent)
|
|
.backgroundColor(Color.Transparent)
|
|
|
.width('100%')
|
|
.width('100%')
|
|
|
- .height(ITEM_HEIGHT)
|
|
|
|
|
|
|
+ .height(this.isGridCoverBig?ITEM_HEIGHT_BIG:ITEM_HEIGHT)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private readonly tabs: string[] = ['文件夹', '媒体库', '艺术家', '专辑']
|
|
private readonly tabs: string[] = ['文件夹', '媒体库', '艺术家', '专辑']
|
|
@@ -2965,6 +2970,7 @@ export struct LocalMusic {
|
|
|
private scroller: Scroller = new Scroller();
|
|
private scroller: Scroller = new Scroller();
|
|
|
@State startIndex:number = 0
|
|
@State startIndex:number = 0
|
|
|
@State endIndex:number = 0
|
|
@State endIndex:number = 0
|
|
|
|
|
+
|
|
|
@Builder
|
|
@Builder
|
|
|
getGridView(){
|
|
getGridView(){
|
|
|
|
|
|
|
@@ -3056,7 +3062,8 @@ export struct LocalMusic {
|
|
|
.scrollBar(BarState.Off)
|
|
.scrollBar(BarState.Off)
|
|
|
.supportAnimation(true)
|
|
.supportAnimation(true)
|
|
|
.cachedCount(3)
|
|
.cachedCount(3)
|
|
|
- .columnsTemplate('1fr '.repeat(this.currentWidthBreakpoint === WidthBreakpoint.WIDTH_SM ? 2 : 5))
|
|
|
|
|
|
|
+ // .columnsTemplate('1fr '.repeat(this.currentWidthBreakpoint === WidthBreakpoint.WIDTH_SM ? 2 : 5))
|
|
|
|
|
+ .columnsTemplate(this.isGridCoverBig?'repeat(auto-fit, 150)':'repeat(auto-fit, 110)')
|
|
|
.rowsGap(12)
|
|
.rowsGap(12)
|
|
|
.visibility(this.isGridMusic?Visibility.Visible:Visibility.None)
|
|
.visibility(this.isGridMusic?Visibility.Visible:Visibility.None)
|
|
|
.enableScrollInteraction(true)
|
|
.enableScrollInteraction(true)
|
|
@@ -3094,8 +3101,8 @@ export struct LocalMusic {
|
|
|
Stack() {
|
|
Stack() {
|
|
|
Column() {
|
|
Column() {
|
|
|
Image(StrUtil.isEmpty(item.pixelMapPath) ?Utility.getMusisBg2(index) : item.pixelMapPath)
|
|
Image(StrUtil.isEmpty(item.pixelMapPath) ?Utility.getMusisBg2(index) : item.pixelMapPath)
|
|
|
- .height(150)
|
|
|
|
|
- .width(150)
|
|
|
|
|
|
|
+ .height(this.isGridCoverBig?150:100)
|
|
|
|
|
+ .width(this.isGridCoverBig?150:110)
|
|
|
.alt($r('app.media.ic_avatar6'))
|
|
.alt($r('app.media.ic_avatar6'))
|
|
|
.clip(true)
|
|
.clip(true)
|
|
|
.borderRadius({
|
|
.borderRadius({
|
|
@@ -3180,14 +3187,14 @@ export struct LocalMusic {
|
|
|
|
|
|
|
|
})
|
|
})
|
|
|
)
|
|
)
|
|
|
- .height(50)
|
|
|
|
|
- .width(150)
|
|
|
|
|
|
|
+ .height(this.isGridCoverBig?50:40)
|
|
|
|
|
+ .width(this.isGridCoverBig?150:110)
|
|
|
.justifyContent(FlexAlign.Center)
|
|
.justifyContent(FlexAlign.Center)
|
|
|
.margin({ left: this.currentBreakpoint !== BreakpointTypeEnum.SM?40:20 ,
|
|
.margin({ left: this.currentBreakpoint !== BreakpointTypeEnum.SM?40:20 ,
|
|
|
right: this.currentBreakpoint !== BreakpointTypeEnum.SM?40:20})
|
|
right: this.currentBreakpoint !== BreakpointTypeEnum.SM?40:20})
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
- .width(150)
|
|
|
|
|
|
|
+ .width(this.isGridCoverBig?150:110)
|
|
|
.borderRadius(20)
|
|
.borderRadius(20)
|
|
|
.backgroundImage(item.pixelMapPath)
|
|
.backgroundImage(item.pixelMapPath)
|
|
|
.backgroundImageSize({ height: '100%',width:'100%' })
|
|
.backgroundImageSize({ height: '100%',width:'100%' })
|
|
@@ -3213,7 +3220,7 @@ export struct LocalMusic {
|
|
|
}
|
|
}
|
|
|
.backgroundColor(Color.Transparent)
|
|
.backgroundColor(Color.Transparent)
|
|
|
.width('100%')
|
|
.width('100%')
|
|
|
- .height(205)
|
|
|
|
|
|
|
+ .height(this.isGridCoverBig?205:150)
|
|
|
.onClick(() => {
|
|
.onClick(() => {
|
|
|
if(this.isMultiSelect&&item.type!==CommonConstants.TYPE_IS_DIR){
|
|
if(this.isMultiSelect&&item.type!==CommonConstants.TYPE_IS_DIR){
|
|
|
this.handleFileSelection(item, !this.selectedFiles.some(x => x.filePath === item.filePath))
|
|
this.handleFileSelection(item, !this.selectedFiles.some(x => x.filePath === item.filePath))
|
|
@@ -3509,7 +3516,12 @@ export struct LocalMusic {
|
|
|
)
|
|
)
|
|
|
.onAreaChange((oldValue: Area, newValue: Area) => {
|
|
.onAreaChange((oldValue: Area, newValue: Area) => {
|
|
|
this.listArea = newValue
|
|
this.listArea = newValue
|
|
|
- this.listMaxScrollOffsetY = this.videoLocalList.length * (ITEM_HEIGHT) - 10
|
|
|
|
|
|
|
+ if(this.isGridCoverBig){
|
|
|
|
|
+ this.listMaxScrollOffsetY = this.videoLocalList.length * (ITEM_HEIGHT_BIG) - 10
|
|
|
|
|
+ }else{
|
|
|
|
|
+ this.listMaxScrollOffsetY = this.videoLocalList.length * (ITEM_HEIGHT) - 10
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
})
|
|
})
|
|
|
.onScrollFrameBegin((offset: number) => {
|
|
.onScrollFrameBegin((offset: number) => {
|
|
|
|
|
|