diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..26d33521af10bcc7fd8cea344038eaaeb78d0ef5 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/applications_inputmethod.iml b/.idea/applications_inputmethod.iml new file mode 100644 index 0000000000000000000000000000000000000000..d6ebd4805981b8400db3e3291c74a743fef9a824 --- /dev/null +++ b/.idea/applications_inputmethod.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000000000000000000000000000000000000..639900d13c6182e452e33a3bd638e70a0146c785 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000000000000000000000000000000000000..227b5248e50826fa2ff808e923be9f98faf31680 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000000000000000000000000000000000000..35eb1ddfbbc029bcab630581847471d7f238ec53 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/entry/src/main/ets/common/changeItem.ets b/entry/src/main/ets/common/changeItem.ets new file mode 100644 index 0000000000000000000000000000000000000000..74dc32ba96365324f90d57b5c0a9d51d700db69f --- /dev/null +++ b/entry/src/main/ets/common/changeItem.ets @@ -0,0 +1,74 @@ +// @ts-nocheck +import styleConfiguration from '../common/styleConfiguration' + + +let inputStyle: any = styleConfiguration.getInputStyle() +let basicButtonHeight : string +let switchButtonWidth : string + + + +// 中英文切换 +@Component +export struct changeItem { + + private keyValue: string + @Link menuType: number + @State isChinese: boolean = AppStorage.Get("isChinese") + + @Styles pressedStyles() { + .backgroundColor("#868b95") + } + + @Styles normalStyles() { + .backgroundColor("#a8abb7") + } + + aboutToAppear() : void{ + + var dHeight = AppStorage.Get("dHeight") + if (dHeight == 1280) { + basicButtonHeight = inputStyle.basicButtonHeight_1280; + switchButtonWidth = inputStyle.switchButtonWidth_1280; + } + else{ + basicButtonHeight = inputStyle.basicButtonHeight; + switchButtonWidth = inputStyle.switchButtonWidth; + } + + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + if (this.isChinese) { + Row() { + Text("中").fontSize(inputStyle.switchNumberFontSize_g).fontColor('black') + Text("/英").fontSize(inputStyle.switchNumberFontSize).fontColor('black') + } + } else { + Row() { + Text("中/").fontSize(inputStyle.switchNumberFontSize).fontColor('black') + Text("英").fontSize(inputStyle.switchNumberFontSize_g).fontColor('black') + } + } + } + .backgroundColor('#a8abb7') + .borderRadius(6) + .height(basicButtonHeight) + .width(switchButtonWidth)//mxg inputStyle.switchButtonWidth + .shadow({ radius: 1, color: '#76787c', offsetY: 3 }) + .stateStyles({ + normal: this.normalStyles, pressed: this.pressedStyles + }) + + .onClick(() => { + if (this.keyValue === 'PY') { + this.menuType = 3 // 拼音 + AppStorage.SetOrCreate('isChinese',true) + }else { + this.menuType = 0 //英文 + AppStorage.SetOrCreate('isChinese',false) + } + }) + } +} \ No newline at end of file