diff --git a/entry/src/main/ets/Common/Utils/FileUtil.ts b/entry/src/main/ets/Common/Utils/FileUtil.ts index bb5ddbe27d773ed2c4a19953e52125f26a0f3b17..6ed7450c8a7de4a1601996cef02d433e87da9871 100644 --- a/entry/src/main/ets/Common/Utils/FileUtil.ts +++ b/entry/src/main/ets/Common/Utils/FileUtil.ts @@ -162,11 +162,13 @@ export default class FileUtil { file = Fileio.openSync(uri, Constants.READ_WRITE); } catch (error) { Log.error(TAG, 'open fail: ' + JSON.stringify(error)); + errorFileName = fileName; errorCount++; continue; } if (file === undefined || file.fd < 0) { Log.error(TAG, 'open fail, file is undefined'); + errorFileName = fileName; errorCount++; continue; } @@ -175,6 +177,7 @@ export default class FileUtil { Log.info(TAG, 'image.createImageSource: ', JSON.stringify(imageSource)); if (CheckEmptyUtils.isEmpty(imageSource)) { Log.error(TAG, 'imageSource is error'); + errorFileName = fileName; errorCount++; continue; } @@ -182,6 +185,7 @@ export default class FileUtil { Log.info(TAG, 'imageSource.getImageInfo: ', JSON.stringify(imageInfo)); if (CheckEmptyUtils.isEmpty(imageInfo)) { Log.error(TAG, 'imageInfo is error'); + errorFileName = fileName; errorCount++; continue; } diff --git a/entry/src/main/ets/Controller/PrintJobController.ets b/entry/src/main/ets/Controller/PrintJobController.ets index b693efd5d91e4dbbe010b8bf2fc8e44c4428e29b..8b4e57f05feeb8c7ebc6241e54aa128b8e68eeb4 100644 --- a/entry/src/main/ets/Controller/PrintJobController.ets +++ b/entry/src/main/ets/Controller/PrintJobController.ets @@ -22,6 +22,7 @@ import { Log } from '@ohos/common'; import { PrintJobModel } from '../Model/PrintJobModel'; import { PrintJob } from '../Model/PrintJob'; import FileUtil from '../Common/Utils/FileUtil'; +import CheckEmptyUtils from '@ohos/common'; const TAG = '[PrintJobController]:'; @@ -226,9 +227,9 @@ export class PrintJobController { } } - private convertToHwPrintJob(item: print.PrintJob): PrintJob { + convertToPrintJob(item: print.PrintJob): PrintJob { if (!this.isValidPrintJob(item)) { - Log.info(TAG, `convertToHwPrintJob invalid job, jobId${item.jobId}}`); + Log.info(TAG, `convertToPrintJob invalid job, jobId${item.jobId}}`); return null; } return new PrintJob(item.jobFiles, item.fdList, item.jobId, item.printerId, item.jobState, @@ -236,6 +237,17 @@ export class PrintJobController { item.colorMode, item.duplexMode, item.margin, item.preview, item.option); } + isValidPrintJob(job: print.PrintJob): boolean { + if (job == null) { + return false; + } + if(CheckEmptyUtils.checkStrIsEmpty(job.printerId) || CheckEmptyUtils.checkStrIsEmpty(job.jobId) || + !(job.jobState in PrintJobState) || !(job.jobSubState in PrintJobSubState)){ + return false; + } + return true; + } + /** * queryAllPrintJobs */ @@ -245,7 +257,7 @@ export class PrintJobController { Log.info(TAG, `queryAllPrintJobs data.length:${data?.length}`); let retPrintJobs:Array = []; for (let item of data) { - let printJob = this.convertToHwPrintJob(item); + let printJob = this.convertToPrintJob(item); if (printJob === null) { Log.warn(TAG, 'queryAllPrintJobs invalid job.'); continue; diff --git a/entry/src/main/ets/pages/component/PreviewComponent.ets b/entry/src/main/ets/pages/component/PreviewComponent.ets index aebd544027c08bff44e82d163eaa7d09be4ee6d5..def8c9c725b3e8ac295a68fd266f2a55b412fca5 100644 --- a/entry/src/main/ets/pages/component/PreviewComponent.ets +++ b/entry/src/main/ets/pages/component/PreviewComponent.ets @@ -65,7 +65,7 @@ export struct PreviewComponent { build() { Column() { Row() { - Image($r('app.media.ic_firstPage')).width($r('app.float.image_comp_width')).height($r('app.float.image_comp_height')).key('PreviewComponent_Image_firstPage') + Image($r('app.media.ic_firstPage')).width(32).height(32).key('PreviewComponent_Image_firstPage') .enabled(this.currentIndex !== 1 && !this.isGlobalDisable) .opacity((this.currentIndex !== 1 && !this.isGlobalDisable) ? Constants.NUMBER_1 : $r('app.float.disable_opacity')) .onClick(() => { @@ -90,7 +90,7 @@ export struct PreviewComponent { } }) - Image($r('app.media.ic_previous')).width($r('app.float.image_comp_width')).height($r('app.float.image_comp_height')).key('PreviewComponent_Image_previous') + Image($r('app.media.ic_previous')).width(32).height(32).key('PreviewComponent_Image_previous') .enabled(this.currentIndex !== 1 && !this.isGlobalDisable) .opacity((this.currentIndex !== 1 && !this.isGlobalDisable) ? Constants.NUMBER_1 : $r('app.float.disable_opacity')) .onClick(() => { @@ -120,13 +120,13 @@ export struct PreviewComponent { }) Text(this.currentIndex+'/'+this.imageCount).key('PreviewComponent_Text_imageCount') - .fontSize($r('app.float.font_size_body2')) + .fontSize($r('app.float.font_size_body1')) .width($r('app.float.preview_pages_comp_width')) .height($r('app.float.params_comp_height')).textAlign(TextAlign.Center) .margin({left:$r('app.float.preview_pages_comp_margin_left'),right:$r('app.float.preview_pages_comp_margin_right')}) Image($r('app.media.ic_next')).key('PreviewComponent_Image_next') - .width($r('app.float.image_comp_width')) - .height($r('app.float.image_comp_height')) + .width(32) + .height(32) .enabled(this.currentIndex !== this.imageCount && !this.isGlobalDisable) .opacity((this.currentIndex !== this.imageCount && !this.isGlobalDisable) ? Constants.NUMBER_1 : $r('app.float.disable_opacity')) .onClick(() => { @@ -156,8 +156,8 @@ export struct PreviewComponent { }) Image($r('app.media.ic_lastPage')).key('PreviewComponent_Image_lastPage') - .width($r('app.float.image_comp_width')) - .height($r('app.float.image_comp_height')) + .width(32) + .height(32) .enabled(this.currentIndex !== this.imageCount && !this.isGlobalDisable) .opacity((this.currentIndex !== this.imageCount && !this.isGlobalDisable) ? Constants.NUMBER_1 : $r('app.float.disable_opacity')) .onClick(() => { @@ -182,8 +182,8 @@ export struct PreviewComponent { } }) - }.height($r('app.float.params_comp_height')) - .margin({top:$r('app.float.preview_comp_margin'), bottom : $r('app.float.preview_comp_margin')}) + }.height(48) + .margin({top:8, bottom : 8}) Row() { if (this.currentPixelMap) { Image(this.currentPixelMap).key('PreviewComponent_Image_currentPixelMap') diff --git a/entry/src/main/resources/base/element/float.json b/entry/src/main/resources/base/element/float.json index 460424fec5c4bc1817bf5aca28f57fc86639d644..93f5167e571488cc52860cb30dc2fcc7c0fc25c2 100644 --- a/entry/src/main/resources/base/element/float.json +++ b/entry/src/main/resources/base/element/float.json @@ -6,7 +6,7 @@ }, { "name": "disable_opacity", - "value": "0.6" + "value": "0.4" }, { "name": "divider_opacity",