mirror of
https://gitee.com/openharmony/applications_photos
synced 2024-11-23 07:00:09 +00:00
Signed-off-by: houfei <1069760703@qq.com>
Changes to be committed:
This commit is contained in:
parent
c104165920
commit
5361b1a37b
@ -177,6 +177,7 @@ export default class MainAbility extends Ability {
|
||||
if (dataSource.getRawData(0) || times >= MainAbility.RETRY_MAX_TIMES) {
|
||||
AppStorage.SetOrCreate(Constants.APP_KEY_PHOTO_BROWSER, dataSource);
|
||||
windowStage.setUIContent(this.context, 'feature/browser/view/PhotoBrowser', null);
|
||||
ScreenManager.getInstance().initWindowMode();
|
||||
clearInterval(intervalId);
|
||||
}
|
||||
times++;
|
||||
@ -184,6 +185,7 @@ export default class MainAbility extends Ability {
|
||||
});
|
||||
} else {
|
||||
windowStage.setUIContent(this.context, pagePath, null);
|
||||
ScreenManager.getInstance().initWindowMode();
|
||||
}
|
||||
TraceControllerUtils.finishTrace('onWindowStageCreate');
|
||||
}).catch(() => {
|
||||
|
@ -79,19 +79,24 @@ export class ScreenManager {
|
||||
async initializationSize(win): Promise<void> {
|
||||
this.mainWindow = win;
|
||||
let properties = await win.getProperties();
|
||||
let size = properties.windowRect;
|
||||
this.logger.info(`display screen windowRect: ${JSON.stringify(size)}`);
|
||||
this.winWidth = px2vp(size.width);
|
||||
this.winHeight = px2vp(size.height);
|
||||
this.logger.info(`display screen windowRect px2vp: ${this.winWidth} ${this.winHeight}`);
|
||||
if (this.winWidth < ScreenWidth.WIDTH_MEDIUM) {
|
||||
this.columns = ColumnSize.COLUMN_FOUR;
|
||||
} else if (this.winWidth >= ScreenWidth.WIDTH_MEDIUM && this.winWidth < ScreenWidth.WIDTH_LARGE) {
|
||||
this.columns = ColumnSize.COLUMN_EIGHT;
|
||||
} else {
|
||||
this.columns = ColumnSize.COLUMN_TWELVE;
|
||||
}
|
||||
await this.initWindowMode()
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
if (!properties || !properties.windowRect) {
|
||||
reject();
|
||||
}
|
||||
let size = properties.windowRect;
|
||||
this.logger.info(`display screen windowRect: ${JSON.stringify(size)}`);
|
||||
this.winWidth = px2vp(size.width);
|
||||
this.winHeight = px2vp(size.height);
|
||||
this.logger.info(`display screen windowRect px2vp: ${this.winWidth} ${this.winHeight}`);
|
||||
if (this.winWidth < ScreenWidth.WIDTH_MEDIUM) {
|
||||
this.columns = ColumnSize.COLUMN_FOUR;
|
||||
} else if (this.winWidth >= ScreenWidth.WIDTH_MEDIUM && this.winWidth < ScreenWidth.WIDTH_LARGE) {
|
||||
this.columns = ColumnSize.COLUMN_EIGHT;
|
||||
} else {
|
||||
this.columns = ColumnSize.COLUMN_TWELVE;
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@ -185,9 +190,9 @@ export class ScreenManager {
|
||||
return this.naviBarHeight;
|
||||
}
|
||||
|
||||
private async initWindowMode() {
|
||||
initWindowMode() {
|
||||
this.logger.debug(`start to initialize photos application window mode: ${this.windowMode}`);
|
||||
await this.checkWindowMode();
|
||||
this.checkWindowMode();
|
||||
this.mainWindow && this.setMainWindow();
|
||||
}
|
||||
|
||||
@ -211,7 +216,7 @@ export class ScreenManager {
|
||||
}
|
||||
}
|
||||
|
||||
private setMainWindow() {
|
||||
setMainWindow() {
|
||||
this.logger.debug('setMainWindow');
|
||||
this.mainWindow.on('windowSizeChange', (data) => {
|
||||
this.logger.debug(`windowSizeChange ${JSON.stringify(data)}`);
|
||||
@ -227,7 +232,7 @@ export class ScreenManager {
|
||||
});
|
||||
}
|
||||
|
||||
private async setFullScreen() {
|
||||
async setFullScreen() {
|
||||
let topWindow: any = AppStorage.Get(Constants.MAIN_WINDOW);
|
||||
this.logger.debug('getTopWindow start');
|
||||
try {
|
||||
|
@ -31,7 +31,7 @@ export struct ToolBar {
|
||||
@StorageLink('isSplitMode') isSplitMode: boolean = ScreenManager.getInstance().isSplitMode();
|
||||
@StorageLink('leftBlank') leftBlank: [number, number, number, number]
|
||||
= [0, ScreenManager.getInstance().getStatusBarHeight(), 0, ScreenManager.getInstance().getNaviBarHeight()];
|
||||
@State toolMenuList: Action[] = [];
|
||||
toolMenuList: Action[] = [];
|
||||
@Consume moreMenuList: Action[];
|
||||
@StorageLink('isHorizontal') isHorizontal: boolean = ScreenManager.getInstance().isHorizontal();
|
||||
@State showPopup: boolean = false;
|
||||
|
@ -111,7 +111,8 @@ export class CopyMenuOperation extends ProcessMenuOperation {
|
||||
if (this.menuContext.deviceId) {
|
||||
let displayName = assets.sourceAsset.displayName;
|
||||
let index = displayName.lastIndexOf('.');
|
||||
displayName = `${displayName.slice(0, index)}${new Date().getTime()}${displayName.slice(index)}`;
|
||||
let start = displayName.lastIndexOf('_');
|
||||
displayName = `${displayName.slice(0, start)}_${new Date().getTime()}${displayName.slice(index)}`;
|
||||
this.copy(assets.sourceAsset, null, {
|
||||
mediaType: assets.sourceAsset.mediaType,
|
||||
name: displayName,
|
||||
|
@ -66,7 +66,7 @@ struct PhotoBrowser {
|
||||
@Provide('dateTitle') photoDate: string = '';
|
||||
@Provide('timeLocationTitle') timeAndLocation: string = '';
|
||||
@Provide menuList: Array<Action> = new Array<Action>();
|
||||
private toolMenuList: Array<Action> = new Array<Action>();
|
||||
@State toolMenuList: Array<Action> = new Array<Action>();
|
||||
@Provide topMenuList: Array<Action> = new Array<Action>();
|
||||
@Provide moreMenuList: Array<Action> = new Array<Action>();
|
||||
@Provide broadCast: BroadCast = new BroadCast();
|
||||
|
Loading…
Reference in New Issue
Block a user