mirror of
https://gitee.com/openharmony/applications_photos
synced 2024-11-23 15:10:25 +00:00
!57 修改视频播放熄屏,图片不显示,复制改为copyfile
Merge pull request !57 from wlxtt/master
This commit is contained in:
commit
009148b5ab
@ -87,6 +87,7 @@ export class MediaDataSource extends AbsDataSource {
|
||||
deviceId: string = undefined;
|
||||
isRefresh: boolean = false;
|
||||
isEditSaveReload: boolean = false;
|
||||
isFirstPatchDataRequest: boolean = false;
|
||||
|
||||
constructor(windowSize: number) {
|
||||
super();
|
||||
@ -166,6 +167,7 @@ export class MediaDataSource extends AbsDataSource {
|
||||
milliseconds to load first batch: ${(assets == null ? 0 : assets.length)}`);
|
||||
this.updateMediaData(this.firstPatchDataRequestTime, start, assets);
|
||||
this.broadCast && this.broadCast.emit(Constants.FIRST_PATCH_LOAD_FINISH, []);
|
||||
this.isFirstPatchDataRequest = true
|
||||
let secondPatchDataCallback: GetItemsCallback = new GetItemsCallback(this, limit);
|
||||
this.photoDataImpl.getData(secondPatchDataCallback, {
|
||||
id: this.albumId,
|
||||
|
@ -44,7 +44,7 @@ export class OperationImpl implements BrowserOperationInterface {
|
||||
|
||||
TraceControllerUtils.startTrace('openAssetR')
|
||||
let fd = await MediaLibraryAccess.getInstance().openAsset('R', source);
|
||||
TraceControllerUtils.finishTrace('openAsset')
|
||||
TraceControllerUtils.finishTrace('openAssetR')
|
||||
if (fd <= 0) {
|
||||
throw 'fd is invalid'
|
||||
return;
|
||||
@ -58,9 +58,9 @@ export class OperationImpl implements BrowserOperationInterface {
|
||||
return;
|
||||
}
|
||||
|
||||
TraceControllerUtils.startTrace('readAndWriteData')
|
||||
await this.readAndWriteData(fd, targetFd);
|
||||
TraceControllerUtils.finishTrace('readAndWriteData')
|
||||
TraceControllerUtils.startTrace('copyFile')
|
||||
await fileio.copyFile(fd, targetFd)
|
||||
TraceControllerUtils.finishTrace('copyFile')
|
||||
|
||||
TraceControllerUtils.startTrace('sourceClose')
|
||||
await source.close(fd);
|
||||
|
@ -428,4 +428,28 @@ export class ScreenManager {
|
||||
getScreenColumns(): number {
|
||||
return this.columns;
|
||||
}
|
||||
|
||||
setKeepScreenOn() {
|
||||
this.logger.info('setKeepScreenOn start');
|
||||
let topWindow: any = AppStorage.Get('mainWindow');
|
||||
try {
|
||||
topWindow.setKeepScreenOn(true, () => {
|
||||
this.logger.info('setKeepScreenOn Succeeded');
|
||||
})
|
||||
} catch(err) {
|
||||
this.logger.error(`setKeepScreenOn err: ${err}`);
|
||||
}
|
||||
}
|
||||
|
||||
setKeepScreenOff() {
|
||||
this.logger.info('setKeepScreenOff start');
|
||||
let topWindow: any = AppStorage.Get('mainWindow');
|
||||
try {
|
||||
topWindow.setKeepScreenOn(false, () => {
|
||||
this.logger.info('setKeepScreenOff Succeeded');
|
||||
})
|
||||
} catch(err) {
|
||||
this.logger.error(`setKeepScreenOff err: ${err}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ export struct DeleteProgressDialog {
|
||||
.fontColor($r('sys.color.ohos_id_color_text_secondary'))
|
||||
.margin({
|
||||
left: $r('app.float.process_bar_margin_left'),
|
||||
right: $r('app.float.process_bar_margin_left'),
|
||||
right: $r('app.float.delete_process_bar_margin_right'),
|
||||
})
|
||||
}
|
||||
.width('100%')
|
||||
|
@ -79,8 +79,7 @@ export struct AlbumGridItemNewStyle {
|
||||
this.bigWidth = gridWidth * 2 + Constants.ALBUM_SET_GUTTER;
|
||||
let numberHeight = px2vp(fp2px(Constants.TEXT_SIZE_BODY2));
|
||||
let nameHeight = px2vp(fp2px(Constants.TEXT_SIZE_SUB_TITLE1));
|
||||
this.icHeight = this.gridHeight - Constants.ALBUM_SET_NEW_ICON_MARGIN;
|
||||
-numberHeight - nameHeight;
|
||||
this.icHeight = this.gridHeight - Constants.ALBUM_SET_NEW_ICON_MARGIN - numberHeight - nameHeight;
|
||||
|
||||
if (Constants.ANGLE_90 == this.item.coverOrientation
|
||||
|| Constants.ANGLE_270 == this.item.coverOrientation) {
|
||||
|
@ -13,6 +13,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import router from '@ohos.router';
|
||||
import { CopyMenuOperation } from '../../../common/view/browserOperation/CopyMenuOperation';
|
||||
import { MoveMenuOperation } from '../../../common/view/browserOperation/MoveMenuOperation';
|
||||
import { AlbumInfo } from '../../../common/model/browser/album/AlbumInfo';
|
||||
import { AlbumSetDataSource } from '../../../common/model/browser/album/AlbumSetDataSource'
|
||||
import { Constants } from '../../../common/model/common/Constants'
|
||||
import { ScreenManager } from '../../../common/model/common/ScreenManager'
|
||||
@ -23,7 +27,7 @@ import { BroadCastManager } from '../../../common/model/common/BroadCastManager'
|
||||
import { TraceControllerUtils } from '../../../common/utils/TraceControllerUtils'
|
||||
import { TabBarForAlbumSet } from '../../../common/view/TabBar'
|
||||
import { TabItemWithText } from '../../../common/model/common/TabItem'
|
||||
import { AlbumSetSelectManager } from '../../../common/model/browser/SelectManager'
|
||||
import { AlbumSetSelectManager, SelectManager } from '../../../common/model/browser/SelectManager'
|
||||
import { AlbumSetNewMenuOperation } from '../../../common/view/browserOperation/AlbumSetNewMenuOperation'
|
||||
import { DistributedDataSource } from '../../../common/model/browser/album/DistributedDataSource'
|
||||
import { MenuContext } from '../../../common/view/browserOperation/MenuContext'
|
||||
@ -79,6 +83,7 @@ export struct AlbumSetPage {
|
||||
private needNotify = false;
|
||||
private ignoreLocalNotify = false;
|
||||
private barModel: AlbumBarModel = new AlbumBarModel()
|
||||
private toPhotoGrid: boolean = false;
|
||||
|
||||
onMenuClicked(action: Action, arg: any[]) {
|
||||
this.logger.info(`onMenuClicked, action: ${action.actionID}`);
|
||||
@ -145,6 +150,11 @@ export struct AlbumSetPage {
|
||||
this.ignoreLocalNotify = false;
|
||||
this.albums.onChange(Constants.MEDIA_TYPE_IMAGE);
|
||||
this.albums.unfreeze();
|
||||
let newAlbum = AppStorage.Get<boolean>(Constants.APP_KEY_NEW_ALBUM);
|
||||
if (newAlbum) {
|
||||
this.toPhotoGrid = true;
|
||||
AppStorage.Delete(Constants.APP_KEY_NEW_ALBUM_SELECTED);
|
||||
}
|
||||
}
|
||||
|
||||
aboutToAppear(): void {
|
||||
@ -155,6 +165,28 @@ export struct AlbumSetPage {
|
||||
this.appBroadCast.on(BroadCastConstants.RESET_STATE_EVENT, this.onStateReset.bind(this));
|
||||
this.broadCast.on(Constants.ON_LOADING_FINISHED, (size: number) => {
|
||||
this.isEmpty = (size == 0);
|
||||
let newAlbum = AppStorage.Get<boolean>(Constants.APP_KEY_NEW_ALBUM);
|
||||
if (!this.isEmpty && newAlbum && this.toPhotoGrid) {
|
||||
this.toPhotoGrid = false;
|
||||
let newAlbum = AppStorage.Get<AlbumInfo>(Constants.APP_KEY_NEW_ALBUM_TARGET);
|
||||
for (let album of this.albums.mediaSetList) {
|
||||
if (album.name == newAlbum.name
|
||||
&& album.displayName == newAlbum.displayName
|
||||
&& album.relativePath == newAlbum.relativePath) {
|
||||
let options = {
|
||||
url: 'feature/browser/view/photoGrid/PhotoGridPage',
|
||||
params: {
|
||||
item: JSON.stringify(album)
|
||||
}
|
||||
}
|
||||
router.push(options);
|
||||
break;
|
||||
}
|
||||
}
|
||||
AppStorage.Delete(Constants.APP_KEY_NEW_ALBUM);
|
||||
AppStorage.Delete(Constants.APP_KEY_NEW_ALBUM_TARGET);
|
||||
AppStorage.Delete(Constants.APP_KEY_NEW_ALBUM_SELECTED);
|
||||
}
|
||||
});
|
||||
|
||||
this.appBroadCast.on(BroadCastConstants.RESET_ZERO, this.onResetZero.bind(this));
|
||||
@ -220,12 +252,55 @@ export struct AlbumSetPage {
|
||||
this.logger.info(`onIndexPageShow`)
|
||||
if (this.isShow && this.isInCurrentTab) {
|
||||
this.onActive();
|
||||
this.createAlbum();
|
||||
} else if (!this.isShow && this.isInCurrentTab) {
|
||||
this.onInActive();
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
createAlbum() {
|
||||
let newAlbum = AppStorage.Get<boolean>(Constants.APP_KEY_NEW_ALBUM);
|
||||
if (newAlbum) {
|
||||
this.broadCast.emit(BroadCastConstants.SHOW_COPY_OR_MOVE_DIALOG,
|
||||
[this.moveOperation.bind(this), this.copyOperation.bind(this)]);
|
||||
}
|
||||
}
|
||||
|
||||
private copyOperation() {
|
||||
let selectManager = AppStorage.Get<SelectManager>(Constants.APP_KEY_NEW_ALBUM_SELECTED);
|
||||
let targetAlbum = AppStorage.Get<AlbumInfo>(Constants.APP_KEY_NEW_ALBUM_TARGET);
|
||||
if (undefined == selectManager || undefined == targetAlbum) {
|
||||
return;
|
||||
}
|
||||
let menuContext = new MenuContext();
|
||||
menuContext
|
||||
.withSelectManager(selectManager)
|
||||
.withOperationStartCallback(this.onOperationStart.bind(this))
|
||||
.withOperationEndCallback(this.onOperationEnd.bind(this))
|
||||
.withBroadCast(this.broadCast)
|
||||
.withAlbumInfo(targetAlbum);
|
||||
let menuOperation = MenuOperationFactory.getInstance().createMenuOperation(CopyMenuOperation, menuContext);
|
||||
menuOperation.doAction();
|
||||
}
|
||||
|
||||
private moveOperation() {
|
||||
let selectManager = AppStorage.Get<SelectManager>(Constants.APP_KEY_NEW_ALBUM_SELECTED);
|
||||
let targetAlbum = AppStorage.Get<AlbumInfo>(Constants.APP_KEY_NEW_ALBUM_TARGET);
|
||||
if (undefined == selectManager || undefined == targetAlbum) {
|
||||
return;
|
||||
}
|
||||
let menuContext = new MenuContext();
|
||||
menuContext
|
||||
.withSelectManager(selectManager)
|
||||
.withOperationStartCallback(this.onOperationStart.bind(this))
|
||||
.withOperationEndCallback(this.onOperationEnd.bind(this))
|
||||
.withBroadCast(this.broadCast)
|
||||
.withAlbumInfo(targetAlbum);
|
||||
let menuOperation = MenuOperationFactory.getInstance().createMenuOperation(MoveMenuOperation, menuContext);
|
||||
menuOperation.doAction();
|
||||
}
|
||||
|
||||
onModeChange() {
|
||||
this.logger.info(`onModeChange ${this.isAlbumSetSelectedMode}`);
|
||||
if (!this.isAlbumSetSelectedMode) {
|
||||
@ -496,7 +571,7 @@ export struct AlbumSetPage {
|
||||
}.visibility(this.isEmpty && !this.isTabBarShow ? Visibility.None : Visibility.Visible)
|
||||
|
||||
ToolBar({
|
||||
isShowBar: $isAlbumSetSelectedMode,
|
||||
isShowBar: this.isAlbumSetSelectedMode,
|
||||
toolMenuList: this.barModel.getMenuList(
|
||||
this.isAlbumSetSelectedMode,
|
||||
this.selectedAlbumsCount,
|
||||
|
@ -95,11 +95,13 @@ struct VideoBrowser {
|
||||
this.isShowBar = !this.isShowBar;
|
||||
})
|
||||
.onStart(() => {
|
||||
ScreenManager.getInstance().setKeepScreenOn();
|
||||
})
|
||||
.onPause(() => {
|
||||
})
|
||||
.onFinish(() => {
|
||||
this.isShowBar = true;
|
||||
ScreenManager.getInstance().setKeepScreenOff();
|
||||
})
|
||||
.autoPlay(true)
|
||||
|
||||
|
@ -453,7 +453,7 @@ struct FormEditorPage {
|
||||
bottom: $r('app.float.FA_ListCard_padding_top')
|
||||
})
|
||||
.backgroundColor($r('app.color.white'))
|
||||
.borderRadius($r("app.float.FA_ListCard_radius"))
|
||||
.borderRadius($r('sys.float.ohos_id_corner_radius_default_l'))
|
||||
.onClick(() => {
|
||||
this.selectPhoto();
|
||||
})
|
||||
@ -486,7 +486,7 @@ struct FormEditorPage {
|
||||
bottom: $r('app.float.FA_ListCard_padding_top')
|
||||
})
|
||||
.backgroundColor($r('app.color.white'))
|
||||
.borderRadius($r("app.float.FA_ListCard_radius"))
|
||||
.borderRadius($r('sys.float.ohos_id_corner_radius_default_l'))
|
||||
.onClick(() => {
|
||||
this.selectAlbum();
|
||||
})
|
||||
@ -502,7 +502,7 @@ struct FormEditorPage {
|
||||
Row() {
|
||||
Text($r('app.string.fa_setting_text'))
|
||||
.fontSize($r('sys.float.ohos_id_text_size_body2'))
|
||||
.fontColor($r('sys.color.ohos_id_color_text_secondary'))
|
||||
.fontColor($r('app.color.FA_subTitle_text_color'))
|
||||
}
|
||||
.padding({
|
||||
top: $r('app.float.FA_setting_padding_top'),
|
||||
@ -545,7 +545,7 @@ struct FormEditorPage {
|
||||
bottom: $r('app.float.FA_ListCard_padding_top')
|
||||
})
|
||||
.backgroundColor($r('app.color.white'))
|
||||
.borderRadius($r("app.float.FA_ListCard_radius"))
|
||||
.borderRadius($r('sys.float.ohos_id_corner_radius_default_l'))
|
||||
.onClick(() => {
|
||||
this.setPlayInterval()
|
||||
})
|
||||
|
@ -90,8 +90,13 @@ export struct NewAlbumPage {
|
||||
}
|
||||
this.logger.info(`onMenuClicked, action: ${action.actionID} newAlbum: ${this.isNewAlbum}`);
|
||||
if (this.isNewAlbum) {
|
||||
this.broadCast.emit(BroadCastConstants.SHOW_COPY_OR_MOVE_DIALOG,
|
||||
[this.moveOperation.bind(this), this.copyOperation.bind(this)]);
|
||||
let url = this.isHorizontal ? 'product/pad/view/index' : 'product/phone/view/index'
|
||||
router.back({
|
||||
uri: url,
|
||||
params: {
|
||||
jumpSource: JumpSourceToMain.ALBUM
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.copyOperation();
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ export struct TimelinePage {
|
||||
this.mSelectManager.setTotalCount(this.dataSource.getMediaCount());
|
||||
this.moreMenuList = [Action.MOVE, Action.COPY, Action.INFO];
|
||||
this.isEmpty = !Boolean(this.dataSource.getMediaCount());
|
||||
this.initLoadFinish = Boolean(this.dataSource.getMediaCount());
|
||||
this.initLoadFinish = this.dataSource.isFirstPatchDataRequest;
|
||||
MediaObserver.getInstance().registerObserver(this.dataObserver);
|
||||
this.dataSource.registerCallback('updateGroupData', (newState: TimelineData[]) => {
|
||||
self.mSelectManager.updateGroupData(newState);
|
||||
@ -675,7 +675,7 @@ export struct TimelinePage {
|
||||
}
|
||||
|
||||
ToolBar({
|
||||
isShowBar: $isSelectedMode,
|
||||
isShowBar: this.isSelectedMode,
|
||||
toolMenuList: this.barModel.getMenuList(this.isSelectedMode, this.totalSelectedCount, this.isAllSelected),
|
||||
onMenuClicked: this.onMenuClicked
|
||||
})
|
||||
|
@ -754,11 +754,15 @@
|
||||
},
|
||||
{
|
||||
"name": "process_bar_margin_left",
|
||||
"value": "4"
|
||||
"value": "4vp"
|
||||
},
|
||||
{
|
||||
"name": "delete_process_bar_margin_right",
|
||||
"value": "12vp"
|
||||
},
|
||||
{
|
||||
"name": "process_bar_margin_right",
|
||||
"value": "40"
|
||||
"value": "44vp"
|
||||
},
|
||||
{
|
||||
"name": "menu_padding_horizontal",
|
||||
@ -854,7 +858,7 @@
|
||||
},
|
||||
{
|
||||
"name": "FA_setting_padding_left",
|
||||
"value": "24vp"
|
||||
"value": "12vp"
|
||||
},
|
||||
{
|
||||
"name": "FA_setting_padding_bottom",
|
||||
|
Loading…
Reference in New Issue
Block a user