diff --git a/README.md b/README.md index e45c18457b959679bfda9d70a0f761f6a25e9487..eaedcb9060a02b1cf5b7d2b801ff36bee007720e 100644 --- a/README.md +++ b/README.md @@ -37,72 +37,29 @@ dependencies { 并依据自己的版本创建新项目,将新项目的对应文件复制到根目录下 ## 使用说明 -1.自定义类,继承Text,实现Imag接口,根据需要,设置Percent属性 - -```java - @Override - public void setPercent(float percent) { - float pc = percentIn01(percent); - anim(0, pc, (long) (pc * maxTime)); - } - - @Override - public void setPercent(float percent, long durationMillis) { - float pc = percentIn01(percent); - anim(0, pc, durationMillis); - } - - @Override - public void setSmoothPercent(float percent) { - float pc = percentIn01(percent); - anim(magPercent, pc, (long) ((pc - magPercent) * maxTime)); - } - - @Override - public void setSmoothPercent(float percent, long durationMillis) { - float pc = percentIn01(percent); - anim(magPercent, pc, durationMillis); - } - - private void anim(float lastPercent, float percent, long duration) { - if (magValueAnimator != null) { - if (magValueAnimator.isRunning()) { - magValueAnimator.end(); - } - magValueAnimator.release(); - } - magValueAnimator = MagValueAnimator.ofFloat(lastPercent, percent); - magValueAnimator.setDuration(duration); - magValueAnimator.setValueUpdateListener(new AnimatorValue.ValueUpdateListener() { - @Override - public void onUpdate(AnimatorValue animatorValue, float value) { - MagicProgressBar.this.percentValue = value; - invalidate(); - } - }); - magValueAnimator.start(); - this.magPercent = percent; - } - +1.选择需要的自定义view,直接引用 + +```xml + ``` - - -2.xml中引用 - - ```xml - - ``` - +```xml + +``` ## 测试信息 + CodeCheck代码测试无异常 CloudTest代码测试无异常 @@ -112,7 +69,7 @@ CloudTest代码测试无异常 当前版本demo功能与原组件基本无差异 -## 版本迭代 +## 版本迭代 0.0.1-SNAPSHOT ## 版权和许可信息 diff --git a/library/src/main/java/com/liulishuo/magicprogresswidget/Imag.java b/library/src/main/java/com/liulishuo/magicprogresswidget/Imag.java index 99a867a915d0f727308d7bfe693209cff877f6d6..67cc080d2d8ad0da39ee24afe4bbbbc78d5d684f 100644 --- a/library/src/main/java/com/liulishuo/magicprogresswidget/Imag.java +++ b/library/src/main/java/com/liulishuo/magicprogresswidget/Imag.java @@ -1,18 +1,19 @@ /* - * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved. - *

+ * Copyright (c) 2021 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 - *

+ * + * 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. */ + package com.liulishuo.magicprogresswidget; /**