Sfoglia il codice sorgente

自定义背景 顶部

onecold 1 anno fa
parent
commit
56777b61eb

+ 16 - 35
entry/src/main/ets/pages/SplashIndex.ets

@@ -83,6 +83,7 @@ struct  SplashIndex{
   @State adLoadSuccess: Boolean = false
   @State errorMsg: string | undefined = undefined;
   @State startLoad: boolean = false;
+  @State appName:string = ''
   private mLoadListener: CSJSplashAdLoadListener = {
     onAdLoaded: (splashAd: CSJSplashAd) => {
       // ToastUtil.showToast("开屏回调 - 加载广告成功")
@@ -170,36 +171,6 @@ struct  SplashIndex{
   }
   async getSortedFiles(curPath:string){
 
-    // this.currentPath = curPath
-    // this.fileList = FileUtil.listFileSync(curPath)
-    // let directories: Array<VideoItem> = [];
-    // let files: Array<VideoItem> = [];
-    // for (let i = 0; i < this.fileList.length; i++) {
-    //   console.info(`The name of file: ${this.fileList[i]}`);
-    //   let path = curPath+'/'+this.fileList[i]
-    //   if(FileUtil.isDirectory(path)){
-    //     let item:VideoItem = new VideoItem(this.fileList[i].toString(),this.fileList[i].toString(),path,CommonConstants.TYPE_IS_DIR,0,'')
-    //
-    //     directories.push(item);
-    //     // directories.sort((a, b) => a.cTime.localeCompare(b.cTime));
-    //     Utility.doSortListAscending(directories)
-    //
-    //   }else{
-    //     let item:VideoItem = await Utility.uriGetMusicAssetsFromFile(this.context,path,CommonConstants.TYPE_LOCAL,false);
-    //     if(!path.endsWith('.lrc') &&Utility.isMeidaByExtension(path)&&!path.endsWith('.srt')){
-    //       files.push(item);
-    //       // files.sort((a, b) => a.cTime.localeCompare(b.cTime));
-    //       Utility.doSortListAscending(files)
-    //     }
-    //
-    //   }
-    // }
-    // if(this.currentPath===this.rootPath){
-    //   this.dirList = directories
-    // }
-    // // 合并文件夹和文件,文件夹在前,文件在后
-    // this.videoLocalList =  directories.concat(files);
-    // console.log(" onecold 欢迎页面 this.videoLocalList.length = " + this.videoLocalList.length);
 
     if(!Utility.isNoble()&&Utility.isPassInstallTime(2)){
       //判断用户安装app是否超过2天,超过2天才展示广告
@@ -250,6 +221,9 @@ struct  SplashIndex{
 
   //判断是否弹出隐私政策对话框
   aboutToAppear(): void {
+    Utility.getAppName(getContext(this)).then((appName:string)=>{
+      this.appName = appName
+    })
     let preferences = data_preferences.getPreferences(this.context,H_STORE)
     preferences.then((res) =>{
       res.get(IS_PRIVACY,false).then((isPrivacy) =>{
@@ -382,8 +356,8 @@ struct  SplashIndex{
 
         Column(){
           Image($r('app.media.icon'))
-            .width(45)
-            .height(45)
+            .width(66)
+            .height(66)
             .clip(true)
             .borderRadius('100%')
             .onClick(()=>{
@@ -392,9 +366,14 @@ struct  SplashIndex{
                 params:{ titleName:'ICP备案',webUrl:CommonConstants.ICP_URL}
               });
             })
+          Text(this.appName)
+            .fontColor(Color.Grey)
+            .fontSize(18)
+            .margin({top:20})
           Text(CommonConstants.ICP_NO)
             .fontColor(Color.Grey)
             .fontSize(9)
+            .visibility(Visibility.None)
             .onClick(()=>{
               this.isToPri = true
               router.pushUrl({url:'pages/WebIndex',
@@ -405,15 +384,17 @@ struct  SplashIndex{
         }
         .height(66)
         .width('100%')
+        .margin({bottom:30})
         .justifyContent(FlexAlign.Center)
         .backgroundColor(Color.White)
 
       }
-      .justifyContent(FlexAlign.End)
+      .justifyContent(FlexAlign.Center)
       .width('100%')
       .height('100%')
-      .backgroundImage($r('app.media.welcomeBg'))
-      .backgroundImageSize({width:'100%',height:'100%'})
+      // .backgroundImage($r('app.media.welcomeBg'))
+      // .backgroundImageSize({height:'100%'})
+      // .backgroundImagePosition(Alignment.Center)
       .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP])
 
 

+ 28 - 7
entry/src/main/ets/view/LocalMusic.ets

@@ -318,7 +318,7 @@ export struct LocalMusic {
     .setLeftIconWidth(25)
     .setLeftIconHeight(25)
     .setTitleName('首页')
-    .setTitleFontSize(19)
+    .setTitleFontSize(18)
     .setTitleFontColor(Color.White)
     .setTitleBarBackground($r('app.color.title_bar_bg'))
     .setTitleBarBottomLineColor($r('app.color.title_bar_bg'))
@@ -366,7 +366,17 @@ export struct LocalMusic {
     this.sortType = PreferencesUtil.getNumberSync(SettingPage.SORT_TYPE, 4)
     this.isCustomizeBg  = PreferencesUtil.getBooleanSync(SettingPage.IS_CUSTOMIZE_BG, false)
     this.customizeBgPath  = PreferencesUtil.getStringSync(SettingPage.IS_CUSTOMIZE_BG_PATH, '')
+    if(this.isCustomizeBg){
+      this.titleBarModel.setRightTitleBackground(Color.Transparent)
+      this.titleBarModel.setTitleBarBackground(Color.Transparent)
+      this.titleBarModel.setTitleBarBottomLineColor(Color.Transparent)
+      this.titleBarModel.setLeftTitleBackground(Color.Transparent)
 
+    }else{
+      this.titleBarModel.setTitleBarBackground($r('app.color.title_bar_bg'))
+      this.titleBarModel.setTitleBarBottomLineColor($r('app.color.title_bar_bg'))
+      this.titleBarModel  .setRightTitleBackground($r('app.color.title_bar_bg'))
+    }
 
     Utility.getAppName(getContext(this)).then((appName: string) => {
       this.appName = appName
@@ -449,6 +459,16 @@ export struct LocalMusic {
     this.sortType = PreferencesUtil.getNumberSync(SettingPage.SORT_TYPE, 4)
     this.isCustomizeBg  = PreferencesUtil.getBooleanSync(SettingPage.IS_CUSTOMIZE_BG, false)
     this.customizeBgPath  = PreferencesUtil.getStringSync(SettingPage.IS_CUSTOMIZE_BG_PATH, '')
+    if(this.isCustomizeBg){
+      this.titleBarModel.setTitleBarBackground(Color.Transparent)
+      this.titleBarModel.setTitleBarBottomLineColor(Color.Transparent)
+      this.titleBarModel.setRightTitleBackground(Color.Transparent)
+      this.titleBarModel.setLeftTitleBackground(Color.Transparent)
+    }else{
+      this.titleBarModel.setTitleBarBackground($r('app.color.title_bar_bg'))
+        .setTitleBarBottomLineColor($r('app.color.title_bar_bg'))
+        .setRightTitleBackground($r('app.color.title_bar_bg'))
+    }
 
     this.doUpdateData()
   }
@@ -1673,12 +1693,10 @@ export struct LocalMusic {
           Line().width('100%').height('100%')
         }
         .height(this.currentBreakpoint !== BreakpointTypeEnum.SM?0:CommonConstants.TOP_HEIGHT)
-        .backgroundColor($r('app.color.title_bar_bg'))
+        .backgroundColor(this.isCustomizeBg?Color.Transparent:$r('app.color.title_bar_bg'))
         .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP])
         TitleBar({ model: $titleBarModel })
           .id('pup_positon_music')
-          .backgroundColor($r('app.color.title_bar_bg'))
-          .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP])
         Stack() {
           Column() {
 
@@ -1831,7 +1849,8 @@ export struct LocalMusic {
       .width('100%')
       .height('100%')
       .backgroundImage(this.isCustomizeBg?this.customizeBgPath:$r('app.color.bottom_control_background'))
-      .backgroundImageSize({ height: '100%', width: '100%' })
+      .backgroundImageSize({ height: '100%'})
+      .backgroundImagePosition(Alignment.Center)
       // .backgroundColor($r('app.color.bottom_control_background'))
       .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
 
@@ -2979,12 +2998,13 @@ export struct LocalMusic {
               .fontSize(13)
               .textOverflow({ overflow: TextOverflow.MARQUEE })//超长滚动
               .maxLines(1)
+              .fontColor($r('app.color.text_color'))
               .fontWeight(500)
             Row() {
               Text(this.currentSong?.artist)
                 .margin({ top: 2 })
                 .fontSize(11)
-                .fontColor('#4D000000')
+                .fontColor($r('app.color.text_color'))
             }
           }
           .alignItems(HorizontalAlign.Start)
@@ -4740,6 +4760,7 @@ export struct LocalMusic {
           Row() {
             Text(this.currentSong?.artist !== undefined ? this.currentSong?.artist : '')
               .fontSize(10)
+              .fontWeight(FontWeight.Bold)
               .padding({ top: 8 })
               .fontColor(this.currentLyricColor)
               .margin({ left: this.currentLyricAlignMode === 0 ? 18 : 0 })
@@ -6065,7 +6086,7 @@ export struct LocalMusic {
   searchCover(title: string, artist: string) {
 
 
-    NetAxiosUtil.getLyricCover(title, artist).then(async (res) => {
+    NetAxiosUtil.getLyricCover(title, artist, PreferencesUtil.getStringSync('COVER_API','')).then(async (res) => {
 
       LogUtil.debug("onecold res =" + res)
       if (StrUtil.isNotEmpty(res) && res !== 'unknown' && res !== 'Timeout was reached') {