6 Star 6 Fork 1

HarmonyOS-TPC / material-intro-screen

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Material Intro Screen

Material intro screen 的设计灵感来自于 Material Intro , 它是最好用的material design风格的引导页,可以很方便的自定义各种动画效果.

Features

Simple slide Custom slide Permission slide Finish slide
simple_slide customer_slide permission_slide finish_slide

用法

第1步-使用:

方法1-使用har包

通过library生成har包,添加har包到要集成的libs文件夹内
在entry的gradle内添加如下代码
implementation fileTree(dir: 'libs', include: ['*.jar', '*.har'])

方法2-使用implementation依赖

allprojects{
    repositories{
        mavenCentral()
    }
}
implementation 'io.openharmony.tpc.thirdlib:material-intro-screen:1.0.2'

entry运行要求

通过DevEco studio,并下载SDK
将项目中的build.gradle文件中dependencies→classpath版本改为对应的版本(即你的IDE新建项目中所用的版本)

第2步:

首先, 你的 intro Slice 类需要继承 MaterialIntroSlice:

public class IntroSlice extends MaterialIntroSlice

第3步:

config 里面设置沉浸式主题等:

        {
               "orientation": "unspecified",
               "name": "agency.tango.materialintro.IntroAbility",
               "icon": "$media:icon",
               "description": "$string:introability_description",
               "label": "$string:app_name",
               "type": "page",
               "launchType": "standard",
               "metaData": {
                 "customizeData": [
                   {
                     "name": "hwc-theme",
                     "value": "androidhwext:style/Theme.Emui.NoTitleBar",
                     "extra": ""
                   }
                 ]
               }
             }

第4步:

添加幻灯片:

    @Override
    protected void onStart(Intent intent) {
        super.onStart(intent);
        if (isFirst) {
            enableLastSlideAlphaExitTransition(true);
            getBackButtonTranslationWrapper().setEnterTranslation(Component::setAlpha);
            addOrganizePage();
            addGoOnPage();
            addCustomPage();
            addPermissionPage();
            addEndPage();
            isFirst = false;
        }
    }

SlideComponet用法的说明:

  • possiblePermissions ⇾ 不强制要求需要授予的权限
  • neededPersmissions ⇾ 需要获得许可才能从该幻灯片进一步移动的权限
  • MessageButtonBehaviour ⇾ 仅仅在你需要自定义操作或者button显示文字才会创建新的实例

第5步:

自定义 Intro Slice:

  • setSkipButtonVisible() ⇾ 在屏幕左下方显示跳过按钮,而不是后退按钮
  • hideBackButton() ⇾ 隐藏屏幕左下方的返回按钮
  • enableLastSlideAlphaExitTransition() ⇾ 设置最后一张幻灯片是否以Alpha渐渐透明的效果消失

自定义视图动画:

你可以为Intro Slice里面的任何控件设置进场、默认、退场位移动画. 因此,你需要为选定的视图控件选取包装器 (例如: getNextButtonTranslationWrapper()) 并在那里设置接口 IViewTranslation的实现类

 getBackButtonTranslationWrapper().setEnterTranslation(Component::setAlpha);

目前提供的包装器 translation wrappers:

  • getNextButtonTranslationWrapper()
  • getBackButtonTranslationWrapper()
  • getPageIndicatorTranslationWrapper()
  • getViewPagerTranslationWrapper()
  • getSkipButtonTranslationWrapper()

定制幻灯片

您只需要扩展SlideComponet并覆盖以下功能就可以实现完全自定义的幻灯片:

  • backgroundColor()
  • buttonsColor()
  • canMoveFurther() (仅当您要阻止用户在执行某些操作之前就无法进一步移动时才需要实现这个方法)
  • cantMoveFurtherErrorMessage() (同上)

如果要在自定义控件中使用视差,请使用以下视图之一:

并在XML中设置 zdy:layout_parallax_Factor 属性:

<agency.tango.materialintroscreen.parallax.ParallaxDirectionalLayout
    xmlns:ohos="http://schemas.huawei.com/res/ohos"
    xmlns:zdy="http://schemas.huawei.com/res/ohos/zdy"
   >

    <Image
        zdy:layout_parallax_Factor="0.6"
        />

此处显示了简单SlideComponet中没有的所有功能: Custom Slide

License

 MIT License
 
 Copyright (c) 2016 Tango Agency
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 in the Software without restriction, including without limitation the rights
 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 copies of the Software, and to permit persons to whom the Software is
 furnished to do so, subject to the following conditions:
 
 The above copyright notice and this permission notice shall be included in all
 copies or substantial portions of the Software.
 
 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 SOFTWARE.
MIT License Copyright (c) 2016 Tango Agency Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

Material intro screen 的设计灵感来自于 Material Intro , 为了使简介屏幕易于所有人使用并尽可能方便的扩展 展开 收起
Java
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/HarmonyOS-tpc/material-intro-screen.git
git@gitee.com:HarmonyOS-tpc/material-intro-screen.git
HarmonyOS-tpc
material-intro-screen
material-intro-screen
master

搜索帮助