|
@@ -20,6 +20,10 @@ export struct SettingPage {
|
|
|
@State isMediacodec: boolean = false //是否启用硬件解码
|
|
@State isMediacodec: boolean = false //是否启用硬件解码
|
|
|
@State isMusicMemoryPlay: boolean = false //是否启用记忆播放
|
|
@State isMusicMemoryPlay: boolean = false //是否启用记忆播放
|
|
|
@State isMusicBGCover: boolean = true //播放背景随封面
|
|
@State isMusicBGCover: boolean = true //播放背景随封面
|
|
|
|
|
+ @State showCoverApiDialog: boolean = false
|
|
|
|
|
+ @State tempCoverApiUrl: string = ''
|
|
|
|
|
+ @State coverApiUrl: string = PreferencesUtil.getStringSync('COVER_API', 'https://lrc.ss5.xyz/cover')
|
|
|
|
|
+ @State apiDialogType: 'lyric' | 'cover' = 'lyric'
|
|
|
static readonly IS_BGPLAY_OPEN: string = 'isBgPlayOpen';
|
|
static readonly IS_BGPLAY_OPEN: string = 'isBgPlayOpen';
|
|
|
static readonly IS_AUTO_RATATE: string = 'isAutoRatate';
|
|
static readonly IS_AUTO_RATATE: string = 'isAutoRatate';
|
|
|
static readonly iS_MEMORY_PLAY: string = 'isMemoryPlay';
|
|
static readonly iS_MEMORY_PLAY: string = 'isMemoryPlay';
|
|
@@ -44,7 +48,7 @@ export struct SettingPage {
|
|
|
|
|
|
|
|
apiDialogController: CustomDialogController = new CustomDialogController({
|
|
apiDialogController: CustomDialogController = new CustomDialogController({
|
|
|
builder: CustomContentDialog({
|
|
builder: CustomContentDialog({
|
|
|
- primaryTitle: '修改歌词API地址',
|
|
|
|
|
|
|
+ primaryTitle: this.apiDialogType === 'lyric' ? '修改歌词API地址' : '修改封面API地址',
|
|
|
contentBuilder: () => {
|
|
contentBuilder: () => {
|
|
|
this.buildApiDialogContent();
|
|
this.buildApiDialogContent();
|
|
|
},
|
|
},
|
|
@@ -58,15 +62,26 @@ export struct SettingPage {
|
|
|
{
|
|
{
|
|
|
value: '保存',
|
|
value: '保存',
|
|
|
action: () => {
|
|
action: () => {
|
|
|
- this.lyricApiUrl = this.tempApiUrl
|
|
|
|
|
- PreferencesUtil.put('LRC_API', this.lyricApiUrl)
|
|
|
|
|
|
|
+ if (this.apiDialogType === 'lyric') {
|
|
|
|
|
+ this.lyricApiUrl = this.tempApiUrl
|
|
|
|
|
+ PreferencesUtil.put('LRC_API', this.lyricApiUrl)
|
|
|
|
|
+ this.getUIContext().getPromptAction().showToast({
|
|
|
|
|
+ message: '保存成功,当前LRC_API:' + this.lyricApiUrl,
|
|
|
|
|
+ duration: 2000,
|
|
|
|
|
+ showMode: promptAction.ToastShowMode.TOP_MOST,
|
|
|
|
|
+ bottom: 85
|
|
|
|
|
+ })
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.coverApiUrl = this.tempApiUrl
|
|
|
|
|
+ PreferencesUtil.put('COVER_API', this.coverApiUrl)
|
|
|
|
|
+ this.getUIContext().getPromptAction().showToast({
|
|
|
|
|
+ message: '保存成功,当前COVER_API:' + this.coverApiUrl,
|
|
|
|
|
+ duration: 2000,
|
|
|
|
|
+ showMode: promptAction.ToastShowMode.TOP_MOST,
|
|
|
|
|
+ bottom: 85
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
this.apiDialogController.close();
|
|
this.apiDialogController.close();
|
|
|
- this.getUIContext().getPromptAction().showToast({
|
|
|
|
|
- message: '保存成功,当前LRC_API:' + this.lyricApiUrl,
|
|
|
|
|
- duration: 2000,
|
|
|
|
|
- showMode: promptAction.ToastShowMode.TOP_MOST,
|
|
|
|
|
- bottom: 85
|
|
|
|
|
- })
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
]
|
|
]
|
|
@@ -78,7 +93,7 @@ export struct SettingPage {
|
|
|
@Builder
|
|
@Builder
|
|
|
buildApiDialogContent() {
|
|
buildApiDialogContent() {
|
|
|
Column() {
|
|
Column() {
|
|
|
- TextInput({ text: this.tempApiUrl, placeholder: '请输入API地址' })
|
|
|
|
|
|
|
+ TextInput({ text: this.tempApiUrl, placeholder: this.apiDialogType === 'lyric' ? '请输入歌词API地址' : '请输入封面API地址' })
|
|
|
.onChange((val: string) => {
|
|
.onChange((val: string) => {
|
|
|
this.tempApiUrl = val
|
|
this.tempApiUrl = val
|
|
|
})
|
|
})
|
|
@@ -176,9 +191,9 @@ export struct SettingPage {
|
|
|
|
|
|
|
|
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'))
|
|
|
|
|
|
|
|
- //第三方歌词API设置
|
|
|
|
|
|
|
+ // API设置(合并标题)
|
|
|
Row() {
|
|
Row() {
|
|
|
- Text('第三方歌词API设置')
|
|
|
|
|
|
|
+ Text('API设置')
|
|
|
.margin({ left: 38, right: 20 })
|
|
.margin({ left: 38, right: 20 })
|
|
|
.fontSize(16)
|
|
.fontSize(16)
|
|
|
.fontColor(Color.Gray)
|
|
.fontColor(Color.Gray)
|
|
@@ -188,9 +203,14 @@ export struct SettingPage {
|
|
|
.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'))
|
|
|
|
|
+ // 歌词API地址展示
|
|
|
Row() {
|
|
Row() {
|
|
|
|
|
+ Text('歌词:')
|
|
|
|
|
+ .margin({ left: 38, right: 6 })
|
|
|
|
|
+ .fontSize(15)
|
|
|
|
|
+ .fontColor(Color.Gray)
|
|
|
Text(this.lyricApiUrl)
|
|
Text(this.lyricApiUrl)
|
|
|
- .margin({ left: 38, right: 10 })
|
|
|
|
|
|
|
+ .margin({ right: 10 })
|
|
|
.fontSize(15)
|
|
.fontSize(15)
|
|
|
.fontColor(Color.Gray)
|
|
.fontColor(Color.Gray)
|
|
|
.layoutWeight(1)
|
|
.layoutWeight(1)
|
|
@@ -200,6 +220,7 @@ export struct SettingPage {
|
|
|
.height(28)
|
|
.height(28)
|
|
|
.margin({ right: 18 })
|
|
.margin({ right: 18 })
|
|
|
.onClick(() => {
|
|
.onClick(() => {
|
|
|
|
|
+ this.apiDialogType = 'lyric'
|
|
|
this.tempApiUrl = this.lyricApiUrl
|
|
this.tempApiUrl = this.lyricApiUrl
|
|
|
this.apiDialogController.open()
|
|
this.apiDialogController.open()
|
|
|
})
|
|
})
|
|
@@ -208,6 +229,32 @@ export struct SettingPage {
|
|
|
.width('100%')
|
|
.width('100%')
|
|
|
.margin({ top: 8, bottom: 12 })
|
|
.margin({ top: 8, bottom: 12 })
|
|
|
|
|
|
|
|
|
|
+ // 封面API地址展示
|
|
|
|
|
+ Row() {
|
|
|
|
|
+ Text('封面:')
|
|
|
|
|
+ .margin({ left: 38, right: 6 })
|
|
|
|
|
+ .fontSize(15)
|
|
|
|
|
+ .fontColor(Color.Gray)
|
|
|
|
|
+ Text(this.coverApiUrl)
|
|
|
|
|
+ .margin({ right: 10 })
|
|
|
|
|
+ .fontSize(15)
|
|
|
|
|
+ .fontColor(Color.Gray)
|
|
|
|
|
+ .layoutWeight(1)
|
|
|
|
|
+ // 编辑图标按钮
|
|
|
|
|
+ Image($r('app.media.edit'))
|
|
|
|
|
+ .width(28)
|
|
|
|
|
+ .height(28)
|
|
|
|
|
+ .margin({ right: 18 })
|
|
|
|
|
+ .onClick(() => {
|
|
|
|
|
+ this.apiDialogType = 'cover'
|
|
|
|
|
+ this.tempApiUrl = this.coverApiUrl
|
|
|
|
|
+ this.apiDialogController.open()
|
|
|
|
|
+ })
|
|
|
|
|
+ Blank()
|
|
|
|
|
+ }
|
|
|
|
|
+ .width('100%')
|
|
|
|
|
+ .margin({ top: 8, bottom: 12 })
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
.backgroundColor(Color.White)
|
|
.backgroundColor(Color.White)
|
|
|
.margin({
|
|
.margin({
|