diff --git a/commons/colorLibrary/src/main/resources/base/element/string.json b/commons/colorLibrary/src/main/resources/base/element/string.json index 1e1244d5..8ff52079 100644 --- a/commons/colorLibrary/src/main/resources/base/element/string.json +++ b/commons/colorLibrary/src/main/resources/base/element/string.json @@ -20,14 +20,6 @@ "name": "color_black_88", "value": "rgba(0, 0, 0, 0.88)" }, - { - "name": "ThemeColor", - "value": "#FF6600" - }, - { - "name": "BackgroundThemeColor", - "value": "rgba(255, 102, 0, 0.12)" - }, { "name": "color_black_6", "value": "rgba(0, 0, 0, 0.06)" diff --git a/entry/src/main/ets/common/constants/Theme.ets b/entry/src/main/ets/common/constants/Theme.ets new file mode 100644 index 00000000..f076280e --- /dev/null +++ b/entry/src/main/ets/common/constants/Theme.ets @@ -0,0 +1,18 @@ +import { ThemeColorItem } from "../model/Theme" + +// 配置主题颜色 +export class ThemeColor { + static readonly ORANGE: ThemeColorItem = {mainColor: '#ff6600', secondColor: '#ffece0'} + static readonly RED: ThemeColorItem = {mainColor: '#ef4444', secondColor: '#fde8e8'} + static readonly YELLOW: ThemeColorItem = {mainColor: '#ff9500', secondColor: '#fff2e0'} + static readonly BLUE: ThemeColorItem = {mainColor: '#188bff', secondColor: '#e3f1ff'} + static readonly GREEN: ThemeColorItem = {mainColor: '#24b277', secondColor: '#e4f5ee'} +} + +// AppStorage key 标识 +export class ThemeStorageKey { + static readonly THEME: string = 'theme' // 主题key + static readonly THEMELIST: string = 'themelist' + static readonly THEMELISTSTR: string = 'themeliststr' + static readonly THEMEINDEX: string = 'themeindex' // 被选中主题索引key +} \ No newline at end of file diff --git a/entry/src/main/ets/common/model/Theme.ets b/entry/src/main/ets/common/model/Theme.ets new file mode 100644 index 00000000..5e4cd42e --- /dev/null +++ b/entry/src/main/ets/common/model/Theme.ets @@ -0,0 +1,10 @@ +export interface ThemeColorItem { + mainColor: string // 主色 前景色 + secondColor: string // 次色 背景色 +} + +export interface ThemeItem { + mainColor: string // 主色 前景色 + secondColor: string // 次色 背景色 + text: string +} diff --git a/entry/src/main/ets/common/utils/ThemeManager.ets b/entry/src/main/ets/common/utils/ThemeManager.ets new file mode 100644 index 00000000..309ee3c2 --- /dev/null +++ b/entry/src/main/ets/common/utils/ThemeManager.ets @@ -0,0 +1,55 @@ +import { ThemeColor, ThemeStorageKey } from "../constants/Theme"; +import { ThemeItem } from "../model/Theme"; + +export class ThemeManager { + themeList: ThemeItem[] = [ + {text: '主题1', mainColor: ThemeColor.ORANGE.mainColor, secondColor: ThemeColor.ORANGE.secondColor}, + {text: '主题2', mainColor: ThemeColor.RED.mainColor, secondColor: ThemeColor.RED.secondColor}, + {text: '主题3', mainColor: ThemeColor.GREEN.mainColor, secondColor: ThemeColor.GREEN.secondColor}, + {text: '主题4', mainColor: ThemeColor.YELLOW.mainColor, secondColor: ThemeColor.YELLOW.secondColor}, + {text: '主题5', mainColor: ThemeColor.BLUE.mainColor, secondColor: ThemeColor.BLUE.secondColor}, + ] + + init() { + PersistentStorage.persistProp(ThemeStorageKey.THEME, {text: '主题1', mainColor: ThemeColor.ORANGE.mainColor, secondColor: ThemeColor.ORANGE.secondColor}) + PersistentStorage.persistProp(ThemeStorageKey.THEMELISTSTR, JSON.stringify(this.themeList)) + + // 解析主题数组字符串 加载主题 + const str = AppStorage.get(ThemeStorageKey.THEMELISTSTR) + const themeList = JSON.parse(str as string) as ThemeItem[] + AppStorage.setOrCreate(ThemeStorageKey.THEMELIST, themeList) + + PersistentStorage.persistProp(ThemeStorageKey.THEMEINDEX, 0) // 被选中主题的索引 + } + + setTheme(newTheme: ThemeItem, index: number) { + AppStorage.setOrCreate(ThemeStorageKey.THEME, newTheme) + AppStorage.setOrCreate(ThemeStorageKey.THEMEINDEX, index) + } + + addTheme(newTheme: ThemeItem) { + const str = AppStorage.get(ThemeStorageKey.THEMELISTSTR) + const themeList = JSON.parse(str as string) as ThemeItem[] + themeList.push(newTheme) + AppStorage.setOrCreate(ThemeStorageKey.THEMELISTSTR, JSON.stringify(themeList)) + AppStorage.setOrCreate(ThemeStorageKey.THEMELIST, themeList) + } + + deleteTheme(index: number) { + const str = AppStorage.get(ThemeStorageKey.THEMELISTSTR) + let themeList = JSON.parse(str as string) as ThemeItem[] + let activeIndex: number = AppStorage.get(ThemeStorageKey.THEMEINDEX) as number + if (activeIndex > index) { + --activeIndex + } else if (activeIndex == index) { + activeIndex = 0 + } + themeList = themeList.filter((item, i) => i != index) + this.setTheme(themeList[activeIndex], activeIndex) + AppStorage.setOrCreate(ThemeStorageKey.THEMELISTSTR, JSON.stringify(themeList)) + AppStorage.setOrCreate(ThemeStorageKey.THEMELIST, themeList) + } +} + +// 单例模式 +export const themeManager = new ThemeManager() \ No newline at end of file diff --git a/entry/src/main/ets/componets/Form/FormInput.ets b/entry/src/main/ets/componets/Form/FormInput.ets index e1d78c43..cc87c7a6 100644 --- a/entry/src/main/ets/componets/Form/FormInput.ets +++ b/entry/src/main/ets/componets/Form/FormInput.ets @@ -1,4 +1,7 @@ import PaddingConstants from '../../common/constants/PaddingConstants' +import { ThemeStorageKey } from '../../common/constants/Theme' +import { ThemeItem } from '../../common/model/Theme' + /** * @author 2008 * @datetime 2024/7/20 01:21 @@ -19,6 +22,8 @@ export default struct FormInput { onChange: Function = (_value: string) => {} showTitle: boolean = false icon:Resource|string = $r('app.media.icon_rss_source_check_image_font') + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem build() { Column() { Row() { @@ -46,7 +51,7 @@ export default struct FormInput { .backgroundColor(Color.Transparent) .placeholderColor('#73000000') .placeholderFont({ size: 16, weight: 400 }) - .caretColor('#FF6600') + .caretColor(this.theme.mainColor) .margin({ top: 10, bottom: 10 }) .fontSize(16) .fontColor('#E0000000') diff --git a/entry/src/main/ets/componets/Form/FormItem.ets b/entry/src/main/ets/componets/Form/FormItem.ets index 0a0b8a91..f694a22e 100644 --- a/entry/src/main/ets/componets/Form/FormItem.ets +++ b/entry/src/main/ets/componets/Form/FormItem.ets @@ -1,3 +1,6 @@ +import { ThemeStorageKey } from "../../common/constants/Theme" +import { ThemeItem } from "../../common/model/Theme" + export enum FormItemType { Input } @@ -16,6 +19,9 @@ export default struct FormItem { onChange: Function = (_value: string) => {} showTitle: boolean = true + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem + build() { Column() { Row() { @@ -46,7 +52,7 @@ export default struct FormItem { TextInput({ text: this.value ?? '', placeholder: `请输入${this.label}` }) .placeholderColor('#73000000') .placeholderFont({ size: 14, weight: 400 }) - .caretColor('#FF6600') + .caretColor(this.theme.mainColor) .height(38) .margin({ top: 10, bottom: 10 }) .fontSize(14) diff --git a/entry/src/main/ets/componets/Reader/DownloadSettingDialog.ets b/entry/src/main/ets/componets/Reader/DownloadSettingDialog.ets index 8b99e2e5..55d9a50c 100644 --- a/entry/src/main/ets/componets/Reader/DownloadSettingDialog.ets +++ b/entry/src/main/ets/componets/Reader/DownloadSettingDialog.ets @@ -1,4 +1,6 @@ import { AddDownloadDialog } from 'ets/componets/Reader/AddDownloadDialog'; +import { ThemeStorageKey } from '../../common/constants/Theme'; +import { ThemeItem } from '../../common/model/Theme'; @Component export default struct DownloadSettingDialog{ @@ -13,6 +15,7 @@ export default struct DownloadSettingDialog{ @State StartText: string = "1" // 下载-缓存开始章节 @State EndText: string = "2" // 下载-缓存结束章节 controller: TextInputController = new TextInputController() + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem build() { Column() { @@ -109,7 +112,7 @@ export default struct DownloadSettingDialog{ Button() { Text("取消") .lineHeight(24) - .fontColor($r('app.string.ThemeColor')) + .fontColor(this.theme.mainColor) .font({ size: 16, weight: 500 @@ -117,7 +120,7 @@ export default struct DownloadSettingDialog{ } .width("80%") .height(40) - .backgroundColor($r('app.string.BackgroundThemeColor')) + .backgroundColor(this.theme.secondColor) } GridItem() { @@ -132,7 +135,7 @@ export default struct DownloadSettingDialog{ } .width("80%") .height(40) - .backgroundColor($r('app.string.ThemeColor')) + .backgroundColor(this.theme.mainColor) .onClick(() => { this.isShowDownload = false this.isShowSetting = false diff --git a/entry/src/main/ets/componets/Reader/exportRuleDialog.ets b/entry/src/main/ets/componets/Reader/exportRuleDialog.ets index 9f3efe7c..fa00ed78 100644 --- a/entry/src/main/ets/componets/Reader/exportRuleDialog.ets +++ b/entry/src/main/ets/componets/Reader/exportRuleDialog.ets @@ -4,6 +4,8 @@ * @className: exportRuleDialog */ import CommonConstants from '../../common/constants/CommonConstants' +import { ThemeStorageKey } from '../../common/constants/Theme' +import { ThemeItem } from '../../common/model/Theme' @CustomDialog @Preview @@ -11,6 +13,8 @@ export default struct exportRuleDialog{ controller?: CustomDialogController cancel: () => void = () => { } + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem build() { Stack(){ Column(){ @@ -34,7 +38,7 @@ export default struct exportRuleDialog{ }){ Radio({value:'default',group:'exportGroup'}) .radioStyle({ - checkedBackgroundColor: $r('app.color.theme_color') + checkedBackgroundColor: this.theme.mainColor }) .checked(true) .onChange(()=>{ @@ -54,7 +58,7 @@ export default struct exportRuleDialog{ }){ Radio({value:'default',group:'exportGroup'}) .radioStyle({ - checkedBackgroundColor: $r('app.color.theme_color') + checkedBackgroundColor: this.theme.mainColor }) .onChange(()=>{ @@ -85,7 +89,7 @@ export default struct exportRuleDialog{ left:32,right:32, top:8,bottom:8 }) - .backgroundColor($r('app.color.theme_color')) + .backgroundColor(this.theme.mainColor) Column(){ Text('导出本地').font({ diff --git a/entry/src/main/ets/componets/aboutUs/VersionUpdate.ets b/entry/src/main/ets/componets/aboutUs/VersionUpdate.ets index 4ff0848b..db6d0b05 100644 --- a/entry/src/main/ets/componets/aboutUs/VersionUpdate.ets +++ b/entry/src/main/ets/componets/aboutUs/VersionUpdate.ets @@ -1,8 +1,13 @@ +import { ThemeStorageKey } from "../../common/constants/Theme" +import { ThemeItem } from "../../common/model/Theme" + @CustomDialog export default struct VersionUpdateCustomDialog { controller: CustomDialogController @State clickUpdate: boolean = false @State ProgressValue: number = 40 + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem build() { Column() { @@ -55,7 +60,7 @@ export default struct VersionUpdateCustomDialog { if (!this.clickUpdate) { Button("立即更新") - .backgroundColor("#FF6600") + .backgroundColor(this.theme.mainColor) .width("73%") .margin({ top: 24, @@ -81,7 +86,7 @@ export default struct VersionUpdateCustomDialog { }) }) .width("73%") - .color("#FF6600") + .color(this.theme.mainColor) .backgroundColor("#FFAF7A") .margin({ top: 24, diff --git a/entry/src/main/ets/componets/bookDetail/note/NoteListItem.ets b/entry/src/main/ets/componets/bookDetail/note/NoteListItem.ets index 3d322284..0a015c12 100644 --- a/entry/src/main/ets/componets/bookDetail/note/NoteListItem.ets +++ b/entry/src/main/ets/componets/bookDetail/note/NoteListItem.ets @@ -9,6 +9,8 @@ import CommonConstants from '../../../common/constants/CommonConstants' import { NoteVO } from '../../../componetsmodel/NoteVO'; import CircleGeneralButton from './CircleGeneralButton'; import { promptAction } from '@kit.ArkUI'; +import { ThemeItem } from '../../../common/model/Theme'; +import { ThemeStorageKey } from '../../../common/constants/Theme'; @Component export default struct NoteListItem { @@ -18,6 +20,8 @@ export default struct NoteListItem { @State wordCount: number = 48; @State editContent: string = ''; private saveChange = (val: string) => {}; + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem textChange(val: string): void { this.editContent = val; this.wordCount = this.editContent.length; @@ -54,7 +58,7 @@ export default struct NoteListItem { .height(22) .borderRadius(40) .padding({top: 2, bottom: 2, left: 16, right: 16}) - .backgroundColor('#FF6600') + .backgroundColor(this.theme.mainColor) .fontColor('#FFFFFF') .onClick(() => { this.save(); @@ -84,7 +88,7 @@ export default struct NoteListItem { TextArea({text: this.editContent}) .height('auto') .fontColor('#e0000000') - .caretColor('#FF6600') + .caretColor(this.theme.mainColor) .fontSize(12) .fontWeight(400) .fontColor('#e0000000') diff --git a/entry/src/main/ets/componets/common/Dialog.ets b/entry/src/main/ets/componets/common/Dialog.ets index 339f650c..e0dd2f88 100644 --- a/entry/src/main/ets/componets/common/Dialog.ets +++ b/entry/src/main/ets/componets/common/Dialog.ets @@ -1,3 +1,6 @@ +import { ThemeStorageKey } from "../../common/constants/Theme"; +import { ThemeItem } from "../../common/model/Theme"; + @CustomDialog // 通用弹窗 export default struct Dialog { @@ -7,6 +10,9 @@ export default struct Dialog { @Prop ConfirmString: string = "确定" @BuilderParam child: () => void // 通用组件 + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem + build() { Column() { Row() { @@ -41,7 +47,7 @@ export default struct Dialog { }) { Button() { Text(this.CancelString) - .fontColor("#FF6600") + .fontColor(this.theme.mainColor) .lineHeight(22) .font({ size: 14, @@ -50,7 +56,7 @@ export default struct Dialog { } .width(112) .height(38) - .backgroundColor("rgba(255, 102, 0, 0.12)") + .backgroundColor(this.theme.secondColor) .onClick(() => { if (this.controller != undefined) { this.controller.close() @@ -68,7 +74,7 @@ export default struct Dialog { } .width(112) .height(38) - .backgroundColor("#FF6600") + .backgroundColor(this.theme.mainColor) .onClick(() => { }) diff --git a/entry/src/main/ets/componets/common/ReadShow.ets b/entry/src/main/ets/componets/common/ReadShow.ets index 352b4266..6283ca12 100644 --- a/entry/src/main/ets/componets/common/ReadShow.ets +++ b/entry/src/main/ets/componets/common/ReadShow.ets @@ -7,12 +7,18 @@ import { BookHistory } from '../../database/entities/BookHistory' import { Books } from '../../database/entities/Books' import { router } from '@kit.ArkUI' import clickUtil from '../../common/utils/ClickUtils' +import { ThemeStorageKey } from '../../common/constants/Theme' +import { ThemeItem } from '../../common/model/Theme' @Component export default struct ReadShow { @Link showReadShow:boolean @State bookHistory:BookHistory[] = [] @State book:Books = new Books() + + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem + aboutToAppear(): void { this.getBookHistoryList() } @@ -64,7 +70,7 @@ export default struct ReadShow { .fontWeight(600) .padding(10) .borderRadius(20) - .fontColor('#FF6600') + .fontColor(this.theme.mainColor) .backgroundColor(Color.White) } .padding({left:55,right:30}) diff --git a/entry/src/main/ets/componets/common/SideBar.ets b/entry/src/main/ets/componets/common/SideBar.ets index 208ed002..f7b4d178 100644 --- a/entry/src/main/ets/componets/common/SideBar.ets +++ b/entry/src/main/ets/componets/common/SideBar.ets @@ -4,6 +4,8 @@ * @className: SideBar * 分类左侧列表,支持是否开启角标,支持是否开启拖拽 */ +import { ThemeStorageKey } from '../../common/constants/Theme' +import { ThemeItem } from '../../common/model/Theme' import { GroupList, GroupPartList } from '../../database/entities/BookSource' @Component @@ -17,6 +19,9 @@ export default struct SideBar { scroller?: Scroller = undefined onDragChange: (list: GroupList[] | GroupPartList[] | string[]) => void = (_list) => {} + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem + // 交换listArr数组中listItem的位置 changeListItemIndex(index1: number, index2: number) { let tempItem = this.sideBarList[index1]; @@ -36,7 +41,7 @@ export default struct SideBar { Row() .width(3) .height(16) - .backgroundColor('#FF6600') + .backgroundColor(this.theme.mainColor) .borderRadius(12) .position({ top: 16 diff --git a/entry/src/main/ets/componets/common/TitleContentDialog.ets b/entry/src/main/ets/componets/common/TitleContentDialog.ets index 456e9840..bbd0da50 100644 --- a/entry/src/main/ets/componets/common/TitleContentDialog.ets +++ b/entry/src/main/ets/componets/common/TitleContentDialog.ets @@ -1,3 +1,6 @@ +import { ThemeStorageKey } from "../../common/constants/Theme" +import { ThemeItem } from "../../common/model/Theme" + /** * 自定义标题和内容弹窗 * title标题、content内容、confirm确认按钮、cancel取消按钮 @@ -13,6 +16,8 @@ export default struct TitleContentDialog { } @Prop title:string = '' @Prop content:string = '' + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem build() { Column() { @@ -36,8 +41,8 @@ export default struct TitleContentDialog { }) .borderRadius(15) .padding({left:30,right:30,top:10,bottom:10}) - .fontColor($r('app.color.theme_color')) - .backgroundColor('rgba(255,120,0,0.12)') + .fontColor(this.theme.mainColor) + .backgroundColor(this.theme.secondColor) Text('确认') .onClick(() => { if (this.controller != undefined) { @@ -48,7 +53,7 @@ export default struct TitleContentDialog { .borderRadius(15) .padding({left:30,right:30,top:10,bottom:10}) .fontColor(Color.White) - .backgroundColor($r('app.color.theme_color')) + .backgroundColor(this.theme.mainColor) }.padding({top:20,bottom:20}) } } diff --git a/entry/src/main/ets/componets/common/addBookTypeDialog.ets b/entry/src/main/ets/componets/common/addBookTypeDialog.ets index e39e5917..77c1dd9f 100644 --- a/entry/src/main/ets/componets/common/addBookTypeDialog.ets +++ b/entry/src/main/ets/componets/common/addBookTypeDialog.ets @@ -1,3 +1,6 @@ +import { ThemeStorageKey } from "../../common/constants/Theme" +import { ThemeItem } from "../../common/model/Theme" + /** * 添加分类类型弹窗 */ @@ -14,7 +17,8 @@ export default struct addBookTypeDialog { } @State BookTypeValueLength:number = 0 - + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem build() { Column() { @@ -30,8 +34,8 @@ export default struct addBookTypeDialog { }) .borderRadius(15) .padding({left:30,right:30,top:10,bottom:10}) - .fontColor($r('app.color.theme_color')) - .backgroundColor('rgba(255,120,0,0.12)') + .fontColor(this.theme.mainColor) + .backgroundColor(this.theme.secondColor) Text('确认') .onClick(() => { if (this.controller != undefined) { @@ -42,7 +46,7 @@ export default struct addBookTypeDialog { .borderRadius(15) .padding({left:30,right:30,top:10,bottom:10}) .fontColor(Color.White) - .backgroundColor($r('app.color.theme_color')) + .backgroundColor(this.theme.mainColor) }.padding({top:20,bottom:20}) }.width('80%') } diff --git a/entry/src/main/ets/componets/common/buttonCommon.ets b/entry/src/main/ets/componets/common/buttonCommon.ets index 4288f407..5ddd2461 100644 --- a/entry/src/main/ets/componets/common/buttonCommon.ets +++ b/entry/src/main/ets/componets/common/buttonCommon.ets @@ -5,6 +5,9 @@ * 通用确认取消按钮 */ import CommonConstants from '../../common/constants/CommonConstants' +import { ThemeStorageKey } from '../../common/constants/Theme' +import { ThemeItem } from '../../common/model/Theme' + @Component export default struct buttonCommon { @Prop sureTitle:string = '确定' @@ -13,6 +16,9 @@ export default struct buttonCommon { } confirm: () => void = () => { } + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem + build() { Flex(){ Row({space: 20}) { @@ -21,8 +27,8 @@ export default struct buttonCommon { .width(150) .height(40) .borderRadius(200) - .backgroundColor('#1fff6600') - .fontColor('#FF6600') + .backgroundColor(this.theme.secondColor) + .fontColor(this.theme.mainColor) .onClick(() => { this.cancel() }) @@ -31,7 +37,7 @@ export default struct buttonCommon { .width(150) .height(40) .borderRadius(200) - .backgroundColor('#FF6600') + .backgroundColor(this.theme.mainColor) .fontColor('#FFFFFF') .onClick(()=>{ this.confirm() diff --git a/entry/src/main/ets/componets/common/commonInputDialog.ets b/entry/src/main/ets/componets/common/commonInputDialog.ets index 26b7717d..ff95e886 100644 --- a/entry/src/main/ets/componets/common/commonInputDialog.ets +++ b/entry/src/main/ets/componets/common/commonInputDialog.ets @@ -3,6 +3,8 @@ * 主要传值为title标题、textValue输入框值、cancel取消方法、confirm确认方法 */ import PaddingConstants from '../../common/constants/PaddingConstants' +import { ThemeStorageKey } from '../../common/constants/Theme' +import { ThemeItem } from '../../common/model/Theme' import { showMessage } from './promptShow' @CustomDialog @@ -19,6 +21,8 @@ export default struct commonInputDialog { //标题 @Prop title:string = '新增' // @Prop titleWidth:string = '80%' + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem build() { Column() { Text(`${this.title}` ).fontWeight(600).fontSize(20).margin({ top: 20, bottom: 10 }) @@ -33,8 +37,8 @@ export default struct commonInputDialog { }) .borderRadius(15) .padding({left:30,right:30,top:10,bottom:10}) - .fontColor($r('app.color.theme_color')) - .backgroundColor('rgba(255,120,0,0.12)') + .fontColor(this.theme.mainColor) + .backgroundColor(this.theme.secondColor) Text('确认') .onClick(() => { if (this.controller != undefined) { @@ -45,7 +49,7 @@ export default struct commonInputDialog { .borderRadius(15) .padding({left:30,right:30,top:10,bottom:10}) .fontColor(Color.White) - .backgroundColor($r('app.color.theme_color')) + .backgroundColor(this.theme.mainColor) }.padding({top:PaddingConstants.PADDING_20,bottom:PaddingConstants.PADDING_20}) } .padding({left:PaddingConstants.PADDING_20,right:PaddingConstants.PADDING_20}) diff --git a/entry/src/main/ets/componets/common/confirmDialog.ets b/entry/src/main/ets/componets/common/confirmDialog.ets index 86f434f8..0e06b3f5 100644 --- a/entry/src/main/ets/componets/common/confirmDialog.ets +++ b/entry/src/main/ets/componets/common/confirmDialog.ets @@ -1,3 +1,5 @@ +import { ThemeStorageKey } from "../../common/constants/Theme" +import { ThemeItem } from "../../common/model/Theme" @CustomDialog export default struct confirmDialogExample { @@ -11,6 +13,8 @@ export default struct confirmDialogExample { @Prop title:string = '删除' @Link delCache:boolean @Prop isShowCache:boolean = false + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem build() { Column() { @@ -19,7 +23,7 @@ export default struct confirmDialogExample { Row({ space:8 }){ - Checkbox().selectedColor($r('app.color.theme_color')).select(this.delCache) + Checkbox().selectedColor(this.theme.mainColor).select(this.delCache) Text('同时删除本地缓存') .fontColor('rgba(0, 0, 0, 0.45)').fontSize(14).fontWeight(400).lineHeight(22) } @@ -34,8 +38,8 @@ export default struct confirmDialogExample { }) .borderRadius(15) .padding({left:30,right:30,top:10,bottom:10}) - .fontColor($r('app.color.theme_color')) - .backgroundColor('rgba(255,120,0,0.12)') + .fontColor(this.theme.mainColor) + .backgroundColor(this.theme.secondColor) Text('确认') .onClick(() => { if (this.controller != undefined) { @@ -46,7 +50,7 @@ export default struct confirmDialogExample { .borderRadius(15) .padding({left:30,right:30,top:10,bottom:10}) .fontColor(Color.White) - .backgroundColor($r('app.color.theme_color')) + .backgroundColor(this.theme.mainColor) }.padding({top:20,bottom:20}) } } diff --git a/entry/src/main/ets/componets/common/customizeDialog.ets b/entry/src/main/ets/componets/common/customizeDialog.ets index 500e9490..8afbb912 100644 --- a/entry/src/main/ets/componets/common/customizeDialog.ets +++ b/entry/src/main/ets/componets/common/customizeDialog.ets @@ -1,3 +1,6 @@ +import { ThemeStorageKey } from "../../common/constants/Theme" +import { ThemeItem } from "../../common/model/Theme" + /** * 自定义标题和内容 */ @@ -10,6 +13,9 @@ export default struct customizeDialogExample { @Prop title:string = '标签锁' @Prop content:string = '长按底部tab栏书架图标可锁定分组标签栏,再次长按解锁,锁定后左右滑动将直接切换小说,漫画,有声书分组大类' + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem + build() { Column() { Text(`${this.title}` ).fontWeight(600).maxLines(1).minFontSize(12).maxFontSize(20).margin({ top: 20, bottom: 10 }) @@ -31,7 +37,7 @@ export default struct customizeDialogExample { .borderRadius(15) .padding({left:30,right:30,top:10,bottom:10}) .fontColor(Color.White) - .backgroundColor($r('app.color.theme_color')) + .backgroundColor(this.theme.mainColor) }.padding({top:20,bottom:20}) } } diff --git a/entry/src/main/ets/componets/common/hideDialog.ets b/entry/src/main/ets/componets/common/hideDialog.ets index 2d5a59c3..b7e04e9d 100644 --- a/entry/src/main/ets/componets/common/hideDialog.ets +++ b/entry/src/main/ets/componets/common/hideDialog.ets @@ -1,3 +1,5 @@ +import { ThemeStorageKey } from "../../common/constants/Theme" +import { ThemeItem } from "../../common/model/Theme" @CustomDialog export default struct hideDialogExample { @@ -10,6 +12,8 @@ export default struct hideDialogExample { } @Prop title:string @Prop isHide:boolean = true + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem build() { Column() { @@ -28,8 +32,8 @@ export default struct hideDialogExample { }) .borderRadius(15) .padding({left:30,right:30,top:10,bottom:10}) - .fontColor($r('app.color.theme_color')) - .backgroundColor('rgba(255,120,0,0.12)') + .fontColor(this.theme.mainColor) + .backgroundColor(this.theme.secondColor) Text('确认') .onClick(() => { if (this.controller != undefined) { @@ -40,7 +44,7 @@ export default struct hideDialogExample { .borderRadius(15) .padding({left:30,right:30,top:10,bottom:10}) .fontColor(Color.White) - .backgroundColor($r('app.color.theme_color')) + .backgroundColor(this.theme.mainColor) }.padding({top:20,bottom:20}) } } diff --git a/entry/src/main/ets/componets/common/noFind.ets b/entry/src/main/ets/componets/common/noFind.ets index fc2d7303..e26e468f 100644 --- a/entry/src/main/ets/componets/common/noFind.ets +++ b/entry/src/main/ets/componets/common/noFind.ets @@ -8,6 +8,8 @@ import CommonConstants from '../../common/constants/CommonConstants' import FontConstants from '../../common/constants/FontConstants' import ImageConstants from '../../common/constants/ImageConstants' import PaddingConstants from '../../common/constants/PaddingConstants' +import { ThemeStorageKey } from '../../common/constants/Theme' +import { ThemeItem } from '../../common/model/Theme' @Component export default struct noFind { @@ -16,7 +18,8 @@ export default struct noFind { hintIcon: Resource[] = [$r('app.media.icon_no_source_find'), $r('app.media.icon_no_source_net'), $r('app.media.icon_no_source_content')] onclick: () => void = () => {} - + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem build() { Column() { Image(this.hintIcon[this.hintIndex]).width(ImageConstants.IMG_WIDTH_124).height(ImageConstants.IMG_HEIGHT_120) @@ -45,7 +48,7 @@ export default struct noFind { .fontSize(FontConstants.FONT_SIZE_14) .fontWeight(FontConstants.FONT_WEIGHT_500) .fontFamily(CommonConstants.FAMILY_PingFANG) - .backgroundColor($r('app.color.theme_color')) + .backgroundColor(this.theme.mainColor) .onClick(() => { this.onclick() }) diff --git a/entry/src/main/ets/componets/common/noSourceFind.ets b/entry/src/main/ets/componets/common/noSourceFind.ets index f75ee025..70ab1815 100644 --- a/entry/src/main/ets/componets/common/noSourceFind.ets +++ b/entry/src/main/ets/componets/common/noSourceFind.ets @@ -5,6 +5,8 @@ * 公用无发现功能log */ import CommonConstants from '../../common/constants/CommonConstants' +import { ThemeStorageKey } from '../../common/constants/Theme' +import { ThemeItem } from '../../common/model/Theme' @Component export default struct noSourceFind { @@ -13,6 +15,8 @@ export default struct noSourceFind { setOnclick:() => void = () => { } + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem build() { Column(){ Image($r('app.media.icon_no_source_find')).width(124).height(120) @@ -28,7 +32,7 @@ export default struct noSourceFind { .fontColor($r('app.string.color_black_45')) .margin({bottom:24}) if (!this.isShowButton){ - Button('一键隐藏').backgroundColor($r('app.color.theme_color')) + Button('一键隐藏').backgroundColor(this.theme.mainColor) .onClick(()=>{ this.setOnclick() }) diff --git a/entry/src/main/ets/componets/common/sourceType.ets b/entry/src/main/ets/componets/common/sourceType.ets index d5dea51a..7ae7422c 100644 --- a/entry/src/main/ets/componets/common/sourceType.ets +++ b/entry/src/main/ets/componets/common/sourceType.ets @@ -1,11 +1,14 @@ import CommonConstants from '../../common/constants/CommonConstants' import FontConstants from '../../common/constants/FontConstants' +import { ThemeStorageKey } from '../../common/constants/Theme' +import { ThemeItem } from '../../common/model/Theme' @Component export default struct sourceType { @Prop title: string @Prop active: boolean - + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem build() { Column({ space: 2 @@ -18,7 +21,7 @@ export default struct sourceType { .width(12) .height(3) .borderRadius(4) - .backgroundColor($r('app.color.theme_color')) + .backgroundColor(this.theme.mainColor) .visibility(this.active ? Visibility.Visible : Visibility.Hidden) .opacity(this.active ? 1 : 0) .scale({ diff --git a/entry/src/main/ets/componets/dialog/help.ets b/entry/src/main/ets/componets/dialog/help.ets index 5af0d81a..34a31e28 100644 --- a/entry/src/main/ets/componets/dialog/help.ets +++ b/entry/src/main/ets/componets/dialog/help.ets @@ -1,6 +1,8 @@ import CommonConstants from '../../common/constants/CommonConstants' import FontConstants from '../../common/constants/FontConstants' import PaddingConstants from '../../common/constants/PaddingConstants' +import { ThemeStorageKey } from '../../common/constants/Theme' +import { ThemeItem } from '../../common/model/Theme' import { HelpInfo } from '../../viewData/HelpInfo' @Component @@ -16,6 +18,8 @@ export default struct Help { @BuilderParam contentBuilder: () => void = this.contentBuilders @StorageLink('bottomRectHeight') bottomRectHeight: number = 0 isShowContent:boolean = true + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem build() { Flex({ direction: FlexDirection.Column, @@ -56,7 +60,7 @@ export default struct Help { Button(!this.btnText ? $r('app.string.i_know') : this.btnText) .width('100%') - .backgroundColor($r('app.color.theme_color')) + .backgroundColor(this.theme.mainColor) .padding({ left: PaddingConstants.PADDING_32, right: PaddingConstants.PADDING_32, diff --git a/entry/src/main/ets/componets/group/groupTypePanel.ets b/entry/src/main/ets/componets/group/groupTypePanel.ets index 372c05d1..cff9dc56 100644 --- a/entry/src/main/ets/componets/group/groupTypePanel.ets +++ b/entry/src/main/ets/componets/group/groupTypePanel.ets @@ -1,3 +1,5 @@ +import { ThemeStorageKey } from '../../common/constants/Theme' +import { ThemeItem } from '../../common/model/Theme' import bookGroupUtil from '../../common/utils/bookGroupUtils' import BookGroupsDao from '../../database/dao/BookGroupsDao' import { BookGroups } from '../../database/entities/BookGroups' @@ -18,6 +20,8 @@ export default struct groupTypePanel{ @StorageProp('APP_INDEX_SCROLLABLE') APP_INDEX_SCROLLABLE: boolean = true @Prop clickGroup:BookGroups + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem aboutToAppear(): void { this.getGroupList() @@ -45,7 +49,7 @@ export default struct groupTypePanel{ Text('点击进入').fontSize(12).fontWeight(400).lineHeight(20).fontColor('rgba(0, 0, 0, 0.45)') }.alignItems(VerticalAlign.Bottom) Row({space:12}){ - Text(this.isShowIcon?'完成':'管理').fontSize(12).fontWeight(400).lineHeight(20).fontColor($r('app.color.theme_color')) + Text(this.isShowIcon?'完成':'管理').fontSize(12).fontWeight(400).lineHeight(20).fontColor(this.theme.mainColor) .onClick(()=>{ this.isShowIcon = !this.isShowIcon }) @@ -115,7 +119,7 @@ export default struct groupTypePanel{ }) Text('标签锁').fontSize(16).fontWeight(500).lineHeight(24).fontColor('rgba(0, 0, 0, 0.45)') Toggle({ type: ToggleType.Switch, isOn: $$this.APP_INDEX_SCROLLABLE}) - .selectedColor("#F60").hoverEffect(HoverEffect.None) + .selectedColor(this.theme.mainColor).hoverEffect(HoverEffect.None) .onChange(()=>{ updateAppData(this.APP_INDEX_SCROLLABLE) showMessage(this.APP_INDEX_SCROLLABLE?'标签栏锁已开启':'标签栏已解锁') @@ -238,14 +242,14 @@ export default struct groupTypePanel{ Text(title).fontWeight(500).fontSize(12).textOverflow({ overflow:TextOverflow.Ellipsis }).ellipsisMode(EllipsisMode.END) - .maxLines(1).fontColor($r('app.color.theme_color')) + .maxLines(1).fontColor(this.theme.mainColor) .textAlign(TextAlign.Center) } .margin({ right: 16, bottom: 16 }) .justifyContent(FlexAlign.Center) .alignItems(VerticalAlign.Center) .width(68) - .backgroundColor('rgba(252, 121, 0, 0.12)') + .backgroundColor(this.theme.secondColor) .padding({left:16,right:16,top:6,bottom:6}) } } diff --git a/entry/src/main/ets/componets/group/groupTypeSearchPanel.ets b/entry/src/main/ets/componets/group/groupTypeSearchPanel.ets index e4883c63..1907f714 100644 --- a/entry/src/main/ets/componets/group/groupTypeSearchPanel.ets +++ b/entry/src/main/ets/componets/group/groupTypeSearchPanel.ets @@ -1,3 +1,5 @@ +import { ThemeStorageKey } from '../../common/constants/Theme' +import { ThemeItem } from '../../common/model/Theme' import BookGroupsDao from '../../database/dao/BookGroupsDao' import { BookGroups } from '../../database/entities/BookGroups' import BookManageDialog from '../../pages/view/bookShelf/components/dialog/BookManageDialog' @@ -12,6 +14,8 @@ export default struct groupTypeSearchPanel{ @Prop currentIndex:number = 0 @Prop clickGroup:BookGroups @Link searchBookList:number[] + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem aboutToAppear(): void { this.getGroupList() } @@ -125,14 +129,14 @@ export default struct groupTypeSearchPanel{ Text(title).fontWeight(500).fontSize(12).textOverflow({ overflow:TextOverflow.Ellipsis }).ellipsisMode(EllipsisMode.END) - .maxLines(1).fontColor($r('app.color.theme_color')) + .maxLines(1).fontColor(this.theme.mainColor) .textAlign(TextAlign.Center) } .margin({ right: 16, bottom: 16 }) .justifyContent(FlexAlign.Center) .alignItems(VerticalAlign.Center) .width(68) - .backgroundColor('rgba(252, 121, 0, 0.12)') + .backgroundColor(this.theme.secondColor) .padding({left:16,right:16,top:6,bottom:6}) } } diff --git a/entry/src/main/ets/componets/head/BookMark.ets b/entry/src/main/ets/componets/head/BookMark.ets index 5297927a..000916b6 100644 --- a/entry/src/main/ets/componets/head/BookMark.ets +++ b/entry/src/main/ets/componets/head/BookMark.ets @@ -1,3 +1,6 @@ +import { ThemeStorageKey } from "../../common/constants/Theme" +import { ThemeItem } from "../../common/model/Theme" + @Component export default struct BookMark { isBackground: boolean = true @@ -5,18 +8,21 @@ export default struct BookMark { @Prop currentIndex:number @Prop index:number + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem + build() { Column() { if (this.isBackground) { Text(this.title) - .fontColor(this.currentIndex === this.index ? 'rgba(0, 0, 0, 1.00)' : 'rgba(0,0,0,0.5)') + .fontColor(this.currentIndex === this.index ? this.theme.mainColor : this.theme.secondColor) .fontSize(this.currentIndex === this.index ? 25 : 16) .fontWeight(this.currentIndex === this.index ? 700 : 500) .lineHeight(30) .zIndex(999) - .backgroundImage(this.currentIndex === this.index ? $r('app.media.underline') : '') - .backgroundImageSize(this.currentIndex === this.index ? { width: '100%', height: 15 } : {}) - .backgroundImagePosition(Alignment.Center) + // .backgroundImage(this.currentIndex === this.index ? $r('app.media.underline') : '') + // .backgroundImageSize(this.currentIndex === this.index ? { width: '100%', height: 15 } : {}) + // .backgroundImagePosition(Alignment.Center) .animation({ duration: 200, }) diff --git a/entry/src/main/ets/componets/head/BookType.ets b/entry/src/main/ets/componets/head/BookType.ets index d3bac149..72b74d10 100644 --- a/entry/src/main/ets/componets/head/BookType.ets +++ b/entry/src/main/ets/componets/head/BookType.ets @@ -1,3 +1,6 @@ +import { ThemeStorageKey } from "../../common/constants/Theme" +import { ThemeItem } from "../../common/model/Theme" + @Component export default struct BookType { @Prop title:string @@ -5,15 +8,18 @@ export default struct BookType { @Prop index:number @Prop bookTypeNumber:number = 0 + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem + build() { Column() { Text(this.title) - .fontColor(this.index === this.bookTypeNumber ? 'rgb(255,135, 56)' : 'rgba(0,0,0,0.8)') + .fontColor(this.index === this.bookTypeNumber ? this.theme.mainColor : 'rgba(0,0,0,0.8)') .fontSize(12) .fontWeight(this.index === this.bookTypeNumber ? 700 : 700) } .borderRadius(8) .padding(8) - .backgroundColor(this.index === this.bookTypeNumber?'rgba(255,102,0,0.2)':'rgb(240,240,240)') + .backgroundColor(this.index === this.bookTypeNumber? this.theme.secondColor:'rgb(240,240,240)') } } \ No newline at end of file diff --git a/entry/src/main/ets/componets/head/IndexSearchType.ets b/entry/src/main/ets/componets/head/IndexSearchType.ets index 47506027..cd40daae 100644 --- a/entry/src/main/ets/componets/head/IndexSearchType.ets +++ b/entry/src/main/ets/componets/head/IndexSearchType.ets @@ -1,6 +1,8 @@ import CommonConstants from '../../common/constants/CommonConstants' import FontConstants from '../../common/constants/FontConstants' import PaddingConstants from '../../common/constants/PaddingConstants' +import { ThemeStorageKey } from '../../common/constants/Theme' +import { ThemeItem } from '../../common/model/Theme' import { BOOK_SEARCH_TYPE } from '../../database/entities/Books' @Component @@ -8,6 +10,8 @@ export default struct IndexSearchType { @Prop title:string @Link searchValue:string @State isShown: boolean = false + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem build() { if (BOOK_SEARCH_TYPE.includes(this.title)){ @@ -71,7 +75,7 @@ export default struct IndexSearchType { weight: FontConstants.FONT_WEIGHT_400, family: CommonConstants.FAMILY_PingFANG }) - .fontColor(this.searchValue === item ? $r('app.color.theme_color') : $r('app.string.color_black_88')) + .fontColor(this.searchValue === item ? this.theme.mainColor : $r('app.string.color_black_88')) Image(item === this.searchValue?$r('app.media.hook'):'').width(20).height(20) } .padding({ diff --git a/entry/src/main/ets/componets/import/ImportCommon.ets b/entry/src/main/ets/componets/import/ImportCommon.ets index e6b810ce..d716f6a7 100644 --- a/entry/src/main/ets/componets/import/ImportCommon.ets +++ b/entry/src/main/ets/componets/import/ImportCommon.ets @@ -12,6 +12,8 @@ import BookSourceDao from '../../database/dao/BookSourceDao'; import { BookSource, GroupList, SOURCE_GROUP_MAP } from '../../database/entities/BookSource'; import SourceGroup from '../ui/SourceGroup'; import text from '@ohos.graphics.text'; +import { ThemeItem } from '../../common/model/Theme'; +import { ThemeStorageKey } from '../../common/constants/Theme'; @Component export default struct ImportCommon { @@ -32,7 +34,8 @@ export default struct ImportCommon { @State groupIndex: number = 0 private scroll: Scroller = new Scroller() private secondScroll = new Scroller() - + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem aboutToAppear() { BookSourceDao.search().then(data => { const bookSource = data ?? [] @@ -137,7 +140,7 @@ export default struct ImportCommon { Row() { Checkbox() .select(this.fullActive) - .selectedColor(0xff6600) + .selectedColor(this.theme.mainColor) .onChange((val: boolean) => { this.fullActive = val this.sourceList.forEach((item: BookSource) => { @@ -148,7 +151,7 @@ export default struct ImportCommon { Text() { Span('全选(') Span(Object.values(this.insertMap).filter(o => o).length + '') - .fontColor(0xff6600) + .fontColor(this.theme.mainColor) Span(`/${this.sourceList.length})`) } .margin({ left: 8 }) @@ -161,7 +164,7 @@ export default struct ImportCommon { Row() { Image($r('app.media.warning')) .width(20) - .fillColor(0xff6600) + .fillColor(this.theme.mainColor) Text('允许对书架中正在使用的书源进行更新') .fontSize(14) @@ -172,7 +175,7 @@ export default struct ImportCommon { Checkbox() .select(this.waringActive) - .selectedColor(0xff6600) + .selectedColor(this.theme.mainColor) .onChange((val: boolean) => { this.waringActive = val }) @@ -180,13 +183,13 @@ export default struct ImportCommon { .width('100%') .height(48) .padding({ left: 20, right: 20 }) - .backgroundColor('rgba(239, 68, 68, 0.12)') + .backgroundColor(this.theme.secondColor) Row({ space: 20 }) { Button('取消') .height(40) - .fontColor(0xff6600) - .backgroundColor('rgba(255, 102, 0, 0.12)') + .fontColor(this.theme.mainColor) + .backgroundColor(this.theme.secondColor) .layoutWeight(1) .onClick(() => { this.show = false; @@ -195,7 +198,7 @@ export default struct ImportCommon { Button('确认') .height(40) .fontColor(Color.White) - .backgroundColor(0xff6600) + .backgroundColor(this.theme.mainColor) .layoutWeight(1) .onClick(async () => { const insertBookSources = this.sourceList.filter(item => this.insertMap[item.bookSourceUrl] ?? false) @@ -249,7 +252,7 @@ export default struct ImportCommon { Text(SOURCE_GROUP_MAP[groupIndex][0]) .fontSize(14) .lineHeight(22) - .fontColor('#FF6600') + .fontColor(this.theme.mainColor) Image($r('app.media.f60_right')) .width(16) } @@ -264,7 +267,7 @@ export default struct ImportCommon { CheckboxGroup({ group: 'checkboxGroup' + index }) .checkboxShape(CheckBoxShape.CIRCLE) - .selectedColor(0xff6600) + .selectedColor(this.theme.mainColor) } .alignItems(VerticalAlign.Center) .padding({ right: 16 }) @@ -288,7 +291,7 @@ export default struct ImportCommon { Checkbox({ name: 'checkbox' + j, group: 'checkboxGroup' + i }) .select(this.insertMap[item.bookSourceUrl] ?? false) - .selectedColor(0xff6600) + .selectedColor(this.theme.mainColor) .onChange((val: boolean) => { this.insertMap[item.bookSourceUrl] = val }) diff --git a/entry/src/main/ets/componets/import/SubscriptionImport.ets b/entry/src/main/ets/componets/import/SubscriptionImport.ets index e29a00b7..a097bb68 100644 --- a/entry/src/main/ets/componets/import/SubscriptionImport.ets +++ b/entry/src/main/ets/componets/import/SubscriptionImport.ets @@ -15,6 +15,8 @@ import CommonConstants from '../../common/constants/CommonConstants'; import programDataPreferences from '../../preferences/programDataPreferences' import PaddingConstants from '../../common/constants/PaddingConstants'; import addBookTypeDialog from '../common/addBookTypeDialog'; +import { ThemeItem } from '../../common/model/Theme'; +import { ThemeStorageKey } from '../../common/constants/Theme'; @Component export default struct SubscriptionImport { @@ -32,6 +34,8 @@ export default struct SubscriptionImport { private scroll: Scroller = new Scroller() private secondScroll = new Scroller() @State sourceGroup: string = '' + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem aboutToAppear() { subscriptionDao.search().then(data => { @@ -158,7 +162,7 @@ export default struct SubscriptionImport { Row() { Checkbox() .select(this.fullActive) - .selectedColor(0xff6600) + .selectedColor(this.theme.mainColor) .onChange((val: boolean) => { this.fullActive = val this.subscriptionList.forEach((item: rssSources) => { @@ -169,7 +173,7 @@ export default struct SubscriptionImport { Text() { Span('全选(') Span(Object.values(this.insertMap).filter(o => o).length + '') - .fontColor(0xff6600) + .fontColor(this.theme.mainColor) Span(`/${this.subscriptionList.length})`) } .margin({ left: 8 }) @@ -186,7 +190,7 @@ export default struct SubscriptionImport { weight: FontConstants.FONT_WEIGHT_700 }) .textAlign(TextAlign.Center) - .fontColor($r('app.color.theme_color')) + .fontColor(this.theme.mainColor) .lineHeight(22) } Text('导入至').font({ @@ -194,7 +198,7 @@ export default struct SubscriptionImport { weight: FontConstants.FONT_WEIGHT_400 }) .textAlign(TextAlign.Center) - .fontColor($r('app.color.theme_color')) + .fontColor(this.theme.mainColor) .lineHeight(22) .onClick(() => { this.getRssSourceList() @@ -209,8 +213,8 @@ export default struct SubscriptionImport { Row({ space: 20 }) { Button('取消') .height(40) - .fontColor(0xff6600) - .backgroundColor('rgba(255, 102, 0, 0.12)') + .fontColor(this.theme.mainColor) + .backgroundColor(this.theme.secondColor) .layoutWeight(1) .onClick(() => { this.show = false; @@ -219,7 +223,7 @@ export default struct SubscriptionImport { Button('确认') .height(40) .fontColor(Color.White) - .backgroundColor(0xff6600) + .backgroundColor(this.theme.mainColor) .layoutWeight(1) .onClick(async () => { if (this.sourceGroup.length === 0) { @@ -273,7 +277,7 @@ export default struct SubscriptionImport { }) CheckboxGroup({ group: 'checkboxGroup' + index }) .checkboxShape(CheckBoxShape.CIRCLE) - .selectedColor(0xff6600) + .selectedColor(this.theme.mainColor) } .padding({ right: 16 }) .backgroundColor('#f5f5f5') @@ -296,7 +300,7 @@ export default struct SubscriptionImport { Checkbox({ name: 'checkbox' + j, group: 'checkboxGroup' + i }) .select(this.insertMap[item.sourceUrl] ?? false) - .selectedColor(0xff6600) + .selectedColor(this.theme.mainColor) .onChange((val: boolean) => { this.insertMap[item.sourceUrl] = val }) diff --git a/entry/src/main/ets/componets/myCenter/MyCenterTitle.ets b/entry/src/main/ets/componets/myCenter/MyCenterTitle.ets index a8cf197a..593f4241 100644 --- a/entry/src/main/ets/componets/myCenter/MyCenterTitle.ets +++ b/entry/src/main/ets/componets/myCenter/MyCenterTitle.ets @@ -1,5 +1,7 @@ import { router } from '@kit.ArkUI' import CommonConstants from '../../common/constants/CommonConstants' +import { ThemeStorageKey } from '../../common/constants/Theme' +import { ThemeItem } from '../../common/model/Theme' @Component export struct MyCenterTitle{ @@ -22,6 +24,9 @@ export struct MyCenterTitle{ @StorageProp('topRectHeight') topRectHeight: number = 0 + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem + // 重构 我的中心标题栏 build() { Column(){ @@ -98,7 +103,7 @@ export struct MyCenterTitle{ Row(){ Text(text) .font({size: 16, weight: 400}) - .fontColor(index === this.onSelect ? "#FF6600" : "#000000") + .fontColor(index === this.onSelect ? this.theme.mainColor : "#000000") .height(22) if (this.onSelect === index){ Image($r("app.media.ic_select")) diff --git a/entry/src/main/ets/componets/myCenter/cloudDisKBindSheetComponet.ets b/entry/src/main/ets/componets/myCenter/cloudDisKBindSheetComponet.ets index 1ffe5e48..f21e620f 100644 --- a/entry/src/main/ets/componets/myCenter/cloudDisKBindSheetComponet.ets +++ b/entry/src/main/ets/componets/myCenter/cloudDisKBindSheetComponet.ets @@ -1,4 +1,6 @@ import { PublicConstants } from '../../common/constants/PublicConstants' +import { ThemeStorageKey } from '../../common/constants/Theme' +import { ThemeItem } from '../../common/model/Theme' import { dataItem } from '../dataList/dataItem' @@ -6,6 +8,8 @@ import { dataItem } from '../dataList/dataItem' export struct cloudDisKBindSheetComponet{ @Prop items:dataItem[] @Link bindSheetIndex:number + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem build() { Column({space:16}){ ForEach(this.items,(item:dataItem,index:number)=>{ @@ -13,20 +17,20 @@ export struct cloudDisKBindSheetComponet{ //$r("app.media.my_center_file_icon") Image(item.type==1?$r("app.media.phone_icon"):$r("app.media.my_center_file_icon")) .size({width:20,height:20}) - .fillColor(index==this.bindSheetIndex?"rgba(255, 102, 0, 1)":Color.Black) + .fillColor(index==this.bindSheetIndex ? this.theme.mainColor : Color.Black) Text(item.title).fontSize(14) .lineHeight(22) - .fontColor(index==this.bindSheetIndex?"rgba(255, 102, 0, 1)":Color.Black) + .fontColor(index==this.bindSheetIndex? this.theme.mainColor :Color.Black) }.padding({top:14,bottom:14,left:20,right:20}) .width(280) .borderRadius(8) - .backgroundColor(index==this.bindSheetIndex? "rgba(255, 102, 0, 0.12)":"rgb(245, 245, 245)") + .backgroundColor(index==this.bindSheetIndex? this.theme.secondColor:"rgb(245, 245, 245)") .onClick(()=>{ this.bindSheetIndex=index }) .border({ width:index==this.bindSheetIndex?1:0, - color:index==this.bindSheetIndex?"rgba(255, 102, 0, 1)":PublicConstants.THEME_COLOR_WHITE + color:index==this.bindSheetIndex? this.theme.mainColor :PublicConstants.THEME_COLOR_WHITE }) }) }.padding({top:12,left:20,right:20}) diff --git a/entry/src/main/ets/componets/myCenter/myCenterInputDialog.ets b/entry/src/main/ets/componets/myCenter/myCenterInputDialog.ets index 6204a488..e6b50f30 100644 --- a/entry/src/main/ets/componets/myCenter/myCenterInputDialog.ets +++ b/entry/src/main/ets/componets/myCenter/myCenterInputDialog.ets @@ -1,3 +1,5 @@ +import { ThemeStorageKey } from "../../common/constants/Theme" +import { ThemeItem } from "../../common/model/Theme" @CustomDialog @@ -13,6 +15,8 @@ export struct myCenterInputDialog{ @Prop title:string = '' @Link value:string @Prop placeholder:string="" + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem @Builder button(title:string,color:Array,confirm: () => void){ Text(title) .onClick(() => { @@ -51,8 +55,8 @@ export struct myCenterInputDialog{ Row({space:12}) { - this.button("取消",[$r('app.color.theme_color'),'rgba(255,120,0,0.12)'],this.cancel) - this.button("确定",[Color.White,$r('app.color.theme_color')],this.confirm) + this.button("取消",[this.theme.mainColor,this.theme.secondColor],this.cancel) + this.button("确定",[Color.White,this.theme.mainColor],this.confirm) } }.padding(24) .width(284) diff --git a/entry/src/main/ets/componets/search/SearchBookItem.ets b/entry/src/main/ets/componets/search/SearchBookItem.ets index 0c6ff2a6..de718c3f 100644 --- a/entry/src/main/ets/componets/search/SearchBookItem.ets +++ b/entry/src/main/ets/componets/search/SearchBookItem.ets @@ -1,6 +1,8 @@ import { SearchBook } from '../../database/entities/SearchBook' import { router } from '@kit.ArkUI' import clickUtil from '../../common/utils/ClickUtils' +import { ThemeStorageKey } from '../../common/constants/Theme' +import { ThemeItem } from '../../common/model/Theme' @Component export struct SearchBookItem { @@ -16,6 +18,8 @@ export struct SearchBookItem { .backgroundColor("rgba(0, 0, 0, 0.06)") .borderRadius(5) } + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem build() { Row({space:20}){ Image(this.book.coverUrl).size({ @@ -27,7 +31,7 @@ export struct SearchBookItem { //书名 Row(){ Text(this.book.name) - .fontColor(this.SearchValue=== this.book.name?"rgba(255, 102, 0, 1)":"#000000") + .fontColor(this.SearchValue=== this.book.name ? this.theme.mainColor :"#000000") } //作者及书源数量 Row({space:2}){ diff --git a/entry/src/main/ets/componets/search/SearchBookList.ets b/entry/src/main/ets/componets/search/SearchBookList.ets index 976330c7..17f3e4ef 100644 --- a/entry/src/main/ets/componets/search/SearchBookList.ets +++ b/entry/src/main/ets/componets/search/SearchBookList.ets @@ -2,7 +2,9 @@ import { common } from '@kit.AbilityKit' import { util } from '@kit.ArkTS' import CommonConstants from '../../common/constants/CommonConstants' +import { ThemeStorageKey } from '../../common/constants/Theme' import taskSearchBooks from '../../common/model/taskSearchBook' +import { ThemeItem } from '../../common/model/Theme' import { SearchBook } from '../../database/entities/SearchBook' import { SearchBookItem } from './SearchBookItem' @@ -24,6 +26,8 @@ export struct SearchBookList { readonly SWITCH_BUTTON: number = 5; // 当前显示在屏幕上的子组件Index到达该阈值时,将跳转到历史记录按钮切换成跳转到顶部 @State listOffsetY:number=0 @State listScrollerY:number = 0 + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem build() { Column(){ List({space:8,scroller:this.listScroller}){ @@ -51,7 +55,7 @@ export struct SearchBookList { Row(){ LoadingProgress() - .color($r('app.color.theme_color')) + .color(this.theme.mainColor) .width(30) .height(30) Text('搜索中...') @@ -59,7 +63,7 @@ export struct SearchBookList { size:14, weight:500 }) - .fontColor($r('app.color.theme_color')) + .fontColor(this.theme.mainColor) } .visibility(this.isSearch?Visibility.Visible:Visibility.None) .position({ x: '95%', y: '0%'}) @@ -70,13 +74,13 @@ export struct SearchBookList { }){ Image($r('app.media.icon_search_stop')) .width(24).height(24) - .fillColor($r('app.color.theme_color')) + .fillColor(this.theme.mainColor) Text('停止') .font({ size:14, weight:500 }) - .fontColor($r('app.color.theme_color')) + .fontColor(this.theme.mainColor) } .onClick(()=>{ this.isSearch = false @@ -109,7 +113,7 @@ export struct SearchBookList { .position({ x: '95%', y: '90%'}) .markAnchor({ x:'90%'}) .opacity(0.8) - .backgroundColor($r('app.color.theme_color')) + .backgroundColor(this.theme.mainColor) .borderRadius(8) .onClick(() => { // 当前显示的index值小于设定的SWITCH_BUTTON时,按钮为跳转到上次浏览记录,否则为跳转到顶部 diff --git a/entry/src/main/ets/componets/search/SearchDetails.ets b/entry/src/main/ets/componets/search/SearchDetails.ets index 0ff5e825..168789f0 100644 --- a/entry/src/main/ets/componets/search/SearchDetails.ets +++ b/entry/src/main/ets/componets/search/SearchDetails.ets @@ -1,6 +1,8 @@ import { SearchBookList } from './SearchBookList' import { SearchBook } from '../../database/entities/SearchBook' +import { ThemeItem } from '../../common/model/Theme' +import { ThemeStorageKey } from '../../common/constants/Theme' @Component export struct SearchDetails{ @@ -13,6 +15,8 @@ export struct SearchDetails{ @Consume('searchBookList') books:SearchBook[] @Consume('isSearch') isSearch:boolean @StorageLink('bottomRectHeight') bottomRectHeight: number = 0 + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem refresh(){ if(this.SearchStatus>2){ this.isRefreshing=true @@ -21,7 +25,7 @@ export struct SearchDetails{ @Builder RefreshComponent(){ Stack(){ Row(){ - LoadingProgress().color("#FF6600").height(26) + LoadingProgress().color(this.theme.mainColor).height(26) Text("共搜索到"+this.books.length+"个相关结果").fontSize(14).margin({left:20}).fontColor($r('app.string.color_black_45')) }.alignItems(VerticalAlign.Center) }.width("100%").align(Alignment.Center) @@ -52,7 +56,7 @@ export struct SearchDetails{ } //给border添加加载动画 .border({ - width: { top:this.isSearch?2:0 },color:$r('app.color.theme_color') + width: { top:this.isSearch?2:0 },color:this.theme.mainColor }) .borderStyle({ top:BorderStyle.Solid, diff --git a/entry/src/main/ets/componets/search/SearchRefresh.ets b/entry/src/main/ets/componets/search/SearchRefresh.ets index 23f9a87c..55661dcb 100644 --- a/entry/src/main/ets/componets/search/SearchRefresh.ets +++ b/entry/src/main/ets/componets/search/SearchRefresh.ets @@ -1,13 +1,18 @@ +import { ThemeStorageKey } from "../../common/constants/Theme"; +import { ThemeItem } from "../../common/model/Theme"; @Component export struct SearchRefresh{ @State color:string="rgba(0, 0, 0, 0.45)" @Consume SearchStatus: number; + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem + @Builder refresh(){ Stack(){ Row(){ - LoadingProgress().color("#FF6600").height(30) + LoadingProgress().color(this.theme.mainColor).height(30) Text("玩命加载中...").fontSize(16).margin({left:20}).fontColor(this.color) }.alignItems(VerticalAlign.Center) }.width("100%").height("100%").align(Alignment.Center) diff --git a/entry/src/main/ets/componets/source/SourceView.ets b/entry/src/main/ets/componets/source/SourceView.ets index 65924c6a..4bc0c85f 100644 --- a/entry/src/main/ets/componets/source/SourceView.ets +++ b/entry/src/main/ets/componets/source/SourceView.ets @@ -11,6 +11,8 @@ import SideBar from '../common/SideBar' import Tag from '../common/Tag' import { router } from '@kit.ArkUI' import noFind from '../common/noFind' +import { ThemeItem } from '../../common/model/Theme' +import { ThemeStorageKey } from '../../common/constants/Theme' @Component export default struct SourceView { @@ -35,7 +37,8 @@ export default struct SourceView { } private scroll: Scroller = new Scroller() private secondScroll = new Scroller() - + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem aboutToAppear() { console.info('TagInfo', '当前下标: ' + this.index) this.loading = true @@ -269,7 +272,7 @@ export default struct SourceView { Column() { if (this.loading) { LoadingProgress() - .color(0xff6600) + .color(this.theme.mainColor) .width('50%') Text('加载中...') } else if (this.errorText) { @@ -313,7 +316,7 @@ export default struct SourceView { Blank() CheckboxGroup({ group: 'checkboxGroup' + index }) .checkboxShape(CheckBoxShape.CIRCLE) - .selectedColor(0xff6600) + .selectedColor(this.theme.mainColor) } else { Text('长按批量管理') .fontSize(12) @@ -348,7 +351,7 @@ export default struct SourceView { } if (item.hasExploreUrl) { - Tag({ text: '发现', color: '#FF6600', bgColor: '#1FFF6600' }) + Tag({ text: '发现', color: this.theme.mainColor, bgColor: this.theme.secondColor }) } Blank() @@ -356,7 +359,7 @@ export default struct SourceView { if (this.isBatch) { Checkbox({ name: 'checkbox' + j, group: 'checkboxGroup' + i }) .select(this.activeNameMap[item.bookSourceUrl] ?? false) - .selectedColor(0xff6600) + .selectedColor(this.theme.mainColor) .onChange((val: boolean) => { this.activeNameMap[item.bookSourceUrl] = val }) @@ -449,10 +452,10 @@ export default struct SourceView { }) .border({ width: 1, - color: this.activeNameMap[item.bookSourceUrl] ? '#FF6600' : Color.White, + color: this.activeNameMap[item.bookSourceUrl] ? this.theme.mainColor : Color.White, style: BorderStyle.Solid }) - .backgroundColor(this.activeNameMap[item.bookSourceUrl] ? '#1FFF6600' : Color.White) + .backgroundColor(this.activeNameMap[item.bookSourceUrl] ? this.theme.secondColor : Color.White) } Item_Right_Dialog_Data: IconTitleVo[] = [ diff --git a/entry/src/main/ets/componets/webDavService/WebdavService.ets b/entry/src/main/ets/componets/webDavService/WebdavService.ets index e231d962..1c88f055 100644 --- a/entry/src/main/ets/componets/webDavService/WebdavService.ets +++ b/entry/src/main/ets/componets/webDavService/WebdavService.ets @@ -3,6 +3,8 @@ import { font, promptAction } from '@kit.ArkUI' import { pasteboard } from '@kit.BasicServicesKit' import { serviceDialog } from './serviceDialog' import CommonConstants from '../../common/constants/CommonConstants' +import { ThemeStorageKey } from '../../common/constants/Theme' +import { ThemeItem } from '../../common/model/Theme' @Component @@ -19,6 +21,8 @@ export struct WebdavService { private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) @State serviceDialogStatus:boolean=false + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem @Builder canvas(color:ResourceColor,X:number,Y:number){ Canvas(this.context) @@ -45,7 +49,7 @@ export struct WebdavService { Toggle({type:ToggleType.Switch,isOn:$$this.webDavStatus}) .onChange((isOn: boolean) => { this.webDavStatus=isOn - }).selectedColor("#F60").hoverEffect(HoverEffect.None) + }).selectedColor(this.theme.mainColor).hoverEffect(HoverEffect.None) } }.width("100%").justifyContent(FlexAlign.SpaceBetween) //wifi 阅读 写源 @@ -99,7 +103,7 @@ export struct WebdavService { .fontColor("rgba(0, 0, 0, 0.45)") .fontSize(14) Text("复制") - .fontColor("#FF6600") + .fontColor(this.theme.mainColor) .fontSize(14) .fontWeight(600) .onClick(()=>{this.copy(this.address)}) diff --git a/entry/src/main/ets/componets/webDavService/serviceDialog.ets b/entry/src/main/ets/componets/webDavService/serviceDialog.ets index 0cc1af76..14ae3183 100644 --- a/entry/src/main/ets/componets/webDavService/serviceDialog.ets +++ b/entry/src/main/ets/componets/webDavService/serviceDialog.ets @@ -1,3 +1,5 @@ +import { ThemeStorageKey } from "../../common/constants/Theme" +import { ThemeItem } from "../../common/model/Theme" @CustomDialog @@ -26,7 +28,8 @@ export struct serviceDialog{ .fontColor(color[0]) .backgroundColor(color[1]) } - + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem build() { Column({space:15}) { @@ -43,8 +46,8 @@ export struct serviceDialog{ .lineHeight(25) } Row({space:24}) { - this.button("取消",[$r('app.color.theme_color'),'rgba(255,120,0,0.12)'],this.cancel) - this.button("确定",[Color.White,$r('app.color.theme_color')],this.confirm) + this.button("取消",[this.theme.mainColor, this.theme.secondColor],this.cancel) + this.button("确定",[Color.White,this.theme.mainColor],this.confirm) }.padding({top:10}) }.padding({top:20,bottom:20}) .width(270) diff --git a/entry/src/main/ets/entryability/EntryAbility.ets b/entry/src/main/ets/entryability/EntryAbility.ets index 79ce0bd6..ccb44c2d 100644 --- a/entry/src/main/ets/entryability/EntryAbility.ets +++ b/entry/src/main/ets/entryability/EntryAbility.ets @@ -7,6 +7,7 @@ import display from '@ohos.display'; import DbUtil from '../common/utils/DbUtil'; import DataBase from '../database' import { webview } from '@kit.ArkWeb'; +import { themeManager, ThemeManager } from '../common/utils/ThemeManager'; export default class EntryAbility extends UIAbility { @@ -96,11 +97,14 @@ export default class EntryAbility extends UIAbility { AppStorage.setOrCreate('stateHeight', px2vp(avoidAreaSys.topRect.height)); }) - windowStage.loadContent('pages/welcomePage', (err, data) => { + + windowStage.loadContent('/pages/Index'.slice(1), (err, data) => { if (err.code) { hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); return; } + // 主题初始化 + themeManager.init() hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); }); } diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index 6f735ea6..29414663 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -7,6 +7,11 @@ import Find from './view/Find/Find' import MyCenter from './view/myCenter/MyCenter' import Subscription from './view/Subscription' import {testGetColorFunction} from '@ohos/colorLibrary' +import { BusinessError, emitter } from '@kit.BasicServicesKit' +import { JSON } from '@kit.ArkTS' +import { image } from '@kit.ImageKit' +import { ThemeStorageKey } from '../common/constants/Theme' +import { ThemeItem } from '../common/model/Theme' @Entry @Component @@ -18,6 +23,10 @@ struct Main { @StorageLink('topRectHeight') topRectHeight: number = 0 @StorageProp('APP_INDEX_SCROLLABLE') APP_INDEX_SCROLLABLE: boolean = true @State ShowBar: boolean = true + tabController: TabsController = new TabsController() + + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem onPageShow(): void { // initBookListData() @@ -33,7 +42,26 @@ struct Main { }) } + screenShot() { + // 切换回首页 + let index = this.currentTabIndex + this.tabController.changeIndex(0) + this.getUIContext().getComponentSnapshot().get('main', ((err: Error, pixmap: image.PixelMap) => { + if (err) { + console.log("error: " + JSON.stringify(err)) + return + } + AppStorage.setOrCreate('screen_shot', pixmap) + })) + // 恢复当前页 + this.tabController.changeIndex(index) + } + aboutToAppear(): void { + // 注册监听截图事件 用于我的页面下主题设置预览 + emitter.on('screen_shot', () => { + this.screenShot() + }) //测试颜色模块 testGetColorFunction(); } @@ -45,9 +73,10 @@ struct Main { alignItems:ItemAlign.Center, justifyContent:FlexAlign.Center }){ - Image(this.currentTabIndex === index?icon_select:unselected).height(25) + Image(this.currentTabIndex === index? icon_select:unselected).height(25) .draggable(false) - Text(name).fontSize(11).margin(5).fontColor(this.currentTabIndex === index ?'rgb(255,119, 50)' : '#000000') + .fillColor(this.currentTabIndex === index ? this.theme.mainColor : '#000000') + Text(name).fontSize(11).margin(5).fontColor(this.currentTabIndex === index ? this.theme.mainColor : '#000000') } }.gesture( LongPressGesture({ repeat: index === 0,duration:1000 }) @@ -71,7 +100,8 @@ struct Main { build() { Column() { Tabs({ - barPosition:BarPosition.End + barPosition:BarPosition.End, + controller: this.tabController }){ ForEach(this.nav,(item:NavItem) => { TabContent() { @@ -106,5 +136,6 @@ struct Main { } .width("100%") .height("100%") + .id('main') } } \ No newline at end of file diff --git a/entry/src/main/ets/pages/view/BookDetailPage.ets b/entry/src/main/ets/pages/view/BookDetailPage.ets index 2b287e73..74a09849 100644 --- a/entry/src/main/ets/pages/view/BookDetailPage.ets +++ b/entry/src/main/ets/pages/view/BookDetailPage.ets @@ -10,6 +10,8 @@ import { Books } from '../../database/entities/Books' import { BookHistory } from '../../database/entities/BookHistory' import bookHistoryUtils from '../../common/utils/BookHistoryUtils' import booksUtil from '../../common/utils/booksUtils' +import { ThemeStorageKey } from '../../common/constants/Theme' +import { ThemeItem } from '../../common/model/Theme' /** * 标题图片样式 @@ -87,6 +89,10 @@ struct BookDetailPage { }) @State txtFiles: chaptersItem[] = []; @State txtFile: ChaptersDataSource = new ChaptersDataSource() + + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem + onPageShow() { this.isShow = true } @@ -227,8 +233,8 @@ struct BookDetailPage { .width(150) .height(40) .borderRadius(200) - .backgroundColor('#1fff6600') - .fontColor('#FF6600') + .backgroundColor(this.theme.secondColor) + .fontColor(this.theme.mainColor) .onClick(() => { !this.bookData.isJoin?this.addBookShelf():'' }) @@ -242,7 +248,7 @@ struct BookDetailPage { .width(150) .height(40) .borderRadius(200) - .backgroundColor(this.txtFile.totalCount() > 0 ? '#FF6600' : 'gray') + .backgroundColor(this.txtFile.totalCount() > 0 ? this.theme.mainColor : 'gray') .fontColor('#FFFFFF') .enabled(this.txtFile.totalCount() > 0) .onClick(() => { @@ -295,7 +301,7 @@ struct BookDetailPage { .width(10) .strokeWidth(3) .lineCap(LineCapStyle.Round) - .color('#FF6600') + .color(this.theme.mainColor) .opacity(this.currentIndex === index ? 1 : 0) } .padding({ top: 8, bottom: 8 }) diff --git a/entry/src/main/ets/pages/view/BookEditor/BookEditorPage.ets b/entry/src/main/ets/pages/view/BookEditor/BookEditorPage.ets index 203bac61..7ca0f065 100644 --- a/entry/src/main/ets/pages/view/BookEditor/BookEditorPage.ets +++ b/entry/src/main/ets/pages/view/BookEditor/BookEditorPage.ets @@ -1,4 +1,6 @@ import { router, SwipeRefresher } from '@kit.ArkUI' +import { ThemeStorageKey } from '../../../common/constants/Theme' +import { ThemeItem } from '../../../common/model/Theme' import { BookEditorType } from './BookEditorType/BookEditorType' import inputComponent from './InputComponet/inputComponet' @@ -31,6 +33,7 @@ struct BookEditorPage { this.BookIconUrl, this.BookSynopsis ); + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem //标题文本颜色 @@ -41,7 +44,7 @@ struct BookEditorPage { ButtonColor:string = '#0f000000' //编辑书籍确认、取消按钮颜色 BtnConfirmColor:string = '#F60' - BtnCancelColor:string = '#1fff6600' + BtnCancelColor:string = this.theme.secondColor //电池显示组件 @Builder BufComponent () { diff --git a/entry/src/main/ets/pages/view/Find/BookSource/AddSourcePage.ets b/entry/src/main/ets/pages/view/Find/BookSource/AddSourcePage.ets index 78a3bafb..46e16083 100644 --- a/entry/src/main/ets/pages/view/Find/BookSource/AddSourcePage.ets +++ b/entry/src/main/ets/pages/view/Find/BookSource/AddSourcePage.ets @@ -10,6 +10,8 @@ import { JSON } from '@kit.ArkTS'; import BookSourceDao from '../../../../database/dao/BookSourceDao'; import { BookSource, BOOK_SOURCE_TYPE, GRADE_TYPE, SOURCE_GROUP_MAP, SOURCE_SCORE_ARR } from '../../../../database/entities/BookSource'; +import { ThemeItem } from '../../../../common/model/Theme'; +import { ThemeStorageKey } from '../../../../common/constants/Theme'; interface RouteParams { id: string, @@ -52,6 +54,8 @@ struct AddSourcePage { showRecentIcon: false, showExplore: true } + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem async aboutToAppear() { const params = router.getParams() as RouteParams; @@ -152,8 +156,8 @@ struct AddSourcePage { Row({ space: 20 }) { Button('取消') .height(40) - .fontColor(0xff6600) - .backgroundColor('rgba(255, 102, 0, 0.12)') + .fontColor(this.theme.mainColor) + .backgroundColor(this.theme.secondColor) .layoutWeight(1) .onClick(() => { router.back() @@ -163,7 +167,7 @@ struct AddSourcePage { Button('确认') .height(40) .fontColor(Color.White) - .backgroundColor(0xff6600) + .backgroundColor(this.theme.mainColor) .layoutWeight(1) .onClick(async () => { if (!this.formModel.bookSourceName || !this.formModel.bookSourceUrl) { @@ -203,7 +207,7 @@ struct AddSourcePage { Text('CookieJar') Toggle({ type: ToggleType.Switch, isOn: enabledCookieJar }) - .selectedColor(0xff6600) + .selectedColor(this.theme.mainColor) .margin({ left: 8 }) .onChange((val: boolean) => { onChange(val) @@ -945,9 +949,9 @@ struct AddSourcePage { .fontSize(16) .fontWeight(this.currentIndex === index ? 700 : 400) .lineHeight(24) - .backgroundImage(this.currentIndex === index ? $r('app.media.underline') : '') - .backgroundImageSize(this.currentIndex === index ? { width: '100%', height: 15 } : {}) - .backgroundImagePosition({ y: 16 }) + // .backgroundImage(this.currentIndex === index ? $r('app.media.underline') : '') + // .backgroundImageSize(this.currentIndex === index ? { width: '100%', height: 15 } : {}) + // .backgroundImagePosition({ y: 16 }) } } diff --git a/entry/src/main/ets/pages/view/Find/BookSource/components/FilterText.ets b/entry/src/main/ets/pages/view/Find/BookSource/components/FilterText.ets index 92068e0f..76042a91 100644 --- a/entry/src/main/ets/pages/view/Find/BookSource/components/FilterText.ets +++ b/entry/src/main/ets/pages/view/Find/BookSource/components/FilterText.ets @@ -1,3 +1,6 @@ +import { ThemeStorageKey } from "../../../../../common/constants/Theme" +import { ThemeItem } from "../../../../../common/model/Theme" + @Component export default struct FilterText { index: number = 0 @@ -5,24 +8,25 @@ export default struct FilterText { @Prop hasActive: boolean = false isIcon: boolean = true onChange: (val: number) => void = (_val) => {} + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem build() { Row() { Text(this.title) .fontSize(12) - .fontColor(this.hasActive ? '#FF6600' : '#E0000000') - + .fontColor(this.hasActive ? this.theme.mainColor : '#E0000000') if (this.isIcon) { Image($r('app.media.down_arrow')) .width(8) .margin({ left: 6 }) - .fillColor(this.hasActive ? '#FF6600' : '#E0000000') + .fillColor(this.hasActive ? this.theme.mainColor : '#E0000000') } if (this.index === 4 && this.hasActive) { Image($r('app.media.close')) .width(8) .margin({ left: 2 }) - .fillColor(this.hasActive ? '#FF6600' : '#E0000000') + .fillColor(this.hasActive ? this.theme.mainColor : '#E0000000') } } .height(22) @@ -33,7 +37,7 @@ export default struct FilterText { right: 4 }) .layoutWeight(1) - .backgroundColor(this.hasActive ? 'rgba(255, 102, 0, 0.12)' : Color.White) + .backgroundColor(this.hasActive ? this.theme.secondColor : Color.White) .borderRadius(4) .alignItems(VerticalAlign.Center) .justifyContent(FlexAlign.Center) diff --git a/entry/src/main/ets/pages/view/Find/BookSource/components/FiltrateOption.ets b/entry/src/main/ets/pages/view/Find/BookSource/components/FiltrateOption.ets index 6b5bd162..5fcd2d04 100644 --- a/entry/src/main/ets/pages/view/Find/BookSource/components/FiltrateOption.ets +++ b/entry/src/main/ets/pages/view/Find/BookSource/components/FiltrateOption.ets @@ -1,3 +1,6 @@ +import { ThemeStorageKey } from "../../../../../common/constants/Theme"; +import { ThemeItem } from "../../../../../common/model/Theme"; + export interface Options { label: string; value?: number | string | boolean; @@ -11,13 +14,15 @@ export default struct FiltrateOption { isAgain: boolean = false @Prop value?: number | string | boolean onChange: (value?: number | string | boolean) => void = () => {} + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem build() { Grid() { ForEach(this.options, (item: Options) => { GridItem() { Text(item.label) - .fontColor(this.value === item.value ? '#FF6600' : '#E0000000') + .fontColor(this.value === item.value ? this.theme.mainColor : '#E0000000') .fontSize(12) .height(20) .lineHeight(20) @@ -26,10 +31,10 @@ export default struct FiltrateOption { radius: 4, width: 1, style: BorderStyle.Solid, - color: this.value === item.value ? '#FF6600' : '#0A000000' + color: this.value === item.value ? this.theme.mainColor : '#0A000000' }) .padding({ top: 6, bottom: 6 }) - .backgroundColor(this.value === item.value ? 'rgba(255, 102, 0, 0.12)' : '#0A000000') + .backgroundColor(this.value === item.value ? this.theme.secondColor : '#0A000000') .onClick(() => { if (this.value !== undefined && this.isAgain && this.value === item.value) { this.onChange(undefined) diff --git a/entry/src/main/ets/pages/view/Find/BookSource/components/SourceView.ets b/entry/src/main/ets/pages/view/Find/BookSource/components/SourceView.ets index 0428474c..74169990 100644 --- a/entry/src/main/ets/pages/view/Find/BookSource/components/SourceView.ets +++ b/entry/src/main/ets/pages/view/Find/BookSource/components/SourceView.ets @@ -16,6 +16,8 @@ import SourceGroup from '../../../../../componets/ui/SourceGroup' import { BookSourceSearchParams } from '../../../../../database/types/BookSourceType' import FiltrateOption from './FiltrateOption' import FilterText from './FilterText' +import { ThemeItem } from '../../../../../common/model/Theme' +import { ThemeStorageKey } from '../../../../../common/constants/Theme' @Component export default struct SourceView { @@ -52,6 +54,8 @@ export default struct SourceView { order: undefined, hasLoginUrl: undefined } + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem private dialogController: CustomDialogController = new CustomDialogController({ builder: CustomContentDialog({ primaryTitle: '书源评分', @@ -67,8 +71,8 @@ export default struct SourceView { buttons: [ { value: '取消', - background: '#1FFF6600', - fontColor: '#FF6600', + background: this.theme.secondColor, + fontColor: this.theme.mainColor, action: () => { this.dialogItem = {} this.dialogController.close() @@ -76,7 +80,7 @@ export default struct SourceView { }, { value: '确认', - background: '#FF6600', + background: 'this.theme.mainColor', fontColor: '#FFFFFF', action: async () => { if (this.isBatch) { @@ -104,7 +108,7 @@ export default struct SourceView { ], theme: { colors: { - confirm: 0xff6600 + confirm: this.theme.mainColor } } }), @@ -503,7 +507,7 @@ export default struct SourceView { Text(this.errorText) } else { LoadingProgress() - .color(0xff6600) + .color(this.theme.mainColor) .width('50%') Text('加载中...') } @@ -538,7 +542,7 @@ export default struct SourceView { Row().width(12) Column() { Toggle({ type: ToggleType.Switch, isOn: this.toggleAll }) - .selectedColor(0xff6600) + .selectedColor(this.theme.mainColor) .margin({ bottom: 4 }) .onChange(async (val: boolean) => { this.toggleAll = val @@ -706,7 +710,7 @@ export default struct SourceView { Radio({ value: '2', group: 'radioGroup' }) .checked(this.dialogItem?.bookSourceGrade === 2) .radioStyle({ - checkedBackgroundColor: 0xff6600 + checkedBackgroundColor: this.theme.mainColor }) .height(20) .width(20) @@ -723,7 +727,7 @@ export default struct SourceView { Radio({ value: '1', group: 'radioGroup' }) .checked(this.dialogItem?.bookSourceGrade === 1) .radioStyle({ - checkedBackgroundColor: 0xff6600 + checkedBackgroundColor: this.theme.mainColor }) .height(20) .width(20) @@ -741,7 +745,7 @@ export default struct SourceView { Radio({ value: '0', group: 'radioGroup' }) .checked(this.dialogItem?.bookSourceGrade === 0) .radioStyle({ - checkedBackgroundColor: 0xff6600 + checkedBackgroundColor: this.theme.mainColor }) .height(20) .width(20) @@ -777,7 +781,7 @@ export default struct SourceView { Blank() CheckboxGroup({ group: 'checkboxGroup' + index }) .checkboxShape(CheckBoxShape.CIRCLE) - .selectedColor(0xff6600) + .selectedColor(this.theme.mainColor) } else { Text('长按批量管理') .fontSize(12) @@ -812,7 +816,7 @@ export default struct SourceView { } if (item.hasExploreUrl) { - Tag({ text: '发现', color: '#FF6600', bgColor: '#1FFF6600' }) + Tag({ text: '发现', color: this.theme.mainColor, bgColor: this.theme.secondColor }) } Blank() @@ -820,7 +824,7 @@ export default struct SourceView { if (this.isBatch) { Checkbox({ name: 'checkbox' + j, group: 'checkboxGroup' + i }) .select(this.activeNameMap[item.bookSourceUrl] ?? false) - .selectedColor(0xff6600) + .selectedColor(this.theme.mainColor) .onChange((val: boolean) => { this.activeNameMap[item.bookSourceUrl] = val }) @@ -892,7 +896,7 @@ export default struct SourceView { .fontColor('rgba(0, 0, 0, 0.45)') Blank() Toggle({ type: ToggleType.Switch, isOn: item.enabled }) - .selectedColor(0xff6600) + .selectedColor(this.theme.mainColor) .onChange(async (val: boolean) => { item.enabled = val await BookSourceDao.updateFlow(item) diff --git a/entry/src/main/ets/pages/view/Find/CategoryList/Index.ets b/entry/src/main/ets/pages/view/Find/CategoryList/Index.ets index 27630020..4b014ff1 100644 --- a/entry/src/main/ets/pages/view/Find/CategoryList/Index.ets +++ b/entry/src/main/ets/pages/view/Find/CategoryList/Index.ets @@ -8,35 +8,25 @@ import axios, { AxiosResponse } from '@ohos/axios'; import noFind from '../../../../componets/common/noFind'; import { CardItem } from '../components/CardItem'; import CommonConstants from '../../../../common/constants/CommonConstants'; -import { BookSource } from '../../../../database/entities/BookSource'; +import { ThemeColorItem, ThemeItem } from '../../../../common/model/Theme'; +import { ThemeStorageKey } from '../../../../common/constants/Theme'; interface RouteParams { - bookSource: BookSource, + bookSourceUrl: string, exploreItem: ExploreItem, + exploreRule: ExploreRule, currentIndex: number } @Entry @Component struct CateGoryListPage { + @State bookSourceUrl: string = '' @State exploreItem: ExploreItem = { title: '', url: '' } - @State bookSource?: BookSource = { - bookSourceUrl: '', - bookSourceName: '', - bookSourceType: 0, - customOrder: 0, - enabled: false, - enabledExplore: false, - lastUpdateTime: 0, - respondTime: 0, - weight: 0, - isTop: false, - showRecentIcon: false, - showExplore: true - } + @State exploreRule: ExploreRule = {} @State pageNum: number = 1 @State pageSize: number = 10 @State bookList: ExploreRule[] = [] @@ -45,38 +35,38 @@ struct CateGoryListPage { @State isRefreshing: boolean = false @State RefreshingTitle: string = '松开刷新' @State currentIndex:number = 0 + + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem async aboutToAppear() { this.startLoading = true const params = router.getParams() as RouteParams; this.currentIndex = params.currentIndex console.log('TagInfo', JSON.stringify(params)) - this.bookSource = params.bookSource + this.bookSourceUrl = params.bookSourceUrl this.exploreItem = params.exploreItem + this.exploreRule = params.exploreRule await this.getList() this.startLoading = false } async getList() { - if (!this.bookSource) return - const bookSourceUrl = this.bookSource.bookSourceUrl - const exploreRule = this.bookSource.ruleExplore - const searchRule = this.bookSource.ruleSearch let url = this.exploreItem.url.replace('{{page}}', this.pageNum.toString()) if (!isNetworkUrl(url)) { - url = bookSourceUrl + url + url = this.bookSourceUrl + url } const exploreQuery: ExploreQuery = { url, + bookList: this.exploreRule.bookList, pageSize: this.pageSize, - bookList: exploreRule?.bookList || searchRule?.bookList, - name: exploreRule?.name || searchRule?.name, - author: exploreRule?.author || searchRule?.author, - intro: exploreRule?.intro || searchRule?.intro, - kind: exploreRule?.kind || searchRule?.kind, - lastChapter: exploreRule?.lastChapter || searchRule?.lastChapter, - bookUrl: exploreRule?.bookUrl || searchRule?.bookUrl, - coverUrl: exploreRule?.coverUrl || searchRule?.coverUrl, - wordCount: exploreRule?.wordCount || searchRule?.wordCount + name: this.exploreRule.name, + author: this.exploreRule.author, + intro: this.exploreRule.intro, + kind: this.exploreRule.kind, + lastChapter: this.exploreRule.lastChapter, + bookUrl: this.exploreRule.bookUrl, + coverUrl: this.exploreRule.coverUrl, + wordCount: this.exploreRule.wordCount } if (this.pageNum * this.pageSize - this.bookList.length >= this.pageSize * 2 && !this.startLoading) { return @@ -87,7 +77,7 @@ struct CateGoryListPage { console.info('TagInfo, 解析内容:', JSON.stringify(res.data)) const bookList = (res.data as ExploreRule[]).map(item => { if (item.coverUrl && !isNetworkUrl(item.coverUrl)) { - item.coverUrl = bookSourceUrl + item.coverUrl + item.coverUrl = this.bookSourceUrl + item.coverUrl } return item }) @@ -116,7 +106,7 @@ struct CateGoryListPage { if (this.startLoading) { Row() { LoadingProgress() - .color(0xff6600) + .color(this.theme.mainColor) .width(35) Text('内容加载中...') } diff --git a/entry/src/main/ets/pages/view/Find/IndexFind.ets b/entry/src/main/ets/pages/view/Find/IndexFind.ets index 4e36edcf..37e3fc3f 100644 --- a/entry/src/main/ets/pages/view/Find/IndexFind.ets +++ b/entry/src/main/ets/pages/view/Find/IndexFind.ets @@ -11,6 +11,8 @@ import { getPasteDataSync, isNetworkUrl, sleep } from '../../../common/utils/uti import { showMessage } from '../../../componets/common/promptShow'; import FindContent from './components/FindContent'; import { BookSource } from '../../../database/entities/BookSource'; +import { ThemeItem } from '../../../common/model/Theme'; +import { ThemeStorageKey } from '../../../common/constants/Theme'; /** * @author 2008 @@ -35,6 +37,8 @@ export default struct IndexFind { @State isShowHelp: boolean = false @State isShowImport: boolean = false @State sourceList: BookSource[] = [] + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem build() { Column() { @@ -128,9 +132,7 @@ export default struct IndexFind { } .linearGradient({ direction: GradientDirection.Bottom, // 渐变方向 - colors: [ - ["rgb(254, 203, 169)", 0], ["RGB(245, 245, 245)", 0.15] - , ["RGB254, 203, 169)", 0.25]] // 数组末尾元素占比小于1时满足重复着色效果 + colors: [[this.theme.mainColor, 0], [this.theme.secondColor, 0.2]] // 数组末尾元素占比小于1时满足重复着色效果 }) } diff --git a/entry/src/main/ets/pages/view/Find/components/AllCategory.ets b/entry/src/main/ets/pages/view/Find/components/AllCategory.ets index 02cd0ad4..5e5668bb 100644 --- a/entry/src/main/ets/pages/view/Find/components/AllCategory.ets +++ b/entry/src/main/ets/pages/view/Find/components/AllCategory.ets @@ -1,6 +1,6 @@ import { ExploreItem } from '../../../../database/types/BookSourceType' import { router } from '@kit.ArkUI' -import { BookSource } from '../../../../database/entities/BookSource' +import { ExploreRule } from '../../../../database/entities/rule' export interface GroupExploreList { title: string, @@ -14,7 +14,8 @@ export default struct AllCategory { @StorageLink('bottomRectHeight') bottomRectHeight: number = 0 @Prop list: GroupExploreList[] = [] @Link showSheet: boolean - @Prop bookSource?: BookSource + @Prop bookSourceUrl: string = '' + @Prop exploreRule: ExploreRule = {} build() { Column() { @@ -105,14 +106,15 @@ export default struct AllCategory { .backgroundColor('#0F000000') .borderRadius(4) .onClick(() => { - if (!item.url || !this.bookSource) { + if (!item.url) { return } router.pushUrl({ url: 'pages/view/Find/CategoryList/Index', params: { - bookSource: this.bookSource, - exploreItem: item + bookSourceUrl: this.bookSourceUrl, + exploreItem: item, + exploreRule: this.exploreRule } }) }) diff --git a/entry/src/main/ets/pages/view/Find/components/BodyContent.ets b/entry/src/main/ets/pages/view/Find/components/BodyContent.ets index f776a85a..62d8be1c 100644 --- a/entry/src/main/ets/pages/view/Find/components/BodyContent.ets +++ b/entry/src/main/ets/pages/view/Find/components/BodyContent.ets @@ -4,6 +4,8 @@ * @className: BodyContent */ import CommonConstants from '../../../../common/constants/CommonConstants' +import { ThemeStorageKey } from '../../../../common/constants/Theme' +import { ThemeItem } from '../../../../common/model/Theme' import sourceType from '../../../../componets/common/sourceType' import SourceCommon from '../../../../componets/source/SourceCommon' import BookSourceDao from '../../../../database/dao/BookSourceDao' @@ -21,7 +23,8 @@ export default struct BodyContent { @StorageLink(CommonConstants.HAS_EXPLORE_URL) @Watch('getList') hasExploreUrl?: boolean = undefined tabsBodyController: TabsController = new TabsController(); @StorageLink('refreshCount') @Watch('getList') refreshCount: number = 0 - + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem aboutToAppear() { this.getList() } @@ -58,7 +61,7 @@ export default struct BodyContent { if (this.loading) { Row() { LoadingProgress() - .color(0xff6600) + .color(this.theme.mainColor) .width(30) Text('加载中...') } @@ -111,7 +114,7 @@ export default struct BodyContent { if (this.loading) { Column() { LoadingProgress() - .color(0xff6600) + .color(this.theme.mainColor) .width('50%') Text('加载中...') } diff --git a/entry/src/main/ets/pages/view/Find/components/BookFindContent.ets b/entry/src/main/ets/pages/view/Find/components/BookFindContent.ets index 26a4474e..183322ea 100644 --- a/entry/src/main/ets/pages/view/Find/components/BookFindContent.ets +++ b/entry/src/main/ets/pages/view/Find/components/BookFindContent.ets @@ -13,54 +13,52 @@ import mayAlsoLike from '../mayAlsoLike' import { CardItem } from './CardItem' import { router } from '@kit.ArkUI' import CommonConstants from '../../../../common/constants/CommonConstants'; -import { BookSource } from '../../../../database/entities/BookSource' +import { ThemeItem } from '../../../../common/model/Theme' +import { ThemeStorageKey } from '../../../../common/constants/Theme' @Component export default struct BookFindContent { @Prop currentIndex: number + @Prop bookSourceUrl: string @Prop exploreItem: ExploreItem @Prop @Watch('getList') counter: number = 0 @State loading: boolean = true @State errorExplore: boolean = false @State bookList: ExploreRule[] = [] - @Prop bookSource?: BookSource + @Prop exploreRule: ExploreRule = {} handleClick: () => void = () => { } + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem aboutToAppear() { this.getList() - if (!this.bookSource) return } getList() { - if (!this.bookSource) return - const bookSourceUrl = this.bookSource.bookSourceUrl - const exploreRule = this.bookSource.ruleExplore - const searchRule = this.bookSource.ruleSearch this.loading = true let url = this.exploreItem.url.replace('{{page}}', "1") if (!isNetworkUrl(url)) { - url = bookSourceUrl + url + url = this.bookSourceUrl + url } const exploreQuery: ExploreQuery = { url, + bookList: this.exploreRule.bookList, pageSize: 3, - bookList: exploreRule?.bookList || searchRule?.bookList, - name: exploreRule?.name || searchRule?.name, - author: exploreRule?.author || searchRule?.author, - intro: exploreRule?.intro || searchRule?.intro, - kind: exploreRule?.kind || searchRule?.kind, - lastChapter: exploreRule?.lastChapter || searchRule?.lastChapter, - bookUrl: exploreRule?.bookUrl || searchRule?.bookUrl, - coverUrl: exploreRule?.coverUrl || searchRule?.coverUrl, - wordCount: exploreRule?.wordCount || searchRule?.wordCount + name: this.exploreRule.name, + author: this.exploreRule.author, + intro: this.exploreRule.intro, + kind: this.exploreRule.kind, + lastChapter: this.exploreRule.lastChapter, + bookUrl: this.exploreRule.bookUrl, + coverUrl: this.exploreRule.coverUrl, + wordCount: this.exploreRule.wordCount } - console.info('解析参数:', JSON.stringify(exploreQuery)) axios.post(CommonConstants.BASE_URL + '/common/analysisRules', exploreQuery).then((res: AxiosResponse) => { console.info('TagInfo, 解析内容:', JSON.stringify(res.data)) this.bookList = (res.data as ExploreRule[]).map(item => { if (item.coverUrl && !isNetworkUrl(item.coverUrl)) { - item.coverUrl = bookSourceUrl + item.coverUrl + item.coverUrl = this.bookSourceUrl + item.coverUrl } return item }) @@ -85,7 +83,7 @@ export default struct BookFindContent { if (this.loading) { Column() { LoadingProgress() - .color(0xff6600) + .color(this.theme.mainColor) .width('50%') Text('内容加载中...') } @@ -121,8 +119,9 @@ export default struct BookFindContent { router.pushUrl({ url: 'pages/view/Find/CategoryList/Index', params: { - bookSource: this.bookSource, + bookSourceUrl: this.bookSourceUrl, exploreItem: this.exploreItem, + exploreRule: this.exploreRule, currentIndex: this.currentIndex } }) diff --git a/entry/src/main/ets/pages/view/Find/components/CardItem.ets b/entry/src/main/ets/pages/view/Find/components/CardItem.ets index 7b830465..33b7404e 100644 --- a/entry/src/main/ets/pages/view/Find/components/CardItem.ets +++ b/entry/src/main/ets/pages/view/Find/components/CardItem.ets @@ -1,11 +1,17 @@ import { ExploreRule } from '../../../../database/entities/rule'; import { router } from '@kit.ArkUI'; import clickUtil from '../../../../common/utils/ClickUtils'; +import { ThemeStorageKey } from '../../../../common/constants/Theme'; +import { ThemeItem } from '../../../../common/model/Theme'; @Component export struct CardItem { @Prop item: ExploreRule = {}; currentIndex:number = 0 + + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem + build() { Row() { Image(this.item.coverUrl ?? $r('app.media.no_record')) @@ -35,12 +41,12 @@ export struct CardItem { Column() { Text(this.item.author) .fontSize(10) - .fontColor('#FF6600') + .fontColor(this.theme.mainColor) } .padding({ left: 6, right: 6 }) .height(16) .justifyContent(FlexAlign.Center) - .backgroundColor('#1FFF6600') + .backgroundColor(this.theme.secondColor) if (this.item.kind) { Column() { diff --git a/entry/src/main/ets/pages/view/Find/components/ContentRefresh.ets b/entry/src/main/ets/pages/view/Find/components/ContentRefresh.ets index ec1ff551..db838b2c 100644 --- a/entry/src/main/ets/pages/view/Find/components/ContentRefresh.ets +++ b/entry/src/main/ets/pages/view/Find/components/ContentRefresh.ets @@ -4,6 +4,7 @@ import RefreshComponent from '../../../../componets/common/RefreshComponent' import { BookSource } from '../../../../database/entities/BookSource' import BookFindContent from './BookFindContent' import { JSON } from '@kit.ArkTS' +import { ExploreRule } from '../../../../database/entities/rule' import { ExploreItem } from '../../../../database/types/BookSourceType' import AllCategory, { GroupExploreList } from './AllCategory' @@ -35,6 +36,7 @@ export default struct ContentRefresh { @State groupExploreList: GroupExploreList[] = [] @State exploreList: ExploreItem[] = [] @State showExploreList: ExploreItem[] = [] + @State exploreRule?: ExploreRule = {} @State showSheet: boolean = false aboutToAppear() { @@ -47,6 +49,7 @@ export default struct ContentRefresh { getList () { try { + this.exploreRule = this.bookSource.ruleExplore console.info('TagInfo: 书源地址:', this.bookSource.bookSourceUrl) console.info('TagInfo: 发现地址:', JSON.stringify(JSON.parse(this.bookSource.exploreUrl ?? '[]'))) const exploreList = JSON.parse(this.bookSource.exploreUrl ?? '[]') as ExploreItem[] @@ -119,8 +122,9 @@ export default struct ContentRefresh { ForEach(this.showExploreList, (item: ExploreItem) => { BookFindContent({ currentIndex: this.currentIndex, + bookSourceUrl: this.bookSource.bookSourceUrl, exploreItem: item, - bookSource: this.bookSource, + exploreRule: this.exploreRule, counter: this.counter, handleClick: () => { this.showSheet = true @@ -176,7 +180,8 @@ export default struct ContentRefresh { Column() { AllCategory({ showSheet: this.showSheet, - bookSource: this.bookSource, + bookSourceUrl: this.bookSource.bookSourceUrl, + exploreRule: this.exploreRule, list: this.groupExploreList }) } diff --git a/entry/src/main/ets/pages/view/Reader/RuleGroupTypePanel.ets b/entry/src/main/ets/pages/view/Reader/RuleGroupTypePanel.ets index 7066e058..0ca9a38a 100644 --- a/entry/src/main/ets/pages/view/Reader/RuleGroupTypePanel.ets +++ b/entry/src/main/ets/pages/view/Reader/RuleGroupTypePanel.ets @@ -1,3 +1,5 @@ +import { ThemeStorageKey } from '../../../common/constants/Theme' +import { ThemeItem } from '../../../common/model/Theme' import { showMessage } from '../../../componets/common/promptShow' import { folderList } from '../../../componets/dataList/folderList' @@ -11,6 +13,8 @@ export default struct RuleGroupTypePanel{ @StorageProp('GROUP_LIST_DATA') groupData:folderList[] = [] @StorageProp('APP_INDEX_SCROLLABLE') APP_INDEX_SCROLLABLE: boolean = true + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem build() { Column({ space:15 @@ -24,7 +28,7 @@ export default struct RuleGroupTypePanel{ Text('点击进入,长按编辑').fontSize(12).fontWeight(400).lineHeight(20).fontColor('rgba(0, 0, 0, 0.45)') }.alignItems(VerticalAlign.Bottom) Row({space:12}){ - Text(this.isShowIcon?'完成':'管理').fontSize(12).fontWeight(400).lineHeight(20).fontColor($r('app.color.theme_color')) + Text(this.isShowIcon?'完成':'管理').fontSize(12).fontWeight(400).lineHeight(20).fontColor(this.theme.mainColor) .onClick(()=>{ this.isShowIcon = !this.isShowIcon }) @@ -110,14 +114,14 @@ export default struct RuleGroupTypePanel{ Text(title).fontWeight(500).fontSize(12).textOverflow({ overflow:TextOverflow.Ellipsis }).ellipsisMode(EllipsisMode.END) - .maxLines(1).fontColor($r('app.color.theme_color')) + .maxLines(1).fontColor(this.theme.mainColor) .textAlign(TextAlign.Center) } .margin({ right: 16, bottom: 16 }) .justifyContent(FlexAlign.Center) .alignItems(VerticalAlign.Center) .width(68) - .backgroundColor('rgba(252, 121, 0, 0.12)') + .backgroundColor(this.theme.secondColor) .padding({left:16,right:16,top:6,bottom:6}) } } diff --git a/entry/src/main/ets/pages/view/Reader/chapterCommon.ets b/entry/src/main/ets/pages/view/Reader/chapterCommon.ets index daefb8a2..a96ef176 100644 --- a/entry/src/main/ets/pages/view/Reader/chapterCommon.ets +++ b/entry/src/main/ets/pages/view/Reader/chapterCommon.ets @@ -5,10 +5,14 @@ * 章节选择弹窗 */ import CommonConstants from '../../../common/constants/CommonConstants' +import { ThemeStorageKey } from '../../../common/constants/Theme' +import { ThemeItem } from '../../../common/model/Theme' @Component export default struct chapterCommon{ @Link isShowChapter:boolean + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem build() { Column(){ Column(){ @@ -63,8 +67,8 @@ export default struct chapterCommon{ .width(150) .height(40) .borderRadius(200) - .backgroundColor('#1fff6600') - .fontColor($r('app.color.theme_color')) + .backgroundColor(this.theme.secondColor) + .fontColor(this.theme.mainColor) .onClick(()=>{ this.isShowChapter = false }) @@ -74,7 +78,7 @@ export default struct chapterCommon{ .width(150) .height(40) .borderRadius(200) - .backgroundColor($r('app.color.theme_color')) + .backgroundColor(this.theme.mainColor) .fontColor($r('sys.color.comp_background_list_card')) } @@ -94,7 +98,7 @@ export default struct chapterCommon{ if (!showRead){ Radio({value:'第一章',group:'radioGroup'}).checked(checkRead) .radioStyle({ - checkedBackgroundColor: $r('app.color.theme_color') + checkedBackgroundColor: this.theme.mainColor }) .border({width:2,color:'rgba(255, 255, 255, 0.10)'}) .width(24).height(24) diff --git a/entry/src/main/ets/pages/view/Reader/directoryPurification.ets b/entry/src/main/ets/pages/view/Reader/directoryPurification.ets index 56b719e2..81052501 100644 --- a/entry/src/main/ets/pages/view/Reader/directoryPurification.ets +++ b/entry/src/main/ets/pages/view/Reader/directoryPurification.ets @@ -5,6 +5,8 @@ * 目录净化弹窗 */ import CommonConstants from '../../../common/constants/CommonConstants' +import { ThemeStorageKey } from '../../../common/constants/Theme' +import { ThemeItem } from '../../../common/model/Theme' import buttonCommon from '../../../componets/common/buttonCommon' import { showMessage } from '../../../componets/common/promptShow' @@ -14,6 +16,8 @@ export default struct directoryPurification{ @Prop isEdit:boolean = false cancel: () => void = () => { } + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem build() { Flex({ direction:FlexDirection.Column, @@ -54,7 +58,7 @@ export default struct directoryPurification{ family:CommonConstants.FAMILY_PingFANG }) .lineHeight(24) - Text('*').fontColor($r('app.color.theme_color')).font({ + Text('*').fontColor(this.theme.mainColor).font({ size:16, weight:500, family:CommonConstants.FAMILY_PingFANG @@ -82,7 +86,7 @@ export default struct directoryPurification{ family:CommonConstants.FAMILY_PingFANG }) .lineHeight(24) - Text('*').fontColor($r('app.color.theme_color')).font({ + Text('*').fontColor(this.theme.mainColor).font({ size:16, weight:500, family:CommonConstants.FAMILY_PingFANG diff --git a/entry/src/main/ets/pages/view/Reader/newAddRule.ets b/entry/src/main/ets/pages/view/Reader/newAddRule.ets index a94d4900..9e38a352 100644 --- a/entry/src/main/ets/pages/view/Reader/newAddRule.ets +++ b/entry/src/main/ets/pages/view/Reader/newAddRule.ets @@ -5,6 +5,8 @@ * 新建替换规则弹窗 */ import CommonConstants from '../../../common/constants/CommonConstants' +import { ThemeStorageKey } from '../../../common/constants/Theme' +import { ThemeItem } from '../../../common/model/Theme' import buttonCommon from '../../../componets/common/buttonCommon' import { showMessage } from '../../../componets/common/promptShow' @@ -17,6 +19,8 @@ export default struct newAddRule{ @Prop isEdit:boolean = false cancel: () => void = () => { } + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem build() { Flex({ direction:FlexDirection.Column, @@ -58,7 +62,7 @@ export default struct newAddRule{ family:CommonConstants.FAMILY_PingFANG }) .lineHeight(24) - Text('*').fontColor($r('app.color.theme_color')).font({ + Text('*').fontColor(this.theme.mainColor).font({ size:16, weight:500, family:CommonConstants.FAMILY_PingFANG @@ -82,7 +86,7 @@ export default struct newAddRule{ family:CommonConstants.FAMILY_PingFANG }) .lineHeight(24) - Text('*').fontColor($r('app.color.theme_color')).font({ + Text('*').fontColor(this.theme.mainColor).font({ size:16, weight:500, family:CommonConstants.FAMILY_PingFANG @@ -152,7 +156,7 @@ export default struct newAddRule{ family:CommonConstants.FAMILY_PingFANG }) .lineHeight(24) - Text('*').fontColor($r('app.color.theme_color')).font({ + Text('*').fontColor(this.theme.mainColor).font({ size:16, weight:500, family:CommonConstants.FAMILY_PingFANG @@ -215,7 +219,7 @@ export default struct newAddRule{ .fontColor($r('app.string.color_black_45')) Radio({value:'default',group:'radioGroup'}) .radioStyle({ - checkedBackgroundColor: $r('app.color.theme_color') + checkedBackgroundColor: this.theme.mainColor }) .onChange(()=>{ @@ -234,7 +238,7 @@ export default struct newAddRule{ .fontColor($r('app.string.color_black_45')) Radio({value:'default',group:'radioGroup'}) .radioStyle({ - checkedBackgroundColor: $r('app.color.theme_color') + checkedBackgroundColor: this.theme.mainColor }) .checked(true) .onChange(()=>{ @@ -332,7 +336,7 @@ export default struct newAddRule{ justifyContent:FlexAlign.SpaceBetween, alignItems:ItemAlign.Center }) { - Text(item).fontSize(14).lineHeight(24).fontColor(item === this.grouping?$r('app.color.theme_color'):$r('app.string.color_black_88')) + Text(item).fontSize(14).lineHeight(24).fontColor(item === this.grouping?this.theme.mainColor:$r('app.string.color_black_88')) if (item === this.grouping){ Image($r('app.media.hook')).width(24).height(24) } diff --git a/entry/src/main/ets/pages/view/Reader/ruleView.ets b/entry/src/main/ets/pages/view/Reader/ruleView.ets index 40ac46b4..627d7f4b 100644 --- a/entry/src/main/ets/pages/view/Reader/ruleView.ets +++ b/entry/src/main/ets/pages/view/Reader/ruleView.ets @@ -4,6 +4,8 @@ * @className: ruleView */ import CommonConstants from '../../../common/constants/CommonConstants' +import { ThemeStorageKey } from '../../../common/constants/Theme' +import { ThemeItem } from '../../../common/model/Theme' import buttonCommon from '../../../componets/common/buttonCommon' import InsideCircleIcon from '../../../componets/common/InsideCircleIcon' import operateIcon from '../../../componets/common/operateIcon' @@ -46,6 +48,8 @@ export default struct ruleView{ } this.ruleNumber = this.checkedRuleList.length } + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem build() { Flex({ direction:FlexDirection.Column @@ -72,8 +76,8 @@ export default struct ruleView{ }) .textAlign(TextAlign.Center) .lineHeight(24) - .fontColor(this.ruleType === item?$r('app.color.theme_color'):$r('app.string.color_black_45')) - Row().width(10).height(3).backgroundColor($r('app.color.theme_color')).borderRadius(8).offset({y:5}) + .fontColor(this.ruleType === item?this.theme.mainColor:$r('app.string.color_black_45')) + Row().width(10).height(3).backgroundColor(this.theme.mainColor).borderRadius(8).offset({y:5}) .visibility(this.ruleType === item?Visibility.Visible:Visibility.None) .opacity(this.ruleType === item?1:0) .scale({ @@ -212,7 +216,7 @@ export default struct ruleView{ .height('83%') Column(){ Row(){ - Checkbox().selectedColor($r('app.color.theme_color')).margin({right:8}).select(this.checkRule) + Checkbox().selectedColor(this.theme.mainColor).margin({right:8}).select(this.checkRule) .onChange(()=>{ this.checkRule = !this.checkRule }) @@ -228,7 +232,7 @@ export default struct ruleView{ weight:400 }) .lineHeight(24) - Text(`${this.ruleNumber}`).fontColor($r('app.color.theme_color')) + Text(`${this.ruleNumber}`).fontColor(this.theme.mainColor) .font({ size:16, weight:400 @@ -303,7 +307,7 @@ export default struct ruleView{ borderRadius:12 }) .animationIsBatchF() - Checkbox().selectedColor($r('app.color.theme_color')).select(this.isRuleCheck) + Checkbox().selectedColor(this.theme.mainColor).select(this.isRuleCheck) .onChange((value:boolean)=>{ this.checkedRuleListPush(title,value) }) @@ -317,7 +321,7 @@ export default struct ruleView{ Checkbox({ name: title }) - .selectedColor($r('app.color.theme_color')) + .selectedColor(this.theme.mainColor) .select(this.checkRule) .onChange((value:boolean)=>{ this.checkedRuleListPush(title,value) @@ -352,7 +356,7 @@ export default struct ruleView{ borderRadius:12 }) .animationIsBatchF() - Checkbox().selectedColor($r('app.color.theme_color')).select(this.isRuleCheck) + Checkbox().selectedColor(this.theme.mainColor).select(this.isRuleCheck) .onChange((value:boolean)=>{ this.checkedRuleListPush(title,value) }) @@ -370,7 +374,7 @@ export default struct ruleView{ .onChange((value:boolean)=>{ this.checkedRuleListPush(title,value) }) - .selectedColor($r('app.color.theme_color')) + .selectedColor(this.theme.mainColor) } } } @@ -579,7 +583,7 @@ export default struct ruleView{ if (item.id === 2) { Column(){ Toggle({ type: ToggleType.Switch, isOn: $$this.operateDisable}) - .selectedColor($r('app.color.theme_color')).hoverEffect(HoverEffect.None) + .selectedColor(this.theme.mainColor).hoverEffect(HoverEffect.None) .onChange(()=>{ if (this.checkedRuleList.length === 0) { showMessage('请选择要禁用的内容') diff --git a/entry/src/main/ets/pages/view/Reader/sourceCommon.ets b/entry/src/main/ets/pages/view/Reader/sourceCommon.ets index 559b1cd0..fc8cda18 100644 --- a/entry/src/main/ets/pages/view/Reader/sourceCommon.ets +++ b/entry/src/main/ets/pages/view/Reader/sourceCommon.ets @@ -3,6 +3,8 @@ * @datetime 2024/6/6 22:05 * @className: sourceCommon */ +import { ThemeStorageKey } from '../../../common/constants/Theme' +import { ThemeItem } from '../../../common/model/Theme' import chapterCommon from './chapterCommon' @Component @@ -11,6 +13,8 @@ export default struct sourceCommon{ @Prop IsSelect:boolean = true @Prop sourceType:string @State isShowChapter:boolean = false + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem build() { Flex({ @@ -125,9 +129,9 @@ export default struct sourceCommon{ }) } } - .border({width:this.IsSelect?1:0,color:$r('app.color.theme_color'),style:BorderStyle.Solid}) + .border({width:this.IsSelect?1:0,color:this.theme.mainColor,style:BorderStyle.Solid}) .borderRadius(12) - .backgroundColor(this.IsSelect?'rgba(255, 102, 0, 0.12)':'rgba(0, 0, 0, 0.06)') + .backgroundColor(this.IsSelect?this.theme.secondColor:'rgba(0, 0, 0, 0.06)') } @Builder chapterView(){ diff --git a/entry/src/main/ets/pages/view/Reader/sourceView.ets b/entry/src/main/ets/pages/view/Reader/sourceView.ets index fc9086bd..34bafc76 100644 --- a/entry/src/main/ets/pages/view/Reader/sourceView.ets +++ b/entry/src/main/ets/pages/view/Reader/sourceView.ets @@ -4,6 +4,8 @@ * @className: sourceView * 换源组件 */ +import { ThemeStorageKey } from '../../../common/constants/Theme' +import { ThemeItem } from '../../../common/model/Theme' import sourceCommon from './sourceCommon' @Component @@ -11,6 +13,8 @@ import sourceCommon from './sourceCommon' export default struct sourceView{ @State sourceType:string = '整本换源' @StorageLink('bottomRectHeight') bottomRectHeight: number = 0 + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem build() { Column({ space:16 @@ -49,7 +53,7 @@ export default struct sourceView{ }) .fontColor(this.sourceType === '整本换源'?$r('app.string.color_black_88'):$r('app.string.color_black_45')) if (this.sourceType === '整本换源'){ - Row().width(10).height(3).backgroundColor($r('app.color.theme_color')).borderRadius(8).offset({y:16}) + Row().width(10).height(3).backgroundColor(this.theme.mainColor).borderRadius(8).offset({y:16}) } }.onClick(()=>{ this.sourceType ='整本换源' @@ -62,7 +66,7 @@ export default struct sourceView{ }) .fontColor(this.sourceType !== '整本换源'?$r('app.string.color_black_88'):$r('app.string.color_black_45')) if (this.sourceType !== '整本换源'){ - Row().width(10).height(3).backgroundColor($r('app.color.theme_color')).borderRadius(8).offset({y:16}) + Row().width(10).height(3).backgroundColor(this.theme.mainColor).borderRadius(8).offset({y:16}) } }.onClick(()=>{ this.sourceType ='单章换源' @@ -82,7 +86,7 @@ export default struct sourceView{ Text('点击刷新') .fontWeight(400) .fontSize(14) - .fontColor($r('app.color.theme_color')) + .fontColor(this.theme.mainColor) } Row({ space:4 diff --git a/entry/src/main/ets/pages/view/Subscription/RssSources/newSources.ets b/entry/src/main/ets/pages/view/Subscription/RssSources/newSources.ets index 8b8c2ffb..d9f12a10 100644 --- a/entry/src/main/ets/pages/view/Subscription/RssSources/newSources.ets +++ b/entry/src/main/ets/pages/view/Subscription/RssSources/newSources.ets @@ -3,6 +3,8 @@ import FontConstants from '../../../../common/constants/FontConstants' import ImageConstants from '../../../../common/constants/ImageConstants' import PaddingConstants from '../../../../common/constants/PaddingConstants' import TextConstants from '../../../../common/constants/TextConstants' +import { ThemeStorageKey } from '../../../../common/constants/Theme' +import { ThemeItem } from '../../../../common/model/Theme' import { isNetworkUrl } from '../../../../common/utils/utils' import buttonCommon from '../../../../componets/common/buttonCommon' import dialogTitleFuction from '../../../../componets/common/dialogTitleFuction' @@ -239,6 +241,8 @@ export default struct newSources{ } this.readIndex = 0 } + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem @Builder baseForm() { @@ -546,7 +550,7 @@ export default struct newSources{ Text('启用JavaScript') .fontColor(16) Toggle({ type: ToggleType.Switch, isOn: this.formModel.rssWebViewRule?.enableJs }) - .selectedColor(0xff6600) + .selectedColor(this.theme.mainColor) .margin({ left: 8 }) .onChange((val: boolean) => { if ( this.formModel.rssWebViewRule) { @@ -562,7 +566,7 @@ export default struct newSources{ Text('加载 BaseUrl') .fontColor(16) Toggle({ type: ToggleType.Switch, isOn: this.formModel.rssWebViewRule?.loadWithBaseUrl }) - .selectedColor(0xff6600) + .selectedColor(this.theme.mainColor) .margin({ left: 8 }) .onChange((val: boolean) => { if ( this.formModel.rssWebViewRule) { @@ -639,9 +643,9 @@ export default struct newSources{ .fontSize(16) .fontWeight(this.currentIndex === index ? 700 : 400) .lineHeight(24) - .backgroundImage(this.currentIndex === index ? $r('app.media.underline') : '') - .backgroundImageSize(this.currentIndex === index ? { width: '100%', height: 15 } : {}) - .backgroundImagePosition({ y: 16 }) + // .backgroundImage(this.currentIndex === index ? $r('app.media.underline') : '') + // .backgroundImageSize(this.currentIndex === index ? { width: '100%', height: 15 } : {}) + // .backgroundImagePosition({ y: 16 }) } } @@ -651,7 +655,7 @@ export default struct newSources{ Text('CookieJar') Toggle({ type: ToggleType.Switch, isOn: enabledCookieJar }) - .selectedColor(0xff6600) + .selectedColor(this.theme.mainColor) .margin({ left: 8 }) .onChange((val: boolean) => { onChange(val) @@ -665,7 +669,7 @@ export default struct newSources{ Text('使用链接') Toggle({ type: ToggleType.Switch, isOn: sourceIconIsUrl }) - .selectedColor(0xff6600) + .selectedColor(this.theme.mainColor) .margin({ left: 8 }) .onChange((val: boolean) => { onChange(val) @@ -778,7 +782,7 @@ export default struct newSources{ .fontColor($r('app.string.color_black_88')) .lineHeight(TextConstants.TEXT_LINE_HEIGHT_22) Toggle({ type: ToggleType.Switch, isOn: this.formModel.autoComplete}) - .selectedColor(0xff6600) + .selectedColor(this.theme.mainColor) .margin({ left: 8 }) .onChange((val: boolean) => { this.formModel.autoComplete = val diff --git a/entry/src/main/ets/pages/view/Subscription/RssSources/newSourcesNetWork.ets b/entry/src/main/ets/pages/view/Subscription/RssSources/newSourcesNetWork.ets index 6565ad25..d3ac6edc 100644 --- a/entry/src/main/ets/pages/view/Subscription/RssSources/newSourcesNetWork.ets +++ b/entry/src/main/ets/pages/view/Subscription/RssSources/newSourcesNetWork.ets @@ -6,6 +6,8 @@ */ import FontConstants from '../../../../common/constants/FontConstants' import PaddingConstants from '../../../../common/constants/PaddingConstants' +import { ThemeStorageKey } from '../../../../common/constants/Theme' +import { ThemeItem } from '../../../../common/model/Theme' import { isNetworkUrl } from '../../../../common/utils/utils' import buttonCommon from '../../../../componets/common/buttonCommon' import { showMessage } from '../../../../componets/common/promptShow' @@ -20,6 +22,8 @@ import RssSourceCheckImage from '../components/RssSourceCheckImage' export default struct newSourcesNetWork{ hideNewWork:Function = ()=>{} @Prop isEdit:boolean = false + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem build() { Column(){ Column(){ @@ -243,7 +247,7 @@ export default struct newSourcesNetWork{ Text('使用链接') Toggle({ type: ToggleType.Switch, isOn: sourceIconIsUrl }) - .selectedColor(0xff6600) + .selectedColor(this.theme.mainColor) .margin({ left: 8 }) .onChange((val: boolean) => { onChange(val) diff --git a/entry/src/main/ets/pages/view/Subscription/SubscriptionIndex.ets b/entry/src/main/ets/pages/view/Subscription/SubscriptionIndex.ets index b85926f4..2ca87b16 100644 --- a/entry/src/main/ets/pages/view/Subscription/SubscriptionIndex.ets +++ b/entry/src/main/ets/pages/view/Subscription/SubscriptionIndex.ets @@ -21,6 +21,8 @@ import RssSourcesHistory from './components/RssSourcesHistory' import rssSourcesHistoryDao from '../../../database/dao/RssSourcesHistoryDao' import { rssSourcesHistory } from '../../../database/entities/rssSourcesHistory' import { FileHandler } from 'ets/common/utils/FileHandler' +import { ThemeItem } from '../../../common/model/Theme' +import { ThemeStorageKey } from '../../../common/constants/Theme' @Component export default struct SubscriptionIndex { @@ -42,6 +44,8 @@ export default struct SubscriptionIndex { @State rssSourcesList: rssSources[] = [] @State groupList: rssGroupList[] = [] @State batchEdit: boolean = false + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem //刷新 refresh = () => { this.resetState() @@ -149,7 +153,7 @@ export default struct SubscriptionIndex { if (this.loading) { Column() { LoadingProgress() - .color(0xff6600) + .color(this.theme.mainColor) .width('50%') Text('加载中...') } @@ -284,7 +288,7 @@ export default struct SubscriptionIndex { } .linearGradient({ direction: GradientDirection.Bottom, // 渐变方向 - colors: [["rgb(254, 203, 169)", 0], ["RGB(245, 245, 245)", 0.2]] // 数组末尾元素占比小于1时满足重复着色效果 + colors: [[this.theme.mainColor, 0], [this.theme.secondColor, 0.2]] // 数组末尾元素占比小于1时满足重复着色效果 }) .height('100%') } diff --git a/entry/src/main/ets/pages/view/Subscription/components/PreviewEffectImage.ets b/entry/src/main/ets/pages/view/Subscription/components/PreviewEffectImage.ets index ab6b9ed4..3889029e 100644 --- a/entry/src/main/ets/pages/view/Subscription/components/PreviewEffectImage.ets +++ b/entry/src/main/ets/pages/view/Subscription/components/PreviewEffectImage.ets @@ -6,6 +6,8 @@ */ import CommonConstants from '../../../../common/constants/CommonConstants' import FontConstants from '../../../../common/constants/FontConstants' +import { ThemeStorageKey } from '../../../../common/constants/Theme' +import { ThemeItem } from '../../../../common/model/Theme' @Component export default struct PreviewEffectImage{ @@ -18,6 +20,8 @@ export default struct PreviewEffectImage{ @Prop ImageRadius:number = 4 @Prop sourceName:string = '' @State isError:boolean = false + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem build() { Column(){ if (this.isShowTitle){ @@ -38,8 +42,8 @@ export default struct PreviewEffectImage{ Stack(){ this.ImageStack(this.customizeTitle.length > 0 && !this.sourceIconIsUrl) Column(){ - LoadingProgress().color("#FF6600").height(30) - Text('图片加载中...').fontSize(5).fontColor($r('app.color.theme_color')) + LoadingProgress().color(this.theme.mainColor).height(30) + Text('图片加载中...').fontSize(5).fontColor(this.theme.mainColor) }.zIndex(-1) } } diff --git a/entry/src/main/ets/pages/view/Subscription/components/RssSourceCheckImage.ets b/entry/src/main/ets/pages/view/Subscription/components/RssSourceCheckImage.ets index 86ffa150..cdafd57a 100644 --- a/entry/src/main/ets/pages/view/Subscription/components/RssSourceCheckImage.ets +++ b/entry/src/main/ets/pages/view/Subscription/components/RssSourceCheckImage.ets @@ -7,6 +7,8 @@ import CommonConstants from '../../../../common/constants/CommonConstants' import FontConstants from '../../../../common/constants/FontConstants' import PaddingConstants from '../../../../common/constants/PaddingConstants' +import { ThemeStorageKey } from '../../../../common/constants/Theme' +import { ThemeItem } from '../../../../common/model/Theme' import buttonCommon from '../../../../componets/common/buttonCommon' import FormInput from '../../../../componets/Form/FormInput' import PreviewEffectImage from './PreviewEffectImage' @@ -49,6 +51,8 @@ export default struct RssSourceCheckImage{ //取消 onCancel:Function = ()=>{} scroller: Scroller = new Scroller() + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem build() { Flex({ @@ -93,7 +97,7 @@ export default struct RssSourceCheckImage{ Stack(){ Radio({value:JSON.stringify(index),group:'iconGroup'}) .radioStyle({ - checkedBackgroundColor: $r('app.color.theme_color') + checkedBackgroundColor: this.theme.mainColor }) .zIndex(999) .onChange(()=>{ diff --git a/entry/src/main/ets/pages/view/Subscription/components/RssSourceGroup.ets b/entry/src/main/ets/pages/view/Subscription/components/RssSourceGroup.ets index 370fb193..5319f2dd 100644 --- a/entry/src/main/ets/pages/view/Subscription/components/RssSourceGroup.ets +++ b/entry/src/main/ets/pages/view/Subscription/components/RssSourceGroup.ets @@ -6,6 +6,8 @@ */ import CommonConstants from '../../../../common/constants/CommonConstants' import PaddingConstants from '../../../../common/constants/PaddingConstants' +import { ThemeStorageKey } from '../../../../common/constants/Theme' +import { ThemeItem } from '../../../../common/model/Theme' import buttonCommon from '../../../../componets/common/buttonCommon' import { showMessage } from '../../../../componets/common/promptShow' import programDataPreferences from '../../../../preferences/programDataPreferences' @@ -19,6 +21,8 @@ export default struct RssSourceGroup { cancel:Function = () =>{ } + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem aboutToAppear() { this.getRssSourceList() @@ -38,7 +42,7 @@ export default struct RssSourceGroup { space:5 }){ Text('移动至').fontSize(16).fontWeight(700).lineHeight(24) - Text(`${this.moveGroup}`).fontSize(16).fontWeight(700).lineHeight(24).fontColor($r('app.color.theme_color')) + Text(`${this.moveGroup}`).fontSize(16).fontWeight(700).lineHeight(24).fontColor(this.theme.mainColor) } .padding({ right:20, diff --git a/entry/src/main/ets/pages/view/Subscription/components/SubscriptionSearch.ets b/entry/src/main/ets/pages/view/Subscription/components/SubscriptionSearch.ets index b6da7649..30ec60ac 100644 --- a/entry/src/main/ets/pages/view/Subscription/components/SubscriptionSearch.ets +++ b/entry/src/main/ets/pages/view/Subscription/components/SubscriptionSearch.ets @@ -14,6 +14,8 @@ import SubscriptionDao from '../../../../database/dao/SubscriptionDao'; import { showMessage } from '../../../../componets/common/promptShow'; import rssSourcesUtils from '../../../../common/utils/rssSourcesUtils'; import PreviewEffectImage from './PreviewEffectImage'; +import { ThemeItem } from '../../../../common/model/Theme'; +import { ThemeStorageKey } from '../../../../common/constants/Theme'; @Entry @Component @@ -22,6 +24,8 @@ struct SubscriptionSearch { @StorageLink('topRectHeight') topRectHeight: number = 0 @State searchList: rssSources[] = [] + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem onPageShow(): void { this.changeSearchValue() @@ -98,7 +102,7 @@ struct SubscriptionSearch { } .linearGradient({ direction: GradientDirection.Bottom, // 渐变方向 - colors: [["rgb(254, 203, 169)", 0], ["RGB(245, 245, 245)", 0.2]] // 数组末尾元素占比小于1时满足重复着色效果 + colors: [[this.theme.mainColor, 0], [this.theme.secondColor, 0.2]] // 数组末尾元素占比小于1时满足重复着色效果 }) .padding({ top: this.topRectHeight, diff --git a/entry/src/main/ets/pages/view/bookShelf/DownloadManagementPage.ets b/entry/src/main/ets/pages/view/bookShelf/DownloadManagementPage.ets index b08190d5..a6421869 100644 --- a/entry/src/main/ets/pages/view/bookShelf/DownloadManagementPage.ets +++ b/entry/src/main/ets/pages/view/bookShelf/DownloadManagementPage.ets @@ -1,6 +1,8 @@ import { router } from '@kit.ArkUI'; import picker from '@ohos.file.picker'; import fs from '@ohos.file.fs'; +import { ThemeItem } from '../../../common/model/Theme'; +import { ThemeStorageKey } from '../../../common/constants/Theme'; class DownloadItem { bookName: string @@ -52,6 +54,9 @@ struct DownloadManagementPage { new DownloadItem("斗破苍穹导出", 50, 200, "PDF"), ] + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem + build() { Stack() { if (this.IsEdit === false) { @@ -61,13 +66,13 @@ struct DownloadManagementPage { ForEach(this.questionsList, (item: string, index) => { Column() { Text(item) - .fontColor(this.currentScrollCardIndex === index ? '#FF6600' : 'rgba(0, 0, 0, 0.88)') + .fontColor(this.currentScrollCardIndex === index ? this.theme.mainColor : 'rgba(0, 0, 0, 0.88)') .fontSize(12) .fontWeight(700) } .borderRadius(8) .padding(8) - .backgroundColor(this.currentScrollCardIndex === index ? 'rgba(255, 102, 0, 0.12)' : 'rgb(240,240,240)') + .backgroundColor(this.currentScrollCardIndex === index ? this.theme.secondColor : 'rgb(240,240,240)') .onClick(() => { this.currentScrollCardIndex = index }) @@ -120,7 +125,7 @@ struct DownloadManagementPage { } else { Text("全部暂停") .lineHeight(20) - .fontColor("#FF6600") + .fontColor(this.theme.mainColor) .font({ size: 12, weight: 500 @@ -193,7 +198,7 @@ struct DownloadManagementPage { Text("全部导出") .lineHeight(20) - .fontColor("#FF6600") + .fontColor(this.theme.mainColor) .font({ size: 12, weight: 500 @@ -226,7 +231,7 @@ struct DownloadManagementPage { } else { Text("查看文件") .lineHeight(20) - .fontColor("#FF6600") + .fontColor(this.theme.mainColor) .font({ size: 12, weight: 500 @@ -341,7 +346,7 @@ struct DownloadManagementPage { } else if (itemType === "DownloadFinish" && currentTab === 1) { // 导出页的已下载 Progress({ value: 50, total: 100, type: ProgressType.Capsule }) - .color("#FF6600") + .color(this.theme.mainColor) .backgroundColor("#FFAF7A") .value(50) .width(68) @@ -544,7 +549,7 @@ struct DownloadManagementPage { size: 16, weight: 500 }) - .fontColor(this.currentTabIndex === index ? '#FF6600' : '#000000') + .fontColor(this.currentTabIndex === index ? this.theme.mainColor : '#000000') .opacity(this.currentTabIndex === index ? null : 0.45) } } diff --git a/entry/src/main/ets/pages/view/bookShelf/IndexShelf.ets b/entry/src/main/ets/pages/view/bookShelf/IndexShelf.ets index 47279d30..3446c273 100644 --- a/entry/src/main/ets/pages/view/bookShelf/IndexShelf.ets +++ b/entry/src/main/ets/pages/view/bookShelf/IndexShelf.ets @@ -8,6 +8,8 @@ import { bookShelfImport } from '../../../database/entities/Books' import { getPasteDataSync, isNetworkUrl, sleep } from '../../../common/utils/utils' import booksUtil from '../../../common/utils/booksUtils' import axios, { AxiosResponse } from '@ohos/axios' +import { ThemeItem } from '../../../common/model/Theme' +import { ThemeStorageKey } from '../../../common/constants/Theme' @Component export default struct IndexShelf { @@ -32,6 +34,8 @@ export default struct IndexShelf { @StorageProp('APP_INDEX_SCROLLABLE') APP_INDEX_SCROLLABLE: boolean = false @StorageLink('BOOK_IS_BOOK_REFRESHING') isBookRefreshing: number = 0 @State bookImport:bookShelfImport[] = [] + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem // 网址导入dialog dialogController: CustomDialogController = new CustomDialogController({ builder: Dialog({ @@ -198,7 +202,7 @@ export default struct IndexShelf { .height('100%') .linearGradient({ direction: GradientDirection.Bottom, // 渐变方向 - colors: [["rgb(254, 203, 169)", 0], ["RGB(245, 245, 245)", 0.2]] // 数组末尾元素占比小于1时满足重复着色效果 + colors: [[this.theme.mainColor, 0], [this.theme.secondColor, 0.2]] // 数组末尾元素占比小于1时满足重复着色效果 }) .borderRadius({ bottomRight: 5, bottomLeft: 5 }) } diff --git a/entry/src/main/ets/pages/view/bookShelf/LocalImportPage.ets b/entry/src/main/ets/pages/view/bookShelf/LocalImportPage.ets index 2efe4faa..99887ba2 100644 --- a/entry/src/main/ets/pages/view/bookShelf/LocalImportPage.ets +++ b/entry/src/main/ets/pages/view/bookShelf/LocalImportPage.ets @@ -1,5 +1,7 @@ import { router } from '@kit.ArkUI'; import fs from '@ohos.file.fs'; +import { ThemeStorageKey } from '../../../common/constants/Theme'; +import { ThemeItem } from '../../../common/model/Theme'; class SmartScanItem { bookName: string @@ -49,6 +51,8 @@ struct LocalImportPage { '按大小排序', '系统文件夹', ] + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem // 加载测试 onPageShow(): void { @@ -254,7 +258,7 @@ struct LocalImportPage { Text("导入书架") .lineHeight(24) - .fontColor("#FF6600") + .fontColor(this.theme.mainColor) .opacity(0.5) .font({ size: 16, @@ -361,7 +365,7 @@ struct LocalImportPage { size: 16, weight: 500 }) - .fontColor(this.currentTabIndex === index ? '#FF6600' : '#000000') + .fontColor(this.currentTabIndex === index ? this.theme.mainColor : '#000000') .opacity(this.currentTabIndex === index ? null : 0.45) } } diff --git a/entry/src/main/ets/pages/view/bookShelf/Manage/BookManagePage.ets b/entry/src/main/ets/pages/view/bookShelf/Manage/BookManagePage.ets index 270988b1..c51d5a32 100644 --- a/entry/src/main/ets/pages/view/bookShelf/Manage/BookManagePage.ets +++ b/entry/src/main/ets/pages/view/bookShelf/Manage/BookManagePage.ets @@ -18,6 +18,8 @@ import WorksBookLists from '../Shelf/WorksBookLists'; import worksListsDao from '../../../../database/dao/WorksListsDao'; import { WorksLists } from '../../../../database/entities/WorksLists'; import worksListsUtils from '../../../../common/utils/WorksListsUtils'; +import { ThemeItem } from '../../../../common/model/Theme'; +import { ThemeStorageKey } from '../../../../common/constants/Theme'; class routerParams { currentIndex:number @@ -49,6 +51,8 @@ struct BookManagePage { @State worksLists:WorksLists[] =[] //书单 @StorageLink('BOOK_IS_BOOK_REFRESHING') isBookRefreshing: number = 0 @StorageLink('BOOK_IS_BOOK_GROUPS_REFRESHING') @Watch('getGroupList')BOOK_IS_BOOK_GROUPS_REFRESHING: number = 0 + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem //判断是否全部置顶或取消置顶 selectIsAllTop(){ let allTopNumber = 0 @@ -159,7 +163,7 @@ struct BookManagePage { }) .linearGradient({ direction: GradientDirection.Bottom, // 渐变方向 - colors: [["rgb(254, 203, 169)", 0.1],["RGB(245, 245, 245)", 0.2]] // 数组末尾元素占比小于1时满足重复着色效果 + colors: [[this.theme.mainColor, 0.1],[this.theme.secondColor, 0.2]] // 数组末尾元素占比小于1时满足重复着色效果 }) .borderRadius({ bottomRight: 5, bottomLeft: 5 }) @@ -243,7 +247,7 @@ struct BookManagePage { }) { Checkbox() .select(this.allCheck) - .selectedColor(0xff6600) + .selectedColor(this.theme.mainColor) .onClick(() => { if (this.verificationDate()) { return diff --git a/entry/src/main/ets/pages/view/bookShelf/Manage/bookManage/BookFolderGridManage.ets b/entry/src/main/ets/pages/view/bookShelf/Manage/bookManage/BookFolderGridManage.ets index bbf441e4..1a50b620 100644 --- a/entry/src/main/ets/pages/view/bookShelf/Manage/bookManage/BookFolderGridManage.ets +++ b/entry/src/main/ets/pages/view/bookShelf/Manage/bookManage/BookFolderGridManage.ets @@ -1,3 +1,5 @@ +import { ThemeStorageKey } from '../../../../../common/constants/Theme' +import { ThemeItem } from '../../../../../common/model/Theme' import { BookGroups } from '../../../../../database/entities/BookGroups' /** @@ -9,6 +11,8 @@ export default struct BookFolderGridManage { @Link checkGroup:Record @Prop isManage:boolean onSelect:Function = () => {} + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem build() { Column() { Stack() { @@ -17,7 +21,7 @@ export default struct BookFolderGridManage { Checkbox() .zIndex(9) .select(this.group.groupId?this.checkGroup[this.group.groupId] ?? false:false) - .selectedColor($r('app.color.theme_color')) + .selectedColor(this.theme.mainColor) .onChange((val: boolean) => { if (this.group.groupId) { this.checkGroup[this.group.groupId] = val diff --git a/entry/src/main/ets/pages/view/bookShelf/Manage/bookManage/BookFolderInfoManage.ets b/entry/src/main/ets/pages/view/bookShelf/Manage/bookManage/BookFolderInfoManage.ets index c62ccdf1..c36bca02 100644 --- a/entry/src/main/ets/pages/view/bookShelf/Manage/bookManage/BookFolderInfoManage.ets +++ b/entry/src/main/ets/pages/view/bookShelf/Manage/bookManage/BookFolderInfoManage.ets @@ -1,3 +1,5 @@ +import { ThemeStorageKey } from '../../../../../common/constants/Theme' +import { ThemeItem } from '../../../../../common/model/Theme' import BookOverlay from '../../../../../componets/bookDetail/BookOverlay' import { BookGroups } from '../../../../../database/entities/BookGroups' @@ -10,6 +12,8 @@ export default struct BookFolderInfoManage { @Link checkGroup:Record @Prop isManage:boolean onSelect:Function = () => {} + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem build() { Flex( { @@ -60,7 +64,7 @@ export default struct BookFolderInfoManage { Checkbox() //判断是否存在当前id .select(this.group.groupId?this.checkGroup[this.group.groupId] ?? false:false) - .selectedColor($r('app.color.theme_color')) + .selectedColor(this.theme.mainColor) .onChange((val: boolean) => { if (this.group.groupId) { this.checkGroup[this.group.groupId] = val diff --git a/entry/src/main/ets/pages/view/bookShelf/Manage/bookManage/BookInfoGridManage.ets b/entry/src/main/ets/pages/view/bookShelf/Manage/bookManage/BookInfoGridManage.ets index 2fdfca57..deb527ec 100644 --- a/entry/src/main/ets/pages/view/bookShelf/Manage/bookManage/BookInfoGridManage.ets +++ b/entry/src/main/ets/pages/view/bookShelf/Manage/bookManage/BookInfoGridManage.ets @@ -1,5 +1,7 @@ import CommonConstants from '../../../../../common/constants/CommonConstants' import FontConstants from '../../../../../common/constants/FontConstants' +import { ThemeStorageKey } from '../../../../../common/constants/Theme' +import { ThemeItem } from '../../../../../common/model/Theme' import { Books } from '../../../../../database/entities/Books' @Component @@ -14,6 +16,8 @@ export default struct BookInfoGridManage{ @Link checkGroup:Record onSelect:Function = () => {} + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem build() { Column({ space:CommonConstants.SPACE_6 @@ -42,7 +46,7 @@ export default struct BookInfoGridManage{ this.onSelect() }) .select(this.bookData.id?this.checkGroup[this.bookData.id] ?? false:false) - .selectedColor($r('app.color.theme_color')) + .selectedColor(this.theme.mainColor) .unselectedColor('rgba(0, 0, 0, 0.35)') .zIndex(2) .onChange((val:boolean)=>{ diff --git a/entry/src/main/ets/pages/view/bookShelf/Manage/bookManage/BookInfoManage.ets b/entry/src/main/ets/pages/view/bookShelf/Manage/bookManage/BookInfoManage.ets index 4c1a0395..32e95791 100644 --- a/entry/src/main/ets/pages/view/bookShelf/Manage/bookManage/BookInfoManage.ets +++ b/entry/src/main/ets/pages/view/bookShelf/Manage/bookManage/BookInfoManage.ets @@ -1,4 +1,6 @@ import FontConstants from '../../../../../common/constants/FontConstants' +import { ThemeStorageKey } from '../../../../../common/constants/Theme' +import { ThemeItem } from '../../../../../common/model/Theme' import { Books } from '../../../../../database/entities/Books' @Component @@ -9,6 +11,8 @@ export default struct BookInfoManage{ @Prop bookData:Books @Link checkGroup:Record onSelect:Function = () => {} + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem build() { Flex( { @@ -89,7 +93,7 @@ export default struct BookInfoManage{ this.checkGroup[this.bookData.id] = val } }) - .selectedColor($r('app.color.theme_color')) + .selectedColor(this.theme.mainColor) .unselectedColor('rgba(0, 0, 0, 0.35)') } .padding({ left: 15, right: 15, bottom: 5, top: 5 }) diff --git a/entry/src/main/ets/pages/view/bookShelf/Manage/bookManage/newAddShelf.ets b/entry/src/main/ets/pages/view/bookShelf/Manage/bookManage/newAddShelf.ets index 944ed160..4fafc9cf 100644 --- a/entry/src/main/ets/pages/view/bookShelf/Manage/bookManage/newAddShelf.ets +++ b/entry/src/main/ets/pages/view/bookShelf/Manage/bookManage/newAddShelf.ets @@ -1,3 +1,5 @@ +import { ThemeStorageKey } from '../../../../../common/constants/Theme' +import { ThemeItem } from '../../../../../common/model/Theme' import { showMessage } from '../../../../../componets/common/promptShow' import groupTypeSearch from '../../../../../componets/group/GroupTypeSearch' import booksDao from '../../../../../database/dao/BooksDao' @@ -23,6 +25,9 @@ export default struct newAddShelf{ @State @Watch('getBookList')bookTypeNumber:number = 2 @State groupCoverShow: boolean = false @State @Watch('searchBook')searchBookList:number[] = [] + + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem //用于分组弹窗添加书籍 searchBook(){ if (this.searchBookList.length === 0 ) return @@ -159,11 +164,11 @@ export default struct newAddShelf{ Row(){ Text('添加').fontSize(16) .fontWeight(400) - .fontColor(this.selectBookIdList.length === 0?'rgba(252, 102, 0, 0.5)':$r('app.color.theme_color')) + .fontColor(this.selectBookIdList.length === 0?this.theme.secondColor:this.theme.mainColor) Text(`(${this.selectBookIdList.length??0})`) .fontSize(16) .fontWeight(400) - .fontColor(this.selectBookIdList.length === 0?'rgba(252, 102, 0, 0.5)':$r('app.color.theme_color')) + .fontColor(this.selectBookIdList.length === 0?this.theme.secondColor:this.theme.mainColor) } .justifyContent(FlexAlign.Center) .width('50%') diff --git a/entry/src/main/ets/pages/view/bookShelf/Manage/bookManage/newBookShelf.ets b/entry/src/main/ets/pages/view/bookShelf/Manage/bookManage/newBookShelf.ets index 218dd77d..323afff6 100644 --- a/entry/src/main/ets/pages/view/bookShelf/Manage/bookManage/newBookShelf.ets +++ b/entry/src/main/ets/pages/view/bookShelf/Manage/bookManage/newBookShelf.ets @@ -3,6 +3,8 @@ */ import CommonConstants from '../../../../../common/constants/CommonConstants' import PaddingConstants from '../../../../../common/constants/PaddingConstants' +import { ThemeStorageKey } from '../../../../../common/constants/Theme' +import { ThemeItem } from '../../../../../common/model/Theme' import worksListsUtils from '../../../../../common/utils/WorksListsUtils' import confirmDialogExample from '../../../../../componets/common/confirmDialog' import { showMessage } from '../../../../../componets/common/promptShow' @@ -121,6 +123,8 @@ export default struct newBookShelf{ isTop: false, worksBookList:[] } + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem build() { Flex({ @@ -198,7 +202,7 @@ export default struct newBookShelf{ .placeholderColor('#73000000') .maxLength(20) .placeholderFont({ size: 14, weight: 400 }) - .caretColor('#FF6600') + .caretColor(this.theme.mainColor) .height(38) .margin({ top: 10, bottom: 10 }) .fontSize(14) @@ -220,7 +224,7 @@ export default struct newBookShelf{ }) .borderRadius(4) .fontColor('#E0000000') - .caretColor('#FF6600') + .caretColor(this.theme.mainColor) .placeholderColor('#73000000') .width('80%') .fontSize(14) @@ -346,7 +350,7 @@ export default struct newBookShelf{ .borderRadius(20) .width('50%') .height(38) - .backgroundColor(this.workBookList.worksName.length >=1?$r('app.color.theme_color'):'rgba(252, 102, 0, 0.5)') + .backgroundColor(this.workBookList.worksName.length >=1?this.theme.mainColor: this.theme.mainColor) }.padding({top:12,bottom:12,left:20,right:20}) } @@ -408,9 +412,9 @@ export default struct newBookShelf{ space:6 }){ Row(){ - Text('卖报小郎君').fontSize(10).fontWeight(400).fontColor($r('app.color.theme_color')) + Text('卖报小郎君').fontSize(10).fontWeight(400).fontColor(this.theme.mainColor) } - .padding({left:6,right:6,top:5,bottom:5}).backgroundColor('rgba(255, 102, 0, 0.12)').borderRadius(10) + .padding({left:6,right:6,top:5,bottom:5}).backgroundColor(this.theme.secondColor).borderRadius(10) Row(){ Text('玄幻').fontSize(10).fontWeight(400).fontColor('rgba(0, 0, 0, 0.45)') } @@ -451,7 +455,7 @@ export default struct newBookShelf{ Flex({ justifyContent:FlexAlign.End }){ - Text('清空').textAlign(TextAlign.End).fontColor($r('app.color.theme_color')) + Text('清空').textAlign(TextAlign.End).fontColor(this.theme.mainColor) }.onClick(()=>{ this.TextRecommend[book.id ?? 0] = '' }) diff --git a/entry/src/main/ets/pages/view/bookShelf/Manage/components/catalogAddShelf.ets b/entry/src/main/ets/pages/view/bookShelf/Manage/components/catalogAddShelf.ets index f1effc8b..9c393a8f 100644 --- a/entry/src/main/ets/pages/view/bookShelf/Manage/components/catalogAddShelf.ets +++ b/entry/src/main/ets/pages/view/bookShelf/Manage/components/catalogAddShelf.ets @@ -5,6 +5,8 @@ * 加入书单弹窗 */ import CommonConstants from '../../../../../common/constants/CommonConstants' +import { ThemeStorageKey } from '../../../../../common/constants/Theme' +import { ThemeItem } from '../../../../../common/model/Theme' import bookGroupUtil from '../../../../../common/utils/bookGroupUtils' import worksListsUtils from '../../../../../common/utils/WorksListsUtils' import { showMessage } from '../../../../../componets/common/promptShow' @@ -24,6 +26,8 @@ export default struct catalogAddShelf{ @State worksBook:WorksLists = new WorksLists() @State worksLists:WorksLists[] =[] @State newBookIds:number[] = [] + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem getWorkLists() { worksListsDao.search({ type:this.currentIndex @@ -139,8 +143,8 @@ export default struct catalogAddShelf{ Row({ space:12 }){ - Image($r('app.media.add')).width(24).fillColor($r('app.color.theme_color')) - Text('新建书单').fontSize(14).fontColor($r('app.color.theme_color')).fontWeight(400).lineHeight(22) + Image($r('app.media.add')).width(24).fillColor(this.theme.mainColor) + Text('新建书单').fontSize(14).fontColor(this.theme.mainColor).fontWeight(400).lineHeight(22) }.onClick(()=>{ this.workBookListStatus = 0 this.isShowEditBook = true diff --git a/entry/src/main/ets/pages/view/bookShelf/Shelf/WorksBookListGrid.ets b/entry/src/main/ets/pages/view/bookShelf/Shelf/WorksBookListGrid.ets index cc367677..2c859f76 100644 --- a/entry/src/main/ets/pages/view/bookShelf/Shelf/WorksBookListGrid.ets +++ b/entry/src/main/ets/pages/view/bookShelf/Shelf/WorksBookListGrid.ets @@ -1,3 +1,5 @@ +import { ThemeStorageKey } from '../../../../common/constants/Theme' +import { ThemeItem } from '../../../../common/model/Theme' import { WorksLists } from '../../../../database/entities/WorksLists' @Component @@ -7,6 +9,8 @@ export default struct WorksBookListGrid { @Prop isShowCheck:boolean @Link checkGroup:Record onSelect:Function = () => {} + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem build() { Column() { Stack() { @@ -17,10 +21,10 @@ export default struct WorksBookListGrid { }){ Checkbox() .zIndex(2) - .selectedColor($r('app.color.theme_color')) + .selectedColor(this.theme.mainColor) .unselectedColor('rgba(0, 0, 0, 0.35)') .select(this.work.worksId?this.checkGroup[this.work.worksId] ?? false:false) - .selectedColor($r('app.color.theme_color')) + .selectedColor(this.theme.mainColor) .onChange((val: boolean) => { if (this.work.worksId) { this.checkGroup[this.work.worksId] = val diff --git a/entry/src/main/ets/pages/view/bookShelf/Shelf/WorksBookListInfo.ets b/entry/src/main/ets/pages/view/bookShelf/Shelf/WorksBookListInfo.ets index ac263b7f..1acd79c2 100644 --- a/entry/src/main/ets/pages/view/bookShelf/Shelf/WorksBookListInfo.ets +++ b/entry/src/main/ets/pages/view/bookShelf/Shelf/WorksBookListInfo.ets @@ -1,6 +1,8 @@ /** * 书单信息 */ +import { ThemeStorageKey } from '../../../../common/constants/Theme' +import { ThemeItem } from '../../../../common/model/Theme' import BookOverlay from '../../../../componets/bookDetail/BookOverlay' import { WorksLists } from '../../../../database/entities/WorksLists' @@ -11,6 +13,8 @@ export default struct WorksBookListInfo{ @Prop work:WorksLists @Prop isShowCheck:boolean onSelect:Function = () => {} + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem build() { Flex( { @@ -62,7 +66,7 @@ export default struct WorksBookListInfo{ if (this.isShowCheck){ Row() { Checkbox() - .selectedColor($r('app.color.theme_color')) + .selectedColor(this.theme.mainColor) .select(this.work.worksId?this.checkGroup[this.work.worksId] ?? false:false) .onChange((val: boolean) => { if (this.work.worksId) { diff --git a/entry/src/main/ets/pages/view/bookShelf/components/BookContent.ets b/entry/src/main/ets/pages/view/bookShelf/components/BookContent.ets index 05bf8791..a74a4d6f 100644 --- a/entry/src/main/ets/pages/view/bookShelf/components/BookContent.ets +++ b/entry/src/main/ets/pages/view/bookShelf/components/BookContent.ets @@ -1,4 +1,6 @@ +import { ThemeStorageKey } from '../../../../common/constants/Theme' import BasicDataSource from '../../../../common/LazyIDataSource/BasicDataSource' +import { ThemeItem } from '../../../../common/model/Theme' import booksDao from '../../../../database/dao/BooksDao' import { Books } from '../../../../database/entities/Books' import BookInfoGrids from './BookInfoGrids' @@ -66,6 +68,8 @@ export default struct BookContent { @State isLoading: boolean = false @State currentPage:number = 1 + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem async loadMoreBooks() { if (!this.isLoading) { this.isLoading = true; @@ -87,7 +91,7 @@ export default struct BookContent { if (this.isLoading) { Row(){ LoadingProgress() - .color(0xff6600) + .color(this.theme.mainColor) .width('50%') Text('加载中...') } diff --git a/entry/src/main/ets/pages/view/bookShelf/components/dialog/BookManageDialog.ets b/entry/src/main/ets/pages/view/bookShelf/components/dialog/BookManageDialog.ets index a81d69c3..854cb733 100644 --- a/entry/src/main/ets/pages/view/bookShelf/components/dialog/BookManageDialog.ets +++ b/entry/src/main/ets/pages/view/bookShelf/components/dialog/BookManageDialog.ets @@ -20,6 +20,8 @@ import WorksBookLists from '../../Shelf/WorksBookLists'; import { WorksLists } from '../../../../../database/entities/WorksLists'; import worksListsDao from '../../../../../database/dao/WorksListsDao'; import worksListsUtils from '../../../../../common/utils/WorksListsUtils'; +import { ThemeItem } from '../../../../../common/model/Theme'; +import { ThemeStorageKey } from '../../../../../common/constants/Theme'; /** @@ -239,6 +241,8 @@ export default struct BookManageDialog { } @State titleManage:string = '最近阅读' @State searchValue: string = '最近阅读' + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem @Builder headTitleManage(){ Flex( { @@ -319,7 +323,7 @@ export default struct BookManageDialog { }) { Checkbox() .select(this.allCheck) - .selectedColor(0xff6600) + .selectedColor(this.theme.mainColor) .onClick(() => { if (this.verificationDate()) { return diff --git a/entry/src/main/ets/pages/view/bookShelf/components/dialog/coverInfoDialog.ets b/entry/src/main/ets/pages/view/bookShelf/components/dialog/coverInfoDialog.ets index e21942fb..2c453a2a 100644 --- a/entry/src/main/ets/pages/view/bookShelf/components/dialog/coverInfoDialog.ets +++ b/entry/src/main/ets/pages/view/bookShelf/components/dialog/coverInfoDialog.ets @@ -4,6 +4,8 @@ import { BookGroups } from '../../../../../database/entities/BookGroups' import { showMessage } from '../../../../../componets/common/promptShow' import buttonCommon from '../../../../../componets/common/buttonCommon' import bookGroupUtil from '../../../../../common/utils/bookGroupUtils' +import { ThemeItem } from '../../../../../common/model/Theme' +import { ThemeStorageKey } from '../../../../../common/constants/Theme' @CustomDialog /** @@ -22,6 +24,8 @@ export default struct coverInfoDialog{ this.coverImages = this.itemData.coverUrl??'' } @State coverFolder:boolean = false + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem build() { Column(){ Flex({ @@ -81,7 +85,7 @@ export default struct coverInfoDialog{ justifyContent:FlexAlign.SpaceBetween }) { Column(){ - Text('取消').fontSize(16).fontWeight(400).fontColor($r('app.color.theme_color')) + Text('取消').fontSize(16).fontWeight(400).fontColor(this.theme.mainColor) .lineHeight(24) .padding({left:32,right:32,bottom:8,top:8}) } @@ -91,7 +95,7 @@ export default struct coverInfoDialog{ .width('49%') .borderRadius(20) .alignItems(HorizontalAlign.Center) - .backgroundColor('rgba(255, 102, 0, 0.12)') + .backgroundColor(this.theme.secondColor) Column(){ Text('确定') .fontSize(16) @@ -111,7 +115,7 @@ export default struct coverInfoDialog{ .width('49%') .borderRadius(20) .alignItems(HorizontalAlign.Center) - .backgroundColor($r('app.color.theme_color')) + .backgroundColor(this.theme.mainColor) } } .alignItems(HorizontalAlign.Center) diff --git a/entry/src/main/ets/pages/view/coverInfoImageShow.ets b/entry/src/main/ets/pages/view/coverInfoImageShow.ets index d62b1958..24d4cea5 100644 --- a/entry/src/main/ets/pages/view/coverInfoImageShow.ets +++ b/entry/src/main/ets/pages/view/coverInfoImageShow.ets @@ -4,6 +4,8 @@ * @className: coverInfoImageShow */ import CommonConstants from '../../common/constants/CommonConstants' +import { ThemeStorageKey } from '../../common/constants/Theme' +import { ThemeItem } from '../../common/model/Theme' import BookOverlay from '../../componets/bookDetail/BookOverlay' @Component @@ -13,6 +15,8 @@ export default struct coverInfoImageShow { @Prop imageString:string @Prop selectImage:number = 0 onSelectImageNumber:Function = (_selectImage:number)=>{} + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem build() { if (this.coverCount === 1){ this.coverImageOne(this.image) @@ -44,7 +48,7 @@ export default struct coverInfoImageShow { Radio({value:JSON.stringify('0'),group:'radioGroup'}) .checked(this.selectImage === 0) .radioStyle({ - checkedBackgroundColor: $r('app.color.theme_color') + checkedBackgroundColor: this.theme.mainColor }) .border({width:2,color:'rgba(255, 255, 255, 0.10)'}) .width(20).height(20) @@ -100,7 +104,7 @@ export default struct coverInfoImageShow { Radio({value:JSON.stringify('1'),group:'radioGroup'}) .checked(this.selectImage === 1) .radioStyle({ - checkedBackgroundColor: $r('app.color.theme_color') + checkedBackgroundColor: this.theme.mainColor }) .border({width:2,color:'rgba(255, 255, 255, 0.10)'}) .width(20).height(20) @@ -138,7 +142,7 @@ export default struct coverInfoImageShow { Radio({value:JSON.stringify('2'),group:'radioGroup'}) .checked(this.selectImage === 2) .radioStyle({ - checkedBackgroundColor: $r('app.color.theme_color') + checkedBackgroundColor: this.theme.mainColor }) .border({width:2,color:'rgba(255, 255, 255, 0.10)'}) .width(20).height(20) diff --git a/entry/src/main/ets/pages/view/dialog/RenameDialog.ets b/entry/src/main/ets/pages/view/dialog/RenameDialog.ets index d9285700..9634fa6c 100644 --- a/entry/src/main/ets/pages/view/dialog/RenameDialog.ets +++ b/entry/src/main/ets/pages/view/dialog/RenameDialog.ets @@ -1,3 +1,6 @@ +import { ThemeStorageKey } from "../../../common/constants/Theme" +import { ThemeItem } from "../../../common/model/Theme" + /** * @author 惟草木之零落兮 * @date 2024/5/26 16:22 @@ -17,6 +20,9 @@ export default struct RenameDialog{ confirm?: (value: string)=>void + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem + @Styles buttonStyles(){ .height(38) .padding({left: 32, right: 32, top: 8, bottom: 8}) @@ -41,7 +47,7 @@ export default struct RenameDialog{ .padding({left: 20, right:20, top: 8, bottom: 8}) .height(38) .maxLength(4) - .caretColor("rgba(255, 102, 0, 1)") + .caretColor(this.theme.mainColor) .onChange((value: string)=>{ if (value.length > 4){ // value 截取前四个 @@ -73,8 +79,8 @@ export default struct RenameDialog{ Button("取消") .buttonStyles() .margin({left: 24}) - .fontWeight(500).fontSize(14).fontColor("#FF6600") - .backgroundColor("rgba(255, 102, 0, 0.12)") + .fontWeight(500).fontSize(14).fontColor(this.theme.mainColor) + .backgroundColor(this.theme.secondColor) .onClick(()=>{ this.controller?.close() }) @@ -85,7 +91,7 @@ export default struct RenameDialog{ .buttonStyles() .margin({right: 24}) .fontWeight(500).fontSize(14).fontColor("rgba(255, 255, 255, 1)") - .backgroundColor("rgba(255, 102, 0, 1)") + .backgroundColor(this.theme.mainColor) .onClick(()=>{ if (this.confirm) this.confirm(this.newName) this.controller?.close() diff --git a/entry/src/main/ets/pages/view/myCenter/CreateCustomTheme.ets b/entry/src/main/ets/pages/view/myCenter/CreateCustomTheme.ets new file mode 100644 index 00000000..fe14f538 --- /dev/null +++ b/entry/src/main/ets/pages/view/myCenter/CreateCustomTheme.ets @@ -0,0 +1,177 @@ +import { componentSnapshot, promptAction, router } from '@kit.ArkUI' +import { image } from '@kit.ImageKit' +import { emitter } from '@kit.BasicServicesKit' +import { ThemeColor, ThemeStorageKey } from '../../../common/constants/Theme' +import { ThemeColorItem, ThemeItem } from '../../../common/model/Theme' +import { themeManager } from '../../../common/utils/ThemeManager' +import { sleep } from '../../../common/utils/utils' + +@Entry +@Component +struct CreateCustomTheme { + @StorageLink('topRectHeight') topRectHeight: number = 0 + @StorageLink('bottomRectHeight') bottomRectHeight: number = 0 + // 颜色列表 + colorList: ThemeColorItem[] = [ + ThemeColor.RED, + ThemeColor.ORANGE, + ThemeColor.BLUE, + ThemeColor.GREEN, + ThemeColor.YELLOW, + ] + @StorageProp('screen_shot') previewIndexPage: PixelMap = {} as PixelMap + @State activeIndex: number = 0 + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem + originTheme: ThemeItem = {} as ThemeItem + selectTheme: ThemeItem = {} as ThemeItem + @State themeName: string = '新建主题' + + aboutToAppear(): void { + this.originTheme = this.theme // 暂存原主题配置信息 + this.selectTheme = this.theme + } + + aboutToDisappear() { + themeManager.setTheme(this.originTheme, AppStorage.get(ThemeStorageKey.THEMEINDEX) as number) + } + + build() { + Column() { + // 头部标题栏 + RelativeContainer() { + Image($r('sys.media.ohos_ic_public_arrow_left')) + .width(24) + .aspectRatio(1) + .alignRules({ + center: { anchor: '__container__', align: VerticalAlign.Center }, + left: { anchor: '__container__', align: HorizontalAlign.Start } + }) + .onClick(() => { + themeManager.setTheme(this.originTheme, AppStorage.get(ThemeStorageKey.THEMEINDEX) as number) + router.back() + }) + Row({space: 8}) { + TextInput({text: $$this.themeName}) + .height(24) + .lineHeight(24) + .fontSize(16) + .fontWeight(FontWeight.Bold) + .onSubmit(() => { + this.selectTheme.text = this.themeName + }) + .padding(0) + .width(75) + .backgroundColor(Color.Transparent) + Image($r('app.media.writing')) + .width(16) + .aspectRatio(1) + .fillColor(Color.Black) + } + .layoutWeight(1) + .alignItems(VerticalAlign.Center) + .height(24) + .alignRules({ + center: { anchor: '__container__', align: VerticalAlign.Center }, + middle: { anchor: '__container__', align: HorizontalAlign.Center } + }) + + Text('保存') + .fontSize(14) + .height(22) + .alignRules({ + center: { anchor: '__container__', align: VerticalAlign.Center }, + right: { anchor: '__container__', align: HorizontalAlign.End } + }) + .onClick(() => { + themeManager.setTheme(this.originTheme, AppStorage.get(ThemeStorageKey.THEMEINDEX) as number) + this.selectTheme.text = this.themeName + themeManager.addTheme(this.selectTheme) + router.back() + }) + + } + .padding({ + left: 20, + right: 20, + top: 12, + bottom: 12 + }) + .width('100%') + .height(48) + .backgroundColor('#fff') + + // 截图区 + Column() { + Image(this.previewIndexPage) + .width(240) + .backgroundColor('#ffdfca') + .objectFit(ImageFit.Cover) + } + .width('100%') + .layoutWeight(1) + .padding({left: 60, right: 60, top: 72, bottom: 88}) + .backgroundColor('#f5f5f5') + + // 底部选色区 + Row({space: 12}) { + Row() { + Image($r('app.media.my_theme_config_custom')) + .width(16) + .aspectRatio(1) + .fillColor('#858585') + } + .justifyContent(FlexAlign.Center) + .alignItems(VerticalAlign.Center) + .width(40) + .aspectRatio(1) + .borderRadius(20) + .backgroundColor('#f0f0f0') + + Column() { + + } + .height(40) + .width(1) + .backgroundColor('#f0f0f0') + + Scroll() { + Row({space: 12}) { + ForEach(this.colorList, (item: ThemeItem, index) => { + Row() { + + } + .width(40) + .aspectRatio(1) + .borderRadius(20) + .backgroundColor(item.mainColor) + .onClick(async () => { + let count = 10 + while (count--) { + themeManager.setTheme(item, AppStorage.get(ThemeStorageKey.THEMEINDEX) as number) + this.selectTheme = item + emitter.emit('screen_shot'); // 触发首页截图 + this.previewIndexPage = AppStorage.get('screen_shot') as PixelMap + await sleep(100) + } + }) + }) + } + .height('100%') + } + .scrollable(ScrollDirection.Horizontal) + .scrollBar(BarState.Off) + .height('100%') + } + .height(72) + .width('100%') + .backgroundColor('#fff') + .padding({left: 20, right: 20, top: 16, bottom: 16}) + + } + .width('100%') + .height('100%') + .padding({top: this.topRectHeight, bottom: this.bottomRectHeight}) + .backgroundColor('#fff') + } +} \ No newline at end of file diff --git a/entry/src/main/ets/pages/view/myCenter/MyCenter.ets b/entry/src/main/ets/pages/view/myCenter/MyCenter.ets index 07292acc..9629ca66 100644 --- a/entry/src/main/ets/pages/view/myCenter/MyCenter.ets +++ b/entry/src/main/ets/pages/view/myCenter/MyCenter.ets @@ -5,6 +5,11 @@ import { promptAction } from '@kit.ArkUI' import { dataItem } from '../../../componets/dataList/dataItem' import { PublicConstants, TextConstants } from '../../../common/constants/PublicConstants' import { ColumnModifier } from '../../../common/utils/ComponetModifier' +import { ThemeStorageKey } from '../../../common/constants/Theme' +import { ThemeItem } from '../../../common/model/Theme' +import { image } from '@kit.ImageKit' +import { resourceManager } from '@kit.LocalizationKit' +import { BusinessError } from '@kit.BasicServicesKit' @Entry @Component @@ -32,6 +37,10 @@ export default struct MyCenter { ] @StorageLink('topRectHeight') topRectHeight: number = 0 Column = new ColumnModifier() + + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem + build() { Column(){ // Blank(this.topRectHeight-20) @@ -144,12 +153,10 @@ export default struct MyCenter { .attributeModifier(this.Column) .linearGradient({ direction: GradientDirection.Bottom, // 渐变方向 - colors: [["rgb(254, 203, 169)", 0.0], ["RGB(245, 245, 245)", 0.2]] // 数组末尾元素占比小于1时满足重复着色效果 + colors: [[this.theme.mainColor , 0.0], [this.theme.secondColor, 0.2]] // 数组末尾元素占比小于1时满足重复着色效果 }) - } - - + //切换夜间模式 night_onclick(){ @@ -185,7 +192,11 @@ export default struct MyCenter { url: 'pages/view/myCenter/cloudDisk' }) break + // 点击主题 case 2: + router.pushUrl({ + url: '/pages/view/myCenter/MyThemeConfig'.slice(1) + }) break case 3: break diff --git a/entry/src/main/ets/pages/view/myCenter/MyThemeConfig.ets b/entry/src/main/ets/pages/view/myCenter/MyThemeConfig.ets new file mode 100644 index 00000000..ef7cb44f --- /dev/null +++ b/entry/src/main/ets/pages/view/myCenter/MyThemeConfig.ets @@ -0,0 +1,145 @@ +import { PromptAction, router } from '@kit.ArkUI' +import { ThemeColor, ThemeStorageKey } from '../../../common/constants/Theme' +import { ThemeColorItem, ThemeItem } from '../../../common/model/Theme' +import { MyThemeConfigComp } from './MyThemeConfigComp' + +// 中间导航区需要渲染的元素列表 +interface NavItem { + text: string + img: ResourceStr +} + +@Entry +@Component +struct MyThemeConfig { + @StorageLink('topRectHeight') topRectHeight: number = 0 + // 中间导航区需要渲染的元素列表 + navList: NavItem[] = [ + {text: '个性主题', img: $r('app.media.my_theme_config_theme')}, + {text: '桌面图标', img: $r('app.media.my_theme_config_desktop')}, + {text: '启动页', img: $r('app.media.my_theme_config_welcome')}, + ] + @State activeNavIndex: number = 0 // 标记当前激活的导航元素 [个性主题 / 桌面图标 / 启动页] 0 1 2 + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem + + // 构建中间导航区TabBar元素 + @Builder + tabBarBuilder(item: NavItem, index: number) { + // 最外层包一层Column(用于设置左右间距), 然后设置左右padding + // 如果不包这一层, 直接用第二层的Column的左右margin设置左右间距好像无效 + Column() { + Column() { + Image(item.img) + .width(24) + .aspectRatio(1) + .fillColor(this.activeNavIndex == index ? Color.White : this.theme.mainColor) + .margin({bottom: 8}) + Text(item.text) + .lineHeight(20) + .fontSize(12) + .fontColor(this.activeNavIndex == index ? Color.White : '#978b83') + // 选中的tab底部会有三角形的效果 + if (this.activeNavIndex == index) { + // 边缘光滑版三角形 + // Path() + // .width(vp2px(18)) + // .height(vp2px(6)) + // .commands('M0 0 L' + vp2px(18) + ' 0 S' + vp2px(9) + ' ' + vp2px(6) + ' 0 0 Z') + // .fill('#ff6600') + // .stroke('#ff6600') + // .position({left: '50%', bottom: 0}) + // .translate({x: -9, y: '100%'}) + + // 正常边缘三角形 + Polygon({ width: 18, height: 6 }) + .points([[0, 0], [9, 6], [18, 0]]) + .fill(Color.Green) + .fill(this.theme.mainColor) + .position({left: '50%', bottom: 0}) + .translate({x: '-50%', y: '100%'}) + } + } + .padding({left: 24, right: 24, top: 12}) + .backgroundColor(this.activeNavIndex == index ? this.theme.mainColor : this.theme.secondColor) + .borderRadius(8) + .width(96) + .height(78) + .margin({bottom: 10}) + } + .padding({ + left: index == 0 ? 20 : 0, + right: index == this.navList.length - 1 ? 20 : 0 + }) + } + + build() { + Column() { + // 头部标题栏 + RelativeContainer() { + Image($r('sys.media.ohos_ic_public_arrow_left')) + .width(24) + .aspectRatio(1) + .alignRules({ + center: {anchor: '__container__', align: VerticalAlign.Center}, + left: {anchor: '__container__', align: HorizontalAlign.Start} + }) + .onClick(() => { + router.back() + }) + Text('主题') + .fontWeight(FontWeight.Bold) + .alignRules({ + center: {anchor: '__container__', align: VerticalAlign.Center}, + middle: {anchor: '__container__', align: HorizontalAlign.Center} + }) + } + .padding({left: 20, right: 20, top: 12, bottom: 12}) + .width('100%') + .height(48) + + // 中间导航区 + Tabs({barPosition: BarPosition.Start}) { + ForEach(this.navList, (item: NavItem, index) => { + TabContent() { + Column() { + // 如果选中个性主题 + if (index == 0) { + MyThemeConfigComp() + } + // 如果选中桌面图标 + else if (index == 1) { + + } + // 如果选中启动页 + else { + + } + } + .padding({left: 20, right: 20, top: 24}) + .borderRadius({ + topLeft: 12, + topRight: 12 + }) + .backgroundColor('#fff') + .width('100%') + } + .tabBar(this.tabBarBuilder(item, index)) + }) + } + // 处理点击tab切换逻辑 + .onTabBarClick((index) => { + this.activeNavIndex = index + }) + .scrollable(false) + .width('100%') + .barHeight(98) + .backgroundColor('#f5f5f5') + } + .height('100%') + .width('100%') + .padding({top: this.topRectHeight}) + .backgroundColor('#f5f5f5') + + } +} diff --git a/entry/src/main/ets/pages/view/myCenter/MyThemeConfigComp.ets b/entry/src/main/ets/pages/view/myCenter/MyThemeConfigComp.ets new file mode 100644 index 00000000..df6353dc --- /dev/null +++ b/entry/src/main/ets/pages/view/myCenter/MyThemeConfigComp.ets @@ -0,0 +1,166 @@ +import { ThemeColor, ThemeStorageKey } from '../../../common/constants/Theme' +import { ThemeItem } from '../../../common/model/Theme' +import { promptAction, PromptAction, router } from '@kit.ArkUI' +import { themeManager } from '../../../common/utils/ThemeManager' +import { JSON } from '@kit.ArkTS' + +// 个性主题组件模块 +@Component +export struct MyThemeConfigComp { + @StorageProp(ThemeStorageKey.THEMEINDEX) + activeIndex: number = 0 // 被选中的主题 + @State longPressGestureIndex: number = 0 // 长按选中主题 + + @StorageProp(ThemeStorageKey.THEMELIST) + themeList: ThemeItem[] = [] + + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem + + dialog: CustomDialogController = new CustomDialogController({ + builder: this.dialogBuilder, + customStyle: true, + alignment: DialogAlignment.Center, + autoCancel: false + }) + + // 构建自定义弹窗 + @Builder + dialogBuilder() { + Column({space: 24}) { + Text('确定要删除吗?') + .fontSize(18) + .fontWeight(FontWeight.Bold) + + Row({space: 12}) { + Button('取消') + .fontSize(14) + .fontColor(this.theme.mainColor) + .backgroundColor(this.theme.secondColor) + .onClick(() => { + this.dialog.close() + }) + .width(112) + .height(38) + Button('确定') + .fontSize(14) + .fontColor(Color.White) + .backgroundColor(this.theme.mainColor) + .onClick(() => { + if (this.themeList.length > 1) { + themeManager.deleteTheme(this.longPressGestureIndex) + } else { + promptAction.showToast({message: "删除失败,至少需要保留一个主题"}) + } + this.dialog.close() + }) + .width(112) + .height(38) + } + .justifyContent(FlexAlign.Center) + + } + .padding(24) + .width(284) + .height(136) + .justifyContent(FlexAlign.Center) + .alignItems(HorizontalAlign.Center) + .backgroundColor(Color.White) + .borderRadius(32) + } + + // 构建个性主题下列表元素 + @Builder + themeItemBuilder(item: ThemeItem, index: number) { + Column({space: 8}) { + Column() { + if (this.activeIndex == index) { + Text('使用中') + .fontSize(9) + .fontColor('#fff') + .backgroundColor('#ef4444') + .textAlign(TextAlign.Center) + .lineHeight(14) + .width(39) + .height(14) + .borderRadius({ + topRight: 8, + bottomLeft: 8 + }) + .position({right: 0, top: 0}) + } + } + .width(154) + .height(77) + .borderRadius(8) + .backgroundColor(item.mainColor) + + Text(item.text) + .fontSize(14) + .height(22) + .lineHeight(22) + .width('100%') + } + .width(154) + .height(107) + } + + build() { + Column() { + Grid() { + // 自定义主题 + GridItem() { + Column({space: 8}) { + Column() { + Image($r('app.media.my_theme_config_custom')) + .width(24) + .aspectRatio(1) + } + .alignItems(HorizontalAlign.Center) + .justifyContent(FlexAlign.Center) + .width(154) + .height(77) + .borderRadius(8) + .backgroundColor('#f5f5f5') + .onClick(() => { + router.pushUrl({ + url: '/pages/view/myCenter/CreateCustomTheme'.slice(1) + }) + }) + + Text('自定义主题') + .fontSize(14) + .height(22) + .lineHeight(22) + .width('100%') + } + .width(154) + .height(107) + } + ForEach(this.themeList, (item: ThemeItem, index) => { + GridItem() { + this.themeItemBuilder(item, index) + } + .onClick(() => { + this.activeIndex = index + themeManager.setTheme(this.themeList[index], index) + }) + .gesture( + LongPressGesture() + .onAction(() => { + this.dialog.open() + this.longPressGestureIndex = index + }) + ) + }) + } + .columnsTemplate('1fr 1fr') + .columnsGap(12) + .rowsGap(12) + .width('100%') + .height('100%') + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/entry/src/main/ets/pages/view/myCenter/WebDav.ets b/entry/src/main/ets/pages/view/myCenter/WebDav.ets index 59bdfd88..fb1096fa 100644 --- a/entry/src/main/ets/pages/view/myCenter/WebDav.ets +++ b/entry/src/main/ets/pages/view/myCenter/WebDav.ets @@ -5,6 +5,8 @@ import web_webview from '@ohos.web.webview' import { promptAction, router } from '@kit.ArkUI'; import { ColumnModifier } from '../../../common/utils/ComponetModifier'; +import { ThemeItem } from '../../../common/model/Theme'; +import { ThemeStorageKey } from '../../../common/constants/Theme'; @Entry @Component @@ -17,6 +19,8 @@ struct WebDav{ new Input_items("","账号",InputType.Email||InputType.PhoneNumber), new Input_items("","密码",InputType.Password) ] + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem @State helper_status:boolean=false controller: web_webview.WebviewController = new web_webview.WebviewController() Column = new ColumnModifier().setPadding(0,0) @@ -91,7 +95,7 @@ struct WebDav{ //查看帮助 Column(){ Text("不会填写?查看帮助") - .fontColor("rgba(255, 149, 0, 1)") + .fontColor(this.theme.mainColor) .fontSize(14) }.bindSheet($$this.helper_status,this.helper,{ height:600, diff --git a/entry/src/main/ets/pages/view/myCenter/aboutUs/versionLogPage.ets b/entry/src/main/ets/pages/view/myCenter/aboutUs/versionLogPage.ets index 2b53695d..0c843195 100644 --- a/entry/src/main/ets/pages/view/myCenter/aboutUs/versionLogPage.ets +++ b/entry/src/main/ets/pages/view/myCenter/aboutUs/versionLogPage.ets @@ -1,4 +1,6 @@ import { router } from '@kit.ArkUI'; +import { ThemeStorageKey } from '../../../../common/constants/Theme'; +import { ThemeItem } from '../../../../common/model/Theme'; @Entry @Component @@ -9,6 +11,8 @@ struct VersionLogPage { '更新icon图标', '关于我们-QQ群增加Beta群', ] + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem build() { Column({ space: 16 }) { @@ -59,7 +63,7 @@ struct VersionLogPage { Column() { Row() { Line({ width: 4, height: 16 }) - .backgroundColor('#FF6600') + .backgroundColor(this.theme.mainColor) .margin({ right: 8 }) Text(version) .lineHeight(24) diff --git a/entry/src/main/ets/pages/view/myCenter/cloudDisk.ets b/entry/src/main/ets/pages/view/myCenter/cloudDisk.ets index 7bd879b0..1c5c890d 100644 --- a/entry/src/main/ets/pages/view/myCenter/cloudDisk.ets +++ b/entry/src/main/ets/pages/view/myCenter/cloudDisk.ets @@ -4,6 +4,8 @@ import { MyCenterTitle } from '../../../componets/myCenter/MyCenterTitle'; import { cloudDisKBindSheetComponet } from '../../../componets/myCenter/cloudDisKBindSheetComponet'; import { ColumnModifier } from '../../../common/utils/ComponetModifier'; import { PublicConstants, TextConstants } from '../../../common/constants/PublicConstants'; +import { ThemeItem } from '../../../common/model/Theme'; +import { ThemeStorageKey } from '../../../common/constants/Theme'; @Entry @Component @@ -49,7 +51,8 @@ struct CloudDisk { @State zipDataIndex:number=0 @State deviceDataIndex:number=0 @State isShow:boolean=false - + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem @Builder backups_item(item:dataItem){ Row(){ @@ -119,8 +122,8 @@ struct CloudDisk { .size({width:320,height:200}) Row({space:20}) { - this.button("取消",[$r('app.color.theme_color'),'rgba(255,120,0,0.12)'],()=>{this.bindSheetCancel(this.isShow)}) - this.button("确定",[PublicConstants.THEME_COLOR_WHITE,$r('app.color.theme_color')],()=>{this.bindSheetConfirm(this.isShow)}) + this.button("取消",[this.theme.mainColor,this.theme.secondColor],()=>{this.bindSheetCancel(this.isShow)}) + this.button("确定",[PublicConstants.THEME_COLOR_WHITE,this.theme.mainColor],()=>{this.bindSheetConfirm(this.isShow)}) }.height(40) .width("100%") @@ -174,7 +177,7 @@ struct CloudDisk { this.backups_botton() } .margin({top:32,bottom:42}) - .backgroundColor(PublicConstants.THEME_COLOR) + .backgroundColor(this.theme.mainColor) .onClick(()=>{this.backups_onClick()}) } //备份设置 diff --git a/entry/src/main/ets/pages/view/myCenter/diskSet.ets b/entry/src/main/ets/pages/view/myCenter/diskSet.ets index 2dedb5d8..074bd1c8 100644 --- a/entry/src/main/ets/pages/view/myCenter/diskSet.ets +++ b/entry/src/main/ets/pages/view/myCenter/diskSet.ets @@ -5,6 +5,8 @@ import { MyCenterTitle } from '../../../componets/myCenter/MyCenterTitle'; import { diskComponet } from '../../../componets/myCenter/diskComponet'; import { PublicConstants, TextConstants } from '../../../common/constants/PublicConstants'; +import { ThemeItem } from '../../../common/model/Theme'; +import { ThemeStorageKey } from '../../../common/constants/Theme'; @Entry @Component @@ -25,7 +27,8 @@ struct DiskSet { @State localBackup:dataItem= new dataItem("本地备份","","","",false) @State deviceName:dataItem= new dataItem("设备名称","Meta 40 Pro","","",false) @State localBackupPath:dataItem= new dataItem("本地备份路径","emulated/emulated/阅读/备份","","",true) - + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem @Builder toggleComponets(item:dataItem){ Row(){ @@ -37,7 +40,7 @@ struct DiskSet { Toggle({type:ToggleType.Switch,isOn:item.status}) .onChange((isOn: boolean) => { item.status=isOn; - }).selectedColor(PublicConstants.THEME_COLOR).hoverEffect(HoverEffect.None) + }).selectedColor(this.theme.mainColor).hoverEffect(HoverEffect.None) }.justifyContent(FlexAlign.SpaceBetween) .stateStyles({normal: this.componetStyles}) } diff --git a/entry/src/main/ets/pages/view/myCenter/helpCenterPage.ets b/entry/src/main/ets/pages/view/myCenter/helpCenterPage.ets index ae30558d..977767fe 100644 --- a/entry/src/main/ets/pages/view/myCenter/helpCenterPage.ets +++ b/entry/src/main/ets/pages/view/myCenter/helpCenterPage.ets @@ -1,4 +1,6 @@ import { router } from '@kit.ArkUI'; +import { ThemeStorageKey } from '../../../common/constants/Theme'; +import { ThemeItem } from '../../../common/model/Theme'; @Entry @Component @@ -39,6 +41,9 @@ struct HelpCenterPage { ] scroller: Scroller = new Scroller() + // 主题颜色 + @StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem + build() { Column() { Flex({ @@ -199,7 +204,7 @@ struct HelpCenterPage { Row() { if (this.MoreQuestionsIndex == index) { Line({ width: 3, height: 16 }) - .backgroundColor('#FF6600') + .backgroundColor(this.theme.mainColor) } Text(item) .lineHeight(22) @@ -285,12 +290,12 @@ struct HelpCenterPage { question(title: string, index: number) { Column() { Text(title) - .fontColor(index == 0 ? '#FF6600' : 'rgba(0, 0, 0, 0.88)') + .fontColor(index == 0 ? this.theme.mainColor : 'rgba(0, 0, 0, 0.88)') .fontSize(12) .fontWeight(700) } .borderRadius(8) .padding(8) - .backgroundColor(index == 0 ? 'rgba(255, 102, 0, 0.12)' : 'rgb(240,240,240)') + .backgroundColor(index == 0 ? this.theme.secondColor : 'rgb(240,240,240)') } } \ No newline at end of file diff --git a/entry/src/main/resources/base/element/color.json b/entry/src/main/resources/base/element/color.json index 7c18cd7a..e18f8bc7 100644 --- a/entry/src/main/resources/base/element/color.json +++ b/entry/src/main/resources/base/element/color.json @@ -17,10 +17,6 @@ "name": "test", "value": "#FFFF0000" }, - { - "name": "theme_color", - "value": "#FF6600" - }, { "name": "book_detail_background", "value": "#2a5d5d" diff --git a/entry/src/main/resources/base/media/FIND_theme.png b/entry/src/main/resources/base/media/FIND_theme.png deleted file mode 100644 index ba0933a6..00000000 Binary files a/entry/src/main/resources/base/media/FIND_theme.png and /dev/null differ diff --git a/entry/src/main/resources/base/media/FIND_theme.svg b/entry/src/main/resources/base/media/FIND_theme.svg new file mode 100644 index 00000000..465cd845 --- /dev/null +++ b/entry/src/main/resources/base/media/FIND_theme.svg @@ -0,0 +1,3 @@ + + + diff --git a/entry/src/main/resources/base/media/HOME_theme.png b/entry/src/main/resources/base/media/HOME_theme.png deleted file mode 100644 index 31c2b85b..00000000 Binary files a/entry/src/main/resources/base/media/HOME_theme.png and /dev/null differ diff --git a/entry/src/main/resources/base/media/HOME_theme.svg b/entry/src/main/resources/base/media/HOME_theme.svg new file mode 100644 index 00000000..5bb5b326 --- /dev/null +++ b/entry/src/main/resources/base/media/HOME_theme.svg @@ -0,0 +1,3 @@ + + + diff --git a/entry/src/main/resources/base/media/MINE_theme.png b/entry/src/main/resources/base/media/MINE_theme.png deleted file mode 100644 index 5f9e436c..00000000 Binary files a/entry/src/main/resources/base/media/MINE_theme.png and /dev/null differ diff --git a/entry/src/main/resources/base/media/MINE_theme.svg b/entry/src/main/resources/base/media/MINE_theme.svg new file mode 100644 index 00000000..90e94b03 --- /dev/null +++ b/entry/src/main/resources/base/media/MINE_theme.svg @@ -0,0 +1,3 @@ + + + diff --git a/entry/src/main/resources/base/media/SUB_theme.png b/entry/src/main/resources/base/media/SUB_theme.png deleted file mode 100644 index 42fffdd3..00000000 Binary files a/entry/src/main/resources/base/media/SUB_theme.png and /dev/null differ diff --git a/entry/src/main/resources/base/media/SUB_theme.svg b/entry/src/main/resources/base/media/SUB_theme.svg new file mode 100644 index 00000000..df7c9b8f --- /dev/null +++ b/entry/src/main/resources/base/media/SUB_theme.svg @@ -0,0 +1,3 @@ + + + diff --git a/entry/src/main/resources/base/media/f60_right.svg b/entry/src/main/resources/base/media/f60_right.svg index ec6413ab..f03f7fbc 100644 --- a/entry/src/main/resources/base/media/f60_right.svg +++ b/entry/src/main/resources/base/media/f60_right.svg @@ -1,5 +1,5 @@ - + diff --git a/entry/src/main/resources/base/media/hook.svg b/entry/src/main/resources/base/media/hook.svg index 2c932ad7..bc53c9cc 100644 --- a/entry/src/main/resources/base/media/hook.svg +++ b/entry/src/main/resources/base/media/hook.svg @@ -1,5 +1,5 @@ - + diff --git a/entry/src/main/resources/base/media/ic_select.svg b/entry/src/main/resources/base/media/ic_select.svg index e7310f12..649b2da3 100644 --- a/entry/src/main/resources/base/media/ic_select.svg +++ b/entry/src/main/resources/base/media/ic_select.svg @@ -1,5 +1,5 @@ - + diff --git a/entry/src/main/resources/base/media/legado_icon.svg b/entry/src/main/resources/base/media/legado_icon.svg index 3e5f0d76..285cedb2 100644 --- a/entry/src/main/resources/base/media/legado_icon.svg +++ b/entry/src/main/resources/base/media/legado_icon.svg @@ -1,3 +1,3 @@ - + diff --git a/entry/src/main/resources/base/media/my_theme_config_bg0.png b/entry/src/main/resources/base/media/my_theme_config_bg0.png new file mode 100644 index 00000000..eea9e2e5 Binary files /dev/null and b/entry/src/main/resources/base/media/my_theme_config_bg0.png differ diff --git a/entry/src/main/resources/base/media/my_theme_config_bg1.png b/entry/src/main/resources/base/media/my_theme_config_bg1.png new file mode 100644 index 00000000..eea9e2e5 Binary files /dev/null and b/entry/src/main/resources/base/media/my_theme_config_bg1.png differ diff --git a/entry/src/main/resources/base/media/my_theme_config_bg2.png b/entry/src/main/resources/base/media/my_theme_config_bg2.png new file mode 100644 index 00000000..4822c9a1 Binary files /dev/null and b/entry/src/main/resources/base/media/my_theme_config_bg2.png differ diff --git a/entry/src/main/resources/base/media/my_theme_config_bg3.png b/entry/src/main/resources/base/media/my_theme_config_bg3.png new file mode 100644 index 00000000..04a97c3c Binary files /dev/null and b/entry/src/main/resources/base/media/my_theme_config_bg3.png differ diff --git a/entry/src/main/resources/base/media/my_theme_config_bg4.png b/entry/src/main/resources/base/media/my_theme_config_bg4.png new file mode 100644 index 00000000..730f07ef Binary files /dev/null and b/entry/src/main/resources/base/media/my_theme_config_bg4.png differ diff --git a/entry/src/main/resources/base/media/my_theme_config_bg5.png b/entry/src/main/resources/base/media/my_theme_config_bg5.png new file mode 100644 index 00000000..ed40bec5 Binary files /dev/null and b/entry/src/main/resources/base/media/my_theme_config_bg5.png differ diff --git a/entry/src/main/resources/base/media/my_theme_config_bg6.png b/entry/src/main/resources/base/media/my_theme_config_bg6.png new file mode 100644 index 00000000..93ea99fb Binary files /dev/null and b/entry/src/main/resources/base/media/my_theme_config_bg6.png differ diff --git a/entry/src/main/resources/base/media/my_theme_config_bg7.png b/entry/src/main/resources/base/media/my_theme_config_bg7.png new file mode 100644 index 00000000..a9c1c00e Binary files /dev/null and b/entry/src/main/resources/base/media/my_theme_config_bg7.png differ diff --git a/entry/src/main/resources/base/media/my_theme_config_custom.svg b/entry/src/main/resources/base/media/my_theme_config_custom.svg new file mode 100644 index 00000000..e97b9a78 --- /dev/null +++ b/entry/src/main/resources/base/media/my_theme_config_custom.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/entry/src/main/resources/base/media/my_theme_config_desktop.svg b/entry/src/main/resources/base/media/my_theme_config_desktop.svg new file mode 100644 index 00000000..54675089 --- /dev/null +++ b/entry/src/main/resources/base/media/my_theme_config_desktop.svg @@ -0,0 +1,4 @@ + + + + diff --git a/entry/src/main/resources/base/media/my_theme_config_theme.svg b/entry/src/main/resources/base/media/my_theme_config_theme.svg new file mode 100644 index 00000000..2bf3cc73 --- /dev/null +++ b/entry/src/main/resources/base/media/my_theme_config_theme.svg @@ -0,0 +1,4 @@ + + + + diff --git a/entry/src/main/resources/base/media/my_theme_config_welcome.svg b/entry/src/main/resources/base/media/my_theme_config_welcome.svg new file mode 100644 index 00000000..efc42dd6 --- /dev/null +++ b/entry/src/main/resources/base/media/my_theme_config_welcome.svg @@ -0,0 +1,3 @@ + + + diff --git a/entry/src/main/resources/base/profile/main_pages.json b/entry/src/main/resources/base/profile/main_pages.json index c9262258..059bc1c3 100644 --- a/entry/src/main/resources/base/profile/main_pages.json +++ b/entry/src/main/resources/base/profile/main_pages.json @@ -26,6 +26,8 @@ "pages/view/Find/BookSource/AddSourcePage", "pages/view/Subscription/components/SubscriptionSearch", "pages/view/Subscription/rssWebView", - "pages/view/Find/CategoryList/Index" + "pages/view/Find/CategoryList/Index", + "pages/view/myCenter/MyThemeConfig", + "pages/view/myCenter/CreateCustomTheme" ] } \ No newline at end of file diff --git a/entry/src/main/resources/rawfile/bgi/my_theme_config_bg1.png b/entry/src/main/resources/rawfile/bgi/my_theme_config_bg1.png new file mode 100644 index 00000000..eea9e2e5 Binary files /dev/null and b/entry/src/main/resources/rawfile/bgi/my_theme_config_bg1.png differ diff --git a/entry/src/main/resources/rawfile/bgi/my_theme_config_bg2.png b/entry/src/main/resources/rawfile/bgi/my_theme_config_bg2.png new file mode 100644 index 00000000..4822c9a1 Binary files /dev/null and b/entry/src/main/resources/rawfile/bgi/my_theme_config_bg2.png differ diff --git a/entry/src/main/resources/rawfile/bgi/my_theme_config_bg3.png b/entry/src/main/resources/rawfile/bgi/my_theme_config_bg3.png new file mode 100644 index 00000000..04a97c3c Binary files /dev/null and b/entry/src/main/resources/rawfile/bgi/my_theme_config_bg3.png differ diff --git a/entry/src/main/resources/rawfile/bgi/my_theme_config_bg4.png b/entry/src/main/resources/rawfile/bgi/my_theme_config_bg4.png new file mode 100644 index 00000000..730f07ef Binary files /dev/null and b/entry/src/main/resources/rawfile/bgi/my_theme_config_bg4.png differ diff --git a/entry/src/main/resources/rawfile/bgi/my_theme_config_bg5.png b/entry/src/main/resources/rawfile/bgi/my_theme_config_bg5.png new file mode 100644 index 00000000..ed40bec5 Binary files /dev/null and b/entry/src/main/resources/rawfile/bgi/my_theme_config_bg5.png differ diff --git a/entry/src/main/resources/rawfile/bgi/my_theme_config_bg6.png b/entry/src/main/resources/rawfile/bgi/my_theme_config_bg6.png new file mode 100644 index 00000000..93ea99fb Binary files /dev/null and b/entry/src/main/resources/rawfile/bgi/my_theme_config_bg6.png differ diff --git a/entry/src/main/resources/rawfile/bgi/my_theme_config_bg7.png b/entry/src/main/resources/rawfile/bgi/my_theme_config_bg7.png new file mode 100644 index 00000000..a9c1c00e Binary files /dev/null and b/entry/src/main/resources/rawfile/bgi/my_theme_config_bg7.png differ diff --git a/svg/FIND_theme.svg b/svg/FIND_theme.svg index c5173378..f51eb761 100644 --- a/svg/FIND_theme.svg +++ b/svg/FIND_theme.svg @@ -1,9 +1,9 @@ - + - + diff --git a/svg/HOME_theme.svg b/svg/HOME_theme.svg index 33721260..fa53336b 100644 --- a/svg/HOME_theme.svg +++ b/svg/HOME_theme.svg @@ -1,9 +1,9 @@ - + - + diff --git a/svg/MINE_theme.svg b/svg/MINE_theme.svg index 312dfe16..2fd26c82 100644 --- a/svg/MINE_theme.svg +++ b/svg/MINE_theme.svg @@ -1,9 +1,9 @@ - + - + diff --git a/svg/SUB_theme.svg b/svg/SUB_theme.svg index 769cbd80..cf11e513 100644 --- a/svg/SUB_theme.svg +++ b/svg/SUB_theme.svg @@ -1,9 +1,9 @@ - + - +