# ohos-viewpager-transformers **Repository Path**: chinasoft4_ohos/ohos-viewpager-transformers ## Basic Information - **Project Name**: ohos-viewpager-transformers - **Description**: 视图页面切换效果的集合 - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 2 - **Created**: 2021-07-15 - **Last Updated**: 2022-03-16 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # ohos-viewpager-transformers #### 项目介绍 - 项目名称:ohos-viewpager-transformers - 所属系列:openharmony的第三方组件适配移植 - 功能:视图页面切换效果的集合 - 项目移植状态:主功能完成 - 调用差异:1.CubeInTransformer、CubeOutTransformer、FlipHorizontalTransformer、FlipVerticalTransformer、TabletTransformer五种切换效果未实现,原因:openharmony不支持View的setRotationX()和setRotationY()。2.ZoomInTransformer、ZoomOutTranformer、DrawFromBackTransformer三种切换效果与源库有差异,原因:openharmony的PageSlider与ViewPager有差异,上一页与下一页无法重叠显示。3.除以上效果外,其他切换效果均已实现。 - 开发版本:sdk6,DevEco Studio 2.2 Beta1 - 基线版本:Release 1.0.1 #### 效果演示 #### 安装教程 1.在项目根目录下的build.gradle文件中, ```gradle allprojects { repositories { maven { url 'https://s01.oss.sonatype.org/content/repositories/releases/' } } } ``` 2.在entry模块的build.gradle文件中, ```gradle dependencies { implementation('com.gitee.chinasoft_ohos:ohos-viewpager-transformers:1.0.0') ...... } ``` 在sdk6,DevEco Studio 2.2 Beta1下项目可直接运行 如无法运行,删除项目.gradle,.idea,build,gradle,build.gradle文件, 并依据自己的版本创建新项目,将新项目的对应文件复制到根目录下 #### 使用说明 How you can use it: ```java mPageSlider = (ViewPager) findComponentById(ResourceTable.Id_page_slide); mPageSlider.setProvider(pageProvider); mPageSlider.setPageTransformer(new RotateUpTransformer()); ``` All ViewPagerTransform implementations extend BaseTransformer providing useful hooks improving readability of animations and basic functionality important when switching between animations. BaseTransformer provides three lifecycle hooks and two flags for default handling of hiding offscreen fragments and mimicking the default paging functionality of the ViewPager. * preTransform(View view, float position) * Default implementation resets the animation state of the fragment to defaults that will place it on the screen if its position permits. * onTransform(View view, float position) * Animations should perform all or most of their work inside this callback. * postTransform(View view, float position) * Default implementation does nothing. This provides a logical location for any additional work to be done that is not directly related to the animation. #### 测试信息 CodeCheck代码测试无异常 CloudTest代码测试无异常 病毒安全检测通过 当前版本demo功能与原组件基本无差异 #### 版本迭代 - 1.0.0 #### 版权和许可信息 Copyright 2015 Georgi Eftimov 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.