!299 控制中心文字重叠,代码合入master

Merge pull request !299 from SEASON_SYSU/master
This commit is contained in:
openharmony_ci
2023-02-06 07:22:28 +00:00
committed by Gitee
3 changed files with 16 additions and 5 deletions
@@ -119,7 +119,7 @@ export class ControlCenterService {
Log.showDebug(TAG, `parseConfig, mAllComplexToggles: ${JSON.stringify(this.mAllComplexToggles)}`);
this.calcComplexToggleLayout();
config.LocalToggles.SimpleToggles.forEach((name: string) => {
this.mAllSimpleToggles.push(name);
typeof name === 'string' && this.mAllSimpleToggles.push(name);
});
Log.showDebug(TAG, `parseConfig, allSimpleToggles: ${JSON.stringify(this.mAllSimpleToggles)}`);
this.calcSimpleToggleLayout();
@@ -64,7 +64,7 @@ export default struct SimpleToggleLayoutEditGrid {
mEditMode: true
})
}.width('100%')
.height(80)
.height(108)
}
}, (componentName: string) => componentName)
if (this.mToggles.length == 0) {
@@ -72,7 +72,7 @@ export default struct SimpleToggleLayoutEditGrid {
}
}
}
.constraintSize({ minHeight: 80 })
.height(this.calcGridHeight(Math.ceil(this.mToggles.length / this.mColumnCount), this.style.rowHeight, this.style.rowGap))
.width('100%')
.columnsTemplate(this.calcColumnsTemplate(this.mColumnCount))
.editMode(true)
@@ -93,6 +93,16 @@ export default struct SimpleToggleLayoutEditGrid {
.onItemDrop(this.onGridItemDrop.bind(this))
}
calcGridHeight(rowCount, rowHeight, rowGap) {
Log.showDebug(this.logTag, `calcGridHeight, rowCount: ${rowCount} rowHeight: ${rowHeight} rowGap: ${rowGap}`);
let height = rowCount * rowHeight + (rowCount - 1) * rowGap;
if (height <= 0) {
height = 108;
}
Log.showDebug(this.logTag, `calcGridHeight, height: ${height}`);
return height + 'px';
}
calcColumnsTemplate(columnCount: number): string{
Log.showDebug(this.logTag, `calcColumnsTemplate, columnCount: ${columnCount}`);
let columnsTemplate = '1fr';
@@ -15,13 +15,14 @@
import { FASlotName } from '../../../../../../../../common/src/main/ets/default/Constants';
import { ControlCenterConfig
} from '../../../../../../../../features/controlcentercomponent/src/main/ets/com/ohos/common/Constants';
import {isNfcAvailable} from '../../../../../../../../common/src/main/ets/default/Constants';
const controlCenterConfig: ControlCenterConfig = {
ComplexToggleLayout: [FASlotName.WIFI, FASlotName.BLUETOOTH],
DefaultSimpleToggleLayout: ["screenshot", FASlotName.RING_MODE, FASlotName.LOCATION, 'demosystemuicplmeta', FASlotName.NFC, FASlotName.AUTO_ROTATE],
DefaultSimpleToggleLayout: ["screenshot", FASlotName.RING_MODE, FASlotName.LOCATION, 'demosystemuicplmeta', isNfcAvailable()&&FASlotName.NFC, FASlotName.AUTO_ROTATE],
LocalToggles: {
ComplexToggles: [FASlotName.AIR_PLANE, FASlotName.BLUETOOTH, FASlotName.WIFI],
SimpleToggles: [FASlotName.LOCATION, FASlotName.RING_MODE, FASlotName.NFC, FASlotName.AUTO_ROTATE],
SimpleToggles: [FASlotName.LOCATION, FASlotName.RING_MODE, isNfcAvailable()&&FASlotName.NFC, FASlotName.AUTO_ROTATE],
},
MetaToggles: [
{