|
|
@@ -76,6 +76,7 @@ import app from '@system.app';
|
|
|
import { TextNodeController } from './PipLyricTextBuilder';
|
|
|
import { IndexerView } from './IndexerView';
|
|
|
import { KeyCode } from '@kit.InputKit';
|
|
|
+import { KnockController } from '../controller/KnockController';
|
|
|
// import { FFmpeg, FFProgressMessageParser } from '@sj/ffmpeg';
|
|
|
const TAG = 'LocalMusic';
|
|
|
|
|
|
@@ -137,6 +138,8 @@ const ITEM_HEIGHT_BIG: number = 78; // 列表项大高度
|
|
|
@Preview
|
|
|
@Component
|
|
|
export struct LocalMusic {
|
|
|
+ @State opacityValueImage: number = 1;
|
|
|
+ @State tipPopup:boolean = false
|
|
|
@Consume mType: number;
|
|
|
@StorageProp('themeColor') themeColor: string =
|
|
|
PreferencesUtil.getStringSync('THEME_COLOR', CommonConstants.DEFAULT_THEME_COLOR);
|
|
|
@@ -192,6 +195,7 @@ export struct LocalMusic {
|
|
|
@State isMemoryLastPlay: boolean = false //是否启用应用退出记忆最后一首的播放进度
|
|
|
@State isCoverTopBig: boolean = false //顶部大封面部分手机显示会和播放控制页重叠
|
|
|
@State isSwipe: boolean = false //listItem的左滑开关
|
|
|
+ @State openSkipSongAnimate: boolean = true//切歌动画效果
|
|
|
@State customizeBgPath: string | undefined = '';
|
|
|
@State isDarkMode: boolean = false
|
|
|
@State lyricTextWeight: number = 400
|
|
|
@@ -206,6 +210,7 @@ export struct LocalMusic {
|
|
|
@StorageProp('windowWidth') windowWidth: number = 0;
|
|
|
@StorageProp('windowHeight') windowHeight: number = 0;
|
|
|
@StorageProp('isHiCarStatus') isHiCarStatus: boolean = false;
|
|
|
+ private UNKONWN:string = '';
|
|
|
private listArea: Area = {
|
|
|
width: 0,
|
|
|
height: 0,
|
|
|
@@ -286,6 +291,7 @@ export struct LocalMusic {
|
|
|
@Consume isFavMusic: boolean
|
|
|
@State isClickedPLayAll: boolean = false;
|
|
|
private scrollerForlist: ListScroller = new ListScroller();
|
|
|
+ private knockController: KnockController | undefined = undefined;
|
|
|
imagesF: ImageFrameInfo[] = [
|
|
|
{ src: $r("app.media.app_loading0") },
|
|
|
{ src: $r("app.media.app_loading1") },
|
|
|
@@ -359,13 +365,13 @@ export struct LocalMusic {
|
|
|
@State appName: string = ''
|
|
|
@State isHasDir: boolean = false
|
|
|
@State packName: string = ''
|
|
|
- context = getContext(this);
|
|
|
+ context = this.getUIContext().getHostContext() as common.UIAbilityContext
|
|
|
@State titleBarModel: TitleBar.Model = new TitleBar.Model()
|
|
|
.setTitleTextStyle(FontStyle.Normal)
|
|
|
.setTitleBarStyle(TitleBar.BarStyle.TRANSPARENT)
|
|
|
.setLeftIcon($r('app.media.menu'))
|
|
|
- .setLeftIconWidth(25)
|
|
|
- .setLeftIconHeight(25)
|
|
|
+ .setLeftIconWidth(26)
|
|
|
+ .setLeftIconHeight(26)
|
|
|
.setTitleName('首页')
|
|
|
.setTitleFontSize(18)
|
|
|
.setTitleFontColor(Color.White)
|
|
|
@@ -376,9 +382,9 @@ export struct LocalMusic {
|
|
|
.setOnRightClickListener(() => {
|
|
|
this.showSheelDialog()
|
|
|
})
|
|
|
- .setOnTitleClickListener(() => {
|
|
|
- this.showPupDialog()
|
|
|
- })
|
|
|
+ // .setOnTitleClickListener(() => {
|
|
|
+ // this.showPupDialog()
|
|
|
+ // })
|
|
|
.setOnLeftClickListener(() => {
|
|
|
this.doSwipBack()
|
|
|
})
|
|
|
@@ -447,7 +453,12 @@ export struct LocalMusic {
|
|
|
|
|
|
// 组件生命周期
|
|
|
aboutToAppear() {
|
|
|
+ if(PreferencesUtil.getBooleanSync('isFirstTiped',true)){
|
|
|
+ this.tipPopup = !this.tipPopup
|
|
|
+ PreferencesUtil.putSync('isFirstTiped',false)
|
|
|
+ }
|
|
|
this.initSetting()
|
|
|
+ this.UNKONWN = Utility.resourceToString(this.context, $r('app.string.unknown'));
|
|
|
this.topRectHeight = px2vp(AppUtil.getStatusBarHeight());
|
|
|
Utility.getAppName(getContext(this)).then((appName: string) => {
|
|
|
this.appName = appName
|
|
|
@@ -535,7 +546,7 @@ export struct LocalMusic {
|
|
|
this.themeColor = themeColor;
|
|
|
this.doChangeSetting()
|
|
|
this.windowClass.on('windowSizeChange', (size) => {
|
|
|
- // LogUtil.info('onecold windowSizeChange')
|
|
|
+ LogUtil.info('onecold windowSizeChange')
|
|
|
this.doChangeBarHeight()
|
|
|
let viewWidth = px2vp(size.width);
|
|
|
let viewHeight = px2vp(size.height);
|
|
|
@@ -560,6 +571,7 @@ export struct LocalMusic {
|
|
|
|
|
|
startAutoHide() {
|
|
|
if(PreferencesUtil.getBooleanSync(SettingPage.IS_AUTO_HIDE_PROGRESS,false)){
|
|
|
+ console.info('onecold startAutoHide')
|
|
|
this.is_auto_hide_progress = false
|
|
|
setTimeout(() => {
|
|
|
this.is_auto_hide_progress = true
|
|
|
@@ -609,6 +621,7 @@ export struct LocalMusic {
|
|
|
this.isShowHeader = PreferencesUtil.getBooleanSync(SettingPage.IS_SHOW_HEADER, true)
|
|
|
this.volume = PreferencesUtil.getNumberSync('DefalutVolume', this.volume)
|
|
|
this.isSwipe = PreferencesUtil.getBooleanSync(SettingPage.IS_SWIPE, true)
|
|
|
+ this.openSkipSongAnimate = PreferencesUtil.getBooleanSync(SettingPage.OPEN_SKIPSONG_ANIMATE, true)
|
|
|
//如果是hicar连接状态,这些都是false
|
|
|
if(this.isHiCarStatus){
|
|
|
this.isShowTitleBar = false//不显示导航栏
|
|
|
@@ -662,6 +675,7 @@ export struct LocalMusic {
|
|
|
}
|
|
|
|
|
|
onPageShow() {
|
|
|
+ this.knockController?.immersiveListening();
|
|
|
app.setImageCacheCount(100);
|
|
|
// 设置解码前图片数据内存缓存上限为100MB (100MB=100*1024*1024B=104857600B)
|
|
|
app.setImageRawDataCacheSize(104857600);
|
|
|
@@ -739,8 +753,21 @@ export struct LocalMusic {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ // let context: common.UIAbilityContext = this.getUIContext().getHostContext() as common.UIAbilityContext;
|
|
|
+ //碰一碰分享的监听
|
|
|
+ this.knockController = KnockController.getInstance(this.context);
|
|
|
+ this.knockController?.immersiveListening();
|
|
|
+
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ onPageHide(): void {
|
|
|
+ this.knockController?.immersiveDisableListening();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
@State isFirstStartPlay: boolean = false
|
|
|
|
|
|
//获取download_path
|
|
|
@@ -789,8 +816,7 @@ export struct LocalMusic {
|
|
|
this.videoUrl = this.currentSong.filePath
|
|
|
this.name = this.currentSong.name
|
|
|
this.cover = this.currentSong.pixelMapPath
|
|
|
-
|
|
|
-
|
|
|
+ AppStorage.setOrCreate('currentSong',this.currentSong) ;
|
|
|
} else {
|
|
|
this.name = '空空如也'
|
|
|
}
|
|
|
@@ -828,6 +854,8 @@ export struct LocalMusic {
|
|
|
// 组件消失生命周期
|
|
|
aboutToDisappear() {
|
|
|
console.info('LifeCycleComponent aboutToDisappear');
|
|
|
+ this.knockController?.immersiveDisableListening();
|
|
|
+ this.curIndex = 0
|
|
|
emitter.off(2);
|
|
|
emitter.off(101);
|
|
|
emitter.off(888);
|
|
|
@@ -915,7 +943,7 @@ export struct LocalMusic {
|
|
|
// Utility.doSortListAscending(directories)
|
|
|
|
|
|
} else {
|
|
|
- if (this.currentPath === this.lockPath) {
|
|
|
+ if (this.currentPath === this.lockPath&&Utility.isMeidaByExtension(path)) {
|
|
|
let item: VideoItem =
|
|
|
await Utility.uriGetMusicAssetsFromFile(this.context, path, CommonConstants.TYPE_LOCAL, false);
|
|
|
if (!path.endsWith('.lrc') && Utility.isMeidaByExtension(path) && !path.endsWith('.srt')) {
|
|
|
@@ -991,6 +1019,7 @@ export struct LocalMusic {
|
|
|
}
|
|
|
let item2 = new VideoItem(Utility.getMediaNameByUri(destPath), destPath, destPath, 0, 0, '')
|
|
|
this.doPlay(item2)
|
|
|
+ this.isShowPlay = true
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1054,41 +1083,7 @@ export struct LocalMusic {
|
|
|
|
|
|
}
|
|
|
|
|
|
- //获取视频缩略图头像
|
|
|
- async updatePixelMaps(curPath: string) {
|
|
|
- console.info('updatePixelMaps: ', curPath);
|
|
|
- const updatedList = [...this.videoLocalList]; // 创建一个新的列表
|
|
|
|
|
|
- for (const videoItem of updatedList) {
|
|
|
- if (videoItem.type === CommonConstants.TYPE_LOCAL) {
|
|
|
- let pixelMap: image.PixelMap | undefined = undefined;
|
|
|
- const uri = videoItem.filePath;
|
|
|
-
|
|
|
- // 获取缩略图
|
|
|
- // if (Utility.isVideoByExtension(uri)) {
|
|
|
- // pixelMap = await Utility.getFetchFrameByTime(uri);
|
|
|
- // } else {
|
|
|
- // pixelMap = await Utility.getFetchMetadataFromFdSrcByPromise(uri);
|
|
|
- // }
|
|
|
- let name = await MD5.digestSync(uri)
|
|
|
- let imagePath = this.context.filesDir + FileUtil.separator + name
|
|
|
- console.info('onecold release success. name= ' + name);
|
|
|
- imagePath = fileUri.getUriFromPath(imagePath)
|
|
|
- videoItem.pixelMapPath = imagePath
|
|
|
- // videoItem.pixelMap = pixelMap;
|
|
|
- // videoItem.pixelMapToString = pixelMap ? await ImageUtil.pixelMapToBase64StrBig(pixelMap) : undefined;
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- // console.info('updatePixelMaps完毕: ', updatedList.length);
|
|
|
- this.updateListData(updatedList)
|
|
|
- // this.videoLocalList = updatedList; // 重新赋值以触发更新
|
|
|
- // 缓存结果
|
|
|
- this.addCache(curPath, updatedList);
|
|
|
- await this.saveCacheToStorage(); // 保存缓存至本地存储
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
|
|
|
//排序模式和多选模式
|
|
|
showPupDialog() {
|
|
|
@@ -1238,6 +1233,7 @@ export struct LocalMusic {
|
|
|
transition: AnimationHelper.transitionInDown(555),
|
|
|
onAction: (index) => {
|
|
|
this.doSortType(index)
|
|
|
+ PreferencesUtil.put(SettingPage.SORT_TYPE, index)
|
|
|
this.updateListData(this.videoLocalList, true)
|
|
|
}
|
|
|
})
|
|
|
@@ -1966,11 +1962,6 @@ export struct LocalMusic {
|
|
|
controller: this.xcomponentController
|
|
|
|
|
|
})
|
|
|
- .onLoad((event?: object) => {
|
|
|
- if (!!event) {
|
|
|
- this.initDelayPlay(event);
|
|
|
- }
|
|
|
- })
|
|
|
.onLoad((event?: object) => {
|
|
|
if (!!event) {
|
|
|
this.initDelayPlay(event);
|
|
|
@@ -2184,7 +2175,6 @@ export struct LocalMusic {
|
|
|
.backdropBlur(this.blurValue)
|
|
|
.backgroundBrightness({ rate: this.isCustomizeBg ? 0.1 : 0, lightUpDegree: this.bgBrightness })
|
|
|
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
|
|
|
-
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -2598,6 +2588,19 @@ export struct LocalMusic {
|
|
|
})
|
|
|
)
|
|
|
Row() {
|
|
|
+ Column(){
|
|
|
+ Text(item.md5Str?.includes('Lossless')?
|
|
|
+ Utility.resourceToString(this.context,$r('app.string.lossless')):item.md5Str)//音质
|
|
|
+ .fontSize(this.twoFingerType == 1 ? 8 : this.twoFingerType == 2 ? 9 : 11)
|
|
|
+ .padding({ top: 3,right:6,left:6,bottom:3 })
|
|
|
+ .fontColor(this.currentSong?.filePath === item.filePath ? this.themeColor :
|
|
|
+ $r('app.color.text_color'))
|
|
|
+ .fontWeight(500)
|
|
|
+ .borderRadius(12)
|
|
|
+ .margin({ left: this.twoFingerType == 3 ? 6 : 8 })
|
|
|
+ .backgroundColor('#FFC107')
|
|
|
+ }
|
|
|
+ .padding({ top: 8 })
|
|
|
Text(StrUtil.isEmpty(item.artist) ? item.cTime : item.artist + ' ' + item?.album)
|
|
|
.fontSize(this.twoFingerType == 1 ? 11 : this.twoFingerType == 2 ? 12 : 14)
|
|
|
.padding({ top: 8 })
|
|
|
@@ -2759,7 +2762,6 @@ export struct LocalMusic {
|
|
|
|
|
|
@State currentTitleName: string = '' //点击歌单,艺术家,专辑进去后的标题
|
|
|
@State currentTitleCover: string | ResourceStr = '' //点击歌单,艺术家,专辑进去后的封面
|
|
|
- @State currentYear:string = ''
|
|
|
isShowCoverHeader() {
|
|
|
if (!this.isShowHeader) {
|
|
|
return false
|
|
|
@@ -2830,7 +2832,7 @@ export struct LocalMusic {
|
|
|
|
|
|
}
|
|
|
.alignItems(HorizontalAlign.Start)
|
|
|
- .margin({ left: 30, top: 10, bottom: 15 })
|
|
|
+ .margin({ left: 30, top: 3, bottom: 15 })
|
|
|
|
|
|
Column() {
|
|
|
Column() {
|
|
|
@@ -2842,32 +2844,53 @@ export struct LocalMusic {
|
|
|
.margin({ left: this.currentLyricAlignMode === 0 ? 18 : 0 })
|
|
|
if (this.modeType == 3 && ArrayUtil.isNotEmpty(this.videoLocalList)) {
|
|
|
Text(`艺术家:${this.videoLocalList[0].artist}`)
|
|
|
- .fontSize(16)
|
|
|
+ .fontSize(14)
|
|
|
.padding({ top: 8 })
|
|
|
.maxLines(1)
|
|
|
.fontWeight(FontWeight.Bold)
|
|
|
.fontColor($r('app.color.text_color'))
|
|
|
.margin({ left: this.currentLyricAlignMode === 0 ? 18 : 0 })
|
|
|
+ if(this.videoLocalList[0].genre){
|
|
|
+ Text(`风格:${this.videoLocalList[0].genre}`)
|
|
|
+ .fontSize(14)
|
|
|
+ .padding({ top: 8 })
|
|
|
+ .maxLines(1)
|
|
|
+ .visibility(StrUtil.isEmpty(this.videoLocalList[0].genre)||
|
|
|
+ this.videoLocalList[0].genre.includes(this.UNKONWN)
|
|
|
+ ?Visibility.None:Visibility.Visible)
|
|
|
+ .fontWeight(FontWeight.Bold)
|
|
|
+ .fontColor($r('app.color.text_color'))
|
|
|
+ .margin({ left: this.currentLyricAlignMode === 0 ? 18 : 0 })
|
|
|
+ }
|
|
|
+ if(this.videoLocalList[0].year){
|
|
|
+ Text(`发行时间:${this.videoLocalList[0].year}`)
|
|
|
+ .fontSize(14)
|
|
|
+ .padding({ top: 8 })
|
|
|
+ .maxLines(1)
|
|
|
+ .visibility(StrUtil.isEmpty(this.videoLocalList[0].year)||
|
|
|
+ this.videoLocalList[0].year.includes(this.UNKONWN)
|
|
|
+ ?Visibility.None:Visibility.Visible)
|
|
|
+ .fontWeight(FontWeight.Bold)
|
|
|
+ .fontColor($r('app.color.text_color'))
|
|
|
+ .margin({ left: this.currentLyricAlignMode === 0 ? 18 : 0 })
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
- Text(this.currentYear)
|
|
|
- .fontSize(16)
|
|
|
- .padding({ top: 8 })
|
|
|
- .maxLines(1)
|
|
|
- .fontWeight(FontWeight.Bold)
|
|
|
- .fontColor($r('app.color.text_color'))
|
|
|
- .margin({ left: this.currentLyricAlignMode === 0 ? 18 : 0 })
|
|
|
}
|
|
|
- Row() {
|
|
|
- Text(`共${this.videoLocalList.length}首歌`)
|
|
|
- .fontSize(13)
|
|
|
- .fontWeight(FontWeight.Bold)
|
|
|
- .padding({ top: 8 })
|
|
|
- .fontColor($r('app.color.text_color'))
|
|
|
- .margin({ left: this.currentLyricAlignMode === 0 ? 18 : 0 })
|
|
|
- Blank()
|
|
|
+ if(this.modeType != 3){
|
|
|
+ Row() {
|
|
|
+ Text(`共${this.videoLocalList.length}首歌`)
|
|
|
+ .fontSize(13)
|
|
|
+ .fontWeight(FontWeight.Bold)
|
|
|
+ .padding({ top: 8 })
|
|
|
+ .fontColor($r('app.color.text_color'))
|
|
|
+ .margin({ left: this.currentLyricAlignMode === 0 ? 18 : 0 })
|
|
|
+ Blank()
|
|
|
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+
|
|
|
}
|
|
|
.height('100%')
|
|
|
.width('100%')
|
|
|
@@ -3122,8 +3145,11 @@ export struct LocalMusic {
|
|
|
if (this.isFavMusic) {
|
|
|
this.getFavList(true)
|
|
|
} else {
|
|
|
- this.deleteCache(this.currentPath)
|
|
|
- this.getSortedFiles(this.currentPath)
|
|
|
+ if(this.modeType == 0){
|
|
|
+ this.asyncCurrentPathData()
|
|
|
+ }else if(this.modeType ==1){
|
|
|
+ workerInstance.postMessage({ code: 2, data: this.context });
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
|
|
|
@@ -3177,6 +3203,17 @@ export struct LocalMusic {
|
|
|
})
|
|
|
.fillColor(this.themeColor)
|
|
|
.clickEffect({ level: ClickEffectLevel.MIDDLE, scale: 0.6 })
|
|
|
+ .bindPopup($$this.tipPopup, {
|
|
|
+ builder: this.popupBuilder,
|
|
|
+ placement: Placement.Bottom,
|
|
|
+ maskColor: 0x33000000,
|
|
|
+ enableArrow: true,
|
|
|
+ onStateChange: (e) => {
|
|
|
+ if (!e.isVisible) {
|
|
|
+ this.tipPopup = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
.onClick(() => {
|
|
|
this.isGridMusic = !this.isGridMusic
|
|
|
})
|
|
|
@@ -3195,6 +3232,21 @@ export struct LocalMusic {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ // 第二步:popup构造器定义弹框内容
|
|
|
+ @Builder popupBuilder() {
|
|
|
+ Column({ space: 2 }) {
|
|
|
+ Text('友情提示:双指缩放可以放大缩小列表')
|
|
|
+ .fontSize(12)
|
|
|
+ .fontWeight(FontWeight.Regular)
|
|
|
+ .fontColor($r('app.color.text_color'))
|
|
|
+ }
|
|
|
+ .justifyContent(FlexAlign.SpaceAround)
|
|
|
+ .width(220)
|
|
|
+ .height(55)
|
|
|
+ .padding(15)
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//搜索功能的实现
|
|
|
@State searchText: string = ''; // 用户输入内容
|
|
|
@State filteredList: Array<VideoItem> = []; // 过滤后的结果
|
|
|
@@ -3446,8 +3498,8 @@ export struct LocalMusic {
|
|
|
.animation({ duration: 500, curve: Curve.Ease }))
|
|
|
// .margin({ bottom: this.isCoverOpacity() ? 80 : 175 })
|
|
|
.margin({
|
|
|
- bottom: this.isCoverOpacity() ? (this.isShowCoverHeader() ? 45 : 80)
|
|
|
- : (this.isShowCoverHeader() ? 95 : 178)
|
|
|
+ bottom: this.isCoverOpacity() ? (this.isShowCoverHeader() ? this.topBarHeight+30 : this.topBarHeight+90)
|
|
|
+ : (this.isShowCoverHeader() ? this.topBarHeight+45 : this.topBarHeight+128)
|
|
|
})
|
|
|
.layoutWeight(1)
|
|
|
.scrollBar(BarState.Off)
|
|
|
@@ -3551,7 +3603,7 @@ export struct LocalMusic {
|
|
|
this.isGridMusic = false
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ PreferencesUtil.put(SettingPage.TWO_FINGER_TYPE, this.twoFingerType)
|
|
|
this.pinchValue = 1;
|
|
|
this.scaleValue = 1;
|
|
|
}
|
|
|
@@ -3611,17 +3663,36 @@ export struct LocalMusic {
|
|
|
.fontSize(this.twoFingerType == 1 ? 10 : this.twoFingerType == 2 ? 12 : 14)
|
|
|
.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)
|
|
|
- .fontSize(this.twoFingerType == 1 ? 10 : this.twoFingerType == 2 ? 12 : 14)
|
|
|
- .maxLines(1)
|
|
|
- .margin({ top: 2 })
|
|
|
- .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 ? this.themeColor :
|
|
|
- $r('app.color.text_color'))
|
|
|
+ Row(){
|
|
|
+ Column(){
|
|
|
+ Text(item.md5Str?.includes('Lossless')?
|
|
|
+ Utility.resourceToString(this.context,$r('app.string.lossless')):item.md5Str)//音质
|
|
|
+ .fontSize(this.twoFingerType == 1 ? 8 : this.twoFingerType == 2 ? 9 : 11)
|
|
|
+ .padding({ top: 3,right:6,left:6,bottom:3 })
|
|
|
+ .fontColor(this.currentSong?.filePath === item.filePath ? this.themeColor :
|
|
|
+ $r('app.color.text_color'))
|
|
|
+ .fontWeight(500)
|
|
|
+ .borderRadius(12)
|
|
|
+ .margin({ left: this.twoFingerType == 3 ? 6 : 8 })
|
|
|
+ .backgroundColor('#FFC107')
|
|
|
+ }
|
|
|
+ .margin({ top: 2 ,right:6})
|
|
|
+ .visibility((this.modeType == 3 && !this.isCanBack)||(this.modeType == 2 && !this.isCanBack)
|
|
|
+ ||(this.modeType == 0&&item.type==CommonConstants.TYPE_IS_DIR)? Visibility.None : Visibility.Visible)
|
|
|
+ Text(StrUtil.isEmpty(item.artist) ? item.duration: item.artist)
|
|
|
+ .fontSize(11)
|
|
|
+ .fontSize(this.twoFingerType == 1 ? 10 : this.twoFingerType == 2 ? 12 : 14)
|
|
|
+ .maxLines(1)
|
|
|
+ .textOverflow({ overflow: TextOverflow.MARQUEE })//超长滚动
|
|
|
+ .margin({ top: 2 ,right:18})
|
|
|
+ .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 ? this.themeColor :
|
|
|
+ $r('app.color.text_color'))
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|
|
|
.alignItems(HorizontalAlign.Center) // 关键:使内容水平居中
|
|
|
@@ -3885,6 +3956,7 @@ export struct LocalMusic {
|
|
|
|
|
|
}
|
|
|
}
|
|
|
+ PreferencesUtil.put(SettingPage.TWO_FINGER_TYPE, this.twoFingerType)
|
|
|
this.pinchValue = 1;
|
|
|
this.scaleValue = 1;
|
|
|
}
|
|
|
@@ -4062,8 +4134,8 @@ export struct LocalMusic {
|
|
|
}))
|
|
|
// .divider({ strokeWidth: 1, color: this.isDarkMode? '#333333':'#ffe9f0f0' })
|
|
|
.margin({
|
|
|
- bottom: this.isCoverOpacity() ? (this.isShowCoverHeader() ? 25 : 80)
|
|
|
- : (this.isShowCoverHeader() ? 85 : this.isHiCarSmall()?140:175)
|
|
|
+ bottom: this.isCoverOpacity() ? (this.isShowCoverHeader() ? this.topBarHeight+25 : this.topBarHeight+80)
|
|
|
+ : (this.isShowCoverHeader() ? this.topBarHeight+35 : this.isHiCarSmall()?this.topBarHeight+90:this.topBarHeight+125)
|
|
|
})
|
|
|
.cachedCount(6)
|
|
|
.borderRadius(20)
|
|
|
@@ -4343,6 +4415,11 @@ export struct LocalMusic {
|
|
|
this.titleBarModel.setLeftIconMain($r('app.media.left_back_white'))
|
|
|
}
|
|
|
|
|
|
+ //进入歌单的时候的滚动位置在顶部
|
|
|
+ if (this.isGridMusic) {
|
|
|
+ this.scroller.scrollToIndex(0)
|
|
|
+ }
|
|
|
+
|
|
|
break;
|
|
|
case CommonConstants.TYPE_IS_ALBUM:
|
|
|
// 进入专辑前安全保存当前滚动偏移量,支持列表和网格
|
|
|
@@ -4370,7 +4447,6 @@ export struct LocalMusic {
|
|
|
this.isCanBack = true
|
|
|
this.titleBarModel.setTitleName(item.name)
|
|
|
this.currentTitleName = '专辑:' + item.name
|
|
|
- this.currentYear = '发行时间:' + item.year
|
|
|
if (item.pixelMapPath) {
|
|
|
this.currentTitleCover = item.pixelMapPath
|
|
|
}
|
|
|
@@ -4378,6 +4454,10 @@ export struct LocalMusic {
|
|
|
this.titleBarModel.setLeftIconMain($r('app.media.left_back_white'))
|
|
|
this.mScrollMap.set(item.name, this.selectedIndex)
|
|
|
}
|
|
|
+ //进入歌单的时候的滚动位置在顶部
|
|
|
+ if (this.isGridMusic) {
|
|
|
+ this.scroller.scrollToIndex(0)
|
|
|
+ }
|
|
|
|
|
|
break;
|
|
|
case CommonConstants.TYPE_IS_CSJAD:
|
|
|
@@ -4397,11 +4477,12 @@ export struct LocalMusic {
|
|
|
let globalVideoList = Utility.getGlobalList(this.videoLocalList, CommonConstants.TYPE_LOCAL) as VideoItem[];
|
|
|
this.curIndex = Utility.getCurIndexFromGlobalList(globalVideoList, item.filePath)
|
|
|
this.songList = globalVideoList
|
|
|
+
|
|
|
this.sonDataSource.pushArrayData(this.songList)
|
|
|
this.currentSong = globalVideoList[this.curIndex]
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ AppStorage.setOrCreate('currentSong',this.currentSong) ;
|
|
|
this.videoUrl = this.currentSong.filePath
|
|
|
this.name = this.currentSong.name
|
|
|
this.cover = this.currentSong.pixelMapPath
|
|
|
@@ -4490,7 +4571,7 @@ export struct LocalMusic {
|
|
|
})
|
|
|
.color(this.themeColor)// 进度条前景色为灰色
|
|
|
.backgroundColor($r('app.color.index_background'))
|
|
|
- .height(36)
|
|
|
+ .height(40)
|
|
|
.aspectRatio(CommonConstants.ASPECT_RATIO)
|
|
|
Image(this.CONTROL_PlayStatus === PlayStatus.PLAY ? $r('app.media.hm_pause') : $r('app.media.hm_play2'))
|
|
|
.height(38)
|
|
|
@@ -5053,6 +5134,21 @@ export struct LocalMusic {
|
|
|
.margin({ top: 10, bottom: 10 })
|
|
|
.justifyContent(FlexAlign.Start)
|
|
|
|
|
|
+ Row() {
|
|
|
+ Text('风格:')
|
|
|
+ .fontSize(14)
|
|
|
+ .fontColor(Color.White)
|
|
|
+ .margin({ left: 22 })
|
|
|
+ Text(currentItem.genre)
|
|
|
+ .fontSize(14)
|
|
|
+ .margin({ left: 10 })
|
|
|
+ .fontColor(Color.White)
|
|
|
+ .layoutWeight(1)
|
|
|
+ }
|
|
|
+ .width('100%')
|
|
|
+ .margin({ top: 10, bottom: 10 })
|
|
|
+ .justifyContent(FlexAlign.Start)
|
|
|
+
|
|
|
Row() {
|
|
|
Text('发行时间:')
|
|
|
.fontSize(14)
|
|
|
@@ -5084,11 +5180,11 @@ export struct LocalMusic {
|
|
|
.justifyContent(FlexAlign.Start)
|
|
|
|
|
|
Row() {
|
|
|
- Text('音轨数:')
|
|
|
+ Text('音轨号:')
|
|
|
.fontSize(14)
|
|
|
.fontColor(Color.White)
|
|
|
.margin({ left: 22 })
|
|
|
- Text(StrUtil.isEmpty(currentItem.trackCount)?'1':currentItem.trackCount)
|
|
|
+ Text(currentItem.track)
|
|
|
.fontSize(14)
|
|
|
.margin({ left: 10 })
|
|
|
.fontColor(Color.White)
|
|
|
@@ -5098,6 +5194,7 @@ export struct LocalMusic {
|
|
|
.margin({ top: 10, bottom: 10 })
|
|
|
.justifyContent(FlexAlign.Start)
|
|
|
|
|
|
+
|
|
|
Row() {
|
|
|
Text('格式:')
|
|
|
.fontSize(14)
|
|
|
@@ -5128,6 +5225,8 @@ export struct LocalMusic {
|
|
|
.margin({ top: 10, bottom: 10 })
|
|
|
.justifyContent(FlexAlign.Start)
|
|
|
|
|
|
+
|
|
|
+
|
|
|
Row() {
|
|
|
Text('流数量:')
|
|
|
.fontSize(14)
|
|
|
@@ -5454,6 +5553,7 @@ export struct LocalMusic {
|
|
|
.width(40)
|
|
|
.height(40)
|
|
|
.type(ButtonType.Circle)
|
|
|
+ .clickEffect({level:ClickEffectLevel.LIGHT, scale: 0.7})
|
|
|
.backgroundColor(this.themeColor)
|
|
|
.margin(5)
|
|
|
.onClick(() => {
|
|
|
@@ -5467,6 +5567,7 @@ export struct LocalMusic {
|
|
|
}
|
|
|
.width(40)
|
|
|
.height(40)
|
|
|
+ .clickEffect({level:ClickEffectLevel.LIGHT, scale: 0.7})
|
|
|
.type(ButtonType.Circle)
|
|
|
.backgroundColor(this.themeColor)
|
|
|
.margin(5)
|
|
|
@@ -5482,6 +5583,7 @@ export struct LocalMusic {
|
|
|
}
|
|
|
.width(40)
|
|
|
.height(40)
|
|
|
+ .clickEffect({level:ClickEffectLevel.LIGHT, scale: 0.7})
|
|
|
.type(ButtonType.Circle)
|
|
|
.backgroundColor(this.themeColor)
|
|
|
.margin(5)
|
|
|
@@ -5660,12 +5762,25 @@ export struct LocalMusic {
|
|
|
.maxLines(1)
|
|
|
.margin({ left: this.twoFingerType == 3 ? 18 : 10 })
|
|
|
Row() {
|
|
|
+ Column(){
|
|
|
+ Text(item.md5Str?.includes('Lossless')?
|
|
|
+ Utility.resourceToString(this.context,$r('app.string.lossless')):item.md5Str)//音质
|
|
|
+ .fontSize(this.twoFingerType == 1 ? 8 : this.twoFingerType == 2 ? 9 : 11)
|
|
|
+ .padding({ top: 3,right:6,left:6,bottom:3 })
|
|
|
+ .fontColor(this.currentSong?.filePath === item.filePath ? this.themeColor :
|
|
|
+ $r('app.color.text_color'))
|
|
|
+ .fontWeight(500)
|
|
|
+ .borderRadius(12)
|
|
|
+ .margin({ left: this.twoFingerType == 3 ? 12 : 10 })
|
|
|
+ .backgroundColor('#FFC107')
|
|
|
+ }
|
|
|
+ .padding({ top: 8 })
|
|
|
Text(StrUtil.isEmpty(item.artist) ? item.cTime : item.artist + ' ' + item?.album)
|
|
|
.fontSize(this.twoFingerType == 1 ? 11 : this.twoFingerType == 2 ? 12 : 14)
|
|
|
.padding({ top: 8 })
|
|
|
.fontColor(this.curIndex === index ? this.themeColor :
|
|
|
this.isFrontWhite ? $r('app.color.playlistText_color') : $r('app.color.text_color'))
|
|
|
- .margin({ left: this.twoFingerType == 3 ? 18 : 10 })
|
|
|
+ .margin({ left: this.twoFingerType == 3 ? 5 : 3 })
|
|
|
Blank()
|
|
|
Text(item.size)
|
|
|
.fontSize(this.twoFingerType == 1 ? 11 : this.twoFingerType == 2 ? 12 : 14)
|
|
|
@@ -5818,25 +5933,19 @@ export struct LocalMusic {
|
|
|
// LogUtil.info('twocold this.currentWidthBreakpoint = '+this.currentWidthBreakpoint)
|
|
|
LogUtil.info('hicar isPhoneLan width= ' + this.windowWidth);
|
|
|
LogUtil.info('hicar isPhoneLan height= ' + this.windowHeight);
|
|
|
- LogUtil.info(`twocold hicarWindow size: ${this.windowWidth}x${this.windowHeight}, isHiCar: ${this.isHiCar()}`);
|
|
|
+ LogUtil.info(`twocold hicarWindow size: ${this.windowWidth}x${this.windowHeight}, this.isHiCarStatus: ${this.isHiCarStatus}`);
|
|
|
LogUtil.info(`twocold hicar Window size: ${this.windowWidth}x${this.windowHeight}, isHiCarSmall: ${this.isHiCarSmall()}`);
|
|
|
- if (this.isHiCar()) {
|
|
|
+ if (this.isHiCarStatus) {
|
|
|
return false
|
|
|
}
|
|
|
|
|
|
if (DeviceUtil.getDeviceType() === resourceManager.DeviceType.DEVICE_TYPE_PHONE
|
|
|
&& this.currentHeightBreakpoint == HeightBreakpoint.HEIGHT_SM
|
|
|
- && this.currentWidthBreakpoint == WidthBreakpoint.WIDTH_MD) { //如果是手机横屏,返回true
|
|
|
+ && this.currentWidthBreakpoint == WidthBreakpoint.WIDTH_MD&&this.isLandscape) { //如果是手机横屏,返回true
|
|
|
|
|
|
return true
|
|
|
}
|
|
|
|
|
|
- if (DeviceUtil.getDeviceType() === resourceManager.DeviceType.DEVICE_TYPE_PHONE
|
|
|
- && this.currentBreakpoint !== BreakpointTypeEnum.SM) {
|
|
|
- if (DisplayUtil.getFoldStatus() === 0) {
|
|
|
- return true
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
return false
|
|
|
}
|
|
|
@@ -5893,29 +6002,31 @@ export struct LocalMusic {
|
|
|
|
|
|
isHiCar() {
|
|
|
|
|
|
- const hiCarAspectRatios: HiCarAspectRatio[] = [
|
|
|
- { ratio: 800 / 480, name: "800x480" },
|
|
|
- { ratio: 762 / 752, name: "762x752" },
|
|
|
- { ratio: 968 / 1280, name: "968x1280" },
|
|
|
- { ratio: 1200 / 1200, name: "1200x1200" },
|
|
|
- { ratio: 1280 / 720, name: "1280x720" },
|
|
|
- { ratio: 1920 / 720, name: "1920x720" },
|
|
|
- { ratio: 1920 / 1080, name: "1920x1080" }
|
|
|
- ];
|
|
|
- const currentRatio: number = this.windowWidth / this.windowHeight;
|
|
|
- const RATIO_TOLERANCE: number = 0.18; // 宽高比容差
|
|
|
- LogUtil.info('twocold currentRatio = ' + currentRatio)
|
|
|
-
|
|
|
- for (const hiCarRatio of hiCarAspectRatios) {
|
|
|
- LogUtil.info('twocold hiCarRatio= ' + hiCarRatio.ratio)
|
|
|
- LogUtil.info('twocold Math.abs(currentRatio - hiCarRatio.ratio)= ' + Math.abs(currentRatio - hiCarRatio.ratio))
|
|
|
- if (Math.abs(currentRatio - hiCarRatio.ratio) <= RATIO_TOLERANCE) {
|
|
|
- // LogUtil.info(`HiCar detected: ${hiCarRatio.name}, actual: ${this.windowWidth}x${this.windowHeight}`);
|
|
|
- return true&&this.isHiCarStatus;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return false;
|
|
|
+ return this.isHiCarStatus;
|
|
|
+
|
|
|
+ // const hiCarAspectRatios: HiCarAspectRatio[] = [
|
|
|
+ // { ratio: 800 / 480, name: "800x480" },
|
|
|
+ // { ratio: 762 / 752, name: "762x752" },
|
|
|
+ // { ratio: 968 / 1280, name: "968x1280" },
|
|
|
+ // { ratio: 1200 / 1200, name: "1200x1200" },
|
|
|
+ // { ratio: 1280 / 720, name: "1280x720" },
|
|
|
+ // { ratio: 1920 / 720, name: "1920x720" },
|
|
|
+ // { ratio: 1920 / 1080, name: "1920x1080" }
|
|
|
+ // ];
|
|
|
+ // const currentRatio: number = this.windowWidth / this.windowHeight;
|
|
|
+ // const RATIO_TOLERANCE: number = 0.18; // 宽高比容差
|
|
|
+ // LogUtil.info('twocold currentRatio = ' + currentRatio)
|
|
|
+ //
|
|
|
+ // for (const hiCarRatio of hiCarAspectRatios) {
|
|
|
+ // LogUtil.info('twocold hiCarRatio= ' + hiCarRatio.ratio)
|
|
|
+ // LogUtil.info('twocold Math.abs(currentRatio - hiCarRatio.ratio)= ' + Math.abs(currentRatio - hiCarRatio.ratio))
|
|
|
+ // if (Math.abs(currentRatio - hiCarRatio.ratio) <= RATIO_TOLERANCE) {
|
|
|
+ // // LogUtil.info(`HiCar detected: ${hiCarRatio.name}, actual: ${this.windowWidth}x${this.windowHeight}`);
|
|
|
+ // return true&&this.isHiCarStatus;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // return false;
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -6098,7 +6209,11 @@ export struct LocalMusic {
|
|
|
.backgroundBrightness({ rate: this.isPuraWP() ? 0.1 : 0, lightUpDegree: -0.1 })
|
|
|
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
|
|
|
.onClick(() => {
|
|
|
- this.startAutoHide()
|
|
|
+ // this.startAutoHide()
|
|
|
+ this.is_auto_hide_progress = false
|
|
|
+ setTimeout(() => {
|
|
|
+ this.is_auto_hide_progress = true
|
|
|
+ }, 6000)
|
|
|
})
|
|
|
}
|
|
|
|
|
|
@@ -6143,7 +6258,7 @@ export struct LocalMusic {
|
|
|
private positionX: number = PlayConstants.POSITION_X;
|
|
|
private positionY: number = PlayConstants.POSITION_Y;
|
|
|
private windowClass: window.Window = globalThis.windowClass
|
|
|
- @State volume: number = 0.5;
|
|
|
+ @State volume: number = 0.3;
|
|
|
@State volumeShow: boolean = PlayConstants.VOLUME_SHOW;
|
|
|
@State bright: number = PlayConstants.BRIGHT;
|
|
|
@State brightShow: boolean = PlayConstants.BRIGHT_SHOW;
|
|
|
@@ -6235,7 +6350,7 @@ export struct LocalMusic {
|
|
|
.setEmptyHint("")
|
|
|
.setAnimationDuration(1000)
|
|
|
this.currentLyricAlignMode = PreferencesUtil.getNumberSync('LyricAlignMode', 1)
|
|
|
- this.blurDegree = PreferencesUtil.getNumberSync('setBlurDegree', 0)
|
|
|
+ this.blurDegree = PreferencesUtil.getNumberSync('setBlurDegree', 3)
|
|
|
this.setBlurDegree(this.blurDegree, false)
|
|
|
this.setLyricAlignMode(this.currentLyricAlignMode, false)
|
|
|
this.setLyricTextSize(PreferencesUtil.getNumberSync('LyricTextSize', 18), false)
|
|
|
@@ -6468,7 +6583,7 @@ export struct LocalMusic {
|
|
|
.setEmptyHint("")
|
|
|
.setAnimationDuration(1000)
|
|
|
this.currentLyricAlignModePip = PreferencesUtil.getNumberSync('LyricAlignModePip', 0)
|
|
|
- this.blurDegreePip = PreferencesUtil.getNumberSync('setBlurDegreePip', 2)
|
|
|
+ this.blurDegreePip = PreferencesUtil.getNumberSync('setBlurDegreePip', 3)
|
|
|
this.setBlurDegree(this.blurDegreePip, true)
|
|
|
this.setLyricAlignMode(this.currentLyricAlignModePip, true)
|
|
|
this.setLyricTextSize(PreferencesUtil.getNumberSync('LyricTextSizePip', 18), true)
|
|
|
@@ -6578,8 +6693,9 @@ export struct LocalMusic {
|
|
|
return;
|
|
|
}
|
|
|
let bg = Utility.getMusisBg()
|
|
|
-
|
|
|
this.imageLabel = bg
|
|
|
+
|
|
|
+
|
|
|
ColorConversion.setSysBarLightBackground(true);
|
|
|
this.context.resourceManager.getMediaContent(bg)
|
|
|
.then((value: Uint8Array) => {
|
|
|
@@ -7050,13 +7166,13 @@ export struct LocalMusic {
|
|
|
style: SliderStyle.OutSet
|
|
|
})
|
|
|
.width('600px')
|
|
|
- .blockColor(Color.White)
|
|
|
- .trackColor($r('app.color.track_color'))
|
|
|
+ .blockColor('rgba(255,255,255,1)')
|
|
|
+ .trackColor('rgba(255,255,255,0.3)')
|
|
|
.selectedColor(Color.White)
|
|
|
.trackThickness(PlayConstants.PROGRESS_TRACK_THICKNESS)
|
|
|
.layoutWeight(1)
|
|
|
.margin({ left: PlayConstants.PROGRESS_MARGIN_LEFT })
|
|
|
- .showSteps(true)
|
|
|
+ .showSteps(false)
|
|
|
.showTips(true)
|
|
|
.enabled(this.slideEnable)
|
|
|
.onChange((value: number, mode: SliderChangeMode) => {
|
|
|
@@ -7148,7 +7264,8 @@ export struct LocalMusic {
|
|
|
@State is_auto_hide_progress: boolean = false //手机横屏自动隐藏播放进退条,点击屏幕可以显示,倒计时4秒后又自动隐藏
|
|
|
@State isCoverRectangle: boolean = false
|
|
|
@State isCoverTop: boolean = true
|
|
|
-
|
|
|
+ // 添加控制缩放的状态变量
|
|
|
+ @State scaleValueImage: number = 1
|
|
|
@Builder
|
|
|
CoverInfo() {
|
|
|
Column() {
|
|
|
@@ -7166,8 +7283,8 @@ export struct LocalMusic {
|
|
|
Stack() {
|
|
|
// 唱片旋转效果
|
|
|
Image($r('app.media.ic_music_disc'))
|
|
|
- .width(250)
|
|
|
- .height(250)
|
|
|
+ .width(245)
|
|
|
+ .height(245)
|
|
|
.margin({ right: 20, left: 20 })
|
|
|
.aspectRatio(1)
|
|
|
.opacity(this.isCoverOpacity() || this.isCoverRectangle ? 0 : 1)
|
|
|
@@ -7191,19 +7308,17 @@ export struct LocalMusic {
|
|
|
|
|
|
Column() {
|
|
|
if (this.isCoverTop && !this.isCoverOpacity() && this.isCoverRectangle) {
|
|
|
- Image(StrUtil.isEmpty(this.cover) ? this.imageLabel :
|
|
|
- this.cover)// .height(this.isCoverOpacity() ? 250 : this.isCoverRectangle ? 320 : 162)
|
|
|
+ Image(StrUtil.isEmpty(this.cover) ? this.imageLabel : this.cover)// .height(this.isCoverOpacity() ? 250 : this.isCoverRectangle ? 320 : 162)
|
|
|
.width(this.isBigScreen() ? '72%' : this.isCoverTopBig ? '100%' : '86%')
|
|
|
.objectFit(this.isCoverRectangle ? ImageFit.Contain : ImageFit.Auto)
|
|
|
.alt(this.imageLabel)
|
|
|
.margin({ right: 8, left: 8, top: 8 })
|
|
|
.aspectRatio(1)
|
|
|
+ .opacity(this.opacityValueImage)
|
|
|
+ .scale({ x: this.scaleValueImage, y: this.scaleValueImage }) // 添加缩放效果
|
|
|
+ .clickEffect({ level: ClickEffectLevel.MIDDLE,scale:0.8 })
|
|
|
.visibility(this.isPuraWP() ? Visibility.None : Visibility.Visible)
|
|
|
.borderRadius(this.isCoverRectangle ? 20 : '100%')
|
|
|
- .clickEffect({ level: ClickEffectLevel.MIDDLE })
|
|
|
- .transition(TransitionEffect.asymmetric(TransitionEffect.scale({ x: 1.2, y: 1.2 })
|
|
|
- .animation({ duration: 500 }),
|
|
|
- TransitionEffect.scale({ x: 0, y: 0 })))
|
|
|
.align(Alignment.Center)//
|
|
|
.clip(true)
|
|
|
.rotate({
|
|
|
@@ -7224,12 +7339,11 @@ export struct LocalMusic {
|
|
|
.alt(this.imageLabel)
|
|
|
.margin({ right: 20, left: 20 })
|
|
|
.aspectRatio(1)
|
|
|
+ .opacity(this.opacityValueImage)
|
|
|
+ .scale({ x: this.scaleValueImage, y: this.scaleValueImage }) // 添加缩放效果
|
|
|
.visibility(this.isPuraWP() ? Visibility.None : Visibility.Visible)
|
|
|
.borderRadius(this.isCoverRectangle ? 20 : '100%')
|
|
|
- .clickEffect({ level: ClickEffectLevel.MIDDLE })
|
|
|
- .transition(TransitionEffect.asymmetric(TransitionEffect.scale({ x: 1.2, y: 1.2 })
|
|
|
- .animation({ duration: 500 }),
|
|
|
- TransitionEffect.scale({ x: 0, y: 0 })))
|
|
|
+ .clickEffect({ level: ClickEffectLevel.MIDDLE,scale:0.8 })
|
|
|
.align(Alignment.Center)//
|
|
|
.clip(true)
|
|
|
.rotate({
|
|
|
@@ -7334,11 +7448,13 @@ export struct LocalMusic {
|
|
|
.textOverflow({ overflow: TextOverflow.MARQUEE })//超长滚动
|
|
|
.fontColor(Color.White)
|
|
|
.textAlign(TextAlign.Center)
|
|
|
+ .visibility(StrUtil.isEmpty(this.artist)?Visibility.None:Visibility.Visible)
|
|
|
.width('99%')
|
|
|
.maxLines(1)
|
|
|
}
|
|
|
.margin({ top: this.isCoverOpacity() ? 20 : isHidden ? 40 : 20 })
|
|
|
.zIndex(1)
|
|
|
+ .scale({ x: this.scaleValueImage, y: this.scaleValueImage }) // 添加缩放效果
|
|
|
.visibility(this.isCoverOpacity() || isHidden ? Visibility.None : Visibility.Visible)
|
|
|
}
|
|
|
|
|
|
@@ -7908,8 +8024,8 @@ export struct LocalMusic {
|
|
|
.fontColor(Color.White)
|
|
|
Slider({
|
|
|
value: isPip ? this.currentLyricLineSpacePip : this.currentLyricLineSpace,
|
|
|
- min: 2,
|
|
|
- max: 120,
|
|
|
+ min: 0,
|
|
|
+ max: 100,
|
|
|
step: 1,
|
|
|
style: SliderStyle.OutSet
|
|
|
})
|
|
|
@@ -7978,7 +8094,7 @@ export struct LocalMusic {
|
|
|
Slider({
|
|
|
value: isPip ? this.blurDegreePip : this.blurDegree,
|
|
|
min: 0,
|
|
|
- max: 10,
|
|
|
+ max: 5,
|
|
|
step: 0.1,
|
|
|
style: SliderStyle.OutSet
|
|
|
})
|
|
|
@@ -9505,7 +9621,8 @@ export struct LocalMusic {
|
|
|
} else {
|
|
|
this.getImageColor();
|
|
|
}
|
|
|
-
|
|
|
+ //保存碰一碰分享的当前的歌曲
|
|
|
+ AppStorage.setOrCreate('currentSong',this.currentSong) ;
|
|
|
|
|
|
let lyricPath = this.videoUrl.substring(0, this.videoUrl.lastIndexOf('.')) + '.lrc'
|
|
|
|
|
|
@@ -10313,11 +10430,44 @@ export struct LocalMusic {
|
|
|
this.stop();
|
|
|
this.currentSong = this.songList[this.curIndex]
|
|
|
this.videoUrl = this.songList[this.curIndex].filePath;
|
|
|
- this.cover = this.songList[this.curIndex].pixelMapPath
|
|
|
this.artist = this.songList[this.curIndex].artist
|
|
|
this.name = this.songList[this.curIndex].name
|
|
|
- this.startPlayOrResumePlay()
|
|
|
+ //this.cover = this.songList[this.curIndex].pixelMapPath
|
|
|
+ this.changeImageAnimation()
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
+ }
|
|
|
+
|
|
|
+ changeImageAnimation() {
|
|
|
+ if(this.openSkipSongAnimate){
|
|
|
+ // 第一步:淡出动画
|
|
|
+ this.getUIContext()?.animateTo({
|
|
|
+ duration: 500,
|
|
|
+ curve: Curve.EaseOut,
|
|
|
+ }, () => {
|
|
|
+ this.opacityValueImage = 0.1;
|
|
|
+ if(this.isCoverRectangle){
|
|
|
+ this.scaleValueImage = 0.88
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+ // 第二步:切换图片后淡入
|
|
|
+ setTimeout(() => {
|
|
|
+ this.cover = this.songList[this.curIndex].pixelMapPath
|
|
|
+ this.getUIContext()?.animateTo({
|
|
|
+ duration: 500,
|
|
|
+ curve: Curve.EaseIn,
|
|
|
+ }, () => {
|
|
|
+ this.opacityValueImage = 1;
|
|
|
+ this.scaleValueImage = 1 // 图标恢复到原始大小
|
|
|
+ this.startPlayOrResumePlay()
|
|
|
+ });
|
|
|
+ }, 500);
|
|
|
+ }else{
|
|
|
+ this.cover = this.songList[this.curIndex].pixelMapPath
|
|
|
+ this.startPlayOrResumePlay()
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -10369,9 +10519,9 @@ export struct LocalMusic {
|
|
|
this.currentSong = this.songList[this.curIndex];
|
|
|
this.videoUrl = this.songList[this.curIndex].filePath;
|
|
|
this.name = this.songList[this.curIndex].name;
|
|
|
- this.cover = this.songList[this.curIndex].pixelMapPath
|
|
|
this.artist = this.songList[this.curIndex].artist
|
|
|
- this.startPlayOrResumePlay();
|
|
|
+ // this.cover = this.songList[this.curIndex].pixelMapPath
|
|
|
+ this.changeImageAnimation()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -10386,14 +10536,14 @@ export struct LocalMusic {
|
|
|
this.currentSong = this.songList[this.curIndex]
|
|
|
this.videoUrl = this.songList[index].filePath;
|
|
|
this.name = this.songList[index].name
|
|
|
- this.cover = this.songList[this.curIndex].pixelMapPath
|
|
|
this.artist = this.songList[this.curIndex].artist
|
|
|
this.curIndex = index;
|
|
|
- this.startPlayOrResumePlay()
|
|
|
+ this.changeImageAnimation()
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
//上一个
|
|
|
private playPrevious() {
|
|
|
if (!this.debounce()) {
|
|
|
@@ -10414,9 +10564,8 @@ export struct LocalMusic {
|
|
|
this.currentSong = this.songList[this.curIndex]
|
|
|
this.videoUrl = this.songList[this.curIndex].filePath;
|
|
|
this.name = this.songList[this.curIndex].name
|
|
|
- this.cover = this.songList[this.curIndex].pixelMapPath
|
|
|
this.artist = this.songList[this.curIndex].artist
|
|
|
- this.startPlayOrResumePlay()
|
|
|
+ this.changeImageAnimation()
|
|
|
}
|
|
|
|
|
|
//随机播放模式下点击上一首: 上一首应该应该播放历史记录的第二首
|
|
|
@@ -10444,11 +10593,9 @@ export struct LocalMusic {
|
|
|
this.stop();
|
|
|
this.currentSong = this.songList[this.curIndex];
|
|
|
this.videoUrl = this.songList[this.curIndex].filePath;
|
|
|
- this.cover = this.songList[this.curIndex].pixelMapPath
|
|
|
this.artist = this.songList[this.curIndex].artist
|
|
|
this.name = this.songList[this.curIndex].name;
|
|
|
-
|
|
|
- this.startPlayOrResumePlay();
|
|
|
+ this.changeImageAnimation()
|
|
|
}
|
|
|
}
|
|
|
|