From 7c4a485668905f33eb2a6530151520632920e5f3 Mon Sep 17 00:00:00 2001 From: JiangJun <2680104782@qq.com> Date: Thu, 16 Sep 2021 13:44:43 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E3=80=91=EF=BC=9Amd=E8=AF=B4=E6=98=8E=EF=BC=8Cimag=E7=89=88?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 83 +++++-------------- .../liulishuo/magicprogresswidget/Imag.java | 11 +-- 2 files changed, 26 insertions(+), 68 deletions(-) diff --git a/README.md b/README.md index e45c184..eaedcb9 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 99a867a..67cc080 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; /** -- Gitee