mirror of
https://gitee.com/openharmony/applications_photos
synced 2024-11-23 07:00:09 +00:00
commit
e639931846
@ -103,12 +103,11 @@ export struct ImageGridItemComponent {
|
||||
|
||||
private selectStateChange() {
|
||||
logInfo(TAG, `change selected ${this.isSelectedMode}`);
|
||||
if (this.isSelectedMode) {
|
||||
this.onSelected()
|
||||
} else {
|
||||
if (!this.isSelectedMode) {
|
||||
this.isSelectedMode = true
|
||||
this.pressAnimScale = 1;
|
||||
}
|
||||
this.onSelected()
|
||||
}
|
||||
|
||||
build() {
|
||||
|
@ -24,11 +24,20 @@ export class FavorMediaDataItem extends MediaDataItem {
|
||||
}
|
||||
|
||||
async loadFileAsset(): Promise<MediaLib.FileAsset> {
|
||||
let fetchOption: MediaLib.MediaFetchOptions = {
|
||||
selections: this.selections,
|
||||
selectionArgs: this.selectionArgs,
|
||||
order: `date_added DESC LIMIT ${this.index},1`
|
||||
};
|
||||
let fetchOption: MediaLib.MediaFetchOptions
|
||||
if (this.status == MediaConstants.UNDEFINED) {
|
||||
fetchOption = {
|
||||
selections: this.selections,
|
||||
selectionArgs: this.selectionArgs,
|
||||
order: `date_added DESC LIMIT ${this.index},1`
|
||||
};
|
||||
} else {
|
||||
fetchOption = {
|
||||
selections: `${MediaLib.FileKey.ID} = ?`,
|
||||
selectionArgs: [this.id.toString()],
|
||||
order: `date_added DESC`
|
||||
}
|
||||
}
|
||||
return (await mediaModel.getAllFavorMediaItem(fetchOption, false)).fileAsset
|
||||
}
|
||||
|
||||
|
@ -68,11 +68,20 @@ export class MediaDataItem {
|
||||
}
|
||||
|
||||
async loadFileAsset(): Promise<MediaLib.FileAsset> {
|
||||
let fetchOption: MediaLib.MediaFetchOptions = {
|
||||
selections: this.selections,
|
||||
selectionArgs: this.selectionArgs,
|
||||
order: `date_added DESC LIMIT ${this.index},1`
|
||||
};
|
||||
let fetchOption: MediaLib.MediaFetchOptions
|
||||
if (this.status == MediaConstants.UNDEFINED) {
|
||||
fetchOption = {
|
||||
selections: this.selections,
|
||||
selectionArgs: this.selectionArgs,
|
||||
order: `date_added DESC LIMIT ${this.index},1`
|
||||
};
|
||||
} else {
|
||||
fetchOption = {
|
||||
selections: `${MediaLib.FileKey.ID} = ?`,
|
||||
selectionArgs: [this.id.toString()],
|
||||
order: `date_added DESC`
|
||||
}
|
||||
}
|
||||
if (this.deviceId.length > 0) {
|
||||
fetchOption['networkId'] = this.deviceId
|
||||
}
|
||||
@ -156,7 +165,7 @@ export class MediaDataItem {
|
||||
this.status = MediaConstants.TRASHED
|
||||
return true
|
||||
} catch (err) {
|
||||
logError(TAG, `onDelete error: ${JSON.stringify(err)}`)
|
||||
logError(TAG, `onDelete ${this.index} error: ${JSON.stringify(err)}`)
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
@ -29,11 +29,20 @@ export class TrashMediaDataItem extends MediaDataItem {
|
||||
}
|
||||
|
||||
async loadFileAsset(): Promise<MediaLib.FileAsset> {
|
||||
let fetchOption: MediaLib.MediaFetchOptions = {
|
||||
selections: this.selections,
|
||||
selectionArgs: this.selectionArgs,
|
||||
order: `date_added DESC LIMIT ${this.index},1`
|
||||
};
|
||||
let fetchOption: MediaLib.MediaFetchOptions
|
||||
if (this.status == MediaConstants.UNDEFINED) {
|
||||
fetchOption = {
|
||||
selections: this.selections,
|
||||
selectionArgs: this.selectionArgs,
|
||||
order: `date_added DESC LIMIT ${this.index},1`
|
||||
}
|
||||
} else {
|
||||
fetchOption = {
|
||||
selections: `${MediaLib.FileKey.ID} = ?`,
|
||||
selectionArgs: [this.id.toString()],
|
||||
order: `date_added DESC`
|
||||
}
|
||||
}
|
||||
return (await mediaModel.getAllTrashMediaItem(fetchOption, false)).fileAsset
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user