鸿蒙开源组件——水波纹效果组件

jacksky
发布于 2021-12-30 17:15
浏览
0收藏

material-ripple

项目介绍

项目名称:material-ripple

所属系列:OpenHarmony的第三方组件适配移植

功能:为组件添加点击水波纹效果,水波纹效果已经全部实现

项目移植状态:90% 水波纹动画效果有些卡顿

调用差异:水波纹动画略有卡顿,由于水波纹效果完全通过动画绘制完成,相比于原项目略微有点卡顿

开发版本:sdk6,DevEco Studio 2.2 Beta1

基线版本:Release v1.0.2

演示效果

鸿蒙开源组件——水波纹效果组件-鸿蒙开发者社区

安装教程

1.在项目根目录下的build.gradle文件中,

allprojects {
   repositories {
       maven {
           url 'https://s01.oss.sonatype.org/content/repositories/releases/'
       }
   }
}

2.在entry模块的build.gradle文件中,

dependencies {
   implementation('com.gitee.chinasoft_ohos:material-ripple:1.0.0')
   ......
}​

在sdk6,DevEco Studio 2.2 Beta1下项目可直接运行 如无法运行,删除项目.gradle,.idea,build,gradle,build.gradle文件, 并依据自己的版本创建新项目,将新项目的对应文件复制到根目录下

 

使用说明

布局文件定义,提供控件:MaterialRippleLayout 引入方法:import com.balysv.materialripple.MaterialRippleLayout; MaterialRippleLayout布局、属性设置:

 <com.balysv.materialripple.MaterialRippleLayout
            ohos:height="50vp"
            ohos:width="match_parent"
            ohos:background_element="#ffffff"
            ohos:bottom_margin="30"
            ohos:layout_alignment="horizontal_center"
            ohos:left_margin="16vp"
            ohos:right_margin="16vp"
            app:mrl_rippleAlpha="0.2"
            app:mrl_rippleColor="#80000000"
            app:mrl_rippleOverlay="true"
            >

            <Button
                ohos:id="$+id:ripple_view"
                ohos:height="50vp"
                ohos:width="match_parent"
                ohos:background_element="#ffff00"
                ohos:layout_alignment="center"
                ohos:text="OVERLAY WITH HOVER"
                ohos:text_size="60"/>
        </com.balysv.materialripple.MaterialRippleLayout>​

 

代码中使用:
       MaterialRippleLayout.on(mBtn)
                .rippleColor(Color.getIntColor("#00000000"))
                .rippleAlpha(0.2f)
                .rippleDuration(1000)
                .rippleBackground(Color.getIntColor("#FF0000ff"))
                .rippleOverlay(true)
                .rippleDiameterDp(30)
                .create();​

 


 

点击事件:

 mBtn.setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component component) {
                // handle me
            }
        });​

 

测试信息

CodeCheck代码测试无异常

CloudTest代码测试无异常

病毒安全检测通过

当前版本demo功能与原组件基本无差异

版本迭代

  • 1.0.0

版权和许可信息

Copyright 2015 Balys Valentukevicius

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.

 

material-ripple-master.zip 318.6K 5次下载
已于2021-12-30 17:15:30修改
收藏
回复
举报
回复
    相关推荐