# FloatingActionButtonSpeedDial
**Repository Path**: tycom/FloatingActionButtonSpeedDial
## Basic Information
- **Project Name**: FloatingActionButtonSpeedDial
- **Description**: ohos库提供了一个实现浮动动画的设计
- **Primary Language**: Java
- **License**: Apache-2.0
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 3
- **Created**: 2021-07-23
- **Last Updated**: 2021-08-17
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# FloatingActionButtonSpeedDial
#### 项目介绍
- 项目名称:FloatingActionButtonSpeedDial
- 所属系列:openharmony的第三方组件适配移植
- 功能:ohos库提供了Material Design浮动动作按钮快速拨号的实现
- 项目移植状态:主功能完成
- 调用差异:ohos暂不支持ListContainer动画展开效果
- 开发版本:sdk6,DevEco Studio 2.2 Beta1
- 基线版本:Release 3.2.0
#### 效果演示
#### 安装教程
1.在项目根目录下的build.gradle文件中
```gradle
allprojects {
repositories {
maven {
url 'https://s01.oss.sonatype.org/content/repositories/releases/'
}
}
}
```
2.在app模块的build.gradle文件中
```gradle
dependencies {
implementation('com.gitee.chinasoft_ohos:FloatingActionButtonSpeedDial:1.0.0')
......
}
```
在sdk6,DevEco Studio 2.2 Beta1下项目可直接运行,
如无法运行,删除项目.gradle,.idea,build,gradle,build.gradle文件,
并依据自己的版本创建新项目,将新项目的对应文件复制到根目录下
#### 使用说明
1.如何开始
添加ListContainer和展开按钮:
```
```
2.添加ListContainer滑动事件处理
添加list适配器
```
List list = getData();
ListItemProvider mListItemProvider = new ListItemProvider(list, this);
mListContainer.setItemProvider(mListItemProvider);
```
添加滑动事件处理
```
mListContainer.setTouchEventListener(new Component.TouchEventListener() {
@Override
public boolean onTouchEvent(Component component, TouchEvent touchEvent) {
int action = touchEvent.getAction();
MmiPoint point = touchEvent.getPointerPosition(touchEvent.getIndex());
switch (action) {
case TouchEvent.PRIMARY_POINT_DOWN:
return true;
```
3.添加展开动画和关闭动画
top展开动画:
```
setContentPosition(getDisplayWidthInPx(this) - 225, getDisplayHeightInPx(this) - 555);
animatorPropertyTwo = mDSTwo.createAnimatorProperty();
animatorPropertyTwo.moveByY(-150).setDuration(200);
animatorPropertyThreeTest.start();
```
top关闭动画:
```
view.setVisibility(Component.VERTICAL);
```
4.选择角度变化
添加旋转45°变化
```
animatorPropertyAdd.rotate(0).setDuration(1);
animatorPropertyAdd.start();
mImageAdd.setWidth(90);
mImageAdd.setHeight(90);
animatorPropertyAddPen.rotate(45).setDuration(500);
animatorPropertyAddPen.start();
```
添加旋转90°变化
```
animatorPropertyAdd.rotate(-45).setDuration(1);
animatorPropertyAdd.start();
PixelMapElement pixelMapElement = null;
try {
pixelMapElement = new PixelMapElement(mImageAddPen.getResourceManager().getResource(ResourceTable.Media_brush1));
} catch (IOException e) {
e.printStackTrace();
} catch (NotExistException e) {
e.printStackTrace();
}
mImageAddPen.setBackground(pixelMapElement);
animatorPropertyAddPen.rotate(90).setDuration(500);
animatorPropertyAddPen.start();
```
5.设置切换颜色变化
```
shapeElement.setRgbColor(new RgbColor(66, 133, 244));
mDSOne.setBackground(shapeElement);
```
#### 测试信息
CodeCheck代码测试无异常
CloudTest代码测试无异常
病毒安全检测通过
当前版本demo功能与原组件基本无差异
#### 版本迭代
- 1.0.0
#### 版权和许可信息
```
Copyright 2021 Roberto Leinardi.
Licensed to the Apache Software Foundation (ASF) under one or more contributor
license agreements. See the NOTICE file distributed with this work for
additional information regarding copyright ownership. The ASF licenses this
file to you 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.
```