diff --git a/entry/build.gradle b/entry/build.gradle index c9862d851cf39fcbcc63b425d8f5721b381ab40b..722c409dae0915490bf0558cf7583beabead4ef8 100644 --- a/entry/build.gradle +++ b/entry/build.gradle @@ -19,12 +19,15 @@ dependencies { implementation fileTree(dir: 'libs', include: ['*.jar', '*.har']) testImplementation 'junit:junit:4.13' ohosTestImplementation 'com.huawei.ohos.testkit:runner:1.0.0.200' + // implementation project(':library') // implementation project(':glide_loader') - implementation('com.gitee.chinasoft_ohos:ScrollGalleryView-library:0.0.2-SNAPSHOT') - implementation('com.gitee.chinasoft_ohos:ScrollGalleryView-glide:0.0.2-SNAPSHOT') -// implementation('com.gitee.chinasoft_ohos:ScrollGalleryView-fresco:0.0.1-SNAPSHOT') -// implementation('com.gitee.chinasoft_ohos:ScrollGalleryView-picasso:0.0.1-SNAPSHOT') +// implementation project(':fresco_loader') +// implementation project(':picasso_loader') + implementation('com.gitee.chinasoft_ohos:ScrollGalleryView-library:0.0.2-SNAPSHOT') + implementation('com.gitee.chinasoft_ohos:ScrollGalleryView-glide:0.0.2-SNAPSHOT') +// implementation('com.gitee.chinasoft_ohos:ScrollGalleryView-fresco:0.0.2-SNAPSHOT') +// implementation('com.gitee.chinasoft_ohos:ScrollGalleryView-picasso:0.0.2-SNAPSHOT') } decc { supportType = ['html', 'xml'] diff --git a/entry/src/main/java/com/veinhorn/scrollgalleryview/example/builder/MainAbility.java b/entry/src/main/java/com/veinhorn/scrollgalleryview/example/builder/MainAbility.java index a1ddf3490d1a4a15f2282b8d018662d623759da2..c683a64d9fa48d64bd4bdf8e0226e3204fcd4314 100644 --- a/entry/src/main/java/com/veinhorn/scrollgalleryview/example/builder/MainAbility.java +++ b/entry/src/main/java/com/veinhorn/scrollgalleryview/example/builder/MainAbility.java @@ -2,7 +2,7 @@ * 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 an copy of the License at + * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * diff --git a/entry/src/main/java/com/veinhorn/scrollgalleryview/example/builder/MyApplication.java b/entry/src/main/java/com/veinhorn/scrollgalleryview/example/builder/MyApplication.java index 35b193fa128d194391a5c254baa9283b674eff3a..2e9381800df82c46e5ac99376ff9fe9354c145e4 100644 --- a/entry/src/main/java/com/veinhorn/scrollgalleryview/example/builder/MyApplication.java +++ b/entry/src/main/java/com/veinhorn/scrollgalleryview/example/builder/MyApplication.java @@ -2,7 +2,7 @@ * 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 an copy of the License at + * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * diff --git a/entry/src/ohosTest/java/com/veinhorn/scrollgalleryview/example/builder/ExampleOhosTest.java b/entry/src/ohosTest/java/com/veinhorn/scrollgalleryview/example/builder/ExampleOhosTest.java index 640bd556bbca64681a4101d8c8cc65e030c47095..b0b6a7828841b868d7c6ac492a54aa3fd8424799 100644 --- a/entry/src/ohosTest/java/com/veinhorn/scrollgalleryview/example/builder/ExampleOhosTest.java +++ b/entry/src/ohosTest/java/com/veinhorn/scrollgalleryview/example/builder/ExampleOhosTest.java @@ -2,7 +2,7 @@ * 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 an copy of the License at + * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * diff --git a/entry/src/test/java/com/veinhorn/scrollgalleryview/example/builder/ExampleTest.java b/entry/src/test/java/com/veinhorn/scrollgalleryview/example/builder/ExampleTest.java index d8f20ef4ed7a92cb27e7a496755bfd907e271fee..3b3f2c4b630c0a5df373c3f5bcdf2f490ff27970 100644 --- a/entry/src/test/java/com/veinhorn/scrollgalleryview/example/builder/ExampleTest.java +++ b/entry/src/test/java/com/veinhorn/scrollgalleryview/example/builder/ExampleTest.java @@ -2,7 +2,7 @@ * 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 an copy of the License at + * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * diff --git a/fresco_loader/src/test/java/com/ayokunlepaul/frescoloader/ExampleTest.java b/fresco_loader/src/test/java/com/ayokunlepaul/frescoloader/ExampleTest.java index 8e57255f419494e07ba6ad7fd632efd7630efdbc..0d8dcd4df2c28385e098b3b79c79e81760b5be3c 100644 --- a/fresco_loader/src/test/java/com/ayokunlepaul/frescoloader/ExampleTest.java +++ b/fresco_loader/src/test/java/com/ayokunlepaul/frescoloader/ExampleTest.java @@ -2,7 +2,7 @@ * 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 an copy of the License at + * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * diff --git a/glide_loader/src/main/java/ogbe/ozioma/com/glideimageloader/GlideImageLoader.java b/glide_loader/src/main/java/ogbe/ozioma/com/glideimageloader/GlideImageLoader.java index 45058171d40733a4af0fda3ea420b64785278807..ffbed39a9e86f10bd30f2ac3ba69fe1cc7551d7d 100644 --- a/glide_loader/src/main/java/ogbe/ozioma/com/glideimageloader/GlideImageLoader.java +++ b/glide_loader/src/main/java/ogbe/ozioma/com/glideimageloader/GlideImageLoader.java @@ -22,8 +22,8 @@ import org.jetbrains.annotations.Nullable; */ public class GlideImageLoader implements MediaLoader { private String mUrl; - private int mWidth; - private int mHeight; +// private int mWidth; +// private int mHeight; /** * GlideImageLoader @@ -43,8 +43,8 @@ public class GlideImageLoader implements MediaLoader { */ public GlideImageLoader(String url, int width, int height) { this.mUrl = url; - this.mWidth = width; - this.mHeight = height; +// this.mWidth = width; +// this.mHeight = height; } /** diff --git a/glide_loader/src/test/java/ogbe/ozioma/com/glideimageloader/ExampleTest.java b/glide_loader/src/test/java/ogbe/ozioma/com/glideimageloader/ExampleTest.java index f1e919da0dceb55624f8cc5659ddf67ed12f83e1..46d35e10991f6c8871775798438f56453ccc4992 100644 --- a/glide_loader/src/test/java/ogbe/ozioma/com/glideimageloader/ExampleTest.java +++ b/glide_loader/src/test/java/ogbe/ozioma/com/glideimageloader/ExampleTest.java @@ -2,7 +2,7 @@ * 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 an copy of the License at + * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * diff --git a/library/src/main/java/com/veinhorn/scrollgalleryview/ScreenSlidePagerAdapter.java b/library/src/main/java/com/veinhorn/scrollgalleryview/ScreenSlidePagerAdapter.java index 51f6264e214499b31aa1a7ba60f0542795ceb595..23ca8851230009ac2f2ac61325cd4f8bacf00a70 100644 --- a/library/src/main/java/com/veinhorn/scrollgalleryview/ScreenSlidePagerAdapter.java +++ b/library/src/main/java/com/veinhorn/scrollgalleryview/ScreenSlidePagerAdapter.java @@ -39,7 +39,7 @@ public class ScreenSlidePagerAdapter extends PageSliderProvider { this.mOnImageClickListener = onImageClickListener; this.mContext = context; this.mOnImageLongClickListener = onImageLongClickListener; - imageFragmentList = new ArrayList<>(); +// imageFragmentList = new ArrayList<>(); imageFragmentList = getImageComponent(); } diff --git a/library/src/main/java/com/veinhorn/scrollgalleryview/ScrollGalleryView.java b/library/src/main/java/com/veinhorn/scrollgalleryview/ScrollGalleryView.java index a89f9fcd7288c80527b9bd5079f750d24662f16d..e38904e63fde7ba21acaeaf184e8def8903f2512 100644 --- a/library/src/main/java/com/veinhorn/scrollgalleryview/ScrollGalleryView.java +++ b/library/src/main/java/com/veinhorn/scrollgalleryview/ScrollGalleryView.java @@ -54,8 +54,8 @@ public class ScrollGalleryView extends DirectionalLayout { private HackyViewPager viewPager; // Transitions - private Transition mThumbnailsTransition; - private boolean isUseDefaultThumbnailsTransition; +// private Transition mThumbnailsTransition; +// private boolean isUseDefaultThumbnailsTransition; // Listeners private final PageSlider.PageChangedListener viewPagerChangeListener = new PageSlider.PageChangedListener() { @@ -321,7 +321,7 @@ public class ScrollGalleryView extends DirectionalLayout { if (!mIsThumbnailsHidden) { this.mIsHideThumbnailsOnClick = isHideThumbnailsOnClick; if (isHideThumbnailsOnClick) { - this.isUseDefaultThumbnailsTransition = true; +// this.isUseDefaultThumbnailsTransition = true; } } return this; @@ -337,7 +337,7 @@ public class ScrollGalleryView extends DirectionalLayout { public ScrollGalleryView hideThumbnailsOnClick(boolean isHideThumbnailsOnClick, Transition thumbnailsTransition) { if (!mIsThumbnailsHidden) { this.mIsHideThumbnailsOnClick = isHideThumbnailsOnClick; - this.mThumbnailsTransition = thumbnailsTransition; +// this.mThumbnailsTransition = thumbnailsTransition; } return this; } diff --git a/library/src/main/java/com/veinhorn/scrollgalleryview/util/FactoryUtil.java b/library/src/main/java/com/veinhorn/scrollgalleryview/util/FactoryUtil.java index 7beef851e0eb807ff6f3b2b19d12cc08e71b8866..4f56dc29969024aa4609ddcc57a60ea9b230f5d0 100644 --- a/library/src/main/java/com/veinhorn/scrollgalleryview/util/FactoryUtil.java +++ b/library/src/main/java/com/veinhorn/scrollgalleryview/util/FactoryUtil.java @@ -2,7 +2,7 @@ * 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 an copy of the License at + * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * diff --git a/library/src/main/java/com/veinhorn/scrollgalleryview/util/LogUtil.java b/library/src/main/java/com/veinhorn/scrollgalleryview/util/LogUtil.java index e9b254b673a88d1bcccda309a04c2073fe40b53c..76bc00260b22cb3d798e19955cf9df4db7f789f7 100644 --- a/library/src/main/java/com/veinhorn/scrollgalleryview/util/LogUtil.java +++ b/library/src/main/java/com/veinhorn/scrollgalleryview/util/LogUtil.java @@ -2,7 +2,7 @@ * 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 an copy of the License at + * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * diff --git a/library/src/test/java/com/veinhorn/scrollgalleryview/ExampleTest.java b/library/src/test/java/com/veinhorn/scrollgalleryview/ExampleTest.java index 5f5a20952d94f8a3f81873e3fdf1bce4a2e85812..e7d380b6760f24dc005ee1dee13aedc2d7d67a53 100644 --- a/library/src/test/java/com/veinhorn/scrollgalleryview/ExampleTest.java +++ b/library/src/test/java/com/veinhorn/scrollgalleryview/ExampleTest.java @@ -2,7 +2,7 @@ * 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 an copy of the License at + * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * diff --git a/picasso_loader/src/test/java/com/veinhorn/scrollgalleryview/loader/picasso/ExampleTest.java b/picasso_loader/src/test/java/com/veinhorn/scrollgalleryview/loader/picasso/ExampleTest.java index b2ca2794e114b8a6bf8aedcb1a005db27f6fda9c..c9cebb5ac0429455b5f0f6230db8d460c1dc1cee 100644 --- a/picasso_loader/src/test/java/com/veinhorn/scrollgalleryview/loader/picasso/ExampleTest.java +++ b/picasso_loader/src/test/java/com/veinhorn/scrollgalleryview/loader/picasso/ExampleTest.java @@ -2,7 +2,7 @@ * 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 an copy of the License at + * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * diff --git a/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/HmPlayer.java b/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/HmPlayer.java index 12035d137af59bfa0f024d65aec3d4354cc7785d..7d1eab4a9c9395732ad58d7a58b0af40b28cc8bd 100644 --- a/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/HmPlayer.java +++ b/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/HmPlayer.java @@ -2,7 +2,7 @@ * 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 an copy of the License at + * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * diff --git a/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/api/ImplLifecycle.java b/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/api/ImplLifecycle.java index 5184b8300b4930c9f095ca0a6d1bf3ac94d6246f..99c430ba79d732822d506a88d317646ddef7aa6e 100644 --- a/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/api/ImplLifecycle.java +++ b/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/api/ImplLifecycle.java @@ -2,7 +2,7 @@ * 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 an copy of the License at + * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * diff --git a/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/api/ImplPlayModule.java b/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/api/ImplPlayModule.java index 7160a45fdd6a78c25be6ab2cc38c0385bfbd5ea1..996199fff727d9e15a59ae6a12e627dd44af29f5 100644 --- a/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/api/ImplPlayModule.java +++ b/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/api/ImplPlayModule.java @@ -2,7 +2,7 @@ * 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 an copy of the License at + * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * diff --git a/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/api/ImplPlayer.java b/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/api/ImplPlayer.java index 9047573cb9b6e7d8e0e6b9474a0a51cceb3a2796..8501a74bdebccec0a8c5213962825ac4bd8f4cc6 100644 --- a/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/api/ImplPlayer.java +++ b/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/api/ImplPlayer.java @@ -2,7 +2,7 @@ * 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 an copy of the License at + * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * diff --git a/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/api/ScreenChangeListener.java b/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/api/ScreenChangeListener.java index dd601fa26de475424acf35f6450a1ca1aee02f67..8210c68be05f982765203048e4804d712ac96b74 100644 --- a/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/api/ScreenChangeListener.java +++ b/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/api/ScreenChangeListener.java @@ -2,7 +2,7 @@ * 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 an copy of the License at + * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * diff --git a/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/api/StatuChangeListener.java b/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/api/StatuChangeListener.java index 72f5d871da138c2dc4f9a9594facc5825fdeb190..bff5741892bb169f23436dd05c1dcc8b4e1939f2 100644 --- a/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/api/StatuChangeListener.java +++ b/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/api/StatuChangeListener.java @@ -2,7 +2,7 @@ * 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 an copy of the License at + * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * diff --git a/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/constant/Constants.java b/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/constant/Constants.java index 304f63544d674956f75e3de3a51073e3a31fea36..753e21360902f6e686ab8fb0453e9cf3cceb9ff2 100644 --- a/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/constant/Constants.java +++ b/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/constant/Constants.java @@ -2,7 +2,7 @@ * 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 an copy of the License at + * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * diff --git a/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/constant/GestureConst.java b/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/constant/GestureConst.java index cb55077e8abe8c2f2cb5f44ad15bc129712fc390..79f8040caf5af10679fa8fe18fdec545dda42ba6 100644 --- a/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/constant/GestureConst.java +++ b/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/constant/GestureConst.java @@ -2,7 +2,7 @@ * 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 an copy of the License at + * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * diff --git a/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/constant/PlayerStatu.java b/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/constant/PlayerStatu.java index a82573b8e101e7c8e012141c372c398332aff2bf..e82d6aa549d39bef029a6d43d324c5c0b204e162 100644 --- a/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/constant/PlayerStatu.java +++ b/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/constant/PlayerStatu.java @@ -2,7 +2,7 @@ * 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 an copy of the License at + * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * diff --git a/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/factory/SourceFactory.java b/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/factory/SourceFactory.java index 7d1f423bc87692564b1c4702e44fc7207633486b..430008c72cb189c5ebf25cd2df4dd6f16bcf44b6 100644 --- a/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/factory/SourceFactory.java +++ b/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/factory/SourceFactory.java @@ -2,7 +2,7 @@ * 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 an copy of the License at + * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * diff --git a/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/manager/GestureDetector.java b/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/manager/GestureDetector.java index 4c389e5a95a49e3429fbe50c3b5c151b0120ff52..e7b6b480731dca99f3600374fbc895720860b59b 100644 --- a/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/manager/GestureDetector.java +++ b/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/manager/GestureDetector.java @@ -2,7 +2,7 @@ * 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 an copy of the License at + * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -17,6 +17,7 @@ package com.veinhorn.playerviewlibrary.player.manager; import com.veinhorn.playerviewlibrary.player.constant.Constants; import com.veinhorn.playerviewlibrary.player.constant.GestureConst; +import com.veinhorn.playerviewlibrary.util.NumberUtil; import ohos.agp.components.VelocityDetector; import ohos.multimodalinput.event.TouchEvent; @@ -83,18 +84,18 @@ public class GestureDetector { mLastFocusX = focusX; mLastFocusY = focusY; } - final int deltaX = (int) (focusX - mDownFocusX); - final int deltaY = (int) (focusY - mDownFocusY); + final int deltaX = (int) NumberUtil.sub(focusX , mDownFocusX); + final int deltaY = (int) NumberUtil.sub(focusY , mDownFocusY); int distanceX = Math.abs(deltaX); int distanceY = Math.abs(deltaY); if (GestureConst.getScaledTouchSlop() > distanceX || GestureConst.getScaledTouchSlop() > distanceY) { if (distanceX >= distanceY) { currentMoveType = MOVING_HORIZONTAL; - float scrollX = mLastFocusX - focusX; + float scrollX = (float) NumberUtil.sub(mLastFocusX , focusX); isHandled = mListener.onTouchMoving(MOVING_HORIZONTAL, focusX, focusY, scrollX); } else { currentMoveType = MOVING_VERTICAL; - float scrollY = mLastFocusY - focusY; + float scrollY = (float) NumberUtil.sub(mLastFocusY , focusY);//mLastFocusY - focusY isHandled = mListener.onTouchMoving(MOVING_VERTICAL, focusX, focusY, scrollY); } mLastFocusX = focusX; @@ -129,8 +130,8 @@ public class GestureDetector { if (skipIndex == index) { continue; } - sumX += ev.getPointerPosition(index).getX(); - sumY += ev.getPointerPosition(index).getY(); + sumX = (float) NumberUtil.add(ev.getPointerPosition(index).getX(),sumX); + sumY = (float) NumberUtil.add(ev.getPointerPosition(index).getY(),sumY); } final int div = isPointerUp ? count - 1 : count; float focusX = sumX / div; diff --git a/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/manager/HmPlayerLifecycle.java b/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/manager/HmPlayerLifecycle.java index 95d49950d189509e137e8dae7183aa2754c91281..5dc0b1168d5644dd17043acbf946ad50ab0188b6 100644 --- a/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/manager/HmPlayerLifecycle.java +++ b/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/manager/HmPlayerLifecycle.java @@ -2,7 +2,7 @@ * 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 an copy of the License at + * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * diff --git a/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/util/CommonUtils.java b/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/util/CommonUtils.java index c5b7ae283618e1782df129cf4e019a3271249468..eceb7f4c6ae30abf1abf99aa822828e8b0cc0e6b 100644 --- a/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/util/CommonUtils.java +++ b/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/util/CommonUtils.java @@ -2,7 +2,7 @@ * 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 an copy of the License at + * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * diff --git a/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/util/DateUtils.java b/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/util/DateUtils.java index cee8703f99ed7945d130c2914c6e30a7f0c1a397..18ff63210a9cb30c78bb5bc306f8bebc82f1b15c 100644 --- a/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/util/DateUtils.java +++ b/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/util/DateUtils.java @@ -2,7 +2,7 @@ * 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 an copy of the License at + * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * diff --git a/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/view/PlayerGestureView.java b/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/view/PlayerGestureView.java index 3d7d3134b12ba7bdd87d7ebf79096d113e2f46fb..f2d0cf5c6ec4b5cd42b2434af2bebf829888383a 100644 --- a/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/view/PlayerGestureView.java +++ b/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/view/PlayerGestureView.java @@ -2,7 +2,7 @@ * 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 an copy of the License at + * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -23,6 +23,7 @@ import com.veinhorn.playerviewlibrary.player.constant.PlayerStatu; import com.veinhorn.playerviewlibrary.player.manager.GestureDetector; import com.veinhorn.playerviewlibrary.player.util.CommonUtils; import com.veinhorn.playerviewlibrary.player.util.DateUtils; +import com.veinhorn.playerviewlibrary.util.NumberUtil; import ohos.agp.colors.RgbColor; import ohos.agp.components.AttrSet; import ohos.agp.components.DirectionalLayout; @@ -201,7 +202,8 @@ public class PlayerGestureView extends DirectionalLayout implements ImplPlayModu if (getWidth() / Constants.NUMBER_FLOAT_2 <= focusX) { show(PlayerGestureView.LIGHT_BRIGHT_TYPE, "100%"); } else { - float volume = player.getVolume() + distance / interval; + double mulValue = NumberUtil.div(distance , interval); + float volume = (float) NumberUtil.add(player.getVolume(),mulValue);//player.getVolume() + distance / interval volume = (volume < 0) ? 0 : Math.min(volume, 1); show(PlayerGestureView.VOLUME_TYPE, (int) (volume * Constants.NUMBER_100) + "%"); player.setVolume(volume); diff --git a/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/view/PlayerLoading.java b/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/view/PlayerLoading.java index 2a4fdc9c66cfaab4db0daa16b8b255f80e913863..4eb1e9be9e190d4e64cc9ddf8ce93ef679a725ee 100644 --- a/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/view/PlayerLoading.java +++ b/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/view/PlayerLoading.java @@ -2,7 +2,7 @@ * 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 an copy of the License at + * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * diff --git a/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/view/PlayerView.java b/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/view/PlayerView.java index dcf268dbb9c47fc01042d8ff7e763838742ef638..3f21e9e7b81f16b08c56dd1bcce4690458cf0681 100644 --- a/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/view/PlayerView.java +++ b/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/view/PlayerView.java @@ -2,7 +2,7 @@ * 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 an copy of the License at + * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * diff --git a/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/view/SimplePlayerController.java b/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/view/SimplePlayerController.java index be33c137bbde2b8c340f76a2e2f766a85293fadf..b11e357f3ceab77b716b26631e6dba9107cba31d 100644 --- a/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/view/SimplePlayerController.java +++ b/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/player/view/SimplePlayerController.java @@ -2,7 +2,7 @@ * 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 an copy of the License at + * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * diff --git a/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/util/LogUtil.java b/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/util/LogUtil.java index ae5a9a6e9376559711f881a78d0bd52e6940e26f..84157fc0feb508494e565c98a52a6a75d0ca1d8d 100644 --- a/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/util/LogUtil.java +++ b/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/util/LogUtil.java @@ -2,7 +2,7 @@ * 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 an copy of the License at + * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * diff --git a/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/util/NumberUtil.java b/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/util/NumberUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..56e08c10aea0d370ae333edf57007eac878be0f3 --- /dev/null +++ b/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/util/NumberUtil.java @@ -0,0 +1,173 @@ +/* + * 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.veinhorn.playerviewlibrary.util; + +/** + * 算法工具类 + * + * @since 2021-04-08 + */ +public class NumberUtil { + /** + * 默认除法运算精度 + */ + private static final int DEF_DIV_SCALE = 16; + + private NumberUtil() { + } + + /** + * 提供精确的加法运算。 + * + * @param v1 被加数 + * @param v2 加数 + * @return 两个参数的和 + */ + public static double add(double v1, double v2) { + java.math.BigDecimal b1 = new java.math.BigDecimal(Double.toString(v1)); + java.math.BigDecimal b2 = new java.math.BigDecimal(Double.toString(v2)); + return b1.add(b2).doubleValue(); + } + + /** + * 提供精确的加法运算。 + * + * @param v1 被加数 + * @param v2 加数 + * @return 两个参数的和 + */ + public static double add(String v1, String v2) { + java.math.BigDecimal b1 = new java.math.BigDecimal(v1); + java.math.BigDecimal b2 = new java.math.BigDecimal(v2); + return b1.add(b2).doubleValue(); + } + + /** + * 提供精确的减法运算。 + * + * @param v1 被减数 + * @param v2 减数 + * @return 两个参数的差 + */ + public static double sub(double v1, double v2) { + java.math.BigDecimal b1 = new java.math.BigDecimal(Double.toString(v1)); + java.math.BigDecimal b2 = new java.math.BigDecimal(Double.toString(v2)); + return b1.subtract(b2).doubleValue(); + } + + /** + * 提供精确的减法运算。 + * + * @param v1 被减数 + * @param v2 减数 + * @return 两个参数的差 + */ + public static double sub(String v1, String v2) { + java.math.BigDecimal b1 = new java.math.BigDecimal(v1); + java.math.BigDecimal b2 = new java.math.BigDecimal(v2); + return b1.subtract(b2).doubleValue(); + } + + /** + * 提供精确的乘法运算。 + * + * @param v1 被乘数 + * @param v2 乘数 + * @return 两个参数的积 + */ + public static double mul(double v1, double v2) { + java.math.BigDecimal b1 = new java.math.BigDecimal(Double.toString(v1)); + java.math.BigDecimal b2 = new java.math.BigDecimal(Double.toString(v2)); + return b1.multiply(b2).doubleValue(); + } + + /** + * 提供精确的乘法运算。 + * + * @param v1 被乘数 + * @param v2 乘数 + * @return 两个参数的积 + */ + public static double mul(String v1, String v2) { + java.math.BigDecimal b1 = new java.math.BigDecimal(v1); + java.math.BigDecimal b2 = new java.math.BigDecimal(v2); + return b1.multiply(b2).doubleValue(); + } + + /** + * 提供(相对)精确的除法运算,当发生除不尽的情况时,精确到 小数点以后10位,以后的数字四舍五入。 + * + * @param v1 被除数 + * @param v2 除数 + * @return 两个参数的商 + */ + public static double div(double v1, double v2) { + return div(v1, v2, DEF_DIV_SCALE); + } + + /** + * 提供(相对)精确的除法运算,当发生除不尽的情况时,精确到 小数点以后10位,以后的数字四舍五入。 + * + * @param v1 被除数 + * @param v2 除数 + * @return 两个参数的商 + */ + public static double div(String v1, String v2) { + java.math.BigDecimal b1 = new java.math.BigDecimal(v1); + java.math.BigDecimal b2 = new java.math.BigDecimal(v2); + return b1.divide(b2, DEF_DIV_SCALE, java.math.BigDecimal.ROUND_HALF_UP).doubleValue(); + } + + /** + * 提供(相对)精确的除法运算。当发生除不尽的情况时,由scale参数指 定精度,以后的数字四舍五入。 + * + * @param v1 被除数 + * @param v2 除数 + * @param scale 表示表示需要精确到小数点以后几位。 + * @return 两个参数的商 + */ + public static double div(double v1, double v2, int scale) { + java.math.BigDecimal b1 = new java.math.BigDecimal(Double.toString(v1)); + java.math.BigDecimal b2 = new java.math.BigDecimal(Double.toString(v2)); + return b1.divide(b2, scale, java.math.BigDecimal.ROUND_HALF_UP).doubleValue(); + } + + /** + * 提供精确的小数位四舍五入处理。 + * + * @param value 需要四舍五入的数字 + * @param scale 小数点后保留几位 + * @return 四舍五入后的结果 + */ + public static double round(double value, int scale) { + java.math.BigDecimal bigDecimal = new java.math.BigDecimal(Double.toString(value)); + java.math.BigDecimal one = new java.math.BigDecimal("1"); + return bigDecimal.divide(one, scale, java.math.BigDecimal.ROUND_HALF_UP).doubleValue(); + } + + /** + * 提供精确的小数位四舍五入处理。 + * + * @param value 需要四舍五入的数字 + * @param scale 小数点后保留几位 + * @return 四舍五入后的结果 + */ + public static double round(String value, int scale) { + java.math.BigDecimal bigDecimal = new java.math.BigDecimal(value); + java.math.BigDecimal one = new java.math.BigDecimal("1"); + return bigDecimal.divide(one, scale, java.math.BigDecimal.ROUND_HALF_UP).doubleValue(); + } +} diff --git a/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/util/ScreenUtils.java b/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/util/ScreenUtils.java index 8749a1fabacc10fdf2c73aa5a23ba128edadf951..1e660090d9b00395a011fd77cf235c786870eac7 100644 --- a/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/util/ScreenUtils.java +++ b/playerviewlibrary/src/main/java/com/veinhorn/playerviewlibrary/util/ScreenUtils.java @@ -2,7 +2,7 @@ * 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 an copy of the License at + * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * diff --git a/playerviewlibrary/src/test/java/com/veinhorn/playerviewlibrary/ExampleTest.java b/playerviewlibrary/src/test/java/com/veinhorn/playerviewlibrary/ExampleTest.java index 513e9b79970b9a52dfa83ac46b12462e2d98600f..5531c68356749a6d60013b5c49750f48d60e9422 100644 --- a/playerviewlibrary/src/test/java/com/veinhorn/playerviewlibrary/ExampleTest.java +++ b/playerviewlibrary/src/test/java/com/veinhorn/playerviewlibrary/ExampleTest.java @@ -2,7 +2,7 @@ * 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 an copy of the License at + * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 *