|
@@ -126,6 +126,7 @@ function getFindAlbumPageKey(item: FindAlbumPage, index: number): string {
|
|
|
export struct FindView {
|
|
export struct FindView {
|
|
|
@StorageProp('isLandscape') isLandscape: boolean = false;
|
|
@StorageProp('isLandscape') isLandscape: boolean = false;
|
|
|
@State isCustomizeBg: boolean = false //自定义背景界面
|
|
@State isCustomizeBg: boolean = false //自定义背景界面
|
|
|
|
|
+ @State isHomeBgFollowMusicCover: boolean = true //主页背景随当前播放封面
|
|
|
@State blurValue: number = 0 //背景模糊
|
|
@State blurValue: number = 0 //背景模糊
|
|
|
@State bgBrightness: number = 0 //背景亮度
|
|
@State bgBrightness: number = 0 //背景亮度
|
|
|
@State customizeBgPath: string | undefined = '';
|
|
@State customizeBgPath: string | undefined = '';
|
|
@@ -185,7 +186,8 @@ export struct FindView {
|
|
|
@StorageProp('bottomSafeHeight') bottomSafeHeight: number = 0
|
|
@StorageProp('bottomSafeHeight') bottomSafeHeight: number = 0
|
|
|
@StorageProp('isDarkMode') isDarkMode: boolean = false
|
|
@StorageProp('isDarkMode') isDarkMode: boolean = false
|
|
|
@StorageProp('themeColor') themeColor: string = CommonConstants.DEFAULT_THEME_COLOR
|
|
@StorageProp('themeColor') themeColor: string = CommonConstants.DEFAULT_THEME_COLOR
|
|
|
- @StorageLink('currentSong') currentSong: VideoItem | undefined = undefined
|
|
|
|
|
|
|
+ @StorageProp('customizeMusicBgPath') customizeMusicBgPath: string = ''
|
|
|
|
|
+ @StorageLink('currentSong') @Watch('onHomeBgCurrentSongChange') currentSong: VideoItem | undefined = undefined
|
|
|
@StorageLink('isPlaying') isPlaying: boolean = false
|
|
@StorageLink('isPlaying') isPlaying: boolean = false
|
|
|
|
|
|
|
|
private mediaTable?: MediaTable
|
|
private mediaTable?: MediaTable
|
|
@@ -233,11 +235,53 @@ export struct FindView {
|
|
|
|
|
|
|
|
initSetting(){
|
|
initSetting(){
|
|
|
this.isCustomizeBg = PreferencesUtil.getBooleanSync(SettingPage.IS_CUSTOMIZE_BG, false)
|
|
this.isCustomizeBg = PreferencesUtil.getBooleanSync(SettingPage.IS_CUSTOMIZE_BG, false)
|
|
|
|
|
+ this.isHomeBgFollowMusicCover = PreferencesUtil.getBooleanSync(SettingPage.IS_HOME_BG_FOLLOW_MUSIC_COVER, true)
|
|
|
this.customizeBgPath = PreferencesUtil.getStringSync(SettingPage.IS_CUSTOMIZE_BG_PATH, '')
|
|
this.customizeBgPath = PreferencesUtil.getStringSync(SettingPage.IS_CUSTOMIZE_BG_PATH, '')
|
|
|
this.blurValue = PreferencesUtil.getNumberSync(SettingPage.CUSTOMIZE_BG_BLUR, 0)
|
|
this.blurValue = PreferencesUtil.getNumberSync(SettingPage.CUSTOMIZE_BG_BLUR, 0)
|
|
|
this.bgBrightness = PreferencesUtil.getNumberSync(SettingPage.BG_BRIGHTNESS, 0)
|
|
this.bgBrightness = PreferencesUtil.getNumberSync(SettingPage.BG_BRIGHTNESS, 0)
|
|
|
this.isShowTitleBar = PreferencesUtil.getBooleanSync(SettingPage.IS_SHOW_TITLTBAR, true)
|
|
this.isShowTitleBar = PreferencesUtil.getBooleanSync(SettingPage.IS_SHOW_TITLTBAR, true)
|
|
|
this.autoHideTitle = PreferencesUtil.getBooleanSync('autoHideTitle', true)
|
|
this.autoHideTitle = PreferencesUtil.getBooleanSync('autoHideTitle', true)
|
|
|
|
|
+ this.syncCustomizeMusicBgPath()
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private onHomeBgCurrentSongChange(): void {
|
|
|
|
|
+ this.syncCustomizeMusicBgPath()
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private syncCustomizeMusicBgPath(): void {
|
|
|
|
|
+ if (!this.isHomeBgFollowMusicCover) {
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ const coverPath: string = this.currentSong?.pixelMapPath ?? ''
|
|
|
|
|
+ AppStorage.setOrCreate('customizeMusicBgPath', coverPath)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private isMusicCoverHomeBackgroundActive(): boolean {
|
|
|
|
|
+ return this.isHomeBgFollowMusicCover && this.customizeMusicBgPath.length > 0
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private shouldUseDiscoveryImageBackgroundOverlay(): boolean {
|
|
|
|
|
+ return this.isCustomizeBg || this.isMusicCoverHomeBackgroundActive()
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private getDiscoveryTopBarBackgroundColor(): ResourceColor | string {
|
|
|
|
|
+ if (!this.isSearchMode && !this.isAlbumMode) {
|
|
|
|
|
+ return Color.Transparent
|
|
|
|
|
+ }
|
|
|
|
|
+ if (this.shouldUseDiscoveryImageBackgroundOverlay()) {
|
|
|
|
|
+ return this.isDarkMode ? '#66111111' : '#66FFFFFF'
|
|
|
|
|
+ }
|
|
|
|
|
+ return $r('app.color.start_window_background_blur')
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private getDiscoverySearchBackgroundColor(): ResourceColor | string {
|
|
|
|
|
+ if (this.isMusicCoverHomeBackgroundActive()) {
|
|
|
|
|
+ return this.isDarkMode ? '#80111111' : '#80FFFFFF'
|
|
|
|
|
+ }
|
|
|
|
|
+ if (this.isCustomizeBg) {
|
|
|
|
|
+ return this.isDarkMode ? '#66111111' : '#73FFFFFF'
|
|
|
|
|
+ }
|
|
|
|
|
+ return $r('app.color.input_background')
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private onDiscoverBreakpointChange(): void {
|
|
private onDiscoverBreakpointChange(): void {
|
|
@@ -2235,7 +2279,10 @@ export struct FindView {
|
|
|
.layoutWeight(1)
|
|
.layoutWeight(1)
|
|
|
.height(35)
|
|
.height(35)
|
|
|
.maxLength(40)
|
|
.maxLength(40)
|
|
|
- .backgroundColor($r('app.color.input_background'))
|
|
|
|
|
|
|
+ .backgroundColor(this.getDiscoverySearchBackgroundColor())
|
|
|
|
|
+ .backgroundBlurStyle(this.shouldUseDiscoveryImageBackgroundOverlay()
|
|
|
|
|
+ ? BlurStyle.BACKGROUND_THICK
|
|
|
|
|
+ : BlurStyle.NONE)
|
|
|
.placeholderColor(this.getSecondaryTextColor())
|
|
.placeholderColor(this.getSecondaryTextColor())
|
|
|
.placeholderFont({ size: 14, weight: 400 })
|
|
.placeholderFont({ size: 14, weight: 400 })
|
|
|
.textFont({ size: 14, weight: 400 })
|
|
.textFont({ size: 14, weight: 400 })
|
|
@@ -2270,7 +2317,10 @@ export struct FindView {
|
|
|
}
|
|
}
|
|
|
.padding({ top: this.topSafeHeight + 10, left: 10, right: 10, bottom: 6 })
|
|
.padding({ top: this.topSafeHeight + 10, left: 10, right: 10, bottom: 6 })
|
|
|
.width('100%')
|
|
.width('100%')
|
|
|
- .backgroundColor(this.isSearchMode || this.isAlbumMode ? $r('app.color.start_window_background_blur') : Color.Transparent)
|
|
|
|
|
|
|
+ .backgroundColor(this.getDiscoveryTopBarBackgroundColor())
|
|
|
|
|
+ .backgroundBlurStyle(this.shouldUseDiscoveryImageBackgroundOverlay() && (this.isSearchMode || this.isAlbumMode)
|
|
|
|
|
+ ? BlurStyle.BACKGROUND_ULTRA_THICK
|
|
|
|
|
+ : BlurStyle.NONE)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Builder
|
|
@Builder
|
|
@@ -3438,11 +3488,17 @@ export struct FindView {
|
|
|
.width('100%')
|
|
.width('100%')
|
|
|
.height('100%')
|
|
.height('100%')
|
|
|
.alignContent(Alignment.Bottom)
|
|
.alignContent(Alignment.Bottom)
|
|
|
- .backgroundImage(this.isCustomizeBg?this.customizeBgPath:$r('app.color.start_window_background'))
|
|
|
|
|
|
|
+ .backgroundImage(this.isMusicCoverHomeBackgroundActive()
|
|
|
|
|
+ ? this.customizeMusicBgPath
|
|
|
|
|
+ : (this.isCustomizeBg ? this.customizeBgPath : $r('app.color.start_window_background')))
|
|
|
.backgroundImageSize(this.isLandscape?{width:'100%'}:{ height: '100%'})
|
|
.backgroundImageSize(this.isLandscape?{width:'100%'}:{ height: '100%'})
|
|
|
.backgroundImagePosition(Alignment.Center)
|
|
.backgroundImagePosition(Alignment.Center)
|
|
|
.backdropBlur(this.blurValue)
|
|
.backdropBlur(this.blurValue)
|
|
|
- .backgroundBrightness({rate:this.isCustomizeBg?0.1:0,lightUpDegree:this.bgBrightness})
|
|
|
|
|
|
|
+ .backgroundBrightness({rate:this.isMusicCoverHomeBackgroundActive() || this.isCustomizeBg ? 0.1 : 0,
|
|
|
|
|
+ lightUpDegree:this.bgBrightness})
|
|
|
|
|
+ .backgroundBlurStyle(this.isMusicCoverHomeBackgroundActive()
|
|
|
|
|
+ ? BlurStyle.BACKGROUND_ULTRA_THICK :
|
|
|
|
|
+ BlurStyle.NONE)
|
|
|
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
|
|
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -3459,6 +3515,7 @@ export struct FindView {
|
|
|
albumCoverPath: this.currentAlbumCoverPath,
|
|
albumCoverPath: this.currentAlbumCoverPath,
|
|
|
albumSourceLabel: this.currentAlbumSourceLabel,
|
|
albumSourceLabel: this.currentAlbumSourceLabel,
|
|
|
songs: this.currentAlbumSongs,
|
|
songs: this.currentAlbumSongs,
|
|
|
|
|
+ useTransparentBackground: this.isCustomizeBg || this.isMusicCoverHomeBackgroundActive(),
|
|
|
defaultSortType: this.currentAlbumDefaultSortType,
|
|
defaultSortType: this.currentAlbumDefaultSortType,
|
|
|
supportRecentPlayedSort: this.currentAlbumSupportRecentPlayedSort,
|
|
supportRecentPlayedSort: this.currentAlbumSupportRecentPlayedSort,
|
|
|
allowDelete: this.canDeleteCurrentAlbumSongs(),
|
|
allowDelete: this.canDeleteCurrentAlbumSongs(),
|
|
@@ -3514,6 +3571,7 @@ export struct FindView {
|
|
|
}
|
|
}
|
|
|
.width('100%')
|
|
.width('100%')
|
|
|
.height('100%')
|
|
.height('100%')
|
|
|
- .backgroundColor(this.isCustomizeBg ? Color.Transparent : $r('app.color.start_window_background'))
|
|
|
|
|
|
|
+ .backgroundColor(this.isCustomizeBg || this.isMusicCoverHomeBackgroundActive()
|
|
|
|
|
+ ? Color.Transparent : $r('app.color.start_window_background'))
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|