横竖屏ux适配

Signed-off-by: wwx1133664 <wangyi237@huawei.com>
This commit is contained in:
wwx1133664 2022-06-01 17:43:01 +08:00
parent 17aa6169ec
commit 00c23daaad
5 changed files with 45 additions and 21 deletions

View File

@ -150,6 +150,7 @@ struct Bluetooth {
.width(ConfigData.WH_100_100)
.margin({ bottom: $r('sys.float.ohos_id_default_padding_bottom_fixed') })
}
.scrollBarWidth(0)
.width(ConfigData.WH_100_100)
.align(Alignment.TopStart)
.layoutWeight(1)
@ -454,7 +455,8 @@ struct PairedDeviceComponent {
callback();
}
},
alignment: DialogAlignment.Bottom
alignment: DialogAlignment.Bottom,
offset:({dx:0,dy:'-16dp'}),
})
}
}
@ -495,7 +497,7 @@ struct AvailableDeviceComponent {
this.confirmPairing(accept);
}
}),
alignment: this.isPhone?DialogAlignment.Bottom:DialogAlignment.Center,
alignment:this.isPhone?DialogAlignment.Bottom:DialogAlignment.Center,
offset: ({ dx: 0, dy: this.isPhone?'-16dp':0 }),
autoCancel: true,
});

View File

@ -58,7 +58,7 @@ struct DeviceName {
.type(InputType.Normal)
.enterKeyType(EnterKeyType.Done)
.caretColor($r('app.color.font_color_007DFF'))
.maxLength(20)
.maxLength(30)
.fontColor($r("sys.color.ohos_id_color_primary"))
.padding({ left: $r('app.float.wh_24'), right: $r('app.float.wh_24') })
.height($r("app.float.wh_value_40"))
@ -71,7 +71,7 @@ struct DeviceName {
.onChange((value: string) => {
LogUtil.debug(ConfigData.TAG + 'device name changed to: ' + JSON.stringify(value));
this.deviceName = value;
if (this.deviceName.length == 20) {
if (this.deviceName.length == 30) {
this.isFocused = false
prompt.showToast({
message: "输入已达上限",

View File

@ -26,7 +26,8 @@ import { MAX_LENGTH } from '../model/usersAndAccounts/systemAccountModel';
import account_osAccount from '@ohos.account.osAccount';
import router from '@system.router';
import InputMethod from '@ohos.inputmethod';
import deviceInfo from '@ohos.deviceInfo'
const deviceTypeInfo = deviceInfo.deviceType
@Entry
@Component
@ -35,21 +36,22 @@ struct MultipleUsers {
@StorageLink("isShowAddGuest") isShowAddGuest: boolean = false;
@StorageLink("systemAccoutList") userList: account_osAccount.OsAccountInfo[] = [];
@StorageLink("isShowDelete") isShowDelete: boolean = false;
@State isPhone: boolean = false
private addUserDialogController: CustomDialogController = new CustomDialogController({
builder: AddUserDialog({
controller: this.addUserDialogController,
account: {},
confirm: this.onConfirm.bind(this)
}),
alignment: DialogAlignment.Bottom,
offset: ({ dx: 0, dy: '-24dp' }),
alignment: this.isPhone?DialogAlignment.Bottom:DialogAlignment.Center,
offset: ({ dx: 0, dy: this.isPhone?'-16dp':0 }),
autoCancel: true
});
private waitDialogController: CustomDialogController = new CustomDialogController({
builder: WaitDialog({ controller: this.waitDialogController, content: $r("app.string.isCreatingUser") }),
autoCancel: false,
alignment: DialogAlignment.Bottom,
offset: ({ dx: 0, dy: '-24dp' }),
alignment: this.isPhone?DialogAlignment.Bottom:DialogAlignment.Center,
offset: ({ dx: 0, dy: this.isPhone?'-16dp':0 }),
});
build() {
@ -239,7 +241,13 @@ struct MultipleUsers {
})
})).bind(this);
}
aboutToAppear(): void {
if (deviceTypeInfo === 'phone') {
this.isPhone = true
} else {
this.isPhone = false
}
}
onPageShow() {
LogUtil.info("Multiple user list about to appear.")
SystemAccountController.refreshSystemAccountList();
@ -264,8 +272,8 @@ struct UserItem {
private dialogController: CustomDialogController = new CustomDialogController({
builder: UserItemDialog({ dialogController: this.dialogController, user: this.user }),
autoCancel: false,
alignment: DialogAlignment.Bottom,
offset: ({ dx: 0, dy: '-24dp' }),
alignment: this.isPhone?DialogAlignment.Bottom:DialogAlignment.Center,
offset: ({ dx: 0, dy: this.isPhone?'-16dp':0 }),
});
build() {
@ -377,6 +385,7 @@ struct CurrentDialogBuilder {
let chooseImageDialog = new CustomDialogController({
builder: ChooseImageDialog({ controller: this.controller }),
alignment: DialogAlignment.Bottom,
offset: ({ dx: 0, dy: '-24dp' }),
});
chooseImageDialog.open();
})

View File

@ -22,7 +22,8 @@ import RadioListComponent from '../../../../../../../common/component/src/main/e
import Router from '@system.router';
import { RadioListItem } from '../../../../../../../common/utils/src/main/ets/default/bean/RadioListItem';
import InputMethod from '@ohos.inputmethod';
import deviceInfo from '@ohos.deviceInfo'
const deviceTypeInfo = deviceInfo.deviceType
const MODULE_TAG = ConfigData.TAG + 'PasswdSetting.PasswdInput -> '
let param;
@ -57,7 +58,7 @@ struct PasswordInput {
private passwordOnChangeHandler: (value: string) => void;
private okOnClickHandler: (event?: ClickEvent) => void;
private unlockMethodChosenHandler: (value: number) => void;
@State isPhone: boolean = false
//dialog
private chooseUnlockMethodDialog: CustomDialogController = new CustomDialogController({
builder: chooseUnlockMethodDialog({
@ -69,8 +70,8 @@ struct PasswordInput {
}
}),
autoCancel: true,
alignment: DialogAlignment.Bottom,
offset: ({ dx: 0, dy: '-24dp' }),
alignment: this.isPhone?DialogAlignment.Bottom:DialogAlignment.Center,
offset: ({ dx: 0, dy: this.isPhone?'-16dp':0 }),
});
@Log
@ -89,6 +90,11 @@ struct PasswordInput {
.subscribe();
this.updateView();
if (deviceTypeInfo === 'phone') {
this.isPhone = true
} else {
this.isPhone = false
}
}
@Log

View File

@ -23,6 +23,8 @@ import wifi from '@ohos.wifi';
import LogUtil from '../../../../../../../common/utils/src/main/ets/default/baseUtil/LogUtil';
import router from '@system.router'
import InputMethod from '@ohos.inputmethod';
import deviceInfo from '@ohos.deviceInfo'
const deviceTypeInfo = deviceInfo.deviceType
const MODULE_TAG = ConfigData.TAG + 'WifiModel.WifiPasswd -> ';
@ -39,19 +41,20 @@ struct WifiPsd {
private tobeConnectedAp: WifiScanInfo = null;
private isConnectedBefore: boolean = false;
private taskId: number = -1;
@State isPhone: boolean = false
private connectDialog: CustomDialogController = new CustomDialogController({
builder: connectProgressDialog({
ssid: this.tobeConnectedSSID,
}),
alignment: DialogAlignment.Bottom,
offset: ({ dx: 0, dy: '-16dp' }),
alignment: this.isPhone?DialogAlignment.Bottom:DialogAlignment.Center,
offset: ({ dx: 0, dy: this.isPhone?'-16dp':0 }),
autoCancel: false,
customStyle: true
});
private failedDialog: CustomDialogController = new CustomDialogController({
builder: connectFailedDialog({}),
alignment: DialogAlignment.Bottom,
offset: ({ dx: 0, dy: '-16dp' }),
alignment: this.isPhone?DialogAlignment.Bottom:DialogAlignment.Center,
offset: ({ dx: 0, dy: this.isPhone?'-16dp':0 }),
autoCancel: true,
customStyle: true
});
@ -161,7 +164,6 @@ struct WifiPsd {
() => {
WifiModel.setUserSelectedAp(this.tobeConnectedAp);
WifiModel.connectWiFi(this.userInputs);
this.isFocused = false
this.connectDialog.open();
});
}
@ -228,6 +230,11 @@ struct WifiPsd {
}
this.tobeConnectedAp = params.apInfo;
this.tobeConnectedSSID = this.tobeConnectedAp.ssid;
if (deviceTypeInfo === 'phone') {
this.isPhone = true
} else {
this.isPhone = false
}
}
onPageShow() {