|
@@ -1,5 +1,5 @@
|
|
|
import TitleBar from '../view/TitleBar'
|
|
import TitleBar from '../view/TitleBar'
|
|
|
-import { router } from '@kit.ArkUI'
|
|
|
|
|
|
|
+import { promptAction, router } from '@kit.ArkUI'
|
|
|
import { CommonConstants } from '../common/constants/CommonConstants'
|
|
import { CommonConstants } from '../common/constants/CommonConstants'
|
|
|
import { AppUtil, PreferencesUtil } from '@pura/harmony-utils'
|
|
import { AppUtil, PreferencesUtil } from '@pura/harmony-utils'
|
|
|
import { Utility } from '../common/util/Utility'
|
|
import { Utility } from '../common/util/Utility'
|
|
@@ -9,6 +9,7 @@ import { AvSessionController } from '../controller/AvSessionController'
|
|
|
@Entry
|
|
@Entry
|
|
|
@Component
|
|
@Component
|
|
|
export struct SettingPage{
|
|
export struct SettingPage{
|
|
|
|
|
+ @State lyricApiUrl: string = PreferencesUtil.getStringSync('LRC_API', 'https://lrc.ss5.xyz/jsonapi')
|
|
|
|
|
|
|
|
@State isBgPlayOpen:boolean = true //是否启用后台播放
|
|
@State isBgPlayOpen:boolean = true //是否启用后台播放
|
|
|
@State isAutoRatate:boolean = true //是否启用自动横竖屏
|
|
@State isAutoRatate:boolean = true //是否启用自动横竖屏
|
|
@@ -65,253 +66,122 @@ export struct SettingPage{
|
|
|
build() {
|
|
build() {
|
|
|
Column(){
|
|
Column(){
|
|
|
TitleBar({model:$titleBarModel})
|
|
TitleBar({model:$titleBarModel})
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
Column() {
|
|
Column() {
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- //视频设置
|
|
|
|
|
|
|
+ //音频设置
|
|
|
Row() {
|
|
Row() {
|
|
|
-
|
|
|
|
|
- Text('视频设置')
|
|
|
|
|
|
|
+ Text('音频设置')
|
|
|
.margin({ left: 38, right: 20 })
|
|
.margin({ left: 38, right: 20 })
|
|
|
.fontSize(16)
|
|
.fontSize(16)
|
|
|
.fontColor(Color.Gray)
|
|
.fontColor(Color.Gray)
|
|
|
.fontWeight(480)
|
|
.fontWeight(480)
|
|
|
Blank()
|
|
Blank()
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
.width('100%')
|
|
.width('100%')
|
|
|
.height(55)
|
|
.height(55)
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
Line().width('100%').height(0.3).backgroundColor($r('app.color.index_tab_unselected_font_color'))
|
|
Line().width('100%').height(0.3).backgroundColor($r('app.color.index_tab_unselected_font_color'))
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- //后台播放
|
|
|
|
|
Row() {
|
|
Row() {
|
|
|
- Image($r('app.media.video_s'))
|
|
|
|
|
|
|
+ Image($r('app.media.kp_music_nor'))
|
|
|
.width(22)
|
|
.width(22)
|
|
|
.height(22)
|
|
.height(22)
|
|
|
.alignSelf(ItemAlign.Center)
|
|
.alignSelf(ItemAlign.Center)
|
|
|
.margin({ left: 28 })
|
|
.margin({ left: 28 })
|
|
|
- Text('投屏和后台播放')
|
|
|
|
|
|
|
+ Text('记忆播放')
|
|
|
.margin({ left: 10, right: 20 })
|
|
.margin({ left: 10, right: 20 })
|
|
|
.fontSize(15)
|
|
.fontSize(15)
|
|
|
.fontColor(Color.Gray)
|
|
.fontColor(Color.Gray)
|
|
|
.fontWeight(480)
|
|
.fontWeight(480)
|
|
|
Blank()
|
|
Blank()
|
|
|
- Toggle({ type: ToggleType.Switch,isOn: this.isBgPlayOpen })
|
|
|
|
|
|
|
+ Toggle({ type: ToggleType.Switch,isOn: this.isMusicMemoryPlay })
|
|
|
.selectedColor($r('app.color.title_bar_bg')) // 设置开关打开时的背景颜色为蓝色
|
|
.selectedColor($r('app.color.title_bar_bg')) // 设置开关打开时的背景颜色为蓝色
|
|
|
.switchPointColor(Color.White) // 设置开关关闭时的滑块颜色为白色
|
|
.switchPointColor(Color.White) // 设置开关关闭时的滑块颜色为白色
|
|
|
.margin({ right: 28 })
|
|
.margin({ right: 28 })
|
|
|
.onChange((checked: boolean) => { // 选择开关状态变化时触发事件
|
|
.onChange((checked: boolean) => { // 选择开关状态变化时触发事件
|
|
|
- this.isBgPlayOpen = checked;
|
|
|
|
|
- PreferencesUtil.put(SettingPage.IS_BGPLAY_OPEN,this.isBgPlayOpen)
|
|
|
|
|
- if(!this.isBgPlayOpen){
|
|
|
|
|
- AvSessionController.getInstance(true).unregisterSessionListener()
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
- .width(50)
|
|
|
|
|
- .height(30);
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- .width('100%')
|
|
|
|
|
- .height(55)
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- Line().width('100%').height(0.3).backgroundColor($r('app.color.index_tab_unselected_font_color'))
|
|
|
|
|
-
|
|
|
|
|
- //视频自动横竖屏
|
|
|
|
|
- Row() {
|
|
|
|
|
- Image($r('app.media.video_s'))
|
|
|
|
|
- .width(22)
|
|
|
|
|
- .height(22)
|
|
|
|
|
- .alignSelf(ItemAlign.Center)
|
|
|
|
|
- .margin({ left: 28 })
|
|
|
|
|
- Text('自动横竖屏')
|
|
|
|
|
- .margin({ left: 10, right: 20 })
|
|
|
|
|
- .fontSize(15)
|
|
|
|
|
- .fontColor(Color.Gray)
|
|
|
|
|
- .fontWeight(480)
|
|
|
|
|
- Blank()
|
|
|
|
|
- Toggle({ type: ToggleType.Switch,isOn: this.isAutoRatate })
|
|
|
|
|
- .selectedColor($r('app.color.title_bar_bg'))
|
|
|
|
|
- .switchPointColor(Color.White)
|
|
|
|
|
- .margin({ right: 28 })
|
|
|
|
|
- .onChange((checked: boolean) => { // 选择开关状态变化时触发事件
|
|
|
|
|
- this.isAutoRatate = checked;
|
|
|
|
|
- PreferencesUtil.put(SettingPage.IS_AUTO_RATATE,this.isAutoRatate)
|
|
|
|
|
-
|
|
|
|
|
- })
|
|
|
|
|
- .width(50)
|
|
|
|
|
- .height(30);
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- .width('100%')
|
|
|
|
|
- .height(55)
|
|
|
|
|
-
|
|
|
|
|
- Line().width('100%').height(0.3).backgroundColor($r('app.color.index_tab_unselected_font_color'))
|
|
|
|
|
- //开启记忆播放
|
|
|
|
|
- Row() {
|
|
|
|
|
- Image($r('app.media.video_s'))
|
|
|
|
|
- .width(22)
|
|
|
|
|
- .height(22)
|
|
|
|
|
- .alignSelf(ItemAlign.Center)
|
|
|
|
|
- .margin({ left: 28 })
|
|
|
|
|
- Text('记忆播放')
|
|
|
|
|
- .margin({ left: 10, right: 20 })
|
|
|
|
|
- .fontSize(15)
|
|
|
|
|
- .fontColor(Color.Gray)
|
|
|
|
|
- .fontWeight(480)
|
|
|
|
|
- Blank()
|
|
|
|
|
- Toggle({ type: ToggleType.Switch,isOn: this.isMemoryPlay })
|
|
|
|
|
- .selectedColor($r('app.color.title_bar_bg'))
|
|
|
|
|
- .switchPointColor(Color.White)
|
|
|
|
|
- .margin({ right: 28 })
|
|
|
|
|
- .onChange((checked: boolean) => { // 选择开关状态变化时触发事件
|
|
|
|
|
- this.isMemoryPlay = checked;
|
|
|
|
|
- PreferencesUtil.put(SettingPage.iS_MEMORY_PLAY,this.isMemoryPlay)
|
|
|
|
|
-
|
|
|
|
|
|
|
+ this.isMusicMemoryPlay = checked;
|
|
|
|
|
+ PreferencesUtil.put(SettingPage.iS_MUSIC_MEMORY_PLAY,this.isMusicMemoryPlay)
|
|
|
})
|
|
})
|
|
|
.width(50)
|
|
.width(50)
|
|
|
.height(30);
|
|
.height(30);
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
.width('100%')
|
|
.width('100%')
|
|
|
.height(55)
|
|
.height(55)
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
Line().width('100%').height(0.3).backgroundColor($r('app.color.index_tab_unselected_font_color'))
|
|
Line().width('100%').height(0.3).backgroundColor($r('app.color.index_tab_unselected_font_color'))
|
|
|
- //开启硬件解码
|
|
|
|
|
Row() {
|
|
Row() {
|
|
|
- Image($r('app.media.video_s'))
|
|
|
|
|
|
|
+ Image($r('app.media.kp_music_nor'))
|
|
|
.width(22)
|
|
.width(22)
|
|
|
.height(22)
|
|
.height(22)
|
|
|
.alignSelf(ItemAlign.Center)
|
|
.alignSelf(ItemAlign.Center)
|
|
|
.margin({ left: 28 })
|
|
.margin({ left: 28 })
|
|
|
- Text('硬件解码')
|
|
|
|
|
|
|
+ Text('播放背景随音乐封面')
|
|
|
.margin({ left: 10, right: 20 })
|
|
.margin({ left: 10, right: 20 })
|
|
|
.fontSize(15)
|
|
.fontSize(15)
|
|
|
.fontColor(Color.Gray)
|
|
.fontColor(Color.Gray)
|
|
|
.fontWeight(480)
|
|
.fontWeight(480)
|
|
|
Blank()
|
|
Blank()
|
|
|
- Toggle({ type: ToggleType.Switch,isOn: this.isMediacodec })
|
|
|
|
|
|
|
+ Toggle({ type: ToggleType.Switch,isOn: this.isMusicBGCover })
|
|
|
.selectedColor($r('app.color.title_bar_bg')) // 设置开关打开时的背景颜色为蓝色
|
|
.selectedColor($r('app.color.title_bar_bg')) // 设置开关打开时的背景颜色为蓝色
|
|
|
.switchPointColor(Color.White) // 设置开关关闭时的滑块颜色为白色
|
|
.switchPointColor(Color.White) // 设置开关关闭时的滑块颜色为白色
|
|
|
.margin({ right: 28 })
|
|
.margin({ right: 28 })
|
|
|
.onChange((checked: boolean) => { // 选择开关状态变化时触发事件
|
|
.onChange((checked: boolean) => { // 选择开关状态变化时触发事件
|
|
|
- this.isMediacodec = checked;
|
|
|
|
|
- PreferencesUtil.put(SettingPage.IS_BGPLAY_OPEN,this.isMediacodec)
|
|
|
|
|
|
|
+ this.isMusicBGCover = checked;
|
|
|
|
|
+ PreferencesUtil.put(SettingPage.iS_MUSIC_BG_COVER,this.isMusicBGCover)
|
|
|
|
|
|
|
|
})
|
|
})
|
|
|
.width(50)
|
|
.width(50)
|
|
|
.height(30);
|
|
.height(30);
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
.width('100%')
|
|
.width('100%')
|
|
|
.height(55)
|
|
.height(55)
|
|
|
|
|
+ Line().width('100%').height(0.3).backgroundColor($r('app.color.index_tab_unselected_font_color'))
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- .backgroundColor(Color.White)
|
|
|
|
|
- .visibility(Visibility.None)
|
|
|
|
|
- .margin({left:15,right:15,top:20,bottom:10})
|
|
|
|
|
- .borderRadius(30)
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- Column() {
|
|
|
|
|
-
|
|
|
|
|
- //音频设置
|
|
|
|
|
|
|
+ //第三方歌词API设置
|
|
|
Row() {
|
|
Row() {
|
|
|
-
|
|
|
|
|
- Text('音频设置')
|
|
|
|
|
|
|
+ Text('第三方歌词API设置')
|
|
|
.margin({ left: 38, right: 20 })
|
|
.margin({ left: 38, right: 20 })
|
|
|
.fontSize(16)
|
|
.fontSize(16)
|
|
|
.fontColor(Color.Gray)
|
|
.fontColor(Color.Gray)
|
|
|
.fontWeight(480)
|
|
.fontWeight(480)
|
|
|
- Blank()
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
.width('100%')
|
|
.width('100%')
|
|
|
.height(55)
|
|
.height(55)
|
|
|
Line().width('100%').height(0.3).backgroundColor($r('app.color.index_tab_unselected_font_color'))
|
|
Line().width('100%').height(0.3).backgroundColor($r('app.color.index_tab_unselected_font_color'))
|
|
|
Row() {
|
|
Row() {
|
|
|
- Image($r('app.media.kp_music_nor'))
|
|
|
|
|
- .width(22)
|
|
|
|
|
- .height(22)
|
|
|
|
|
- .alignSelf(ItemAlign.Center)
|
|
|
|
|
- .margin({ left: 28 })
|
|
|
|
|
- Text('记忆播放')
|
|
|
|
|
- .margin({ left: 10, right: 20 })
|
|
|
|
|
|
|
+ TextArea({ text: this.lyricApiUrl })
|
|
|
|
|
+ .margin({ left: 18, right: 10, top: 8, bottom: 8 })
|
|
|
.fontSize(15)
|
|
.fontSize(15)
|
|
|
- .fontColor(Color.Gray)
|
|
|
|
|
- .fontWeight(480)
|
|
|
|
|
- Blank()
|
|
|
|
|
- Toggle({ type: ToggleType.Switch,isOn: this.isMusicMemoryPlay })
|
|
|
|
|
- .selectedColor($r('app.color.title_bar_bg')) // 设置开关打开时的背景颜色为蓝色
|
|
|
|
|
- .switchPointColor(Color.White) // 设置开关关闭时的滑块颜色为白色
|
|
|
|
|
- .margin({ right: 28 })
|
|
|
|
|
- .onChange((checked: boolean) => { // 选择开关状态变化时触发事件
|
|
|
|
|
- this.isMusicMemoryPlay = checked;
|
|
|
|
|
- PreferencesUtil.put(SettingPage.iS_MUSIC_MEMORY_PLAY,this.isMusicMemoryPlay)
|
|
|
|
|
-
|
|
|
|
|
|
|
+ .fontColor(Color.Black)
|
|
|
|
|
+ .backgroundColor(0xf5f5f5)
|
|
|
|
|
+ .borderRadius(10)
|
|
|
|
|
+ .layoutWeight(1)
|
|
|
|
|
+ .onChange((val: string) => {
|
|
|
|
|
+ this.lyricApiUrl = val
|
|
|
})
|
|
})
|
|
|
- .width(50)
|
|
|
|
|
- .height(30);
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- .width('100%')
|
|
|
|
|
- .height(55)
|
|
|
|
|
-
|
|
|
|
|
- Line().width('100%').height(0.3).backgroundColor($r('app.color.index_tab_unselected_font_color'))
|
|
|
|
|
- Row() {
|
|
|
|
|
- Image($r('app.media.kp_music_nor'))
|
|
|
|
|
- .width(22)
|
|
|
|
|
- .height(22)
|
|
|
|
|
- .alignSelf(ItemAlign.Center)
|
|
|
|
|
- .margin({ left: 28 })
|
|
|
|
|
- Text('播放背景随音乐封面')
|
|
|
|
|
- .margin({ left: 10, right: 20 })
|
|
|
|
|
|
|
+ Button('保存', { type: ButtonType.Normal, stateEffect: true })
|
|
|
|
|
+ .borderRadius(8)
|
|
|
|
|
+ .backgroundColor(0x317aff)
|
|
|
|
|
+ .fontColor(Color.White)
|
|
|
.fontSize(15)
|
|
.fontSize(15)
|
|
|
- .fontColor(Color.Gray)
|
|
|
|
|
- .fontWeight(480)
|
|
|
|
|
- Blank()
|
|
|
|
|
- Toggle({ type: ToggleType.Switch,isOn: this.isMusicBGCover })
|
|
|
|
|
- .selectedColor($r('app.color.title_bar_bg')) // 设置开关打开时的背景颜色为蓝色
|
|
|
|
|
- .switchPointColor(Color.White) // 设置开关关闭时的滑块颜色为白色
|
|
|
|
|
- .margin({ right: 28 })
|
|
|
|
|
- .onChange((checked: boolean) => { // 选择开关状态变化时触发事件
|
|
|
|
|
- this.isMusicBGCover = checked;
|
|
|
|
|
- PreferencesUtil.put(SettingPage.iS_MUSIC_BG_COVER,this.isMusicBGCover)
|
|
|
|
|
|
|
+ .width(80)
|
|
|
|
|
+ .height(38)
|
|
|
|
|
+ .margin({ left: 10, right: 18 })
|
|
|
|
|
+ .onClick(() => {
|
|
|
|
|
+ PreferencesUtil.put('LRC_API', this.lyricApiUrl)
|
|
|
|
|
+ this.getUIContext().getPromptAction().showToast({
|
|
|
|
|
+ message: "保存成功,当前LRC_API:"+ this.lyricApiUrl,
|
|
|
|
|
+ duration: 2000,
|
|
|
|
|
+ showMode: promptAction.ToastShowMode.TOP_MOST,
|
|
|
|
|
+ bottom: 85
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
})
|
|
})
|
|
|
- .width(50)
|
|
|
|
|
- .height(30);
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
.width('100%')
|
|
.width('100%')
|
|
|
- .height(55)
|
|
|
|
|
-
|
|
|
|
|
- Line().width('100%').height(0.3).backgroundColor($r('app.color.index_tab_unselected_font_color'))
|
|
|
|
|
|
|
+ .margin({top: 8, bottom: 12})
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
.backgroundColor(Color.White)
|
|
.backgroundColor(Color.White)
|
|
|
.margin({left:15,right:15,top:20,bottom:10})
|
|
.margin({left:15,right:15,top:20,bottom:10})
|
|
|
.borderRadius(30)
|
|
.borderRadius(30)
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
.backgroundColor($r('app.color.index_background'))
|
|
.backgroundColor($r('app.color.index_background'))
|
|
|
.height('100%')
|
|
.height('100%')
|
|
|
|
|
|