mirror of
https://gitee.com/openharmony/applications_systemui
synced 2025-01-05 23:48:45 +00:00
[systemui]优化模块间强依赖关系
Signed-off-by: lizhi <lizhi140@huawei.com>
This commit is contained in:
parent
8ae07bd200
commit
495668db26
@ -20,41 +20,11 @@ import initSystemUi from '../../../../../../common/src/main/ets/default/InitSyst
|
||||
|
||||
const TAG = 'SystemUI_ServiceExtAbility';
|
||||
|
||||
var statusBarWant = {
|
||||
'bundleName': 'com.ohos.systemui',
|
||||
'abilityName': 'com.ohos.systemui.statusbar.ServiceExtAbility'
|
||||
};
|
||||
|
||||
var navigationBarWant = {
|
||||
'bundleName': 'com.ohos.systemui',
|
||||
'abilityName': 'com.ohos.systemui.navigationbar.ServiceExtAbility'
|
||||
};
|
||||
|
||||
var volumePanelWant = {
|
||||
'bundleName': 'com.ohos.systemui',
|
||||
'abilityName': 'com.ohos.systemui.volumepanel.ServiceExtAbility'
|
||||
};
|
||||
|
||||
var controlPanelWant = {
|
||||
'bundleName': 'com.ohos.systemui',
|
||||
'abilityName': 'com.ohos.systemui.controlpanel.ServiceExtAbility'
|
||||
};
|
||||
|
||||
var notificationPanelWant = {
|
||||
'bundleName': 'com.ohos.systemui',
|
||||
'abilityName': 'com.ohos.systemui.notificationpanel.ServiceExtAbility'
|
||||
};
|
||||
|
||||
class ServiceExtAbility extends ServiceExtension {
|
||||
onCreate(want: Want): void {
|
||||
Log.showInfo(TAG, `onCreate, want: ${JSON.stringify(want)}`);
|
||||
initSystemUi(this.context);
|
||||
AbilityManager.setContext(AbilityManager.ABILITY_NAME_ENTRY, this.context);
|
||||
AbilityManager.startAbility(statusBarWant);
|
||||
AbilityManager.startAbility(navigationBarWant);
|
||||
AbilityManager.startAbility(volumePanelWant);
|
||||
AbilityManager.startAbility(controlPanelWant);
|
||||
AbilityManager.startAbility(notificationPanelWant);
|
||||
}
|
||||
|
||||
onDestroy(): void {
|
||||
|
@ -20,29 +20,11 @@ import initSystemUi from '../../../../../../common/src/main/ets/default/InitSyst
|
||||
|
||||
const TAG = 'SystemUI_ServiceExtAbility';
|
||||
|
||||
var statusBarWant = {
|
||||
'bundleName': 'com.ohos.systemui',
|
||||
'abilityName': 'com.ohos.systemui.statusbar.ServiceExtAbility'
|
||||
};
|
||||
|
||||
var navigationBarWant = {
|
||||
'bundleName': 'com.ohos.systemui',
|
||||
'abilityName': 'com.ohos.systemui.navigationbar.ServiceExtAbility'
|
||||
};
|
||||
|
||||
var volumePanelWant = {
|
||||
'bundleName': 'com.ohos.systemui',
|
||||
'abilityName': 'com.ohos.systemui.volumepanel.ServiceExtAbility'
|
||||
};
|
||||
|
||||
class ServiceExtAbility extends ServiceExtension {
|
||||
onCreate(want: Want): void {
|
||||
Log.showInfo(TAG, `onCreate, want: ${JSON.stringify(want)}`);
|
||||
initSystemUi(this.context);
|
||||
AbilityManager.setContext(AbilityManager.ABILITY_NAME_ENTRY, this.context);
|
||||
AbilityManager.startAbility(statusBarWant);
|
||||
AbilityManager.startAbility(navigationBarWant);
|
||||
AbilityManager.startAbility(volumePanelWant);
|
||||
}
|
||||
|
||||
onDestroy(): void {
|
||||
|
@ -14,8 +14,8 @@
|
||||
*/
|
||||
|
||||
import display from '@ohos.display';
|
||||
import Log from '../../../../../../../common/src/main/ets/default/log';
|
||||
import ResourceUtil from '../../../../../../../common/src/main/ets/default/resourceutil';
|
||||
import Log from '../../../../../../../../../common/src/main/ets/default/Log';
|
||||
import ResourceUtil from '../../../../../../../../../common/src/main/ets/default/ResourceUtil';
|
||||
|
||||
const TAG = 'NavBarConfiguration';
|
||||
var directionNav;
|
||||
@ -86,7 +86,7 @@ class NavBarConfiguration {
|
||||
Log.showDebug(TAG, 'statusShortSideLength = ' + statusShortSideLength + 'navShortSideLength = ' + navShortSideLength + 'directionnav = ' + directionNav.direction + 'statusbarPosition = ' + statusbarPosition + 'NavbarPosition = ' + navbarPosition);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Get nav bar configuration
|
||||
*/
|
||||
public async getConfiguration() {
|
||||
@ -147,6 +147,38 @@ class NavBarConfiguration {
|
||||
}
|
||||
return configuration;
|
||||
}
|
||||
|
||||
/**
|
||||
* set nav bar custom configuration
|
||||
*/
|
||||
public setCustomConfiguration(configInfo) {
|
||||
if (configInfo.showNavHorizontal) {
|
||||
if (configInfo.realHeight == 0) {
|
||||
Log.showInfo(TAG, `hide navbar`);
|
||||
} else if (configInfo.maxWidth > configInfo.maxHeight) { // Pad、PC Mode
|
||||
configInfo.realHeight = 44 * configInfo.maxWidth / 1280;
|
||||
} else { // Phone Mode
|
||||
configInfo.realHeight = 36 * configInfo.maxWidth / 360;
|
||||
}
|
||||
configInfo.minHeight = configInfo.realHeight;
|
||||
if (configInfo.yCoordinate > 0) {
|
||||
configInfo.yCoordinate = configInfo.maxHeight - configInfo.realHeight;
|
||||
}
|
||||
} else {
|
||||
if (configInfo.realWidth == 0) {
|
||||
Log.showInfo(TAG, `hide navbar`);
|
||||
} else if (configInfo.maxWidth > configInfo.maxHeight) { // Pad、PC Mode
|
||||
configInfo.realWidth = 44 * configInfo.maxWidth / 1280;
|
||||
} else { // Phone Mode
|
||||
configInfo.realWidth = 36 * configInfo.maxWidth / 360;
|
||||
}
|
||||
configInfo.minHeight = configInfo.realWidth;
|
||||
if (configInfo.xCoordinate > 0) {
|
||||
configInfo.xCoordinate = configInfo.maxWidth - configInfo.realWidth;
|
||||
}
|
||||
}
|
||||
return configInfo;
|
||||
}
|
||||
}
|
||||
|
||||
let navBarConfiguration = new NavBarConfiguration();
|
@ -27,7 +27,7 @@ type NotificationLayoutConfig = {
|
||||
|
||||
@Component
|
||||
export default struct NotificationListComponent {
|
||||
// 当长通知消息展开时,这里用于重新刷新item布局,扩展高度
|
||||
// 当长通知消息展开时,这里用于重新刷新item布局,扩展高度
|
||||
@Provide('notificationUpdate') update: number = 0;
|
||||
@StorageLink('notificationList') notificationList: any[] = []
|
||||
private config: NotificationLayoutConfig = {
|
||||
|
@ -18,54 +18,20 @@ import ServiceExtension from '@ohos.application.ServiceExtensionAbility';
|
||||
import Log from '../../../../../../../common/src/main/ets/default/Log';
|
||||
import WindowManager, { WindowType } from '../../../../../../../common/src/main/ets/default/WindowManager';
|
||||
import AbilityManager from '../../../../../../../common/src/main/ets/default/abilitymanager/abilityManager';
|
||||
import NavBarConfiguration from '../common/NavBarConfiguration';
|
||||
import NavBarConfiguration from '../../../../../../../features/navigationservice/src/main/ets/com/ohos/navigationservice/common/NavBarConfiguration';
|
||||
import { Want } from 'ability/want';
|
||||
|
||||
const TAG = 'NavigationBar_ServiceExtAbility';
|
||||
|
||||
var dropdownPanelWant = {
|
||||
'bundleName': 'com.ohos.systemui',
|
||||
'abilityName': 'com.ohos.systemui.dropdownpanel.ServiceExtAbility'
|
||||
};
|
||||
|
||||
class ServiceExtAbility extends ServiceExtension {
|
||||
async onCreate(want: Want): Promise<void> {
|
||||
Log.showInfo(TAG, `onCreate, want: ${JSON.stringify(want)}`);
|
||||
AbilityManager.setContext(AbilityManager.ABILITY_NAME_NAVIGATION_BAR, this.context);
|
||||
|
||||
let configInfo = await NavBarConfiguration.getConfiguration();
|
||||
if (configInfo.showNavHorizontal) {
|
||||
if (configInfo.realHeight == 0) {
|
||||
Log.showInfo(TAG, `hide navbar`);
|
||||
} else if (configInfo.maxWidth > configInfo.maxHeight) { // Pad、PC Mode
|
||||
configInfo.realHeight = 44 * configInfo.maxWidth / 1280;
|
||||
} else { // Phone Mode
|
||||
configInfo.realHeight = 36 * configInfo.maxWidth / 360;
|
||||
}
|
||||
configInfo.minHeight = configInfo.realHeight;
|
||||
if (configInfo.yCoordinate > 0) {
|
||||
configInfo.yCoordinate = configInfo.maxHeight - configInfo.realHeight;
|
||||
}
|
||||
} else {
|
||||
if (configInfo.realWidth == 0) {
|
||||
Log.showInfo(TAG, `hide navbar`);
|
||||
} else if (configInfo.maxWidth > configInfo.maxHeight) { // Pad、PC Mode
|
||||
configInfo.realWidth = 44 * configInfo.maxWidth / 1280;
|
||||
} else { // Phone Mode
|
||||
configInfo.realWidth = 36 * configInfo.maxWidth / 360;
|
||||
}
|
||||
configInfo.minHeight = configInfo.realWidth;
|
||||
if (configInfo.xCoordinate > 0) {
|
||||
configInfo.xCoordinate = configInfo.maxWidth - configInfo.realWidth;
|
||||
}
|
||||
}
|
||||
let defaultConfigInfo = await NavBarConfiguration.getConfiguration();
|
||||
let configInfo = NavBarConfiguration.setCustomConfiguration(defaultConfigInfo);
|
||||
AbilityManager.setAbilityData(AbilityManager.ABILITY_NAME_NAVIGATION_BAR, 'config', configInfo);
|
||||
|
||||
if (deviceInfo.deviceType == 'phone') {
|
||||
AbilityManager.startAbility(dropdownPanelWant);
|
||||
}
|
||||
Log.showDebug(TAG, `onCreate, configInfo: ${JSON.stringify(configInfo)}`);
|
||||
|
||||
let navigationBarRect = {
|
||||
left: configInfo.xCoordinate,
|
||||
top: configInfo.yCoordinate,
|
||||
|
@ -13,7 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import Log from '../../../../../../../common/src/main/ets/default/log';
|
||||
import Log from '../../../../../../../common/src/main/ets/default/Log';
|
||||
import HeadComponent from '../../../../../../../features/managementcomponent/src/main/ets/com/ohos/view/component/headcomponent';
|
||||
import AppItemComponent from '../../../../../../../features/managementcomponent/src/main/ets/com/ohos/view/component/appitemcomponent';
|
||||
import SwitchComponent from '../../../../../../../features/managementcomponent/src/main/ets/com/ohos/view/component/switchcomponent';
|
||||
|
@ -18,6 +18,7 @@ import display from '@ohos.display';
|
||||
import Log from '../../../../../../../common/src/main/ets/default/Log';
|
||||
import WindowManager, { WindowType } from '../../../../../../../common/src/main/ets/default/WindowManager';
|
||||
import AbilityManager from '../../../../../../../common/src/main/ets/default/abilitymanager/abilityManager';
|
||||
import NavBarConfiguration from '../../../../../../../features/navigationservice/src/main/ets/com/ohos/navigationservice/common/NavBarConfiguration';
|
||||
import { Want } from 'ability/want';
|
||||
|
||||
|
||||
@ -27,6 +28,10 @@ class ServiceExtAbility extends ServiceExtension {
|
||||
async onCreate(want: Want): Promise<void> {
|
||||
Log.showInfo(TAG, `onCreate, want: ${JSON.stringify(want)}`);
|
||||
AbilityManager.setContext(AbilityManager.ABILITY_NAME_DROPDOWN_PANEL, this.context);
|
||||
let defaultConfigInfo = await NavBarConfiguration.getConfiguration();
|
||||
let configInfo = NavBarConfiguration.setCustomConfiguration(defaultConfigInfo);
|
||||
AbilityManager.setAbilityData(AbilityManager.ABILITY_NAME_NAVIGATION_BAR, 'config', configInfo);
|
||||
Log.showDebug(TAG, `onCreate, configInfo: ${JSON.stringify(configInfo)}`);
|
||||
globalThis[AbilityManager.ABILITY_NAME_OWNER_WANT] = want;
|
||||
|
||||
display.getDefaultDisplay().then((dis) => {
|
||||
|
@ -71,6 +71,38 @@
|
||||
{
|
||||
"name": "control_center_complex_toggle_ring_mode_title_vibration",
|
||||
"value": "振动"
|
||||
},
|
||||
{
|
||||
"name": "status_bar_position_landscape",
|
||||
"value": "2"
|
||||
},
|
||||
{
|
||||
"name": "nav_bar_position_landscape",
|
||||
"value": "4"
|
||||
},
|
||||
{
|
||||
"name": "status_bar_size_landscape",
|
||||
"value": "48"
|
||||
},
|
||||
{
|
||||
"name": "nav_bar_size_landscape",
|
||||
"value": "72"
|
||||
},
|
||||
{
|
||||
"name": "status_bar_position_portrait",
|
||||
"value": "1"
|
||||
},
|
||||
{
|
||||
"name": "nav_bar_position_portrait",
|
||||
"value": "4"
|
||||
},
|
||||
{
|
||||
"name": "status_bar_size_portrait",
|
||||
"value": "48"
|
||||
},
|
||||
{
|
||||
"name": "nav_bar_size_portrait",
|
||||
"value": "72"
|
||||
}
|
||||
]
|
||||
}
|
@ -71,6 +71,38 @@
|
||||
{
|
||||
"name": "control_center_complex_toggle_ring_mode_title_vibration",
|
||||
"value": "Vibration"
|
||||
},
|
||||
{
|
||||
"name": "status_bar_position_landscape",
|
||||
"value": "2"
|
||||
},
|
||||
{
|
||||
"name": "nav_bar_position_landscape",
|
||||
"value": "4"
|
||||
},
|
||||
{
|
||||
"name": "status_bar_size_landscape",
|
||||
"value": "48"
|
||||
},
|
||||
{
|
||||
"name": "nav_bar_size_landscape",
|
||||
"value": "72"
|
||||
},
|
||||
{
|
||||
"name": "status_bar_position_portrait",
|
||||
"value": "1"
|
||||
},
|
||||
{
|
||||
"name": "nav_bar_position_portrait",
|
||||
"value": "1"
|
||||
},
|
||||
{
|
||||
"name": "status_bar_size_portrait",
|
||||
"value": "48"
|
||||
},
|
||||
{
|
||||
"name": "nav_bar_size_portrait",
|
||||
"value": "72"
|
||||
}
|
||||
]
|
||||
}
|
@ -71,6 +71,38 @@
|
||||
{
|
||||
"name": "control_center_complex_toggle_ring_mode_title_vibration",
|
||||
"value": "振动"
|
||||
},
|
||||
{
|
||||
"name": "status_bar_position_landscape",
|
||||
"value": "2"
|
||||
},
|
||||
{
|
||||
"name": "nav_bar_position_landscape",
|
||||
"value": "4"
|
||||
},
|
||||
{
|
||||
"name": "status_bar_size_landscape",
|
||||
"value": "48"
|
||||
},
|
||||
{
|
||||
"name": "nav_bar_size_landscape",
|
||||
"value": "72"
|
||||
},
|
||||
{
|
||||
"name": "status_bar_position_portrait",
|
||||
"value": "1"
|
||||
},
|
||||
{
|
||||
"name": "nav_bar_position_portrait",
|
||||
"value": "1"
|
||||
},
|
||||
{
|
||||
"name": "status_bar_size_portrait",
|
||||
"value": "48"
|
||||
},
|
||||
{
|
||||
"name": "nav_bar_size_portrait",
|
||||
"value": "72"
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user