From 69f708ead3c6ccbac34b8eb9e7304cfa7d9c34f2 Mon Sep 17 00:00:00 2001 From: wang zhen Date: Fri, 30 Apr 2021 09:51:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 14 +- .travis.yml | 13 -- README-CHN.md | 110 +++++++++---- README.md | 151 ++++++++++-------- build.gradle | 30 +++- changelog.md | 7 + {sample => entry}/.gitignore | 0 entry/build.gradle | 27 ++++ entry/proguard-rules.pro | 1 + entry/src/main/config.json | 58 +++++++ .../cc/cloudist/acpsample/MainAbility.java | 14 ++ .../cc/cloudist/acpsample/MyApplication.java | 10 ++ .../acpsample/slice/MainAbilitySlice.java | 87 ++++++---- .../main/resources/base/element/string.json | 16 ++ .../base/graphic/background_ability_main.xml | 6 + .../resources/base/graphic/background_btn.xml | 5 + .../resources/base/layout/ability_main.xml | 103 ++++++++++++ .../main/resources/base/media}/background.png | Bin .../resources/base/media}/ic_launcher.png | Bin entry/src/main/resources/base/media/icon.png | Bin 0 -> 6790 bytes .../src/main/resources/base/media}/logo.png | Bin .../src/main/resources/base/media}/p0.jpg | Bin .../src/main/resources/base/media}/p1.jpg | Bin .../src/main/resources/base/media}/p2.jpg | Bin .../src/main/resources/base/media}/p3.jpg | Bin entry/src/ohosTest/config.json | 41 +++++ .../cloudist/acpsample/ExampleOhosTest.java | 14 ++ .../cc/cloudist/acpsample/ExampleTest.java | 9 ++ gradle.properties | 14 +- gradle/wrapper/gradle-wrapper.jar | Bin 49896 -> 58694 bytes gradle/wrapper/gradle-wrapper.properties | 3 +- gradlew | 115 +++++++------ gradlew.bat | 33 ++-- image/01.jpg | Bin 0 -> 1285150 bytes image/02.jpg | Bin 0 -> 1287101 bytes image/03.jpg | Bin 0 -> 1290194 bytes image/04.jpg | Bin 0 -> 1287810 bytes image/05.jpg | Bin 0 -> 1281119 bytes image/demo.gif | Bin 0 -> 1784759 bytes intros/old/README-CHN.md | 87 ---------- intros/old/README.md | 84 ---------- intros/old/acpl1.gif | Bin 19573 -> 0 bytes intros/old/acpl2.gif | Bin 17791 -> 0 bytes intros/old/acpl3.gif | Bin 15206 -> 0 bytes intros/old/sample.apk | Bin 989870 -> 0 bytes intros/sample.apk | Bin 1199617 -> 0 bytes intros/screenshot_0.png | Bin 29962 -> 0 bytes intros/screenshot_1.png | Bin 29132 -> 0 bytes intros/screenshot_2.png | Bin 30981 -> 0 bytes intros/screenshot_3.png | Bin 29735 -> 0 bytes library/build.gradle | 102 ++---------- library/proguard-rules.pro | 18 +-- .../cloudist/acplibrary/ApplicationTest.java | 13 -- library/src/main/AndroidManifest.xml | 4 - library/src/main/config.json | 28 ++++ .../acplibrary/ACProgressBaseDialog.java | 40 ++--- .../cloudist/acplibrary/ACProgressCustom.java | 93 ++++++----- .../cloudist/acplibrary/ACProgressFlower.java | 76 +++++---- .../cc/cloudist/acplibrary/ACProgressPie.java | 59 ++++--- .../java/cc/cloudist/acplibrary/Utils.java | 93 +++++++++++ .../acplibrary/components/FlowerDataCalc.java | 33 ++-- .../components/PetalCoordinate.java | 5 +- .../cloudist/acplibrary/views/CustomView.java | 77 +++++---- .../cloudist/acplibrary/views/FlowerView.java | 121 +++++++------- .../cc/cloudist/acplibrary/views/PieView.java | 95 ++++++----- library/src/main/res/values/acpl_styles.xml | 11 -- .../main/resources/base/element/string.json | 8 + .../cc/cloudist/acplibrary/ExampleTest.java | 9 ++ sample/build.gradle | 25 --- sample/proguard-rules.pro | 17 -- .../cloudist/acpsample/ApplicationTest.java | 13 -- sample/src/main/AndroidManifest.xml | 23 --- sample/src/main/res/layout/activity_main.xml | 114 ------------- .../src/main/res/mipmap-hdpi/ic_launcher.png | Bin 6565 -> 0 bytes .../src/main/res/mipmap-mdpi/ic_launcher.png | Bin 4007 -> 0 bytes .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin 15146 -> 0 bytes sample/src/main/res/values/strings.xml | 3 - sample/src/main/res/values/styles.xml | 11 -- settings.gradle | 2 +- 79 files changed, 1131 insertions(+), 1014 deletions(-) delete mode 100644 .travis.yml create mode 100644 changelog.md rename {sample => entry}/.gitignore (100%) create mode 100644 entry/build.gradle create mode 100644 entry/proguard-rules.pro create mode 100644 entry/src/main/config.json create mode 100644 entry/src/main/java/cc/cloudist/acpsample/MainAbility.java create mode 100644 entry/src/main/java/cc/cloudist/acpsample/MyApplication.java rename sample/src/main/java/cc/cloudist/acpsample/MainActivity.java => entry/src/main/java/cc/cloudist/acpsample/slice/MainAbilitySlice.java (37%) create mode 100644 entry/src/main/resources/base/element/string.json create mode 100644 entry/src/main/resources/base/graphic/background_ability_main.xml create mode 100644 entry/src/main/resources/base/graphic/background_btn.xml create mode 100644 entry/src/main/resources/base/layout/ability_main.xml rename {sample/src/main/res/drawable => entry/src/main/resources/base/media}/background.png (100%) rename {sample/src/main/res/mipmap-xhdpi => entry/src/main/resources/base/media}/ic_launcher.png (100%) create mode 100644 entry/src/main/resources/base/media/icon.png rename {sample/src/main/res/drawable => entry/src/main/resources/base/media}/logo.png (100%) rename {sample/src/main/res/drawable => entry/src/main/resources/base/media}/p0.jpg (100%) rename {sample/src/main/res/drawable => entry/src/main/resources/base/media}/p1.jpg (100%) rename {sample/src/main/res/drawable => entry/src/main/resources/base/media}/p2.jpg (100%) rename {sample/src/main/res/drawable => entry/src/main/resources/base/media}/p3.jpg (100%) create mode 100644 entry/src/ohosTest/config.json create mode 100644 entry/src/ohosTest/java/cc/cloudist/acpsample/ExampleOhosTest.java create mode 100644 entry/src/test/java/cc/cloudist/acpsample/ExampleTest.java create mode 100644 image/01.jpg create mode 100644 image/02.jpg create mode 100644 image/03.jpg create mode 100644 image/04.jpg create mode 100644 image/05.jpg create mode 100644 image/demo.gif delete mode 100644 intros/old/README-CHN.md delete mode 100644 intros/old/README.md delete mode 100644 intros/old/acpl1.gif delete mode 100644 intros/old/acpl2.gif delete mode 100644 intros/old/acpl3.gif delete mode 100644 intros/old/sample.apk delete mode 100644 intros/sample.apk delete mode 100644 intros/screenshot_0.png delete mode 100644 intros/screenshot_1.png delete mode 100644 intros/screenshot_2.png delete mode 100644 intros/screenshot_3.png delete mode 100644 library/src/androidTest/java/cc/cloudist/acplibrary/ApplicationTest.java delete mode 100644 library/src/main/AndroidManifest.xml create mode 100644 library/src/main/config.json create mode 100644 library/src/main/java/cc/cloudist/acplibrary/Utils.java delete mode 100644 library/src/main/res/values/acpl_styles.xml create mode 100644 library/src/main/resources/base/element/string.json create mode 100644 library/src/test/java/cc/cloudist/acplibrary/ExampleTest.java delete mode 100644 sample/build.gradle delete mode 100644 sample/proguard-rules.pro delete mode 100644 sample/src/androidTest/java/cc/cloudist/acpsample/ApplicationTest.java delete mode 100644 sample/src/main/AndroidManifest.xml delete mode 100644 sample/src/main/res/layout/activity_main.xml delete mode 100644 sample/src/main/res/mipmap-hdpi/ic_launcher.png delete mode 100644 sample/src/main/res/mipmap-mdpi/ic_launcher.png delete mode 100644 sample/src/main/res/mipmap-xxhdpi/ic_launcher.png delete mode 100644 sample/src/main/res/values/strings.xml delete mode 100644 sample/src/main/res/values/styles.xml diff --git a/.gitignore b/.gitignore index f1a75aa..37a4eb8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,15 @@ +*.iml .gradle /local.properties -/.idea/workspace.xml +/.idea/caches /.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml .DS_Store /build /captures -*.iml -.idea -local.properties -/intros/old \ No newline at end of file +.externalNativeBuild +/entry/.preview +.cxx diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 649c53e..0000000 --- a/.travis.yml +++ /dev/null @@ -1,13 +0,0 @@ -language: android -android: - components: - - build-tools-21.1.2 - - android-21 -jdk: oraclejdk7 -before_script: - - echo no | android create avd --force -n test -t android-19 --abi armeabi-v7a - - emulator -avd test -no-skin -no-audio -no-window & - - android-wait-for-emulator - - adb shell input keyevent 82 & -before_install: - - chmod +x gradlew \ No newline at end of file diff --git a/README-CHN.md b/README-CHN.md index 0db01c4..aa1ff3e 100644 --- a/README-CHN.md +++ b/README-CHN.md @@ -1,30 +1,66 @@ -# ACProgressLite +# ACProgressLite-ohos -[![Build Status](https://api.travis-ci.org/Cloudist/ACProgressLite.svg?branch=master)](https://travis-ci.org/Cloudist/ACProgressLite) -
[English Version](https://github.com/Cloudist/ACProgressLite/blob/master/README.md) / 中文版本 +**本项目基于开源项目 [ACProgressLite](https://github.com/cloudist/ACProgressLite) 进行openharmony的移植和开发,可以通过项目标签以及github地址(https://github.com/cloudist/ACProgressLite)追踪到原安卓项目版本** -Android 加载控件库,简洁、易用、可定制性强。用于快速实现类似 iOS 的 “加载中” 等弹出框。 -类似于 iOS 中的 [MBProgressHUD](https://github.com/jdg/MBProgressHUD) +#### 项目介绍 -**关键词** *Progressbar, Progresswheel, HUD, Android, Loading* +- 项目名称:ACProgressLite-ohos +- 所属系列:openharmony第三方组件适配移植 +- 功能:openharmony 加载控件库,简洁、易用、可定制性强。用于快速实现类似 iOS 的 “加载中” 等弹出框。 + 类似于 iOS 中的 [MBProgressHUD](https://github.com/jdg/MBProgressHUD) -**最小支持 SDK 版本:** API 9 ( Android 2.3 ) + **关键词** *Progressbar, Progresswheel, HUD, openharmony, Loading* +- 基线版本:ACProgressLite release V0.0.1 +- 项目移植状态:主功能完成 +- 调用差异:无 +- 开发版本:sdk5,DevEco Studio2.1 beta3 +- 项目作者和维护人:王震 +- 联系方式:wangzhen082@chinasoftinc.com +在sdk5,DevEco Studio2.1 beta3下项目可直接运行 +如无法运行,删除项目.gradle,.idea,build,gradle,build.gradle文件, +并依据自己的版本创建新项目,将新项目的对应文件复制到根目录下 -![花瓣 不带文字](https://raw.githubusercontent.com/Cloudist/ACProgressLite/master/intros/screenshot_0.png) -![花瓣 带文字](https://raw.githubusercontent.com/Cloudist/ACProgressLite/master/intros/screenshot_1.png) -![圆饼](https://raw.githubusercontent.com/Cloudist/ACProgressLite/master/intros/screenshot_2.png) -![自定义](https://raw.githubusercontent.com/Cloudist/ACProgressLite/master/intros/screenshot_3.png) +## entry运行要求 +通过DevEco studio,并下载openHarmonySDK +将项目中的build.gradle文件中dependencies→classpath版本改为对应的版本(即你的IDE新建项目中所用的版本) +## Screenshot +

+ ACProgressLite +

-[示例 APK 下载](https://raw.githubusercontent.com/Cloudist/ACProgressLite/master/intros/sample.apk) +#### 安装教程 -## 当前版本 -* 1.2.1 +项目需要添加maven仓库,并且再build.gradle文件下添加依赖 -## 使用方式 -* gradle: `compile 'cc.cloudist.acplibrary:library:1.2.1'` + ```gradle +// 添加maven仓库 +repositories { + maven { + url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' + } +} + +// 添加依赖库 +dependencies { + implementation 'com.gitee.chinasoft_ohos:ACProgressLite:0.0.1-SNAPSHOT' + ...... +} + + ``` + + +###### 使用 + +```java + ACProgressFlower dialog = new ACProgressFlower.Builder(this) + .direction(ACProgressConstant.DIRECT_CLOCKWISE) + .build(); + dialog.setCanceledOnTouchOutside(true); + dialog.show(dialog); +``` +###### 例子 -## 示例代码 * 花瓣类型 ``` @@ -33,7 +69,7 @@ ACProgressFlower dialog = new ACProgressFlower.Builder(this) .themeColor(Color.WHITE) .text("Title is here) .fadeColor(Color.DKGRAY).build(); -dialog.show(); +dialog.show(dialog); ``` * 圆饼类型 @@ -44,7 +80,7 @@ ACProgressPie dialog = new ACProgressPie.Builder(this) .pieColor(Color.WHITE) .updateType(ACProgressConstant.PIE_AUTO_UPDATE) .build(); -dialog.show(); +dialog.show(dialog); ``` * 自定义类型 @@ -53,14 +89,14 @@ dialog.show(); ACProgressCustom dialog = new ACProgressCustom.Builder(this) .useImages(R.drawable.p0, R.drawable.p1, R.drawable.p2, R.drawable.p3) .build(); -dialog.show(); +dialog.show(dialog); ``` ## 配置说明 - 目前提供3种类型的加载框:
+ 目前提供3种类型的加载框:
 下面是一些通用的配置: -1. `sizeRatio` 背景的大小。值应为小于1的浮点数,表示以屏幕较短一边的相应比例为框体大小,即: -背景边长 = 屏幕较短一边的长度 * sizeRatio +1. `sizeRatio` 背景的大小。值应为小于1的浮点数,表示以屏幕较短一边的相应比例为框体大小,即: +背景边长 = 屏幕较短一边的长度 * sizeRatio 需要注意的是花瓣类型带文字的情况,下文有详细说明 1. `bgColor` 背景的颜色,整型值。 @@ -70,7 +106,7 @@ dialog.show(); *其中 bgColor、bgAlpha、bgCornerRadius 不适用于自定义类型* -* **花瓣类型** +* **花瓣类型** 最常见的类型,支持标题文字显示 设置|说明 @@ -91,7 +127,7 @@ textAlpha|文字透明度 textMarginTop|文字与花瓣之间的距离 isTextExpandWidth|在设置了文字的情况下是否扩展背景大小值正方形。设置了文字会导致背景高度变大,如果设为`true`花瓣仍然根据sizeRatio的大小绘制但整个宽度会扩展至与高度相等,花瓣水平居中;如果设为`false`背景为长方形 -* **圆饼类型** +* **圆饼类型** 适合显示进度,支持自动更新进度或者手动更新进度。 设置|说明 @@ -108,7 +144,7 @@ speed|自动更新模式下每秒的帧数 pieces|自动更新模式下圆饼被切分的块数 -* **自定义类型** +* **自定义类型** 类似于 GIF,支持 res/drawable 资源数组 或者 图片文件数组 作为数据源。 设置|说明 @@ -117,14 +153,18 @@ useImages|使用的图片资源 ID useFiles|使用的图片文件对象 speed|每秒的帧数 -## 注意 -* 遇到任何问题都可以优先尝试 **clean** 工程 -* 1.2.0+ 版本如果需要点击弹框之外的区域关闭请使用`setCanceledOnTouchOutside(true)` -* `Dialog` 的绝大部分方法都支持 -* 强烈建议使用 1.2.0+ 版本 -* 如果使用 1.1.0 以前的版本 (不含1.1.0), 如果存在 gradle 错误, 可以在 Manifest 的 `application` 下增加 `tools:ignore="label`"解决 -* 自定义类型中不要同时使用 `useImages` 与 `useFiles`, 否则只有最后一次设置是有效的. -* 默认的配置在多数情况下表现良好. 如果需要自定义样式, 请调节各个配置以达到最佳的显示效果. +#### 测试信息 + +CodeCheck代码测试无异常 +CloudTest代码测试无异常 +火绒安全病毒安全检测通过 +当前版本demo功能与安卓原组件基本无差异 +测试员:常万里 + +#### 版本迭代 + +- v0.0.1_alpha + +#### 版权和许可信息 -## 许可 * [MIT License](http://mit-license.org/) diff --git a/README.md b/README.md index e8e4a55..ca661dc 100644 --- a/README.md +++ b/README.md @@ -1,67 +1,87 @@ -# ACProgressLite - -[![Build Status](https://api.travis-ci.org/Cloudist/ACProgressLite.svg?branch=master)](https://travis-ci.org/Cloudist/ACProgressLite) -
English Version / [中文版本](https://github.com/Cloudist/ACProgressLite/blob/master/README-CHN.md) - -An Android loading widget library. Lite and easy to use, strong customizability. Can be used to implement 'iOS' like loading dialog efficiently. - -Similar to iOS [MBProgressHUD](https://github.com/jdg/MBProgressHUD) - -**Keywords** *Progressbar, Progresswheel, HUD, Android, Loading* - -**Minimum SDK Version:** API 9 ( Android 2.3 ) - -![Flower without text](https://raw.githubusercontent.com/Cloudist/ACProgressLite/master/intros/screenshot_0.png) -![Flower with text](https://raw.githubusercontent.com/Cloudist/ACProgressLite/master/intros/screenshot_1.png) -![Pie](https://raw.githubusercontent.com/Cloudist/ACProgressLite/master/intros/screenshot_2.png) -![Custom](https://raw.githubusercontent.com/Cloudist/ACProgressLite/master/intros/screenshot_3.png) - - -[Sample APK download](https://raw.githubusercontent.com/Cloudist/ACProgressLite/master/intros/sample.apk) - -## Current Version -* 1.2.1 - -## Usage -* gradle: `compile 'cc.cloudist.acplibrary:library:1.2.1'` +# ACProgressLite - ohos +* 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 android version +#### Project Introduction +- Project name: ACProgressLite-OHOS +- 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 Beta3 +-Project author and maintainer: Wang Zhen +- Contact: wangzhen082@chinasoftinc.com +The project can be run directly under SDK5, Deveco Studio2.1 Beta3 +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 - the SNAPSHOT' +... +} +``` -## Sample Code -* Flower +### 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) - .text("Title is here") - .fadeColor(Color.DKGRAY).build(); -dialog.show(); +Direction (ACProgressConstant. DIRECT_CLOCKWISE) +ThemeColor (Color. WHITE). The text (" Title is here) +FadeColor (Color. DKGRAY). The build (); +dialog.show(dialog); ``` +* Round cake type +```java -* Pie - -``` ACProgressPie dialog = new ACProgressPie.Builder(this) - .ringColor(Color.WHITE) - .pieColor(Color.WHITE) - .updateType(ACProgressConstant.PIE_AUTO_UPDATE) - .build(); -dialog.show(); +RingColor (Color. WHITE) +PieColor (Color. WHITE) +UpdateType (ACProgressConstant. PIE_AUTO_UPDATE) +The build (); +dialog.show(dialog); ``` +* Custom types +```java -* Custom - -``` ACProgressCustom dialog = new ACProgressCustom.Builder(this) - .useImages(R.drawable.p0, R.drawable.p1, R.drawable.p2, R.drawable.p3) - .build(); -dialog.show(); +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:
+ 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 +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. @@ -71,7 +91,7 @@ background length = the smaller edge length of the screen * sizeRatio *bgColor, bgAlpha, bgCornerRadius are not available for custom type* -* **Flower** +* **Flower** Most commonly used type. Support adding text title. **Configuration**|**Description** @@ -92,7 +112,7 @@ 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** +* **Pie** Suitable for display progress. Manual-update and auto-update are supported. **Configuration**|**Description** @@ -109,7 +129,7 @@ speed|frames count in each second with auto-update type. pieces|pieces of pie with auto-update type. -* **Custom** +* **Custom** like GIF, support res/drawable resources ids array or image files array as data source. **Configuration**|**Description** @@ -117,16 +137,13 @@ like GIF, support res/drawable resources ids array or image files array as data useImages|resources ids array. useFiles|image files array. speed|frames count in each second. - -## Notice -* Try to **clean** the project first when you come across any problem. -* use `setCanceledOnTouchOutside(true)` in version 1.2.0+ when you want to dismiss the dialog when touch outside. -* Most of the methods in `Dialog` are supported. -* We strongly suggest you to use version above 1.2.0 -* If you use version before 1.1.0 (without 1.1.0),and gradle error occured, you can add `tools:ignore="label` under tag `application` in Manifest to solve it. -* Don not try to use `useImages` and `useFiles` at the same time, or only the last calling is avaliable. -* **Default configuration can perform well under most situations. If you really want to do customization, please tweak carefully to get best visual performance.** -* I'm not a native English speaker, there may be some grammar mistakes in this file. Suggestions and corrections are welcome. - -## License -* [MIT License](http://mit-license.org/) +#### 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 +Tester: Chang Wanli +#### version iteration +- v0.0.1 _alpha +#### Copyright and License Information +* [MIT License](http://mit-license.org/) \ No newline at end of file diff --git a/build.gradle b/build.gradle index b618568..bbb5d8b 100644 --- a/build.gradle +++ b/build.gradle @@ -1,23 +1,37 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. +apply plugin: 'com.huawei.ohos.app' +ohos { + compileSdkVersion 5 + defaultConfig { + compatibleSdkVersion 5 + } +} + buildscript { repositories { - jcenter() maven { - url "https://plugins.gradle.org/m2/" + url 'https://repo.huaweicloud.com/repository/maven/' + } + maven { + url 'https://developer.huawei.com/repo/' } + jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:1.2.3' - classpath 'com.github.dcendents:android-maven-plugin:1.2' - classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2" - // NOTE: Do not place your application dependencies here; they belong - // in the individual module build.gradle files + classpath 'com.huawei.ohos:hap:2.4.2.5' + classpath 'com.huawei.ohos:decctest:1.0.0.6' } } allprojects { repositories { - jcenter() + maven { + url 'https://repo.huaweicloud.com/repository/maven/' + } + maven { + url 'https://developer.huawei.com/repo/' + } + jcenter() } } diff --git a/changelog.md b/changelog.md new file mode 100644 index 0000000..9e54890 --- /dev/null +++ b/changelog.md @@ -0,0 +1,7 @@ +# 基本功能: +openharmony 加载控件库,简洁、易用、可定制性强。用于快速实现类似 iOS 的 “加载中” 等弹出框。 + 类似于 iOS 中的 [MBProgressHUD](https://github.com/jdg/MBProgressHUD) +# 修改点: +无 +# 遗留问题(暂不支持的功能): +无 diff --git a/sample/.gitignore b/entry/.gitignore similarity index 100% rename from sample/.gitignore rename to entry/.gitignore diff --git a/entry/build.gradle b/entry/build.gradle new file mode 100644 index 0000000..e39e92f --- /dev/null +++ b/entry/build.gradle @@ -0,0 +1,27 @@ +apply plugin: 'com.huawei.ohos.hap' +apply plugin: 'com.huawei.ohos.decctest' +ohos { + compileSdkVersion 5 + defaultConfig { + compatibleSdkVersion 5 + } + buildTypes { + release { + proguardOpt { + proguardEnabled false + rulesFiles 'proguard-rules.pro' + } + } + } + +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar', '*.har']) + implementation project(path: ':library') + testImplementation 'junit:junit:4.13' + ohosTestImplementation 'com.huawei.ohos.testkit:runner:1.0.0.100' +} +decc { + supportType = ['html','xml'] +} diff --git a/entry/proguard-rules.pro b/entry/proguard-rules.pro new file mode 100644 index 0000000..f7666e4 --- /dev/null +++ b/entry/proguard-rules.pro @@ -0,0 +1 @@ +# config module specific ProGuard rules here. \ No newline at end of file diff --git a/entry/src/main/config.json b/entry/src/main/config.json new file mode 100644 index 0000000..385975e --- /dev/null +++ b/entry/src/main/config.json @@ -0,0 +1,58 @@ +{ + "app": { + "bundleName": "cc.cloudist.acpsample", + "vendor": "cloudist", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 5, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "cc.cloudist.acpsample", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "name": "cc.cloudist.acpsample.MainAbility", + "icon": "$media:ic_launcher", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard", + "metaData": { + "customizeData": [ + { + "name": "hwc-theme", + "value": "androidhwext:style/Theme.Emui.NoTitleBar", + "extra": "" + } + ] + } + } + ] + } +} \ No newline at end of file diff --git a/entry/src/main/java/cc/cloudist/acpsample/MainAbility.java b/entry/src/main/java/cc/cloudist/acpsample/MainAbility.java new file mode 100644 index 0000000..4a0639a --- /dev/null +++ b/entry/src/main/java/cc/cloudist/acpsample/MainAbility.java @@ -0,0 +1,14 @@ +package cc.cloudist.acpsample; + +import cc.cloudist.acpsample.slice.MainAbilitySlice; +import ohos.aafwk.ability.Ability; +import ohos.aafwk.content.Intent; + +public class MainAbility extends Ability { + @Override + public void onStart(Intent intent) { + super.onStart(intent); + super.setMainRoute(MainAbilitySlice.class.getName()); + } + +} diff --git a/entry/src/main/java/cc/cloudist/acpsample/MyApplication.java b/entry/src/main/java/cc/cloudist/acpsample/MyApplication.java new file mode 100644 index 0000000..9d23399 --- /dev/null +++ b/entry/src/main/java/cc/cloudist/acpsample/MyApplication.java @@ -0,0 +1,10 @@ +package cc.cloudist.acpsample; + +import ohos.aafwk.ability.AbilityPackage; + +public class MyApplication extends AbilityPackage { + @Override + public void onInitialize() { + super.onInitialize(); + } +} diff --git a/sample/src/main/java/cc/cloudist/acpsample/MainActivity.java b/entry/src/main/java/cc/cloudist/acpsample/slice/MainAbilitySlice.java similarity index 37% rename from sample/src/main/java/cc/cloudist/acpsample/MainActivity.java rename to entry/src/main/java/cc/cloudist/acpsample/slice/MainAbilitySlice.java index 1c8faff..812b94b 100644 --- a/sample/src/main/java/cc/cloudist/acpsample/MainActivity.java +++ b/entry/src/main/java/cc/cloudist/acpsample/slice/MainAbilitySlice.java @@ -1,72 +1,89 @@ -package cc.cloudist.acpsample; - -import android.app.Activity; -import android.graphics.Color; -import android.os.Bundle; -import android.view.View; +package cc.cloudist.acpsample.slice; import cc.cloudist.acplibrary.ACProgressConstant; import cc.cloudist.acplibrary.ACProgressCustom; import cc.cloudist.acplibrary.ACProgressFlower; import cc.cloudist.acplibrary.ACProgressPie; +import cc.cloudist.acpsample.ResourceTable; +import ohos.aafwk.ability.AbilitySlice; +import ohos.aafwk.content.Intent; +import ohos.agp.components.Component; + +public class MainAbilitySlice extends AbilitySlice implements Component.ClickedListener { -public class MainActivity extends Activity implements View.OnClickListener { @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main); + public void onStart(Intent intent) { + super.onStart(intent); + super.setUIContent(ResourceTable.Layout_ability_main); + initBtn(); + } - findViewById(R.id.button_1).setOnClickListener(this); - findViewById(R.id.button_2).setOnClickListener(this); - findViewById(R.id.button_3).setOnClickListener(this); - findViewById(R.id.button_4).setOnClickListener(this); - findViewById(R.id.button_5).setOnClickListener(this); + private void initBtn() { + findComponentById(ResourceTable.Id_button_1).setClickedListener(this); + findComponentById(ResourceTable.Id_button_2).setClickedListener(this); + findComponentById(ResourceTable.Id_button_3).setClickedListener(this); + findComponentById(ResourceTable.Id_button_4).setClickedListener(this); + findComponentById(ResourceTable.Id_button_5).setClickedListener(this); + + } + @Override + public void onActive() { + super.onActive(); + } + + @Override + public void onForeground(Intent intent) { + super.onForeground(intent); } @Override - public void onClick(View v) { - switch (v.getId()) { - case R.id.button_1: { - ACProgressFlower dialog = new ACProgressFlower.Builder(this, R.style.NonDimACProgressDialog) - .direction(ACProgressConstant.DIRECT_CLOCKWISE) - .themeColor(Color.WHITE) - .fadeColor(Color.DKGRAY).build(); + public void onClick(Component component) { + switch (component.getId()) { + case ResourceTable.Id_button_1: { + ACProgressFlower dialog = new ACProgressFlower.Builder(this) + + .build(); dialog.setCanceledOnTouchOutside(true); - dialog.show(); + dialog.show(dialog); } + break; - case R.id.button_2: { + case ResourceTable.Id_button_2: { ACProgressFlower dialog = new ACProgressFlower.Builder(this) - .direction(ACProgressConstant.DIRECT_ANTI_CLOCKWISE) - .themeColor(Color.GREEN) - .fadeColor(Color.RED).build(); + .direction( ACProgressConstant.DIRECT_CLOCKWISE) + .themeColor(0xFF00FF00) + .fadeColor(0xFFFF0000) + .build(); dialog.setCanceledOnTouchOutside(true); - dialog.show(); + dialog.show(dialog); } break; - case R.id.button_3: { + case ResourceTable.Id_button_3: { ACProgressFlower dialog = new ACProgressFlower.Builder(this) .text("Text is here") .build(); dialog.setCanceledOnTouchOutside(true); - dialog.show(); + dialog.show(dialog); } break; - case R.id.button_4: { + case ResourceTable.Id_button_4: { ACProgressPie dialog = new ACProgressPie.Builder(this).build(); dialog.setCanceledOnTouchOutside(true); - dialog.show(); + dialog.show(dialog); } break; - case R.id.button_5: { + case ResourceTable.Id_button_5: { ACProgressCustom dialog = new ACProgressCustom.Builder(this) - .useImages(R.drawable.p0, R.drawable.p1, R.drawable.p2, R.drawable.p3).build(); + .useImages(ResourceTable.Media_p0, ResourceTable.Media_p1, ResourceTable.Media_p2, ResourceTable.Media_p3).build(); dialog.setCanceledOnTouchOutside(true); - dialog.show(); + dialog.show(dialog); } break; + } + } + } diff --git a/entry/src/main/resources/base/element/string.json b/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000..996c3fe --- /dev/null +++ b/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "app_name", + "value": "HMACP Sample" + }, + { + "name": "mainability_description", + "value": "Java_Phone_Empty Feature Ability" + }, + { + "name": "HelloWorld", + "value": "Hello World" + } + ] +} \ No newline at end of file diff --git a/entry/src/main/resources/base/graphic/background_ability_main.xml b/entry/src/main/resources/base/graphic/background_ability_main.xml new file mode 100644 index 0000000..c0c0a3d --- /dev/null +++ b/entry/src/main/resources/base/graphic/background_ability_main.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/entry/src/main/resources/base/graphic/background_btn.xml b/entry/src/main/resources/base/graphic/background_btn.xml new file mode 100644 index 0000000..3b5dbf5 --- /dev/null +++ b/entry/src/main/resources/base/graphic/background_btn.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/entry/src/main/resources/base/layout/ability_main.xml b/entry/src/main/resources/base/layout/ability_main.xml new file mode 100644 index 0000000..da7e619 --- /dev/null +++ b/entry/src/main/resources/base/layout/ability_main.xml @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + +