diff --git a/README-EN.md b/README-EN.md deleted file mode 100644 index 4b74e7f6172c5a82ae70806284577a323c877362..0000000000000000000000000000000000000000 --- a/README-EN.md +++ /dev/null @@ -1,147 +0,0 @@ -# ACProgressLite -* this project based on open source projects [ACProgressLite] (https://github.com/cloudist/ACProgressLite) for openharmony migration and development,Can through the project tag as well as making address (https://github.com/cloudist/ACProgressLite) to track the original version -#### Project Introduction -- Project name: ACProgressLite -- Series: OpenHarmony third party component adaptation porting -- Function: OpenHarmony load control library, simple, easy to use, strong customizability.Used to quickly implement similar to iOS "in load" and other pop-up boxes. -Is similar to the [iOS MBProgressHUD] (https://github.com/jdg/MBProgressHUD) - Keywords :Progressbar, Progresswheel, HUD, openharmony, Loading* -- Baseline version: AcProgressLite Release V0.0.1 -- Project migration status: main function complete -- Call difference: none -- Development version: SDK5, Deveco Studio2.1 Beta4 -The project can be run directly under SDK5, Deveco Studio2.1 Beta4 -If can't run, deleting items. Gradle, idea, build, and gradle, build. Gradle file, -And according to their own version to create a new project, the corresponding files of the new project to the root directory - -## Entry to run requirements -Go through Deveco Studio and download OpenHarmonySDK -Change the dependencies→classpath version in your project's build.gradle file to the corresponding version (that is, the version used in your IDE new project). -## Screenshot -

- ACProgressLite -

- - -#### Installation Tutorials -The project needs to add the Maven repository and add dependencies to the build.gradle file -```gradle -// Add the Maven repository -repositories { -Maven { -Url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' -} -} -// Add a dependency library -dependencies { - -implementation('com.gitee.chinasoft_ohos:ACProgressLite:0.0.1-SNAPSHOT') -... -} -``` - -### how to use -```java -AcProgressFlower dialog= new acProgressFlower.Builder(this) -Direction (ACProgressConstant. DIRECT_CLOCKWISE) -The build (); -dialog.SetCanceledOnTouchOutside (true); -dialog.show (dialog); - -``` -###Example -* Petal type -```java -ACProgressFlower dialog = new ACProgressFlower.Builder(this) -Direction (ACProgressConstant. DIRECT_CLOCKWISE) -ThemeColor (Color. WHITE). The text (" Title is here) -FadeColor (Color. DKGRAY). The build (); -dialog.show(dialog); -``` -* Round cake type -```java - -ACProgressPie dialog = new ACProgressPie.Builder(this) -RingColor (Color. WHITE) -PieColor (Color. WHITE) -UpdateType (ACProgressConstant. PIE_AUTO_UPDATE) -The build (); -dialog.show(dialog); -``` -* Custom types -```java - -ACProgressCustom dialog = new ACProgressCustom.Builder(this) -UseImages (R.d rawable. P0, R.d rawable. P1, R.d rawable. P2, R.d rawable. P3) -The build (); -dialog.show(dialog); -``` -## Configuration - 3 types of dialog are avaliable now:
- Here are some general configurations: -1. `sizeRatio` size of the background. The value is float and less than 1f. It means the ratio of "real size / the smaller edge length of the screen". aka: -background length = the smaller edge length of the screen * sizeRatio -> Pay attention to the situation of "Flower type with text", it will be explained int next scetion. - -1. `bgColor` Color of background, int value. -1. `bgAlpha` Transparency of background. 0 is full transparency, 1 is opaque. All alpha configurations are similar. -1. `bgCornerRadius` Radius of four corners of the background. - -*bgColor, bgAlpha, bgCornerRadius are not available for custom type* - - -* **Flower** -Most commonly used type. Support adding text title. - -**Configuration**|**Description** -:------|:------------------ -themeColor|Start color of petals. -borderPadding|Distance between outer edge of petals and edge of background / length of the edge of background. (length of the edge of background is based on sizeRatio) -centerPadding|Distance between inner edge of petals and center of background / length of the edge of background. (length of the edge of background is based on sizeRatio) -fadeColor|End color of petals. -petalCount|Number of petals. -petalAlpha|Transparency of petals. -petalThickness|Thickness of petals. -direction|Direction of petals' rotation, `ACProgressConstant.DIRECT_CLOCKWISE` or `DIRECT_ANTI_CLOCKWISE`. -speed|Speed of petals' rotation, frames count in each second. -text|Text, shown under petals. -textSize|Text's size. -textColor|Text's color. -textAlpha|Text's transparency. -textMarginTop|Distance between text and petals. -isTextExpandWidth|Whether expand the background width to equal the height when a text title is set. If you set a text title, the background's height will become longer because of making room for text. If this value is `true`, the petals are still drawn by sizeRatio, but petals will be horizontally centered as the background's width is expanded to equal the height; if this value is `false`, the background will be rectangle with different width and height. - -* **Pie** -Suitable for display progress. Manual-update and auto-update are supported. - -**Configuration**|**Description** -:------|:------------------ -ringColor|Color of ring. -ringAlpha|Transparency of ring. -ringThickness|Thickness of ring. -ringBorderPadding|Distance between ring and edge of background / length of the edge of background. -pieColor|Color of pie. -pieAlpha|Transparency of pie. -pieRingDistance|Distance between ring and pie / length of the edge of background. -updateType|Update type. `PIE_AUTO_UPDATE` or `PIE_MANUAL_UPDATE`. Manually update with method `setPiePercentage()`. -speed|frames count in each second with auto-update type. -pieces|pieces of pie with auto-update type. - - -* **Custom** -like GIF, support res/drawable resources ids array or image files array as data source. - -**Configuration**|**Description** -:------|:------------------ -useImages|resources ids array. -useFiles|image files array. -speed|frames count in each second. -#### Test Information -The CodeCheck code tests without exception -The cloudTest code test has no exceptions -Tinder safety virus safety test passed -The current version of Demo function is basically the same as the original Android components -#### version iteration -0.0.1-SNAPSHOT -#### Copyright and License Information -* [MIT License](http://mit-license.org/) \ No newline at end of file diff --git a/README.OPENSOURCE b/README.OPENSOURCE new file mode 100644 index 0000000000000000000000000000000000000000..08dd1d45f46c465329b4614b9e1308b57e811ad6 --- /dev/null +++ b/README.OPENSOURCE @@ -0,0 +1,19 @@ +[ + + { + + "Name": "ACProgressLite", + + "License": "MIT License", + + "License File": "LICENSE", + + "Version Number": "v1.2.1", + + "Upstream URL": "https://github.com/cloudist/ACProgressLite", + + "Description": "加载控件库,简洁、易用、可定制性强。用于快速实现类似 iOS 的 “加载中” 等弹出框" + + } + +] \ No newline at end of file diff --git a/README.md b/README.md index 828b4784ed9ec97c0b3104fd863e596ed9ee9057..ac5a0051c29cb767e30bbff1311a5458926f14aa 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,28 @@ # ACProgressLite -**本项目基于开源项目 [ACProgressLite](https://github.com/cloudist/ACProgressLite) 进行openharmony的移植和开发,可以通过项目标签以及github地址( https://github.com/cloudist/ACProgressLite )追踪到原项目版本** #### 项目介绍 - 项目名称:ACProgressLite - 所属系列:openharmony第三方组件适配移植 - 功能:openharmony 加载控件库,简洁、易用、可定制性强。用于快速实现类似 iOS 的 “加载中” 等弹出框。 - 类似于 iOS 中的 [MBProgressHUD](https://github.com/jdg/MBProgressHUD) - - **关键词** *Progressbar, Progresswheel, HUD, openharmony, Loading* -- 基线版本:ACProgressLite release V0.0.1 - 项目移植状态:主功能完成 - 调用差异:无 -- 开发版本:sdk5,DevEco Studio2.1 beta4 - 在sdk5,DevEco Studio2.1 beta4下项目可直接运行 -如无法运行,删除项目.gradle,.idea,build,gradle,build.gradle文件, -并依据自己的版本创建新项目,将新项目的对应文件复制到根目录下 +- 基线版本:V1.2.1 +- 开发版本:sdk5,DevEco Studio2.1 beta4(实时更新以当前最新版本为准) -## entry运行要求 -通过DevEco studio,并下载openHarmonySDK -将项目中的build.gradle文件中dependencies→classpath版本改为对应的版本(即你的IDE新建项目中所用的版本) -## Screenshot +#### 演示效果

- ACProgressLite +

+#### entry运行要求 +通过DevEco studio,并下载openHarmonySDK +将项目中的build.gradle文件中dependencies→classpath版本改为对应的版本(即你的IDE新建项目中所用的版本) + + + #### 安装教程 项目需要添加maven仓库,并且再build.gradle文件下添加依赖 @@ -47,10 +43,12 @@ implementation('com.gitee.chinasoft_ohos:ACProgressLite:0.0.1-SNAPSHOT') } ``` +在sdk5,DevEco Studio2.1 beta3下项目可直接运行 +如无法运行,删除项目.gradle,.idea,build,gradle,build.gradle文件, +并依据自己的版本创建新项目,将新项目的对应文件复制到根目录下 - -###### 使用 - +#### 使用说明 +使用该库非常简单,只需查看提供的示例的源代码。 ```java ACProgressFlower dialog = new ACProgressFlower.Builder(this) .direction(ACProgressConstant.DIRECT_CLOCKWISE) @@ -90,8 +88,7 @@ ACProgressCustom dialog = new ACProgressCustom.Builder(this) .build(); dialog.show(dialog); ``` - -## 配置说明 +###### 配置说明  目前提供3种类型的加载框:
 下面是一些通用的配置: 1. `sizeRatio` 背景的大小。值应为小于1的浮点数,表示以屏幕较短一边的相应比例为框体大小,即: @@ -153,14 +150,12 @@ useFiles|使用的图片文件对象 speed|每秒的帧数 #### 测试信息 - CodeCheck代码测试无异常 CloudTest代码测试无异常 火绒安全病毒安全检测通过 -当前版本demo功能与原组件基本无差异 #### 版本迭代 diff --git a/build.gradle b/build.gradle index e463f147c46e9b38e8fe2fb8e3f3059b899a057d..1dc510ffd5a8d3abe3f2758e193a2619aca86563 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ ohos { compatibleSdkVersion 5 } } - + buildscript { repositories { maven { @@ -16,11 +16,11 @@ buildscript { maven { url 'https://developer.huawei.com/repo/' } - jcenter() + jcenter() } dependencies { classpath 'com.huawei.ohos:hap:2.4.2.7' - classpath 'com.huawei.ohos:decctest:1.0.0.6' + classpath 'com.huawei.ohos:decctest:1.0.0.7' } } @@ -32,6 +32,6 @@ allprojects { maven { url 'https://developer.huawei.com/repo/' } - jcenter() + jcenter() } } diff --git a/changelog.md b/changelog.md index 9e54890d275df550ffce72ec3b483bfeed8facd3..2312fb6dfb7cd2c842e0ee386a4cf4806c05ae68 100644 --- a/changelog.md +++ b/changelog.md @@ -1,7 +1,3 @@ -# 基本功能: -openharmony 加载控件库,简洁、易用、可定制性强。用于快速实现类似 iOS 的 “加载中” 等弹出框。 - 类似于 iOS 中的 [MBProgressHUD](https://github.com/jdg/MBProgressHUD) -# 修改点: -无 -# 遗留问题(暂不支持的功能): -无 +## 0.0.1-SNAPSHOT + +ohos 第一个版本,完整实现了原库的全部 api \ No newline at end of file diff --git a/entry/src/main/config.json b/entry/src/main/config.json index 385975eaefde9038778a29cec20dc07f407b0250..25c4f5d9802c6d27968181eebe5842da644fda31 100644 --- a/entry/src/main/config.json +++ b/entry/src/main/config.json @@ -3,13 +3,13 @@ "bundleName": "cc.cloudist.acpsample", "vendor": "cloudist", "version": { - "code": 1, - "name": "1.0" + "code": 1000000, + "name": "1.0.0" }, "apiVersion": { "compatible": 5, "target": 5, - "releaseType": "Beta1" + "releaseType": "Release" } }, "deviceConfig": {}, @@ -38,7 +38,7 @@ ], "orientation": "unspecified", "name": "cc.cloudist.acpsample.MainAbility", - "icon": "$media:ic_launcher", + "icon": "$media:icon", "description": "$string:mainability_description", "label": "$string:app_name", "type": "page", diff --git a/entry/src/main/java/cc/cloudist/acpsample/MainAbility.java b/entry/src/main/java/cc/cloudist/acpsample/MainAbility.java index 4a0639a69f2314ebd55e43cc8529d3cea4f65556..cb004c7465714c1659e94481b8e949546735983d 100644 --- a/entry/src/main/java/cc/cloudist/acpsample/MainAbility.java +++ b/entry/src/main/java/cc/cloudist/acpsample/MainAbility.java @@ -10,5 +10,4 @@ public class MainAbility extends Ability { super.onStart(intent); super.setMainRoute(MainAbilitySlice.class.getName()); } - } diff --git a/entry/src/ohosTest/config.json b/entry/src/ohosTest/config.json index cd79fbb1d3a2771a6f17e46796ff638506f51cc3..7333081cf5cac10041818e9dd89a5a43812e13c3 100644 --- a/entry/src/ohosTest/config.json +++ b/entry/src/ohosTest/config.json @@ -3,13 +3,13 @@ "bundleName": "cc.cloudist.acpsample", "vendor": "cloudist", "version": { - "code": 1, - "name": "1.0" + "code": 1000000, + "name": "1.0.0" }, "apiVersion": { "compatible": 5, "target": 5, - "releaseType": "Beta1" + "releaseType": "Release" } }, "deviceConfig": {}, diff --git a/entry/src/ohosTest/java/cc/cloudist/acpsample/ExampleOhosTest.java b/entry/src/ohosTest/java/cc/cloudist/acpsample/ExampleOhosTest.java index ced67bb44063f857421ef6d7753d97c35bba3052..73fd1e4b5c34eb4927c25d8f0afffe1d4de8328e 100644 --- a/entry/src/ohosTest/java/cc/cloudist/acpsample/ExampleOhosTest.java +++ b/entry/src/ohosTest/java/cc/cloudist/acpsample/ExampleOhosTest.java @@ -1,14 +1,90 @@ +/* + * 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 cc.cloudist.acpsample; - +import cc.cloudist.acplibrary.ACProgressFlower; +import ohos.aafwk.ability.Ability; import ohos.aafwk.ability.delegation.AbilityDelegatorRegistry; +import ohos.agp.utils.Color; +import org.junit.BeforeClass; import org.junit.Test; import static org.junit.Assert.assertEquals; public class ExampleOhosTest { + static ACProgressFlower.Builder builder; @Test public void testBundleName() { final String actualBundleName = AbilityDelegatorRegistry.getArguments().getTestBundleName(); assertEquals("cc.cloudist.acpsample", actualBundleName); } + + @BeforeClass + public static void set() { + Ability ability = AbilityDelegatorRegistry.getAbilityDelegator().getCurrentTopAbility(); + builder = new ACProgressFlower.Builder(ability.getContext()); + + } + + @Test + public void testBackgroundColor() { + builder.setBackgroundColor(Color.BLACK.getValue()); + assertEquals(Color.BLACK.getValue(), builder.getBackgroundColor()); + } + @Test + public void testBackgroundAlpha() { + builder.setBackgroundAlpha(0.1f); + assertEquals(0.1f, builder.getBackgroundAlpha(),0.2f); + } + @Test + public void testBackgroundCornerRadius() { + builder.setBackgroundCornerRadius(0.2f); + assertEquals(0.1f, builder.getBackgroundCornerRadius(),0.2f); + } + @Test + public void testText() { + builder.setText("test"); + assertEquals("test", builder.getText()); + } + @Test + public void testFadeColor() { + builder.setFadeColor((Color.RED.getValue())); + assertEquals(Color.RED.getValue(), builder.getFadeColor()); + } + @Test + public void testSpeed() { + builder.setSpeed(100f); + assertEquals(100f, builder.getSpeed(),1f); + } + @Test + public void testTextColor() { + builder.setTextColor(Color.BLUE.getValue()); + assertEquals(Color.BLUE.getValue(), builder.getTextColor()); + } + @Test + public void testTextSize() { + builder.setTextSize(100); + assertEquals(100, builder.getTextSize()); + } + @Test + public void testThemeColor() { + builder.setThemeColor(Color.CYAN.getValue()); + assertEquals(Color.CYAN.getValue(), builder.getThemeColor()); + } + @Test + public void testPetalCount() { + builder.setPetalCount(200); + assertEquals(200, builder.getPetalCount()); + } } \ No newline at end of file diff --git a/library/src/main/config.json b/library/src/main/config.json index 83f8dad696d67024fda9cb4d853a958a5eb9e387..b2cb933789d3e4973b9954d31b3d4a11bd2f1cb1 100644 --- a/library/src/main/config.json +++ b/library/src/main/config.json @@ -7,9 +7,9 @@ "name": "1.0" }, "apiVersion": { - "compatible": 4, + "compatible": 5, "target": 5, - "releaseType": "Beta1" + "releaseType": "Release" } }, "deviceConfig": { diff --git a/library/src/main/java/cc/cloudist/acplibrary/ACProgressFlower.java b/library/src/main/java/cc/cloudist/acplibrary/ACProgressFlower.java index 2bc19a958f5c6c4bc5bb6aabe79b8341469aac3b..8e895dcb91dafcb81f1afce24232ceb4cd340ca1 100644 --- a/library/src/main/java/cc/cloudist/acplibrary/ACProgressFlower.java +++ b/library/src/main/java/cc/cloudist/acplibrary/ACProgressFlower.java @@ -105,6 +105,159 @@ public class ACProgressFlower extends ACProgressBaseDialog{ private int mTextMarginTop = 40; private boolean mTextExpandWidth = true; + + public float getSizeRatio() { + return mSizeRatio; + } + + public void setSizeRatio(float mSizeRatio) { + this.mSizeRatio = mSizeRatio; + } + + public float getBorderPadding() { + return mBorderPadding; + } + + public void setBorderPadding(float mBorderPadding) { + this.mBorderPadding = mBorderPadding; + } + + public float getCenterPadding() { + return mCenterPadding; + } + + public void setCenterPadding(float mCenterPadding) { + this.mCenterPadding = mCenterPadding; + } + + public int getBackgroundColor() { + return mBackgroundColor; + } + + public void setBackgroundColor(int mBackgroundColor) { + this.mBackgroundColor = mBackgroundColor; + } + + public int getThemeColor() { + return mThemeColor; + } + + public void setThemeColor(int mThemeColor) { + this.mThemeColor = mThemeColor; + } + + public int getFadeColor() { + return mFadeColor; + } + + public void setFadeColor(int mFadeColor) { + this.mFadeColor = mFadeColor; + } + + public int getPetalCount() { + return mPetalCount; + } + + public void setPetalCount(int mPetalCount) { + this.mPetalCount = mPetalCount; + } + + public int getPetalThickness() { + return mPetalThickness; + } + + public void setPetalThickness(int mPetalThickness) { + this.mPetalThickness = mPetalThickness; + } + + public float getPetalAlpha() { + return mPetalAlpha; + } + + public void setPetalAlpha(float mPetalAlpha) { + this.mPetalAlpha = mPetalAlpha; + } + + public float getBackgroundCornerRadius() { + return mBackgroundCornerRadius; + } + + public void setBackgroundCornerRadius(float mBackgroundCornerRadius) { + this.mBackgroundCornerRadius = mBackgroundCornerRadius; + } + + public float getBackgroundAlpha() { + return mBackgroundAlpha; + } + + public void setBackgroundAlpha(float mBackgroundAlpha) { + this.mBackgroundAlpha = mBackgroundAlpha; + } + + public int getDirection() { + return mDirection; + } + + public void setDirection(int mDirection) { + this.mDirection = mDirection; + } + + public float getSpeed() { + return mSpeed; + } + + public void setSpeed(float mSpeed) { + this.mSpeed = mSpeed; + } + + public String getText() { + return mText; + } + + public void setText(String mText) { + this.mText = mText; + } + + public int getTextColor() { + return mTextColor; + } + + public void setTextColor(int mTextColor) { + this.mTextColor = mTextColor; + } + + public float getTextAlpha() { + return mTextAlpha; + } + + public void setTextAlpha(float mTextAlpha) { + this.mTextAlpha = mTextAlpha; + } + + public int getTextSize() { + return mTextSize; + } + + public void setTextSize(int mTextSize) { + this.mTextSize = mTextSize; + } + + public int getTextMarginTop() { + return mTextMarginTop; + } + + public void setTextMarginTop(int mTextMarginTop) { + this.mTextMarginTop = mTextMarginTop; + } + + public boolean isTextExpandWidth() { + return mTextExpandWidth; + } + + public void setTextExpandWidth(boolean mTextExpandWidth) { + this.mTextExpandWidth = mTextExpandWidth; + } + public Builder(Context context) { mContext = context; }