mirror of
https://gitee.com/openharmony/applications_launcher
synced 2024-11-26 16:41:58 +00:00
!547 修复桌面图标拖动图标缩小
Merge pull request !547 from zhengyongjie/icon_master
This commit is contained in:
commit
b1df32e1cc
@ -38,7 +38,6 @@ import inputConsumer from '@ohos.multimodalInput.inputConsumer';
|
||||
import { KeyCode } from '@ohos.multimodalInput.keyCode';
|
||||
import window from '@ohos.window';
|
||||
import { PreferencesHelper } from '@ohos/common/src/main/ets/default/manager/PreferencesHelper';
|
||||
import systemParameter from '@ohos.systemparameter';
|
||||
|
||||
const TAG = 'LauncherMainAbility';
|
||||
|
||||
@ -54,6 +53,10 @@ export default class MainAbility extends ServiceExtension {
|
||||
async initLauncher(): Promise<void> {
|
||||
// init Launcher context
|
||||
globalThis.desktopContext = this.context;
|
||||
// init rdb
|
||||
let dbStore = RdbStoreManager.getInstance();
|
||||
await dbStore.initRdbConfig();
|
||||
await dbStore.createTable();
|
||||
|
||||
let registerWinEvent = (win: window.Window) => {
|
||||
win.on('windowEvent', (stageEventType) => {
|
||||
@ -65,34 +68,24 @@ export default class MainAbility extends ServiceExtension {
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
// create Launcher entry view
|
||||
windowManager.createWindow(globalThis.desktopContext, windowManager.DESKTOP_WINDOW_NAME,
|
||||
windowManager.DESKTOP_RANK, 'pages/' + windowManager.DESKTOP_WINDOW_NAME, true, registerWinEvent);
|
||||
|
||||
await PreferencesHelper.getInstance().initPreference(globalThis.desktopContext);
|
||||
|
||||
await PreferencesHelper.getInstance().initPreference(this.context);
|
||||
AppStorage.setOrCreate('firstActivate', true);
|
||||
// init global const
|
||||
this.initGlobalConst();
|
||||
|
||||
// init rdb
|
||||
let dbStore = RdbStoreManager.getInstance();
|
||||
|
||||
await dbStore.initRdbConfig();
|
||||
await dbStore.createTable();
|
||||
this.displayManager = DisplayManager.getInstance();
|
||||
|
||||
// init Gesture navigation
|
||||
this.startGestureNavigation();
|
||||
|
||||
windowManager.registerWindowEvent();
|
||||
navigationBarCommonEventManager.registerNavigationBarEvent();
|
||||
|
||||
// load recent
|
||||
windowManager.createRecentWindow();
|
||||
this.registerInputConsumer();
|
||||
this.displayManager = DisplayManager.getInstance();
|
||||
|
||||
AppStorage.setOrCreate('loaded', true);
|
||||
systemParameter.set('bootevent.launcher.ready', 'true');
|
||||
}
|
||||
|
||||
private registerInputConsumer(): void {
|
||||
|
@ -29,6 +29,7 @@ import StyleConstants from '../common/constants/StyleConstants';
|
||||
import { SmartDockStyleConfig } from '@ohos/smartdock';
|
||||
import PhonePageDesktopGridStyleConfig from '../common/PhonePageDesktopGridStyleConfig';
|
||||
import { FormStyleConfig } from '@ohos/form';
|
||||
import systemParameter from '@ohos.systemparameter';
|
||||
|
||||
const TAG = 'EntryView';
|
||||
|
||||
@ -51,6 +52,10 @@ struct EntryView {
|
||||
|
||||
onPageShow(): void {
|
||||
Log.showInfo(TAG, 'onPageShow');
|
||||
let firstActivate:boolean | undefined = AppStorage.get('firstActivate');
|
||||
if (firstActivate) {
|
||||
this.voteBootEvent();
|
||||
}
|
||||
}
|
||||
|
||||
onPageHide(): void {
|
||||
@ -72,6 +77,18 @@ struct EntryView {
|
||||
localEventManager.registerEventListener(listener, [EventConstants.EVENT_NAVIGATOR_BAR_STATUS_CHANGE]);
|
||||
}
|
||||
|
||||
private voteBootEvent(): void {
|
||||
Log.showInfo(TAG, 'voteBootEvent for launcher begin');
|
||||
try {
|
||||
AppStorage.setOrCreate('firstActivate', false);
|
||||
AppStorage.setOrCreate('loaded', true);
|
||||
systemParameter.set('bootevent.launcher.ready', 'true');
|
||||
} catch (err) {
|
||||
Log.showError(TAG, `set voteBootEvent err, ${JSON.stringify(err)}`);
|
||||
}
|
||||
Log.showInfo(TAG, 'voteBootEvent for launcher end');
|
||||
}
|
||||
|
||||
private readonly mLocalEventListener: LocalEventListener = {
|
||||
onReceiveEvent: (event: string, params: string) => {
|
||||
Log.showDebug(TAG, `receive event: ${event}, params: ${params}`);
|
||||
|
Loading…
Reference in New Issue
Block a user