diff --git a/entry/build.gradle b/entry/build.gradle index 5ae2dd0d4347452750a1a82707fe8a6db1166ab7..3310548b83b132be4d0c17ecddb36edcdb397b58 100644 --- a/entry/build.gradle +++ b/entry/build.gradle @@ -19,7 +19,7 @@ dependencies { implementation fileTree(dir: 'libs', include: ['*.jar', '*.har']) testImplementation 'junit:junit:4.13' ohosTestImplementation 'com.huawei.ohos.testkit:runner:1.0.0.100' - //implementation project(":library") +// implementation project(":library") implementation('com.gitee.chinasoft_ohos:TwinklingRefreshLayout:0.0.1-SNAPSHOT') } decc { diff --git a/library/src/main/java/com/lcodecore/tkrefreshlayout/IBottomView.java b/library/src/main/java/com/lcodecore/tkrefreshlayout/IBottomView.java index 9703fe50b4f552dccdd7c3a22fd8b5539cb35c8c..91806ef45951dab94ed9c7cee44d6ebc647b58f6 100644 --- a/library/src/main/java/com/lcodecore/tkrefreshlayout/IBottomView.java +++ b/library/src/main/java/com/lcodecore/tkrefreshlayout/IBottomView.java @@ -12,20 +12,36 @@ public interface IBottomView { /** * 上拉准备加载更多的动作 * - * @param fraction 上拉高度与Bottom总高度之比 + * @param fraction 上拉高度与Bottom总高度之比 * @param maxBottomHeight 底部部可拉伸最大高度 - * @param bottomHeight 底部高度 + * @param bottomHeight 底部高度 */ void onPullingUp(float fraction, float maxBottomHeight, float bottomHeight); + /** + * startAnim + * + * @param maxBottomHeight maxBottomHeight + * @param bottomHeight bottomHeight + */ void startAnim(float maxBottomHeight, float bottomHeight); /** * 上拉释放过程 + * + * @param fraction fraction + * @param maxBottomHeight maxBottomHeight + * @param bottomHeight bottomHeight */ void onPullReleasing(float fraction, float maxBottomHeight, float bottomHeight); + /** + * onFinish + */ void onFinish(); + /** + * reset + */ void reset(); } diff --git a/library/src/main/java/com/lcodecore/tkrefreshlayout/header/bezierlayout/BezierLayout.java b/library/src/main/java/com/lcodecore/tkrefreshlayout/header/bezierlayout/BezierLayout.java index 8d102267caae898001db1ced04560b42da04f69a..4a72b94a772415eeb13bf2ebeb8cfbaef63c6525 100644 --- a/library/src/main/java/com/lcodecore/tkrefreshlayout/header/bezierlayout/BezierLayout.java +++ b/library/src/main/java/com/lcodecore/tkrefreshlayout/header/bezierlayout/BezierLayout.java @@ -69,9 +69,9 @@ public class BezierLayout extends StackLayout implements IHeaderView { /** * 限定值 * - * @param a - * @param b - * @return + * @param a a + * @param b b + * @return 限定值 */ public float limitValue(float a, float b) { float valve = 0; @@ -125,7 +125,8 @@ public class BezierLayout extends StackLayout implements IHeaderView { public void startAnim(float maxHeadHeight, float headHeight) { waveView.setHeadHeight((int) headHeight); AnimatorValueUtil animatorValueUtil = new AnimatorValueUtil(); - animatorValueUtil.ofFloat(waveView.getWaveHeight(), 0, -300, 0, -100, 0); + float[] animaFloat = {waveView.getWaveHeight(), 0, -300, 0, -100, 0}; + animatorValueUtil.ofFloat(animaFloat); waveAnimator = new AnimatorValue(); waveAnimator.setValueUpdateListener(new AnimatorValue.ValueUpdateListener() { @Override @@ -140,7 +141,8 @@ public class BezierLayout extends StackLayout implements IHeaderView { waveAnimator.start(); /*处理圈圈进度条**/ AnimatorValueUtil animatorValueUtil2 = new AnimatorValueUtil(); - animatorValueUtil2.ofFloat(1, 0); + float[] animaFloat2 = {1, 0}; + animatorValueUtil2.ofFloat(animaFloat2); circleAnimator = new AnimatorValue(); circleAnimator.setStateChangedListener(new Animator.StateChangedListener() { @Override @@ -198,7 +200,8 @@ public class BezierLayout extends StackLayout implements IHeaderView { public void releaseAnim(Component component, float start, float end) { AnimatorValueUtil animatorValueUtil = new AnimatorValueUtil(); - animatorValueUtil.ofFloat(start, end); + float[] animaFloat = {start, end}; + animatorValueUtil.ofFloat(animaFloat); AnimatorValue releaseAnimator = new AnimatorValue(); releaseAnimator.setValueUpdateListener(new AnimatorValue.ValueUpdateListener() { @Override diff --git a/library/src/main/java/com/lcodecore/tkrefreshlayout/header/bezierlayout/RippleView.java b/library/src/main/java/com/lcodecore/tkrefreshlayout/header/bezierlayout/RippleView.java index 3d057fdae1097bd2cf6e0d657e1c927fadb540a1..395b4c0f00118f192f88e36ac7bc5bdad2c885fd 100755 --- a/library/src/main/java/com/lcodecore/tkrefreshlayout/header/bezierlayout/RippleView.java +++ b/library/src/main/java/com/lcodecore/tkrefreshlayout/header/bezierlayout/RippleView.java @@ -58,7 +58,8 @@ public class RippleView extends Component implements Component.DrawTask { if (va == null) { int bigRadius = (int) (Math.sqrt(Math.pow(getHeight(), 2) + Math.pow(getWidth(), 2))); AnimatorValueUtil animatorValueUtil = new AnimatorValueUtil(); - animatorValueUtil.ofFloat(0, bigRadius / 2.0f); + float[] animaFloat = {0, bigRadius / 2.0f}; + animatorValueUtil.ofFloat(animaFloat); va = new AnimatorValue(); va.setDuration(bigRadius); va.setValueUpdateListener(new AnimatorValue.ValueUpdateListener() { diff --git a/library/src/main/java/com/lcodecore/tkrefreshlayout/header/bezierlayout/RoundProgressView.java b/library/src/main/java/com/lcodecore/tkrefreshlayout/header/bezierlayout/RoundProgressView.java index c9410327ecf2f9459084f5ee5f17c71a270673b1..5de4bdb0f585ed708e6ad113132d11509a626cbc 100755 --- a/library/src/main/java/com/lcodecore/tkrefreshlayout/header/bezierlayout/RoundProgressView.java +++ b/library/src/main/java/com/lcodecore/tkrefreshlayout/header/bezierlayout/RoundProgressView.java @@ -49,7 +49,8 @@ public class RoundProgressView extends Component implements Component.DrawTask { mPath.setColor(new Color(Color.rgb(114, 114, 114))); AnimatorValueUtil animatorValueUtil = new AnimatorValueUtil(); - animatorValueUtil.ofFloat(0, 360); + float[] animaFloat = {0, 360}; + animatorValueUtil.ofFloat(animaFloat); va = new AnimatorValue(); va.setDuration(720); diff --git a/library/src/main/java/com/lcodecore/tkrefreshlayout/processor/AVLoadingIndicatorView.java b/library/src/main/java/com/lcodecore/tkrefreshlayout/processor/AVLoadingIndicatorView.java index c9cd1b6ef038753222d7f37bb99d85dc2778dd4e..55aee4885e6892f51a809ac45e1257fd886cbee3 100644 --- a/library/src/main/java/com/lcodecore/tkrefreshlayout/processor/AVLoadingIndicatorView.java +++ b/library/src/main/java/com/lcodecore/tkrefreshlayout/processor/AVLoadingIndicatorView.java @@ -30,7 +30,6 @@ import com.lcodecore.tkrefreshlayout.processor.indicator.SemiCircleSpinIndicator import com.lcodecore.tkrefreshlayout.processor.indicator.SquareSpinIndicator; import com.lcodecore.tkrefreshlayout.processor.indicator.SysProgressIndicator; import com.lcodecore.tkrefreshlayout.processor.indicator.TriangleSkewSpinIndicator; -import com.lcodecore.tkrefreshlayout.utils.AttrUtils; import ohos.agp.components.AttrSet; import ohos.agp.components.Component; import ohos.agp.render.Canvas; @@ -100,8 +99,8 @@ public class AVLoadingIndicatorView extends Component implements Component.DrawT } private void init(Context context, AttrSet attrSet, String styleName){ - mIndicatorId = AttrUtils.getIntFromAttr(attrSet, "avl_indicator_int", BallGridPulse); - mIndicatorColor = AttrUtils.getColorFromAttr(attrSet, "avl_indicator_color", Color.WHITE.getValue()); + mIndicatorId = 1; + mIndicatorColor = -1; mPaint=new Paint(); mPaint.setColor(new Color(mIndicatorColor)); diff --git a/library/src/main/java/com/lcodecore/tkrefreshlayout/processor/loading/LoadingBuilder.java b/library/src/main/java/com/lcodecore/tkrefreshlayout/processor/loading/LoadingBuilder.java index 71b8d9c4b9e4f03d6f1b5dc5500ce1b3228dab67..1d05b2251a76d81460c2e72c1f51e56df164a48b 100644 --- a/library/src/main/java/com/lcodecore/tkrefreshlayout/processor/loading/LoadingBuilder.java +++ b/library/src/main/java/com/lcodecore/tkrefreshlayout/processor/loading/LoadingBuilder.java @@ -104,7 +104,8 @@ public class LoadingBuilder implements AnimatorValue.ValueUpdateListener, Animat /** * 初始化Params * - * @param color 颜色 + * @param color color + * @param colorId colorId */ protected void initParams(Color color,int colorId) { setcolor = colorId; diff --git a/library/src/main/java/com/lcodecore/tkrefreshlayout/utils/AnimatorValueUtil.java b/library/src/main/java/com/lcodecore/tkrefreshlayout/utils/AnimatorValueUtil.java index 68da4642fe70ddde633b66f41e9f90f06a228c71..44081e5b95006d93f966664a88adc1f1aba8def2 100644 --- a/library/src/main/java/com/lcodecore/tkrefreshlayout/utils/AnimatorValueUtil.java +++ b/library/src/main/java/com/lcodecore/tkrefreshlayout/utils/AnimatorValueUtil.java @@ -39,7 +39,7 @@ public class AnimatorValueUtil { * * @param tempValues 说明 */ - public void ofFloat(float... tempValues) { + public void ofFloat(float[] tempValues) { this.values = tempValues; rate = new float[this.values.length - 1][RATE_SIZE]; diff --git a/library/src/main/java/com/lcodecore/tkrefreshlayout/utils/AttrUtils.java b/library/src/main/java/com/lcodecore/tkrefreshlayout/utils/AttrUtils.java deleted file mode 100644 index 5ecb7ac3bb5fa2e95db0868e7b74983ba342e80b..0000000000000000000000000000000000000000 --- a/library/src/main/java/com/lcodecore/tkrefreshlayout/utils/AttrUtils.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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 - * - * 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.lcodecore.tkrefreshlayout.utils; - -import ohos.agp.components.AttrSet; - -/** - * AttrUtils - * - * @since 2021-07-19 - */ -public class AttrUtils { - private AttrUtils() { - } - - /** - * get the int value from AttrSet - * - * @param attrs the attrSet - * @param name the attrName - * @param defaultValue the defaultValue - * @return int value - */ - public static int getIntFromAttr(AttrSet attrs, String name, int defaultValue) { - int value = defaultValue; - try { - if (attrs.getAttr(name).isPresent() && attrs.getAttr(name).get() != null) { - value = attrs.getAttr(name).get().getIntegerValue(); - } - } catch (Exception e) { - return value; - } - return value; - } - - /** - * get the float value from AttrSet - * - * @param attrs the attrSet - * @param name the attrName - * @param defaultValue the defaultValue - * @return float value - */ - public static float getFloatFromAttr(AttrSet attrs, String name, float defaultValue) { - float value = defaultValue; - try { - if (attrs.getAttr(name).isPresent() && attrs.getAttr(name).get() != null) { - value = attrs.getAttr(name).get().getFloatValue(); - } - } catch (Exception e) { - return value; - } - return value; - } - - /** - * get the color value from AttrSet - * - * @param attrs the attrSet - * @param name the attrName - * @param defaultValue the defaultValue - * @return int colorValue - */ - public static int getColorFromAttr(AttrSet attrs, String name, int defaultValue) { - int value = defaultValue; - try { - if (attrs.getAttr(name).isPresent() && attrs.getAttr(name).get() != null) { - value = attrs.getAttr(name).get().getColorValue().getValue(); - } - } catch (Exception e) { - return value; - } - return value; - } -} diff --git a/library/src/main/java/com/lcodecore/tkrefreshlayout/utils/DensityUtil.java b/library/src/main/java/com/lcodecore/tkrefreshlayout/utils/DensityUtil.java index fcaeb8c6cc3ad9ea32fec82cd42811691c0a1b02..092e1cc87edcdeea8624b379ede617f35a765f0a 100755 --- a/library/src/main/java/com/lcodecore/tkrefreshlayout/utils/DensityUtil.java +++ b/library/src/main/java/com/lcodecore/tkrefreshlayout/utils/DensityUtil.java @@ -6,7 +6,11 @@ import ohos.app.Context; public class DensityUtil { /** - * 根据手机的分辨率从 dp 的单位 转成为 px(像素) + * 根据手机的分辨率从 dp 的单位 转成为 px(像素) + * + * @param context context + * @param dpValue dpValue + * @return 根据手机的分辨率从 dp 的单位 转成为 px(像素) */ public static int dp2px(Context context, float dpValue) { final float scale = 8; @@ -14,7 +18,11 @@ public class DensityUtil { } /** - * 根据手机的分辨率从 px(像素) 的单位 转成为 dp + * 根据手机的分辨率从 px(像素) 的单位 转成为 dp + * + * @param context context + * @param pxValue pxValue + * @return 根据手机的分辨率从 px(像素) 的单位 转成为 dp */ public static int px2dp(Context context, float pxValue) { final float scale = 8; diff --git a/library/src/main/java/com/lcodecore/tkrefreshlayout/utils/ScrollingUtil.java b/library/src/main/java/com/lcodecore/tkrefreshlayout/utils/ScrollingUtil.java index b7a0cbd18a6f08de4fb70ecfd094a41fc4e6ef87..97fbf739c4bb627daa32528ccaa370f961067cfe 100644 --- a/library/src/main/java/com/lcodecore/tkrefreshlayout/utils/ScrollingUtil.java +++ b/library/src/main/java/com/lcodecore/tkrefreshlayout/utils/ScrollingUtil.java @@ -39,7 +39,9 @@ public class ScrollingUtil { /** * 用来判断是否可以下拉 - * 手指在屏幕上该方法才有效 + * + * @param mChildView mChildView + * @return 用来判断是否可以下拉 */ public static boolean canChildScrollUp(Component mChildView) { if (mChildView == null) { @@ -55,8 +57,10 @@ public class ScrollingUtil { } /** - * Whether it is possible for the child view of this layout to scroll down. Override this if the child view is a custom view. * 判断是否可以上拉 + * + * @param mChildView mChildView + * @return 判断是否可以上拉 */ public static boolean canChildScrollDown(Component mChildView) { if (mChildView instanceof ListContainer) { @@ -130,8 +134,8 @@ public class ScrollingUtil { /** * 通过反射获取RecyclerView的item的topInset * - * @param layoutParams - * @return + * @param layoutParams layoutParams + * @return 通过反射获取RecyclerView的item的topInset */ private static int getRecyclerViewItemTopInset(ComponentContainer.LayoutConfig layoutParams) { try {