any类型整改

Signed-off-by: fengwei <fengwei55@h-partners.com>
This commit is contained in:
fengwei 2023-05-24 15:34:44 +08:00
parent 15f6f38996
commit d946551dbb
10 changed files with 64 additions and 46 deletions

View File

@ -32,8 +32,8 @@ export default struct BatteryIcon {
@StorageLink('StatusCoefficient') StatusCoefficient: number = 1.0
private mGroupId: string = ''
@State mStatusBarGroupComponentData: StatusBarGroupComponentData = new StatusBarGroupComponentData()
@State style: any = StyleConfiguration.getBatteryComponentStyle()
@State styleCommon: any = StyleConfigurationCommon.getCommonStyle()
@State componentGap: Resource = $r('app.float.battery_component_gap')
@State statusBarMarginLeftRight: Resource = $r("app.float.signal_status_margin_Left_right")
aboutToAppear() {
this.mStatusBarGroupComponentData = StatusBarVM.getStatusBarGroupComponentData(this.mGroupId)
@ -47,11 +47,11 @@ export default struct BatteryIcon {
build() {
Row() {
Row().width(this.styleCommon.statusBarMarginLeftRight).height('100%')
Row().width(this.statusBarMarginLeftRight).height('100%')
BatterySoc({ mContentColor: this.mStatusBarGroupComponentData.contentColor })
Row().width(this.style.componentGap).height('100%')
Row().width(this.componentGap).height('100%')
BatteryPic({ mContentColor: this.mStatusBarGroupComponentData.contentColor })
Row().width(this.styleCommon.statusBarMarginLeftRight).height('100%')
Row().width(this.statusBarMarginLeftRight).height('100%')
}
.height('100%')
}

View File

@ -25,7 +25,17 @@ struct BatteryPic {
@StorageLink('batterySoc') batterySoc: number = 100
@StorageLink('batteryCharging') batteryCharging : boolean = false
@State mContentColor: string = "#FFFFFFFF"
@State style: any = StyleConfiguration.getBatteryPicStyle()
@State picBodyWidth: Resource = $r('app.float.battery_component_pic_body_width')
@State picBodyHeight: Resource = $r('app.float.battery_component_pic_body_height')
@State picBodyBorderWidth: Resource = $r('app.float.battery_component_pic_body_border_width')
@State picBorderRadius: Resource = $r('app.float.battery_component_pic_border_radius')
@State picBodyPadding: Resource = $r('app.float.battery_component_pic_body_padding')
@State picGap: Resource = $r('app.float.battery_component_pic_gap')
@State picHeadWidth: Resource = $r('app.float.battery_component_pic_head_width')
@State picHeadHeight: Resource = $r('app.float.battery_component_pic_head_height')
@State picHeadBorderRadius: Resource = $r('app.float.battery_component_pic_head_radius')
@State picChargingColor: Resource = $r('app.color.battery_component_pic_charging_color')
@State picLevelLowColor: Resource = $r('app.color.battery_component_pic_level_low_color')
aboutToAppear(){
Log.showInfo(TAG,'aboutToAppear Start');
@ -46,37 +56,37 @@ struct BatteryPic {
.width((this.batterySoc < 100 ? this.batterySoc: 100) + '%')
.backgroundColor(this.getBatteryColor(this.batterySoc, this.batteryCharging))
}
.width(this.style.picBodyWidth)
.height(this.style.picBodyHeight)
.width(this.picBodyWidth)
.height(this.picBodyHeight)
.backgroundColor($r('app.color.battery_background'))
.border({ width: this.style.picBodyBorderWidth,
.border({ width: this.picBodyBorderWidth,
color: this.mContentColor,
radius: this.style.picBorderRadius,
radius: this.picBorderRadius,
style: BorderStyle.Solid })
.padding(this.style.picBodyPadding)
.padding(this.picBodyPadding)
Row() {
}
.width(this.style.picGap)
.width(this.picGap)
.height(1)
Row() {
}
.width(this.style.picHeadWidth)
.height(this.style.picHeadHeight)
.width(this.picHeadWidth)
.height(this.picHeadHeight)
.backgroundColor(this.mContentColor)
.borderRadius(this.style.picHeadBorderRadius)
.borderRadius(this.picHeadBorderRadius)
}
}
private getBatteryColor(val, charging) {
Log.showDebug(TAG, `getBatteryColor, val: ${ val } charging: ${ charging } `);
if (charging) {
return this.style.picChargingColor;
return this.picChargingColor;
} else if (val <= Constants.BATTERY_LEVEL_LOW) {
return this.style.picLevelLowColor;
return this.picLevelLowColor;
} else {
return this.mContentColor;
}

View File

@ -22,7 +22,7 @@ const TAG = 'BatteryComponent-batterySoc'
export default struct BatterySoc {
@StorageLink('batterySoc') batterySoc: number = 100
@State mContentColor: string = "#FFFFFFFF"
@State styleCommon: any = StyleConfigurationCommon.getCommonStyle()
@State statusBarFontSize: Resource = $r("app.float.signal_fontSize")
aboutToAppear() {
Log.showInfo(TAG, 'aboutToAppear Start');
@ -35,7 +35,7 @@ export default struct BatterySoc {
build() {
Text(this.batterySoc + '%')
.fontColor(this.mContentColor)
.fontSize(this.styleCommon.statusBarFontSize)
.fontSize(this.statusBarFontSize)
.fontWeight(FontWeight.Medium)
}
}

View File

@ -31,8 +31,9 @@ export default struct ClockIcon {
@State mTime: string = '16:01'
private mGroupId: string = ''
@State mStatusBarGroupComponentData: StatusBarGroupComponentData = new StatusBarGroupComponentData()
@State style: any = StyleConfiguration.getClockComponentStyle()
@State styleCommon: any = StyleConfigurationCommon.getCommonStyle()
@State statusBarClockMaxWidth: Resource = $r('app.float.status_bar_clock_width')
@State statusBarMarginLeftRight: Resource = $r("app.float.signal_status_margin_Left_right")
@State statusBarFontSize: Resource = $r("app.float.signal_fontSize")
unSubscriber?: unsubscribe;
aboutToAppear() {
@ -52,14 +53,14 @@ export default struct ClockIcon {
build() {
Row() {
Row().width(this.styleCommon.statusBarMarginLeftRight).height('100%')
Row().width(this.statusBarMarginLeftRight).height('100%')
Text(this.mTime)
.fontColor(this.mStatusBarGroupComponentData.contentColor)
.fontSize(this.styleCommon.statusBarFontSize)
.width(this.style.statusBarClockMaxWidth)
.fontSize(this.statusBarFontSize)
.width(this.statusBarClockMaxWidth)
.fontWeight(FontWeight.Medium)
.margin({ left: $r("app.float.status_bar_clock_margin") })
Row().width(this.styleCommon.statusBarMarginLeftRight).height('100%')
Row().width(this.statusBarMarginLeftRight).height('100%')
}
}
}

View File

@ -24,7 +24,7 @@ const TAG = 'NoticeItem-ActionComponent';
export default struct ActionComponent {
@State showInputText: boolean = false;
@State placeholder: string = '';
@State inputData: any = undefined;
@State inputData: { inputKey: null, wantAgent: null } = undefined;
@State inputActionData: InputActionButtonData = new InputActionButtonData();
private itemData: any = undefined;

View File

@ -26,7 +26,7 @@ export default struct TitleItem {
private notificationTime: string
@Link isExpand: boolean
@Prop needExpand: boolean
@State rowSpace: any = $r('app.float.titleitem_row_space')
@State rowSpace: Resource = $r('app.float.titleitem_row_space')
@Prop distributedDeviceName: string
private isSubItem: boolean= false;
private clickTitleAction: () => void

View File

@ -60,7 +60,7 @@ export default struct Accounts {
@Component
struct UserItem {
@State userItem: any = {};
@State userItem: UserData = null;
private viewModel: ViewModel;
build() {

View File

@ -22,7 +22,7 @@ const TAG = 'ScreenLock-BatterySoc'
export default struct BatterySoc {
@StorageLink('batterySoc') @Watch('onBatterySocChanged') batterySoc: number = 100
@StorageLink('batteryCharging') @Watch('onBatterySocChanged') batteryCharging: boolean = false
@State batterySocText: any = ''
@State batterySocText: Resource = null
aboutToAppear() {
Log.showInfo(TAG, `aboutToAppear`)

View File

@ -32,8 +32,14 @@ export default struct SignalIcon {
@StorageLink('signalObserved') signalObserved: boolean = false
private mGroupId: string = ''
@State mStatusBarGroupComponentData: StatusBarGroupComponentData = new StatusBarGroupComponentData()
@State styleCommon: any = StyleConfigurationCommon.getCommonStyle()
@State style: any = StyleConfiguration.getSignalComponentStyle()
@State statusBarMarginLeftRight: Resource = $r("app.float.signal_status_margin_Left_right")
@State statusBarFontSize: Resource = $r("app.float.signal_fontSize")
@State signalTextMaxWeight: Resource = $r('app.float.signal_text_max_width')
@State statusBarSignalUnknownFontSize: Resource = $r('app.float.status_bar_signal_unknown_font_size')
@State statusBarSignalTypeFontSize: Resource = $r('app.float.status_bar_signal_type_font_size')
@State netSignalTextMaxWidth: Resource = $r('app.float.status_bar_signal_net_signal_text_max_width')
@State cellularImageWidth: Resource = $r('app.float.signal_component_icon_width')
@State cellularImageHeight: Resource = $r('app.float.signal_component_icon_height')
aboutToAppear() {
Log.showInfo(TAG, 'aboutToAppear');
@ -50,34 +56,34 @@ export default struct SignalIcon {
build() {
Row() {
Row().width(this.styleCommon.statusBarMarginLeftRight).height('100%')
Row().width(this.statusBarMarginLeftRight).height('100%')
Text(this.updateNetworkState(this.networkState))
.fontSize(this.styleCommon.statusBarFontSize)
.fontSize(this.statusBarFontSize)
.fontWeight(FontWeight.Medium)
.fontColor(this.mStatusBarGroupComponentData.contentColor)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.constraintSize({ maxWidth: this.style.signalTextMaxWeight })
.constraintSize({ maxWidth: this.signalTextMaxWeight })
.flexShrink(0)
.maxLines(1)
.textAlign(TextAlign.Center)
Row().width(this.styleCommon.statusBarMarginLeftRight).height('100%')
Row().width(this.statusBarMarginLeftRight).height('100%')
Stack({ alignContent: Alignment.TopStart }) {
Text(this.updateCellularType(this.cellularType))
.fontSize(this.cellularType == Constants.RADIO_TECHNOLOGY_UNKNOWN ? this.style.statusBarSignalUnknownFontSize : this.style.statusBarSignalTypeFontSize)
.fontSize(this.cellularType == Constants.RADIO_TECHNOLOGY_UNKNOWN ? this.statusBarSignalUnknownFontSize : this.statusBarSignalTypeFontSize)
.fontColor(this.mStatusBarGroupComponentData.contentColor)
.width(this.style.netSignalTextMaxWidth)
.width(this.netSignalTextMaxWidth)
.fontWeight(FontWeight.Bold)
.textAlign(TextAlign.Start)
.margin({ left: $r("app.float.signal_margin") })
Image(this.updateCellularImage(this.cellularLevel))
.objectFit(ImageFit.Contain)
.width(this.style.cellularImageWidth)
.height(this.style.cellularImageHeight)
.width(this.cellularImageWidth)
.height(this.cellularImageHeight)
.fillColor(this.mStatusBarGroupComponentData.contentColor)
}.flexShrink(1)
Row().width(this.styleCommon.statusBarMarginLeftRight).height('100%')
Row().width(this.statusBarMarginLeftRight).height('100%')
}
.height('100%')
}

View File

@ -30,8 +30,9 @@ export default struct WifiIcon {
@StorageLink('wifiStatus') wifiStatus: boolean = Constants.DEFAULT_WIFI_STATUS
private mGroupId: string = ''
@State mStatusBarGroupComponentData: StatusBarGroupComponentData = new StatusBarGroupComponentData()
@State styleCommon: any = StyleConfigurationCommon.getCommonStyle()
@State style: any = StyleConfiguration.getStartsBarWifiComponentStyle()
@State statusBarMarginLeftRight: Resource = $r("app.float.signal_status_margin_Left_right")
@State statusBarWifiWidth: Resource = $r('app.float.status_bar_wifi_width')
@State statusBarWifiHeight: Resource = $r('app.float.status_bar_wifi_height')
aboutToAppear() {
Log.showInfo(TAG, `aboutToAppear`)
@ -46,13 +47,13 @@ export default struct WifiIcon {
build() {
Row() {
if (this.wifiStatus) {
Row().width(this.styleCommon.statusBarMarginLeftRight).height('100%')
Row().width(this.statusBarMarginLeftRight).height('100%')
Image(this.getImage(this.wifiInfo))
.objectFit(ImageFit.Contain)
.width(this.style.statusBarWifiWidth)
.height(this.style.statusBarWifiHeight)
.width(this.statusBarWifiWidth)
.height(this.statusBarWifiHeight)
.fillColor(this.mStatusBarGroupComponentData.contentColor)
Row().width(this.styleCommon.statusBarMarginLeftRight).height('100%')
Row().width(this.statusBarMarginLeftRight).height('100%')
}
}
.height('100%')