diff --git a/.clang-format b/.clang-format deleted file mode 100644 index 48439ed68073b99be118d374d1ebd43d04d4c4eb..0000000000000000000000000000000000000000 --- a/.clang-format +++ /dev/null @@ -1,64 +0,0 @@ -Language: Cpp -# BasedOnStyle: LLVM -ColumnLimit: 120 -SortIncludes: CaseSensitive -TabWidth: 4 -IndentWidth: 4 -UseTab: Never -AccessModifierOffset: -4 -ContinuationIndentWidth: 4 -IndentCaseBlocks: false -IndentCaseLabels: false -IndentGotoLabels: true -IndentWrappedFunctionNames: false -SortUsingDeclarations: false -NamespaceIndentation: None -SpaceAfterCStyleCast: false -SpaceAfterLogicalNot: false -SpaceAfterTemplateKeyword: true -SpaceBeforeAssignmentOperators: true -SpaceBeforeCaseColon: false -SpaceBeforeCpp11BracedList: false -SpaceBeforeCtorInitializerColon: true -SpaceBeforeInheritanceColon: true -SpaceBeforeRangeBasedForLoopColon: true -SpaceBeforeSquareBrackets: false -SpaceInEmptyBlock: false -SpaceInEmptyParentheses: false -SpacesInAngles: false -SpacesInCStyleCastParentheses: false -SpacesInConditionalStatement: false -SpacesInParentheses: false -SpacesInSquareBrackets: false -AlignTrailingComments: true -AlignAfterOpenBracket: true -AllowShortCaseLabelsOnASingleLine: false -AllowShortEnumsOnASingleLine: true -AllowShortFunctionsOnASingleLine: All -AllowShortIfStatementsOnASingleLine: Never -AllowShortLambdasOnASingleLine: All -AllowShortLoopsOnASingleLine: false -AlwaysBreakTemplateDeclarations: MultiLine -BinPackArguments: true -BinPackParameters: true -BreakBeforeTernaryOperators: true -BreakConstructorInitializers: BeforeColon -BreakInheritanceList: BeforeColon -BreakStringLiterals: true -InsertBraces: false -IndentExternBlock: NoIndent -BreakBeforeBraces: Custom -BraceWrapping: - AfterCaseLabel: false - AfterClass: false - AfterControlStatement: Never - AfterEnum: false - AfterFunction: false - AfterNamespace: false - AfterStruct: false - AfterUnion: false - AfterExternBlock: false - BeforeCatch: false - BeforeElse: false -ReflowComments: true -MaxEmptyLinesToKeep: 2 \ No newline at end of file diff --git a/README.en.md b/README.en.md index bc22eec291df86bf4a1a8daf05c90f44e943286c..9ce112e83e3482317b6b561a7cadb6a2834d240f 100644 --- a/README.en.md +++ b/README.en.md @@ -6,7 +6,7 @@ This sample describes how to smoothly refresh a page. ### Preview -![image](screenshot/device/ltpo.en.png) +![image](screenshot/device/sample_fluent_blog_en.png) ##### How to Use diff --git a/README.md b/README.md index 6db4caa36bdfb842c01a4d4a00f691ddfa92718d..02ce04ab06a314cbda9d2f627b3d5a7021ce3a65 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ ### 效果预览 -![image](screenshot/device/ltpo.png) +![image](screenshot/device/sample_fluent_blog.png) ##### 使用说明 diff --git a/fluentbloglibrary/.gitignore b/fluentbloglibrary/.gitignore deleted file mode 100644 index e2713a2779c5a3e0eb879efe6115455592caeea5..0000000000000000000000000000000000000000 --- a/fluentbloglibrary/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -/node_modules -/oh_modules -/.preview -/build -/.cxx -/.test \ No newline at end of file diff --git a/fluentbloglibrary/BuildProfile.ets b/fluentbloglibrary/BuildProfile.ets deleted file mode 100644 index 3a501e5ddee8ea6d28961648fc7dd314a5304bd4..0000000000000000000000000000000000000000 --- a/fluentbloglibrary/BuildProfile.ets +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Use these variables when you tailor your ArkTS code. They must be of the const type. - */ -export const HAR_VERSION = '1.0.0'; -export const BUILD_MODE_NAME = 'debug'; -export const DEBUG = true; -export const TARGET_NAME = 'default'; - -/** - * BuildProfile Class is used only for compatibility purposes. - */ -export default class BuildProfile { - static readonly HAR_VERSION = HAR_VERSION; - static readonly BUILD_MODE_NAME = BUILD_MODE_NAME; - static readonly DEBUG = DEBUG; - static readonly TARGET_NAME = TARGET_NAME; -} \ No newline at end of file diff --git a/fluentbloglibrary/CHANGELOG.md b/fluentbloglibrary/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..0e24bde3da4b960fecc5932233a4bec0001e4623 --- /dev/null +++ b/fluentbloglibrary/CHANGELOG.md @@ -0,0 +1,6 @@ +# 版本记录 +## 1.0.0(2025.07.03) + +--- +### Initial +- 初始版本 \ No newline at end of file diff --git a/fluentbloglibrary/LICENSE b/fluentbloglibrary/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..338e5b0bc22082e0ffcc7121c2ed3897a3ddccb0 --- /dev/null +++ b/fluentbloglibrary/LICENSE @@ -0,0 +1,78 @@ + Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +Apache License, Version 2.0 +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. + +"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. + +2. Grant of Copyright License. + +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. + +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. + +You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: +1.You must give any other recipients of the Work or Derivative Works a copy of this License; and +2.You must cause any modified files to carry prominent notices stating that You changed the files; and +3.You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and +4.If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. + +You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. + +5. Submission of Contributions. + +Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. + +6. Trademarks. + +This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. + +Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. + +In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. + +While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/fluentbloglibrary/README.md b/fluentbloglibrary/README.md new file mode 100644 index 0000000000000000000000000000000000000000..071f07b2cdc772ad30724f11e26126ef5940b22b --- /dev/null +++ b/fluentbloglibrary/README.md @@ -0,0 +1,43 @@ +# 锁屏沉浸实况窗 + +### 介绍 + +本示例主要通过设置组件的属性来控制屏幕刷新率,达到低功耗的目的,实现了文章和媒体文件浏览的功能。 + +### 下载安装 + +使用ohpm安装依赖 + +``` +ohpm install @ohos_samples/fluentbloglibrary +``` + +或者按需在模块中修改oh-package.json5 + +``` +{ + "dependencies": { + "@ohos_samples/fluentbloglibrary": "^1.0.0" + } +} +``` + +### 使用说明 + +``` +import { FluentBlogPage, WindowUtil } from '@ohos_samples/fluentbloglibrary'; +``` + +按需在文件中使用导出模块即可,其中FluentBlogPage是整个sample的入口页面,进入Sample后可以浏览文字好媒体文件,点击视频可以进入视频播放页面。WindowUtil封装了沉浸式、设备断点判断、避让区域计算等窗口能力。示例如下: +``` +// Page.ets +import { FluentBlogPage } from '@ohos_samples/fluentbloglibrary'; +Stack() { + FluentBlogPage() +} + +// EntryAbility.ets +import { WindowUtil } from '@ohos_samples/fluentbloglibrary'; +WindowUtil.requestFullScreen(windowStage); +WindowUtil.registerBreakPoint(windowStage); +``` \ No newline at end of file diff --git a/fluentbloglibrary/oh-package.json5 b/fluentbloglibrary/oh-package.json5 index 9e9e4a426d5b031a608b662f108c768eaa448cdb..cd663a221f2d438c3a2181e5a8667bc4c92548af 100644 --- a/fluentbloglibrary/oh-package.json5 +++ b/fluentbloglibrary/oh-package.json5 @@ -1,9 +1,10 @@ { - "name": "fluentbloglibrary", + "name": "@ohos_samples/fluentbloglibrary", "version": "1.0.0", - "description": "Please describe the basic information.", + "description": "This sample describes how to create a fluent blog.", "main": "Index.ets", - "author": "", + "author": "@ohos_samples", "license": "Apache-2.0", + "repository": "https://gitee.com/harmonyos_samples/fluent-blog/tree/br_release_hmos/", "dependencies": {} -} +} \ No newline at end of file diff --git a/fluentbloglibrary/src/main/ets/common/BreakpointSystem.ets b/fluentbloglibrary/src/main/ets/common/BreakpointSystem.ets index aa7581b2047323eac83c8d9a031e21faabc55bd2..7db5c724bff3658649e8e2190009e780ab68cac4 100644 --- a/fluentbloglibrary/src/main/ets/common/BreakpointSystem.ets +++ b/fluentbloglibrary/src/main/ets/common/BreakpointSystem.ets @@ -77,6 +77,7 @@ export class BreakpointSystem { public static getInstance(): BreakpointSystem { if (!BreakpointSystem.instance) { BreakpointSystem.instance = new BreakpointSystem(); + AppStorage.setOrCreate('fluentBlogCurrentBreakpoint', BreakpointTypeEnum.MD); } return BreakpointSystem.instance; } @@ -84,7 +85,7 @@ export class BreakpointSystem { public updateCurrentBreakpoint(breakpoint: BreakpointTypeEnum): void { if (this.currentBreakpoint !== breakpoint) { this.currentBreakpoint = breakpoint; - AppStorage.setOrCreate('currentBreakpoint', this.currentBreakpoint); + AppStorage.setOrCreate('fluentBlogCurrentBreakpoint', this.currentBreakpoint); } } @@ -96,7 +97,7 @@ export class BreakpointSystem { try { const mainWindow: window.WindowProperties = window.getWindowProperties(); const windowWidth: number = mainWindow.windowRect.width; - const windowWidthVp = px2vp(windowWidth); + const windowWidthVp = (AppStorage.get('fluentBlogUiContext') as UIContext).px2vp(windowWidth); let widthBp: BreakpointTypeEnum = BreakpointTypeEnum.MD; if (windowWidthVp < 320) { widthBp = BreakpointTypeEnum.XS; diff --git a/fluentbloglibrary/src/main/ets/common/WindowUtil.ets b/fluentbloglibrary/src/main/ets/common/WindowUtil.ets index 5752e10e0f647d6b1ac9cdd22e2d29b6e8f8c69d..8618f4cbd62bec6cab5bf106573af9b3e8947b54 100644 --- a/fluentbloglibrary/src/main/ets/common/WindowUtil.ets +++ b/fluentbloglibrary/src/main/ets/common/WindowUtil.ets @@ -26,6 +26,7 @@ export class WindowUtil { if (err.code) { return; } + AppStorage.setOrCreate('fluentBlogUiContext', data.getUIContext()); const windowClass: window.Window = data; // Realize the immersive effect. try { @@ -61,7 +62,8 @@ export class WindowUtil { // Get status bar height and indicator height. public static setAvoidArea(type: window.AvoidAreaType, area: window.AvoidArea) { if (type === window.AvoidAreaType.TYPE_SYSTEM) { - AppStorage.setOrCreate('topRectHeight', px2vp(area.topRect.height)); + AppStorage.setOrCreate('fluentBlogTopRectHeight', + (AppStorage.get('fluentBlogUiContext') as UIContext).px2vp(area.topRect.height)); } } -} +} \ No newline at end of file diff --git a/fluentbloglibrary/src/main/ets/pages/FluentBlogPage.ets b/fluentbloglibrary/src/main/ets/pages/FluentBlogPage.ets index f08dca53180518d913d286c1d86069eac3d12dc3..6dedd88166b6d506463e148fc802c4bb7b86ad05 100644 --- a/fluentbloglibrary/src/main/ets/pages/FluentBlogPage.ets +++ b/fluentbloglibrary/src/main/ets/pages/FluentBlogPage.ets @@ -1,18 +1,31 @@ -import { BreakpointType } from "../common/BreakpointSystem"; -import { Constants } from "../common/Constants"; -import SampleUnitView from "../view/SampleUnitView"; -import BasicDataSource from "../viewmodel/BasicDataSource"; -import SampleUnitItem from "../viewmodel/SampleUnitItem"; -import { NewPlayPage } from "./NewPlayPage"; +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { BreakpointType } from '../common/BreakpointSystem'; +import { Constants } from '../common/Constants'; +import SampleUnitView from '../view/SampleUnitView'; +import BasicDataSource from '../viewmodel/BasicDataSource'; +import SampleUnitItem from '../viewmodel/SampleUnitItem'; const LIST_SPACE = 10; @Component export struct FluentBlogPage { @State rotateAngle: number = 0; - @StorageLink('currentBreakpoint') curBp: string = Constants.BREAK_POINT_SM; - @StorageProp('topRectHeight') topRectHeight: number = 0; + @StorageLink('fluentBlogCurrentBreakpoint') curBp: string = Constants.BREAK_POINT_SM; + @StorageProp('fluentBlogTopRectHeight') topRectHeight: number = 0; @Provide('NavPathStack') pageStack: NavPathStack = new NavPathStack(); build() { diff --git a/fluentbloglibrary/src/main/ets/pages/NewPlayPage.ets b/fluentbloglibrary/src/main/ets/pages/NewPlayPage.ets index 4a4b51645e1976de36fecbe2826a0e768e84c793..70791fd5f26b48f8e7207b82cd558e254ebf9d99 100644 --- a/fluentbloglibrary/src/main/ets/pages/NewPlayPage.ets +++ b/fluentbloglibrary/src/main/ets/pages/NewPlayPage.ets @@ -14,7 +14,6 @@ */ import { displaySync } from '@kit.ArkGraphics2D'; -import { router } from '@kit.ArkUI'; import { BreakpointType } from '../common/BreakpointSystem'; import { Constants } from '../common/Constants'; import { AVPlayerItem } from '../view/AVPlayerItem'; @@ -24,12 +23,12 @@ import SampleUnitAVPlayView from '../view/SampleUnitAVPlayView'; export struct NewPlayPage { @State rotateAngle: number = 0; @State avPlayer: AVPlayerItem = new AVPlayerItem(); - @StorageLink('currentBreakpoint') curBp: string = Constants.BREAK_POINT_SM; + @StorageLink('fluentBlogCurrentBreakpoint') curBp: string = Constants.BREAK_POINT_SM; private backDisplaySync: displaySync.DisplaySync | undefined = undefined; @Consume('NavPathStack') pageStack: NavPathStack; aboutToAppear(): void { - this.avPlayer.avPlayerPlay(); + this.avPlayer.avPlayerPlay(this.getUIContext()); if (this.backDisplaySync === undefined) { this.CreateDisplaySync(); } @@ -144,6 +143,6 @@ export struct NewPlayPage { } @Builder -export function NewPlayPageBuilder(){ +export function NewPlayPageBuilder() { NewPlayPage() -} +} \ No newline at end of file diff --git a/fluentbloglibrary/src/main/ets/view/AVPlayerItem.ets b/fluentbloglibrary/src/main/ets/view/AVPlayerItem.ets index 880452b18d11efce1b29cbbbb8a1940afa34145b..11ae30d0db00204348dff93dbfc414694be8a5b5 100644 --- a/fluentbloglibrary/src/main/ets/view/AVPlayerItem.ets +++ b/fluentbloglibrary/src/main/ets/view/AVPlayerItem.ets @@ -66,11 +66,11 @@ export class AVPlayerItem { }) } - async avPlayerPlay() { + async avPlayerPlay(uiContext: UIContext) { this.avPlayer = await media.createAVPlayer(); this.avPlayer.setSpeed(media.PlaybackSpeed.SPEED_FORWARD_1_00_X); this.setAVPlayerCallback(this.avPlayer); - let context = getContext(this) as common.UIAbilityContext; + let context = uiContext.getHostContext() as common.UIAbilityContext; let fileDescriptor = await context.resourceManager.getRawFd(VIDEO_NAME); this.totalTime = fileDescriptor.length; this.curTime = fileDescriptor.offset; diff --git a/fluentbloglibrary/src/main/ets/view/SampleUnitAVPlayView.ets b/fluentbloglibrary/src/main/ets/view/SampleUnitAVPlayView.ets index 2343220579ec0646e0dc3acd0dcaffdd6b6d7d04..cdc8b7591f5564f56d52661475abb6236339ddc6 100644 --- a/fluentbloglibrary/src/main/ets/view/SampleUnitAVPlayView.ets +++ b/fluentbloglibrary/src/main/ets/view/SampleUnitAVPlayView.ets @@ -25,7 +25,7 @@ const SURFACE_HEIGHT = 900; @Component export default struct SampleUnitAVPlayView { @Link avPlayer: AVPlayerItem; - @StorageLink('currentBreakpoint') curBp: string = Constants.BREAK_POINT_SM; + @StorageLink('fluentBlogCurrentBreakpoint') curBp: string = Constants.BREAK_POINT_SM; @State xComponentWidth: string = Constants.FULL_SIZE; @State xComponentHeight: string = Constants.FIFTY_SIZE; private xComponentController: XComponentController = new XComponentController(); diff --git a/fluentbloglibrary/src/main/ets/view/SampleUnitPicView.ets b/fluentbloglibrary/src/main/ets/view/SampleUnitPicView.ets index c3bdbb816ea040ec2b7622f77eb19026f5cfba3a..f09514fd207e4c948b6385b360b6f3c109e359fb 100644 --- a/fluentbloglibrary/src/main/ets/view/SampleUnitPicView.ets +++ b/fluentbloglibrary/src/main/ets/view/SampleUnitPicView.ets @@ -27,7 +27,7 @@ const IMAGE_SET_SIZE_9: number = 9; @Component export default struct SampleUnitPicView { - @StorageLink('currentBreakpoint') curBp: string = Constants.BREAK_POINT_SM; + @StorageLink('fluentBlogCurrentBreakpoint') curBp: string = Constants.BREAK_POINT_SM; @Prop imageArray: ResourceStr[] = []; private arraySize: number = 0; @@ -38,17 +38,25 @@ export default struct SampleUnitPicView { build() { Column() { Grid() { - ForEach(this.imageArray.slice(0, this.arraySize), (item: string | Resource) => { + ForEach(this.imageArray.slice(0, this.arraySize), (item: string | Resource, _: number) => { GridItem() { Image(item) .objectFit(ImageFit.Cover) - .width(new BreakpointType({sm:this.getSmConfig(), md:this.getMdConfig(), lg:this.getLgConfig()}).getValue(this.curBp) + .width(new BreakpointType({ + sm: this.getSmConfig(), + md: this.getMdConfig(), + lg: this.getLgConfig() + }).getValue(this.curBp) .imageWidth) .aspectRatio(1) } }, (index: number) => index.toString()) } - .maxCount(new BreakpointType({sm:this.getSmConfig(), md:this.getMdConfig(), lg:this.getLgConfig()}).getValue(this.curBp) + .maxCount(new BreakpointType({ + sm: this.getSmConfig(), + md: this.getMdConfig(), + lg: this.getLgConfig() + }).getValue(this.curBp) .columns) .columnsGap(GRID_GAP) .rowsGap(GRID_GAP) diff --git a/fluentbloglibrary/src/main/ets/view/SampleUnitVideoView.ets b/fluentbloglibrary/src/main/ets/view/SampleUnitVideoView.ets index 76a0e205bf4cd1080794e42f716b439e2cb92894..c379de3164fd35431376b74acb1dbee8e82beaaa 100644 --- a/fluentbloglibrary/src/main/ets/view/SampleUnitVideoView.ets +++ b/fluentbloglibrary/src/main/ets/view/SampleUnitVideoView.ets @@ -28,7 +28,7 @@ const DURATION = 29024; export default struct SampleUnitVideoView { @State videoCurTime: number = 0; @State sliderCurTime: number = 0; - @StorageLink('currentBreakpoint') curBp: string = Constants.BREAK_POINT_SM; + @StorageLink('fluentBlogCurrentBreakpoint') curBp: string = Constants.BREAK_POINT_SM; @Consume('NavPathStack') pageStack: NavPathStack; controller: VideoController = new VideoController(); durationTime: number = 0; @@ -75,33 +75,6 @@ export default struct SampleUnitVideoView { .onClick(() => { this.pageStack.pushPathByName('NewPlayPage', ''); }) - Slider({ value: this.sliderCurTime, min: 0, max: 100 }) - .enabled(false) - .height(4) - .width(320) - .trackThickness(3) - .blockColor(Color.Red) - .blockSize({ width: 4, height: 4 }) - .onVisibleAreaChange([0.0, 1.0], (isVisible: boolean) => { - if (isVisible) { - animateTo({ - duration: DURATION, - iterations: -1, - expectedFrameRateRange: { - expected: 30, - min: 0, - max: 120, - }, - }, () => { - if (this.sliderCurTime >= 100) { - this.sliderCurTime = 0; - } - for (let i = 0; i < 101; i++) { - this.sliderCurTime += 1; - } - }) - } - }) } } diff --git a/fluentblogsample/oh-package-lock.json5 b/fluentblogsample/oh-package-lock.json5 deleted file mode 100644 index 42517e160838327f42adb0835ff7df705dcc6780..0000000000000000000000000000000000000000 --- a/fluentblogsample/oh-package-lock.json5 +++ /dev/null @@ -1,18 +0,0 @@ -{ - "meta": { - "stableOrder": true - }, - "lockfileVersion": 3, - "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", - "specifiers": { - "fluentbloglibrary@../fluentbloglibrary": "fluentbloglibrary@../fluentbloglibrary" - }, - "packages": { - "fluentbloglibrary@../fluentbloglibrary": { - "name": "fluentbloglibrary", - "version": "1.0.0", - "resolved": "../fluentbloglibrary", - "registryType": "local" - } - } -} \ No newline at end of file diff --git a/fluentblogsample/src/main/ets/entryability/EntryAbility.ets b/fluentblogsample/src/main/ets/entryability/EntryAbility.ets index 75049133700a8cb93c1a5651e5457f72b2aca3c2..da1b348052559440ba1d84f22a63abbab1adaf9a 100644 --- a/fluentblogsample/src/main/ets/entryability/EntryAbility.ets +++ b/fluentblogsample/src/main/ets/entryability/EntryAbility.ets @@ -31,8 +31,6 @@ export default class EntryAbility extends UIAbility { } onWindowStageCreate(windowStage: window.WindowStage): void { - WindowUtil.requestFullScreen(windowStage) - WindowUtil.registerBreakPoint(windowStage) // Main window is created, set main page for this ability hilog.info(0x0000, TAG, '%{public}s', 'Ability onWindowStageCreate'); windowStage.loadContent('pages/Index', (err, _) => { @@ -40,6 +38,8 @@ export default class EntryAbility extends UIAbility { hilog.error(0x0000, TAG, 'Failed to load the content. Cause:', err.message); return; } + WindowUtil.requestFullScreen(windowStage) + WindowUtil.registerBreakPoint(windowStage) hilog.info(0x0000, TAG, '%{public}s', 'Succeeded in loading the content'); }); } diff --git a/fluentblogsample/src/main/module.json5 b/fluentblogsample/src/main/module.json5 index 5a16b60044e4249e9035771901e4b39f55619ccb..8a119a7ae64176646c2cbd2ee8d6ca76dce8f0fe 100644 --- a/fluentblogsample/src/main/module.json5 +++ b/fluentblogsample/src/main/module.json5 @@ -9,7 +9,7 @@ "tablet", "2in1" ], - "deliveryWithInstall": true, + "deliveryWithInstall": false, "installationFree": false, "pages": "$profile:main_pages", "abilities": [ @@ -21,7 +21,7 @@ "label": "$string:EntryAbility_label", "startWindowIcon": "$media:startIcon", "startWindowBackground": "$color:start_window_background", - "exported": true, + "exported": false, "skills": [ { "entities": [ diff --git a/screenshot/device/ltpo.en.png b/screenshot/device/ltpo.en.png deleted file mode 100644 index 7f50ea2d4d567a17d9e89640ad298d5306b5ce97..0000000000000000000000000000000000000000 Binary files a/screenshot/device/ltpo.en.png and /dev/null differ diff --git a/screenshot/device/ltpo.png b/screenshot/device/ltpo.png deleted file mode 100644 index 61ce2051b9cb947f614a429adb8b73e53e4a6511..0000000000000000000000000000000000000000 Binary files a/screenshot/device/ltpo.png and /dev/null differ diff --git a/screenshot/device/sample_fluent_blog.png b/screenshot/device/sample_fluent_blog.png new file mode 100644 index 0000000000000000000000000000000000000000..dbc13dd773a74f8e350a060a614328eaabc1572d Binary files /dev/null and b/screenshot/device/sample_fluent_blog.png differ diff --git a/screenshot/device/sample_fluent_blog_en.png b/screenshot/device/sample_fluent_blog_en.png new file mode 100644 index 0000000000000000000000000000000000000000..364b0226fc9b244223c4cc96e29d658d153f4d75 Binary files /dev/null and b/screenshot/device/sample_fluent_blog_en.png differ