diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index 5f940083f5c5d674b5e81c63dd13a4b56715b52d..0000000000000000000000000000000000000000
--- a/.gitignore
+++ /dev/null
@@ -1,7 +0,0 @@
-*.iml
-.gradle
-/local.properties
-/.idea
-.DS_Store
-/build
-/captures
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000000000000000000000000000000000000..c7985c70acb4f3bad229788dc84bf7b43f121f70
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,8 @@
+## 0.0.1-SNAPSHOT
+ ohos 第一个版本
+
+* 实现了原库的全部功能
+
+
+
+
diff --git a/LICENSE.txt b/LICENSE
similarity index 100%
rename from LICENSE.txt
rename to LICENSE
diff --git a/README.OPENSOURCE b/README.OPENSOURCE
new file mode 100644
index 0000000000000000000000000000000000000000..8151b8f27401fca68d41e929d948a63ac61d0ecb
--- /dev/null
+++ b/README.OPENSOURCE
@@ -0,0 +1,10 @@
+[
+ {
+ "Name": "ShadowLayout",
+ "License": "Apache License",
+ "License File": "LICENSE",
+ "Version Number": "1.0.2",
+ "Upstream URL": "https://github.com/Devlight/ShadowLayout",
+ "Description": "此库允许您基于子对象为布局创建阴影效果"
+ }
+]
\ No newline at end of file
diff --git a/README.md b/README.md
index 2a3a3f3777757e6b864eea12f9480e2668b14e39..ad4ab245dfc10b8a415731b135eda65cc97403be 100644
--- a/README.md
+++ b/README.md
@@ -1,168 +1,92 @@
-
-
-
-
-
-
-
-
-ShadowLayout
-============
-
-This library allows you to create a shadow effect for your layout based on your child.
-
-[](http://android-arsenal.com/details/1/3524)
-
-[](https://github.com/DevLight-Mobile-Agency)
-
-[](https://bintray.com/gigamole/maven/shadowlayout/_latestVersion)
-
-[](https://github.com/DevLight-Mobile-Agency/ShadowLayout/blob/master/LICENSE.txt)
-
-[](https://www.codacy.com/app/gigamole53/ShadowLayout?utm_source=github.com&utm_medium=referral&utm_content=DevLight-Mobile-Agency/ShadowLayout&utm_campaign=Badge_Grade)
-
-
-
-
-
-
-
-You can check the sample app [here](https://github.com/DevLight-Mobile-Agency/ShadowLayout/tree/master/app).
-
-Warn
-====
-```
-This library is not more supported.
-If you want to add new feature or fix a bug, grab source code and do it.
-If you think your fix or feature would be useful to other developers,
-I can add link of your repository to this README file.
-Thank you for using our libraries.
-```
+# ShadowLayout
+
+#### 项目介绍
+- 项目名称:ShadowLayout
+- 所属系列:openharmony的第三方组件适配移植
+- 功能:此库允许您基于子对象为布局创建阴影效果
+- 项目移植状态:主功能完成
+- 调用差异:无
+- 开发版本:sdk6,DevEco Studio 2.2 Beta1
+- 基线版本:1.0.2
-Download
-========
+#### 效果演示
+
-You can download a `.aar` from GitHub's [releases page](https://github.com/DevLight-Mobile-Agency/ShadowLayout/releases).
+#### 安装教程
-Or use Gradle jCenter:
-```groovy
-dependencies {
+1.在项目根目录下的build.gradle文件中,
+
+```
+allprojects {
repositories {
- mavenCentral()
maven {
- url 'http://dl.bintray.com/gigamole/maven/'
+ url 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
}
}
- compile 'com.github.devlight.shadowlayout:library:+'
}
```
-Or Gradle Maven Central:
+2.在entry模块的build.gradle文件中,
-```groovy
-compile 'com.github.devlight.shadowlayout:library:1.0.2'
```
-
-Or Maven:
-
-```groovy
-
- com.github.devlight.shadowlayout
- library
- 1.0.2
- aar
-
+ dependencies {
+ implementation('com.gitee.chinasoft_ohos:ShadowLayout:0.0.1-SNAPSHOT')
+ ......
+ }
```
-Android SDK Version
-===================
+在sdk6,DevEco Studio 2.2 Beta1下项目可直接运行
+如无法运行,删除项目.gradle,.idea,build,gradle,build.gradle文件,
+并依据自己的版本创建新项目,将新项目的对应文件复制到根目录下
-`ShadowLayout` requires a minimum SDK version of 11.
+#### 使用说明
-Sample
-======
+1.将仓库导入到本地仓库中
-Parameters
-
-For `ShadowLayout` you can set such parameters as:
-
- - shadowed:
- allows you to handle shadow visibility.
-
- - shadow distance:
- allows you to set distance of shadow.
+2.在布局文件中加入ButtonProgressBar控件,代码实例如下:
- - shadow angle:
- allows you to set shadow angle.
-
- - shadow radius:
- allows you to set shadow radius.
-
- - shadow color:
- allows you to set shadow color.
-
-Tips
-
-Angle can only be positive and be in range from 0 to 360 degrees.
-`ShadowLayout` automatically set padding for shadow space draw.
-
-Init
-
-Check out in code init:
-
-```java
-final ShadowLayout shadowLayout = (ShadowLayout) findViewById(R.id.sl);
-shadowLayout.setIsShadowed(true);
-shadowLayout.setShadowAngle(45);
-shadowLayout.setShadowRadius(20);
-shadowLayout.setShadowDistance(30);
-shadowLayout.setShadowColor(Color.DKGRAY);
```
-
-Other methods check out in sample.
-
-And XML init:
-
-```xml
-
+
-
+
+
-
-```
+
-Getting Help
-============
-To report a specific problem or feature request, [open a new issue on Github](https://github.com/DevLight-Mobile-Agency/ShadowLayout/issues/new).
+```
-Author
-======
+#### 测试信息
-Created by [Basil Miller](https://github.com/GIGAMOLE) - [@gigamole](mailto:gigamole53@gmail.com)
+CodeCheck代码测试无异常
-Company
-=======
+CloudTest代码测试无异常
-[](https://www.facebook.com/devlightagency) [](https://twitter.com/DevLightIO) [](https://www.linkedin.com/company/devlight)
+病毒安全检测通过
-[Here](https://github.com/DevLight-Mobile-Agency) you can see open source work developed by Devlight LLC.
-This and another works is an exclusive property of Devlight LLC.
+当前版本demo功能与原组件基本无差异
-If you want to use this library in applications which will be available on Google Play, please report us or author of the library about it.
+#### 版本迭代
-Whether you're searching for a new partner or trusted team for creating your new great product we are always ready to start work with you.
+- 0.0.1-SNAPSHOT
-You can contact us: info@devlight.io or opensource@devlight.io.
-Thanks in advance.
+#### 版权和许可信息
-Devlight LLC, 2016
-[devlight.io](http://devlight.io)
diff --git a/app/.gitignore b/app/.gitignore
deleted file mode 100644
index 796b96d1c402326528b4ba3c12ee9d92d0e212e9..0000000000000000000000000000000000000000
--- a/app/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build
diff --git a/app/build.gradle b/app/build.gradle
deleted file mode 100644
index c7ebf2ca96f676e383d2f8c1be703e20cc5fb1c4..0000000000000000000000000000000000000000
--- a/app/build.gradle
+++ /dev/null
@@ -1,26 +0,0 @@
-apply plugin: 'com.android.application'
-
-android {
- compileSdkVersion 23
- buildToolsVersion "23.0.3"
-
- defaultConfig {
- applicationId "com.gigamole.shadowlayout"
- minSdkVersion 11
- targetSdkVersion 23
- versionCode 1
- versionName "1.0"
- }
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
- }
- }
-}
-
-dependencies {
- compile fileTree(dir: 'libs', include: ['*.jar'])
- compile project(':library')
- compile 'com.android.support:appcompat-v7:23.3.0'
-}
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
deleted file mode 100644
index 245df8faea619c2b0951d9504ed0dd05b8f5e560..0000000000000000000000000000000000000000
--- a/app/proguard-rules.pro
+++ /dev/null
@@ -1,17 +0,0 @@
-# Add project specific ProGuard rules here.
-# By default, the flags in this file are appended to flags specified
-# in D:\Programs\Programming\AndroidStudio\AS_SDK/tools/proguard/proguard-android.txt
-# You can edit the include path and order by changing the proguardFiles
-# directive in build.gradle.
-#
-# For more details, see
-# http://developer.android.com/guide/developing/tools/proguard.html
-
-# Add any project specific keep options here:
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-# public *;
-#}
diff --git a/app/src/androidTest/java/com/gigamole/shadowlayout/ApplicationTest.java b/app/src/androidTest/java/com/gigamole/shadowlayout/ApplicationTest.java
deleted file mode 100644
index 86ebc37d253df962bc2cb41a3aee9acdbad63424..0000000000000000000000000000000000000000
--- a/app/src/androidTest/java/com/gigamole/shadowlayout/ApplicationTest.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.gigamole.shadowlayout;
-
-import android.app.Application;
-import android.test.ApplicationTestCase;
-
-/**
- * Testing Fundamentals
- */
-public class ApplicationTest extends ApplicationTestCase {
- public ApplicationTest() {
- super(Application.class);
- }
-}
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
deleted file mode 100644
index 5743562abb9890bb30c620f67beb55e9828bbbbd..0000000000000000000000000000000000000000
--- a/app/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/src/main/java/com/gigamole/shadowlayout/MainActivity.java b/app/src/main/java/com/gigamole/shadowlayout/MainActivity.java
deleted file mode 100644
index c30ea3060ffbc35f50a201ec8c02d1f6c694efaa..0000000000000000000000000000000000000000
--- a/app/src/main/java/com/gigamole/shadowlayout/MainActivity.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.gigamole.shadowlayout;
-
-import android.app.Activity;
-import android.os.Bundle;
-
-public class MainActivity extends Activity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- }
-}
diff --git a/app/src/main/res/drawable/ic_design.png b/app/src/main/res/drawable/ic_design.png
deleted file mode 100644
index 89fea86a1220042e186b6ce489e5973e6cbbb001..0000000000000000000000000000000000000000
Binary files a/app/src/main/res/drawable/ic_design.png and /dev/null differ
diff --git a/app/src/main/res/drawable/ic_development.png b/app/src/main/res/drawable/ic_development.png
deleted file mode 100644
index a80b9035ef7f3b61a6ef254aaa4b42725378bfb7..0000000000000000000000000000000000000000
Binary files a/app/src/main/res/drawable/ic_development.png and /dev/null differ
diff --git a/app/src/main/res/drawable/ic_logo.png b/app/src/main/res/drawable/ic_logo.png
deleted file mode 100644
index e69a2c1fe8f60913d925b4dd1e390c55beb0c14f..0000000000000000000000000000000000000000
Binary files a/app/src/main/res/drawable/ic_logo.png and /dev/null differ
diff --git a/app/src/main/res/drawable/ic_qa.png b/app/src/main/res/drawable/ic_qa.png
deleted file mode 100644
index 24293ad0f617a2916f9e8848838c933f28f5d3a5..0000000000000000000000000000000000000000
Binary files a/app/src/main/res/drawable/ic_qa.png and /dev/null differ
diff --git a/app/src/main/res/drawable/ic_strategy.png b/app/src/main/res/drawable/ic_strategy.png
deleted file mode 100644
index f689595ea77512caab2eb7274bcb05e7ad87599d..0000000000000000000000000000000000000000
Binary files a/app/src/main/res/drawable/ic_strategy.png and /dev/null differ
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
deleted file mode 100644
index ee67eb465a421ad8dc207c3bc0d69f6d476794fb..0000000000000000000000000000000000000000
--- a/app/src/main/res/layout/activity_main.xml
+++ /dev/null
@@ -1,179 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png
deleted file mode 100644
index cde69bcccec65160d92116f20ffce4fce0b5245c..0000000000000000000000000000000000000000
Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png
deleted file mode 100644
index c133a0cbd379f5af6dbf1a899a0293ca5eccfad0..0000000000000000000000000000000000000000
Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png
deleted file mode 100644
index bfa42f0e7b91d006d22352c9ff2f134e504e3c1d..0000000000000000000000000000000000000000
Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
deleted file mode 100644
index 324e72cdd7480cb983fa1bcc7ce686e51ef87fe7..0000000000000000000000000000000000000000
Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
deleted file mode 100644
index aee44e138434630332d88b1680f33c4b24c70ab3..0000000000000000000000000000000000000000
Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ
diff --git a/app/src/main/res/values-w820dp/dimens.xml b/app/src/main/res/values-w820dp/dimens.xml
deleted file mode 100644
index 63fc816444614bd64f68a372d1f93211628ee51d..0000000000000000000000000000000000000000
--- a/app/src/main/res/values-w820dp/dimens.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
- 64dp
-
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
deleted file mode 100644
index 1259712e9063f40c1113ef93cb43b6ae270608e6..0000000000000000000000000000000000000000
--- a/app/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
- ShadowLayout
-
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
deleted file mode 100644
index 7bd70de27f638b7ee18c16504a8dca41386ae607..0000000000000000000000000000000000000000
--- a/app/src/main/res/values/styles.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/build.gradle b/build.gradle
index 5f665154f646f45670ee1cd1b68554124d94f1d0..fd383b9ad5f8cb6947c897734ddc7d7681395fe9 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,18 +1,38 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
+apply plugin: 'com.huawei.ohos.app'
+
+//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#ZH-CN_TOPIC_0000001154985555__section1112183053510
+ohos {
+ compileSdkVersion 6
+ defaultConfig {
+ compatibleSdkVersion 5
+ }
+}
buildscript {
repositories {
+ maven {
+ url 'https://repo.huaweicloud.com/repository/maven/'
+ }
+ maven {
+ url 'https://developer.huawei.com/repo/'
+ }
jcenter()
}
dependencies {
- classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
- classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.1"
- classpath 'com.android.tools.build:gradle:2.1.3'
+ classpath 'com.huawei.ohos:hap:2.4.5.0'
+ classpath 'com.huawei.ohos:decctest:1.2.4.1'
}
}
allprojects {
repositories {
+ maven {
+ url 'https://repo.huaweicloud.com/repository/maven/'
+ }
+ maven {
+ url 'https://developer.huawei.com/repo/'
+ }
jcenter()
}
}
diff --git a/entry/build.gradle b/entry/build.gradle
new file mode 100644
index 0000000000000000000000000000000000000000..6d842e268ba28dd3ff83617fd6ea87b952d54a1e
--- /dev/null
+++ b/entry/build.gradle
@@ -0,0 +1,28 @@
+apply plugin: 'com.huawei.ohos.hap'
+apply plugin: 'com.huawei.ohos.decctest'
+//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#ZH-CN_TOPIC_0000001154985555__section1112183053510
+ohos {
+ compileSdkVersion 6
+ defaultConfig {
+ compatibleSdkVersion 5
+ }
+ buildTypes {
+ release {
+ proguardOpt {
+ proguardEnabled false
+ rulesFiles 'proguard-rules.pro'
+ }
+ }
+ }
+
+}
+
+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(path: ':library')
+}
+decc {
+ supportType = ['html','xml']
+}
diff --git a/entry/src/main/config.json b/entry/src/main/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..6842db588fe5146dfa1baa2cfaf7b732756c42a5
--- /dev/null
+++ b/entry/src/main/config.json
@@ -0,0 +1,46 @@
+{
+ "app": {
+ "bundleName": "com.gigamole.shadowlayout",
+ "vendor": "gigamole",
+ "version": {
+ "code": 1000000,
+ "name": "1.0.0"
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "com.gigamole.shadowlayout",
+ "name": ".MyApplication",
+ "mainAbility": "com.gigamole.shadowlayout.MainAbility",
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "entry",
+ "moduleType": "entry",
+ "installationFree": false
+ },
+ "abilities": [
+ {
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "orientation": "unspecified",
+ "name": "com.gigamole.shadowlayout.MainAbility",
+ "icon": "$media:icon",
+ "description": "$string:mainability_description",
+ "label": "$string:entry_MainAbility",
+ "type": "page",
+ "launchType": "standard"
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/entry/src/main/java/com/gigamole/shadowlayout/MainAbility.java b/entry/src/main/java/com/gigamole/shadowlayout/MainAbility.java
new file mode 100644
index 0000000000000000000000000000000000000000..73074a0e9439c8cb5e24af6f9a283057162b8a97
--- /dev/null
+++ b/entry/src/main/java/com/gigamole/shadowlayout/MainAbility.java
@@ -0,0 +1,13 @@
+package com.gigamole.shadowlayout;
+
+import com.gigamole.shadowlayout.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/com/gigamole/shadowlayout/MyApplication.java b/entry/src/main/java/com/gigamole/shadowlayout/MyApplication.java
new file mode 100644
index 0000000000000000000000000000000000000000..d39a50f11b19b6fe53442cd4696c5e6dfd6a12b0
--- /dev/null
+++ b/entry/src/main/java/com/gigamole/shadowlayout/MyApplication.java
@@ -0,0 +1,10 @@
+package com.gigamole.shadowlayout;
+
+import ohos.aafwk.ability.AbilityPackage;
+
+public class MyApplication extends AbilityPackage {
+ @Override
+ public void onInitialize() {
+ super.onInitialize();
+ }
+}
diff --git a/entry/src/main/java/com/gigamole/shadowlayout/slice/MainAbilitySlice.java b/entry/src/main/java/com/gigamole/shadowlayout/slice/MainAbilitySlice.java
new file mode 100644
index 0000000000000000000000000000000000000000..85ca2a3e72c1ee50bdbb295dd8fb99efbe9698f8
--- /dev/null
+++ b/entry/src/main/java/com/gigamole/shadowlayout/slice/MainAbilitySlice.java
@@ -0,0 +1,23 @@
+package com.gigamole.shadowlayout.slice;
+
+import com.gigamole.shadowlayout.ResourceTable;
+import ohos.aafwk.ability.AbilitySlice;
+import ohos.aafwk.content.Intent;
+
+public class MainAbilitySlice extends AbilitySlice {
+ @Override
+ public void onStart(Intent intent) {
+ super.onStart(intent);
+ super.setUIContent(ResourceTable.Layout_ability_main);
+ }
+
+ @Override
+ public void onActive() {
+ super.onActive();
+ }
+
+ @Override
+ public void onForeground(Intent intent) {
+ super.onForeground(intent);
+ }
+}
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 0000000000000000000000000000000000000000..95bec7e003ed9f6eaa3c9ddcd41e8c7ca11f5c5d
--- /dev/null
+++ b/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,16 @@
+{
+ "string": [
+ {
+ "name": "entry_MainAbility",
+ "value": "ShadowLayout"
+ },
+ {
+ "name": "mainability_description",
+ "value": "Java_Empty Ability"
+ },
+ {
+ "name": "mainability_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 0000000000000000000000000000000000000000..c0c0a3df480fa387a452b9c40ca191cc918a3fc0
--- /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/layout/ability_main.xml b/entry/src/main/resources/base/layout/ability_main.xml
new file mode 100644
index 0000000000000000000000000000000000000000..b7459a95b1f844047b1f419667377169b80c3abb
--- /dev/null
+++ b/entry/src/main/resources/base/layout/ability_main.xml
@@ -0,0 +1,152 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/entry/src/main/resources/base/media/ic_design.png b/entry/src/main/resources/base/media/ic_design.png
new file mode 100644
index 0000000000000000000000000000000000000000..e2849b7d4b4c494a6542f81443904a0f7b50f9ec
Binary files /dev/null and b/entry/src/main/resources/base/media/ic_design.png differ
diff --git a/entry/src/main/resources/base/media/ic_development.png b/entry/src/main/resources/base/media/ic_development.png
new file mode 100644
index 0000000000000000000000000000000000000000..4de4ef853d40d20978be89599a6c1b692742130c
Binary files /dev/null and b/entry/src/main/resources/base/media/ic_development.png differ
diff --git a/entry/src/main/resources/base/media/ic_logo.png b/entry/src/main/resources/base/media/ic_logo.png
new file mode 100644
index 0000000000000000000000000000000000000000..2c6bc36b6238daf3abe8b8062cd68dcf375aa5d2
Binary files /dev/null and b/entry/src/main/resources/base/media/ic_logo.png differ
diff --git a/entry/src/main/resources/base/media/ic_qa.png b/entry/src/main/resources/base/media/ic_qa.png
new file mode 100644
index 0000000000000000000000000000000000000000..d420167c14ed46070166ab86d131d4aae1e67f44
Binary files /dev/null and b/entry/src/main/resources/base/media/ic_qa.png differ
diff --git a/entry/src/main/resources/base/media/ic_strategy.png b/entry/src/main/resources/base/media/ic_strategy.png
new file mode 100644
index 0000000000000000000000000000000000000000..2e1b18d652c601a4aa46f810a3da6060de9c3fdb
Binary files /dev/null and b/entry/src/main/resources/base/media/ic_strategy.png differ
diff --git a/entry/src/main/resources/base/media/icon.png b/entry/src/main/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/entry/src/main/resources/base/media/icon.png differ
diff --git a/entry/src/main/resources/en/element/string.json b/entry/src/main/resources/en/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..fef421a3e5a1594791e2c5cc2e3c462cb73911c9
--- /dev/null
+++ b/entry/src/main/resources/en/element/string.json
@@ -0,0 +1,16 @@
+{
+ "string": [
+ {
+ "name": "entry_MainAbility",
+ "value": "ShadowLayout"
+ },
+ {
+ "name": "mainability_description",
+ "value": "Java_Empty Ability"
+ },
+ {
+ "name": "mainability_HelloWorld",
+ "value": "Hello World"
+ }
+ ]
+}
diff --git a/entry/src/main/resources/zh/element/string.json b/entry/src/main/resources/zh/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..c4d0b3c147cbea970d3474d333209d511121fd4f
--- /dev/null
+++ b/entry/src/main/resources/zh/element/string.json
@@ -0,0 +1,16 @@
+{
+ "string": [
+ {
+ "name": "entry_MainAbility",
+ "value": "ShadowLayout"
+ },
+ {
+ "name": "mainability_description",
+ "value": "Java_Empty Ability"
+ },
+ {
+ "name": "mainability_HelloWorld",
+ "value": "你好,世界"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/entry/src/ohosTest/java/com/gigamole/shadowlayout/ExampleOhosTest.java b/entry/src/ohosTest/java/com/gigamole/shadowlayout/ExampleOhosTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..7e20113cff2b3b5769c73bd65ed9a98e2b8beb92
--- /dev/null
+++ b/entry/src/ohosTest/java/com/gigamole/shadowlayout/ExampleOhosTest.java
@@ -0,0 +1,17 @@
+package com.gigamole.shadowlayout;
+
+import ohos.aafwk.ability.delegation.AbilityDelegatorRegistry;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class ExampleOhosTest {
+ /**
+ * 纯UI组件,无法执行单元测试
+ */
+ @Test
+ public void testBundleName() {
+ final String actualBundleName = AbilityDelegatorRegistry.getArguments().getTestBundleName();
+ assertEquals("com.gigamole.shadowlayout", actualBundleName);
+ }
+}
\ No newline at end of file
diff --git a/entry/src/test/java/com/gigamole/shadowlayout/ExampleTest.java b/entry/src/test/java/com/gigamole/shadowlayout/ExampleTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..510399ac3aa6c05c3dd552425b5ad68ab7441c90
--- /dev/null
+++ b/entry/src/test/java/com/gigamole/shadowlayout/ExampleTest.java
@@ -0,0 +1,12 @@
+package com.gigamole.shadowlayout;
+
+import org.junit.Test;
+
+public class ExampleTest {
+ /**
+ * 纯UI组件,无法执行单元测试
+ */
+ @Test
+ public void onStart() {
+ }
+}
diff --git a/gradle.properties b/gradle.properties
deleted file mode 100644
index 1d3591c8a4c9c29578c36c87f80c05a6aea3ee3f..0000000000000000000000000000000000000000
--- a/gradle.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-# Project-wide Gradle settings.
-
-# IDE (e.g. Android Studio) users:
-# Gradle settings configured through the IDE *will override*
-# any settings specified in this file.
-
-# For more details on how to configure your build environment visit
-# http://www.gradle.org/docs/current/userguide/build_environment.html
-
-# Specifies the JVM arguments used for the daemon process.
-# The setting is particularly useful for tweaking memory settings.
-# Default value: -Xmx10248m -XX:MaxPermSize=256m
-# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
-
-# When configured, Gradle will run in incubating parallel mode.
-# This option should only be used with decoupled projects. More details, visit
-# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
-# org.gradle.parallel=true
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index 8c0fb64a8698b08ecc4158d828ca593c4928e9dd..490fda8577df6c95960ba7077c43220e5bb2c0d9 100644
Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index c6daac3d5f86d4d5fc4642a35a653f22b0c6e622..f59159e865d4b59feb1b8c44b001f62fc5d58df4 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,5 @@
-#Thu Sep 15 10:01:10 EEST 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
+distributionUrl=https\://repo.huaweicloud.com/gradle/gradle-6.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
diff --git a/gradlew b/gradlew
deleted file mode 100644
index 91a7e269e19dfc62e27137a0b57ef3e430cee4fd..0000000000000000000000000000000000000000
--- a/gradlew
+++ /dev/null
@@ -1,164 +0,0 @@
-#!/usr/bin/env bash
-
-##############################################################################
-##
-## Gradle start up script for UN*X
-##
-##############################################################################
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn ( ) {
- echo "$*"
-}
-
-die ( ) {
- echo
- echo "$*"
- echo
- exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
-esac
-
-# For Cygwin, ensure paths are in UNIX format before anything is touched.
-if $cygwin ; then
- [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
-fi
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >&-
-APP_HOME="`pwd -P`"
-cd "$SAVED" >&-
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-
-# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- if [ ! -x "$JAVACMD" ] ; then
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
- fi
-else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-fi
-
-# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
- fi
- i=$((i+1))
- done
- case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
-fi
-
-# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
-function splitJvmOpts() {
- JVM_OPTS=("$@")
-}
-eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
-JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
-
-exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/gradlew.bat b/gradlew.bat
deleted file mode 100644
index 8a0b282aa6885fb573c106b3551f7275c5f17e8e..0000000000000000000000000000000000000000
--- a/gradlew.bat
+++ /dev/null
@@ -1,90 +0,0 @@
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/img/Shadowlayout.gif b/img/Shadowlayout.gif
new file mode 100644
index 0000000000000000000000000000000000000000..14e3501c3e48189691a07b79a423f4ead9ffce04
Binary files /dev/null and b/img/Shadowlayout.gif differ
diff --git a/library/.gitignore b/library/.gitignore
deleted file mode 100644
index 796b96d1c402326528b4ba3c12ee9d92d0e212e9..0000000000000000000000000000000000000000
--- a/library/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build
diff --git a/library/build.gradle b/library/build.gradle
index 1f7c1581f4c61ab0473a6c20adffe5bc9e39fa23..fab05b5e63a2f30314f27d9c8b91555fa9d64aa3 100644
--- a/library/build.gradle
+++ b/library/build.gradle
@@ -1,136 +1,23 @@
-/*
- * Copyright (C) 2015 Basil Miller
- *
- * 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.
- */
-
-apply plugin: 'com.android.library'
-apply plugin: "com.jfrog.bintray"
-apply plugin: 'com.github.dcendents.android-maven'
-apply plugin: 'maven'
-
-version = "1.0.2"
-
-android {
- compileSdkVersion 23
- buildToolsVersion "23.0.3"
-
+apply plugin: 'com.huawei.ohos.library'
+//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#ZH-CN_TOPIC_0000001154985555__section1112183053510
+ohos {
+ compileSdkVersion 6
defaultConfig {
- minSdkVersion 11
- targetSdkVersion 23
- versionCode 1
- versionName "1.0.2"
+ compatibleSdkVersion 5
}
buildTypes {
release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
- }
- }
-}
-
-dependencies {
- compile fileTree(dir: 'libs', include: ['*.jar'])
- compile 'com.android.support:appcompat-v7:23.3.0'
- compile 'org.jsoup:jsoup:+'
-}
-
-def siteUrl = 'https://github.com/DevLight-Mobile-Agency/ShadowLayout'
-def gitUrl = 'https://github.com/DevLight-Mobile-Agency/ShadowLayout.git'
-group = "com.github.devlight.shadowlayout"
-
-install {
- repositories.mavenInstaller {
- // This generates POM.xml with proper parameters
- pom {
- project {
- packaging 'aar'
-
- // Add your description here
- name 'ShadowLayout'
- description = 'This library allows you to create a shadow effect for your layout based on your child.'
- url siteUrl
-
- // Set your license
- licenses {
- license {
- name 'The Apache Software License, Version 2.0'
- url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
- }
- }
- developers {
- developer {
- id 'gigamole'
- name 'Basil Miller'
- email 'gigamole53@gmail.com'
- }
- }
- scm {
- connection gitUrl
- developerConnection gitUrl
- url siteUrl
- }
+ proguardOpt {
+ proguardEnabled false
+ rulesFiles 'proguard-rules.pro'
}
}
}
+
}
-task sourcesJar(type: Jar) {
- from android.sourceSets.main.java.srcDirs
- classifier = 'sources'
-}
-
-task javadoc(type: Javadoc) {
- source = android.sourceSets.main.java.srcDirs
- classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
-}
-
-task javadocJar(type: Jar, dependsOn: javadoc) {
- classifier = 'javadoc'
- from javadoc.destinationDir
-}
-artifacts {
- archives javadocJar
- archives sourcesJar
+dependencies {
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+ implementation 'org.jetbrains:annotations:19.0.0'
+ testImplementation 'junit:junit:4.13'
}
-
-Properties properties = new Properties()
-properties.load(project.rootProject.file('local.properties').newDataInputStream())
-
-bintray {
- user = properties.getProperty("bintray.user")
- key = properties.getProperty("bintray.apikey")
-
- configurations = ['archives']
- pkg {
- repo = "maven"
- // it is the name that appears in bintray when logged
- name = "shadowlayout"
- websiteUrl = siteUrl
- vcsUrl = gitUrl
- licenses = ["Apache-2.0"]
- publish = true
- version {
- gpg {
- sign = true //Determines whether to GPG sign the files. The default is false
- passphrase = properties.getProperty("bintray.gpg.password") //Optional. The passphrase for GPG signing'
- }
-// mavenCentralSync {
-// sync = true //Optional (true by default). Determines whether to sync the version to Maven Central.
-// user = properties.getProperty("bintray.oss.user") //OSS user token
-// password = properties.getProperty("bintray.oss.password") //OSS user password
-// close = '1' //Optional property. By default the staging repository is closed and artifacts are released to Maven Central. You can optionally turn this behaviour off (by puting 0 as value) and release the version manually.
-// }
- }
- }
-}
\ No newline at end of file
diff --git a/library/proguard-rules.pro b/library/proguard-rules.pro
deleted file mode 100644
index 245df8faea619c2b0951d9504ed0dd05b8f5e560..0000000000000000000000000000000000000000
--- a/library/proguard-rules.pro
+++ /dev/null
@@ -1,17 +0,0 @@
-# Add project specific ProGuard rules here.
-# By default, the flags in this file are appended to flags specified
-# in D:\Programs\Programming\AndroidStudio\AS_SDK/tools/proguard/proguard-android.txt
-# You can edit the include path and order by changing the proguardFiles
-# directive in build.gradle.
-#
-# For more details, see
-# http://developer.android.com/guide/developing/tools/proguard.html
-
-# Add any project specific keep options here:
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-# public *;
-#}
diff --git a/library/src/androidTest/java/com/gigamole/library/ApplicationTest.java b/library/src/androidTest/java/com/gigamole/library/ApplicationTest.java
deleted file mode 100644
index 35e36d7206f5c63fba5bcc1c69c36f483ee7560b..0000000000000000000000000000000000000000
--- a/library/src/androidTest/java/com/gigamole/library/ApplicationTest.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.gigamole.library;
-
-import android.app.Application;
-import android.test.ApplicationTestCase;
-
-/**
- * Testing Fundamentals
- */
-public class ApplicationTest extends ApplicationTestCase {
- public ApplicationTest() {
- super(Application.class);
- }
-}
\ No newline at end of file
diff --git a/library/src/main/AndroidManifest.xml b/library/src/main/AndroidManifest.xml
deleted file mode 100644
index f3d01c4ed9cddcf40d2cb5f5a1b4bc410895369b..0000000000000000000000000000000000000000
--- a/library/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-
-
-
-
diff --git a/library/src/main/config.json b/library/src/main/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..59acaa9c6e81be246f3988825555e68014ce75f4
--- /dev/null
+++ b/library/src/main/config.json
@@ -0,0 +1,23 @@
+{
+ "app": {
+ "bundleName": "com.gigamole.shadowlayout",
+ "vendor": "gigamole",
+ "version": {
+ "code": 1000000,
+ "name": "1.0.0"
+ }
+ },
+ "deviceConfig": {
+ },
+ "module": {
+ "package": "com.gigamole.library",
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "library",
+ "moduleType": "har"
+ }
+ }
+}
\ No newline at end of file
diff --git a/library/src/main/java/com/gigamole/library/FloatRange.java b/library/src/main/java/com/gigamole/library/FloatRange.java
new file mode 100644
index 0000000000000000000000000000000000000000..e83abd2d28115f59e480a18d215ac99637a94d16
--- /dev/null
+++ b/library/src/main/java/com/gigamole/library/FloatRange.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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.gigamole.library;
+
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.LOCAL_VARIABLE;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.CLASS;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Denotes that the annotated element should be a float or double in the given range
+ *
+ * Example:
+ *
+ * @FloatRange(from=0.0,to=1.0)
+ * public float getAlpha() {
+ * ...
+ * }
+ *
+ */
+@Retention(CLASS)
+@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE, ANNOTATION_TYPE})
+public @interface FloatRange {
+ /**
+ * Smallest value. Whether it is inclusive or not is determined
+ * by {@link #fromInclusive}
+ */
+ double from() default Double.NEGATIVE_INFINITY;
+
+ /**
+ * Largest value. Whether it is inclusive or not is determined
+ * by {@link #toInclusive}
+ */
+ double to() default Double.POSITIVE_INFINITY;
+
+ /**
+ * Whether the from value is included in the range
+ */
+ boolean fromInclusive() default true;
+
+ /**
+ * Whether the to value is included in the range
+ */
+ boolean toInclusive() default true;
+}
\ No newline at end of file
diff --git a/library/src/main/java/com/gigamole/library/ShadowLayout.java b/library/src/main/java/com/gigamole/library/ShadowLayout.java
index b51292e2c14648623da283533f0c27bb02f96c73..15f67e0687216c6f2546e44490e6f397b5696ab3 100644
--- a/library/src/main/java/com/gigamole/library/ShadowLayout.java
+++ b/library/src/main/java/com/gigamole/library/ShadowLayout.java
@@ -16,29 +16,26 @@
package com.gigamole.library;
-import android.content.Context;
-import android.content.res.TypedArray;
-import android.graphics.Bitmap;
-import android.graphics.BlurMaskFilter;
-import android.graphics.Canvas;
-import android.graphics.Color;
-import android.graphics.Paint;
-import android.graphics.PorterDuff;
-import android.graphics.Rect;
-import android.support.annotation.FloatRange;
-import android.util.AttributeSet;
-import android.widget.FrameLayout;
+import com.gigamole.library.utils.AttrValue;
+import ohos.agp.components.*;
+import ohos.agp.render.*;
+import ohos.agp.utils.Color;
+import ohos.app.Context;
+import ohos.media.image.PixelMap;
+import ohos.media.image.common.PixelFormat;
+import ohos.media.image.common.Size;
+
/**
* Created by GIGAMOLE on 13.04.2016.
*/
-public class ShadowLayout extends FrameLayout {
+public class ShadowLayout extends DirectionalLayout implements ComponentContainer.ArrangeListener, Component.DrawTask, Component.EstimateSizeListener {
// Default shadow values
private final static float DEFAULT_SHADOW_RADIUS = 30.0F;
private final static float DEFAULT_SHADOW_DISTANCE = 15.0F;
private final static float DEFAULT_SHADOW_ANGLE = 45.0F;
- private final static int DEFAULT_SHADOW_COLOR = Color.DKGRAY;
+ private final static int DEFAULT_SHADOW_COLOR = Color.DKGRAY.getValue();
// Shadow bounds values
private final static int MAX_ALPHA = 255;
@@ -46,20 +43,15 @@ public class ShadowLayout extends FrameLayout {
private final static float MIN_RADIUS = 0.1F;
private final static float MIN_ANGLE = 0.0F;
// Shadow paint
- private final Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG) {
+ private final Paint mPaint = new Paint() {
{
+ setAntiAlias(true);
setDither(true);
setFilterBitmap(true);
}
};
// Shadow bitmap and canvas
- private Bitmap mBitmap;
- private final Canvas mCanvas = new Canvas();
- // View bounds
- private final Rect mBounds = new Rect();
- // Check whether need to redraw shadow
- private boolean mInvalidateShadow = true;
-
+ private PixelMap mBitmap;
// Detect if shadow is visible
private boolean mIsShadowed;
@@ -71,116 +63,141 @@ public class ShadowLayout extends FrameLayout {
private float mShadowAngle;
private float mShadowDx;
private float mShadowDy;
+ private int padding;
+ /**
+ * 构造函数
+ *
+ * @param context 上下文
+ */
public ShadowLayout(final Context context) {
this(context, null);
}
- public ShadowLayout(final Context context, final AttributeSet attrs) {
- this(context, attrs, 0);
+ /**
+ * 构造函数
+ *
+ * @param context 上下文
+ * @param attrs attrs
+ */
+ public ShadowLayout(final Context context, final AttrSet attrs) {
+ this(context, attrs, "");
}
- public ShadowLayout(final Context context, final AttributeSet attrs, final int defStyleAttr) {
- super(context, attrs, defStyleAttr);
-
- setWillNotDraw(false);
- setLayerType(LAYER_TYPE_HARDWARE, mPaint);
-
- // Retrieve attributes from xml
- final TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.ShadowLayout);
- try {
- setIsShadowed(typedArray.getBoolean(R.styleable.ShadowLayout_sl_shadowed, true));
- setShadowRadius(
- typedArray.getDimension(
- R.styleable.ShadowLayout_sl_shadow_radius, DEFAULT_SHADOW_RADIUS
- )
- );
- setShadowDistance(
- typedArray.getDimension(
- R.styleable.ShadowLayout_sl_shadow_distance, DEFAULT_SHADOW_DISTANCE
- )
- );
- setShadowAngle(
- typedArray.getInteger(
- R.styleable.ShadowLayout_sl_shadow_angle, (int) DEFAULT_SHADOW_ANGLE
- )
- );
- setShadowColor(
- typedArray.getColor(
- R.styleable.ShadowLayout_sl_shadow_color, DEFAULT_SHADOW_COLOR
- )
- );
- } finally {
- typedArray.recycle();
- }
+ /**
+ * 构造函数
+ *
+ * @param context 上下文
+ * @param attrs attrs
+ * @param styleName styleName
+ */
+ public ShadowLayout(final Context context, final AttrSet attrs, final String styleName) {
+ super(context, attrs, styleName);
+ init(context, attrs);
}
- @Override
- protected void onDetachedFromWindow() {
- super.onDetachedFromWindow();
- // Clear shadow bitmap
- if (mBitmap != null) {
- mBitmap.recycle();
- mBitmap = null;
- }
+ private void init(Context context, AttrSet attrs) {
+ setEstimateSizeListener(this);
+ setArrangeListener(this);
+ addDrawTask(this);
+ // Retrieve attributes from xml
+ setIsShadowed(AttrValue.get(attrs, "sl_shadowed", true));
+ setShadowRadius(AttrValue.get(attrs, "sl_shadow_radius", DEFAULT_SHADOW_RADIUS));
+ setShadowDistance(AttrValue.get(attrs, "sl_shadow_distance", DEFAULT_SHADOW_DISTANCE));
+ setShadowAngle(AttrValue.get(attrs, "sl_shadow_angle", DEFAULT_SHADOW_ANGLE));
+ setShadowColor(AttrValue.get(attrs, "sl_shadow_color", DEFAULT_SHADOW_COLOR));
}
+ /**
+ * @return mIsShadowed
+ */
public boolean isShadowed() {
return mIsShadowed;
}
+ /**
+ * @param isShadowed isShadowed
+ */
public void setIsShadowed(final boolean isShadowed) {
mIsShadowed = isShadowed;
- postInvalidate();
+ invalidate();
}
+ /**
+ * @return mShadowDistance
+ */
public float getShadowDistance() {
return mShadowDistance;
}
+ /**
+ * @param shadowDistance shadowDistance
+ */
public void setShadowDistance(final float shadowDistance) {
mShadowDistance = shadowDistance;
resetShadow();
}
+ /**
+ * @return mShadowAngle
+ */
public float getShadowAngle() {
return mShadowAngle;
}
+ /**
+ * @param shadowAngle shadowAngle
+ */
@FloatRange
public void setShadowAngle(@FloatRange(from = MIN_ANGLE, to = MAX_ANGLE) final float shadowAngle) {
mShadowAngle = Math.max(MIN_ANGLE, Math.min(shadowAngle, MAX_ANGLE));
resetShadow();
}
+ /**
+ * @return mShadowRadius
+ */
public float getShadowRadius() {
return mShadowRadius;
}
+ /**
+ * @param shadowRadius shadowRadius
+ */
public void setShadowRadius(final float shadowRadius) {
mShadowRadius = Math.max(MIN_RADIUS, shadowRadius);
- if (isInEditMode()) return;
// Set blur filter to paint
- mPaint.setMaskFilter(new BlurMaskFilter(mShadowRadius, BlurMaskFilter.Blur.NORMAL));
+ mPaint.setMaskFilter(new MaskFilter(mShadowRadius, MaskFilter.Blur.NORMAL));
resetShadow();
}
+ /**
+ * @return mShadowColor
+ */
public int getShadowColor() {
return mShadowColor;
}
+ /**
+ * @param shadowColor shadowColor
+ */
public void setShadowColor(final int shadowColor) {
mShadowColor = shadowColor;
mShadowAlpha = Color.alpha(shadowColor);
-
resetShadow();
}
+ /**
+ * @return mShadowDx
+ */
public float getShadowDx() {
return mShadowDx;
}
+ /**
+ * @return mShadowDy
+ */
public float getShadowDy() {
return mShadowDy;
}
@@ -192,83 +209,81 @@ public class ShadowLayout extends FrameLayout {
mShadowDy = (float) ((mShadowDistance) * Math.sin(mShadowAngle / 180.0F * Math.PI));
// Set padding for shadow bitmap
- final int padding = (int) (mShadowDistance + mShadowRadius);
+ padding = (int) (mShadowDistance + mShadowRadius);
setPadding(padding, padding, padding, padding);
- requestLayout();
+ postLayout();
}
private int adjustShadowAlpha(final boolean adjust) {
return Color.argb(
- adjust ? MAX_ALPHA : mShadowAlpha,
- Color.red(mShadowColor),
- Color.green(mShadowColor),
- Color.blue(mShadowColor)
- );
+ adjust ? MAX_ALPHA : mShadowAlpha, mShadowColor, mShadowColor, mShadowColor);
}
@Override
- protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- super.onMeasure(widthMeasureSpec, heightMeasureSpec);
-
- // Set ShadowLayout bounds
- mBounds.set(0, 0, getMeasuredWidth(), getMeasuredHeight());
+ public void postLayout() {
+ // Redraw shadow
+ super.postLayout();
}
@Override
- public void requestLayout() {
- // Redraw shadow
- mInvalidateShadow = true;
- super.requestLayout();
+ public boolean onArrange(int left, int top, int width, int height) {
+ return false;
}
+
@Override
- protected void dispatchDraw(final Canvas canvas) {
- // If is not shadowed, skip
- if (mIsShadowed) {
- // If need to redraw shadow
- if (mInvalidateShadow) {
- // If bounds is zero
- if (mBounds.width() != 0 && mBounds.height() != 0) {
- // Reset bitmap to bounds
- mBitmap = Bitmap.createBitmap(
- mBounds.width(), mBounds.height(), Bitmap.Config.ARGB_8888
- );
- // Canvas reset
- mCanvas.setBitmap(mBitmap);
-
- // We just redraw
- mInvalidateShadow = false;
- // Main feature of this lib. We create the local copy of all content, so now
- // we can draw bitmap as a bottom layer of natural canvas.
- // We draw shadow like blur effect on bitmap, cause of setShadowLayer() method of
- // paint does`t draw shadow, it draw another copy of bitmap
- super.dispatchDraw(mCanvas);
-
- // Get the alpha bounds of bitmap
- final Bitmap extractedAlpha = mBitmap.extractAlpha();
- // Clear past content content to draw shadow
- mCanvas.drawColor(0, PorterDuff.Mode.CLEAR);
-
- // Draw extracted alpha bounds of our local canvas
- mPaint.setColor(adjustShadowAlpha(false));
- mCanvas.drawBitmap(extractedAlpha, mShadowDx, mShadowDy, mPaint);
-
- // Recycle and clear extracted alpha
- extractedAlpha.recycle();
- } else {
- // Create placeholder bitmap when size is zero and wait until new size coming up
- mBitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.RGB_565);
- }
+ public void onDraw(Component component, Canvas canvas) {
+ for (int i1 = 0; i1 < getChildCount(); i1++) {
+ Component view = getComponentAt(i1);
+ if (view instanceof ShadowLayout) {
+ continue;
}
+ view.setClipEnabled(false);
+ caculateViewAndRender(view, canvas);
+ }
+ }
- // Reset alpha to draw child with full alpha
- mPaint.setColor(adjustShadowAlpha(true));
- // Draw shadow bitmap
- if (mCanvas != null && mBitmap != null && !mBitmap.isRecycled())
- canvas.drawBitmap(mBitmap, 0.0F, 0.0F, mPaint);
+ private void caculateViewAndRender(Component child, Canvas canvas) {
+ if (isShadowed()) {
+ mPaint.setColor(new Color(mShadowColor));
+ if (child instanceof Image) {
+ PixelMap pixelMap;
+ pixelMap = ((Image) child).getPixelMap();
+ PixelMap extractedAlpha = pixelMap.createFromAlpha();
+ int left = child.getLeft();
+ int top = child.getTop();
+ canvas.drawPixelMapHolder(new PixelMapHolder(extractedAlpha),
+ left + mShadowDx + padding, top + mShadowDy + padding, mPaint);
+ } else if (child instanceof Text) {
+ String mText = "";
+ mText = ((Text) child).getText();
+ mPaint.setTextSize(((Text) child).getTextSize());
+ int pointX = child.getLeft();
+ Paint.FontMetrics fontMetrics = mPaint.getFontMetrics();
+ float dy = (fontMetrics.descent - fontMetrics.ascent) / 2 - fontMetrics.descent;
+ int pointY = (child.getBottom() - child.getTop()) / 2 + child.getTop() + (int) dy;
+ canvas.drawText(mPaint, mText, pointX + mShadowDx + padding, pointY + padding + mShadowDy);
+ } else {
+ PixelMap.InitializationOptions options =
+ new PixelMap.InitializationOptions();
+ options.size = new Size(child.getWidth(), child.getHeight());
+ options.pixelFormat = PixelFormat.ARGB_8888;
+ mBitmap = PixelMap.create(options);
+ PixelMap extractedAlpha = mBitmap.createFromAlpha();
+ int left = child.getLeft();
+ int top = child.getTop();
+ canvas.drawPixelMapHolder(new PixelMapHolder(extractedAlpha),
+ left, top, mPaint);
+ }
+ postLayout();
}
+ }
- // Draw child`s
- super.dispatchDraw(canvas);
+ @Override
+ public boolean onEstimateSize(int widthMeasureSpec, int heightMeasureSpec) {
+ int specWidth = EstimateSpec.getSize(widthMeasureSpec);
+ int specHeight = EstimateSpec.getSize(heightMeasureSpec);
+ setEstimatedSize(specWidth, specHeight);
+ return false;
}
}
diff --git a/library/src/main/java/com/gigamole/library/utils/AttrValue.java b/library/src/main/java/com/gigamole/library/utils/AttrValue.java
new file mode 100644
index 0000000000000000000000000000000000000000..71cb06c454e6c2c8d727b5db0343084b044bf05c
--- /dev/null
+++ b/library/src/main/java/com/gigamole/library/utils/AttrValue.java
@@ -0,0 +1,84 @@
+/*
+ * 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.gigamole.library.utils;
+
+import ohos.agp.components.Attr;
+import ohos.agp.components.AttrSet;
+import ohos.agp.components.element.Element;
+import ohos.agp.utils.Color;
+
+/**
+ * 动态属性解析
+ *
+ * @since 2021-04-09
+ */
+public class AttrValue {
+ private AttrValue() {
+ }
+
+ /**
+ * 获取动态属性
+ *
+ * @param attrSet attrSet
+ * @param key key
+ * @param defValue defValue
+ * @param defValue
+ * @return 返回泛型T
+ */
+ @SuppressWarnings("unchecked cast")
+ public static T get(AttrSet attrSet, String key, T defValue) {
+ if (!attrSet.getAttr(key).isPresent()) {
+ return (T) defValue;
+ }
+
+ Attr attr = attrSet.getAttr(key).get();
+ if (defValue instanceof String) {
+ return (T) attr.getStringValue();
+ } else if (defValue instanceof Long) {
+ return (T) (Long) (attr.getLongValue());
+ } else if (defValue instanceof Float) {
+ return (T) (Float) (attr.getFloatValue());
+ } else if (defValue instanceof Integer) {
+ return (T) (Integer) (attr.getIntegerValue());
+ } else if (defValue instanceof Boolean) {
+ return (T) (Boolean) (attr.getBoolValue());
+ } else if (defValue instanceof Color) {
+ return (T) (attr.getColorValue());
+ } else if (defValue instanceof Element) {
+ return (T) (attr.getElement());
+ } else {
+ return (T) defValue;
+ }
+ }
+
+ /**
+ * 获取尺寸
+ *
+ * @param attrSet attrSet
+ * @param key key
+ * @param defDimensionValue defDimensionValue
+ * @return 返回尺寸
+ */
+ public static int getDimension(AttrSet attrSet, String key, int defDimensionValue) {
+ if (!attrSet.getAttr(key).isPresent()) {
+ return defDimensionValue;
+ }
+
+ Attr attr = attrSet.getAttr(key).get();
+ return attr.getDimensionValue();
+ }
+}
diff --git a/library/src/main/res/values/attrs.xml b/library/src/main/res/values/attrs.xml
deleted file mode 100644
index 5a20df4bd3ea428358b6b1f6b64914c4ad4ea827..0000000000000000000000000000000000000000
--- a/library/src/main/res/values/attrs.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/library/src/main/res/values/strings.xml b/library/src/main/res/values/strings.xml
deleted file mode 100644
index 1259712e9063f40c1113ef93cb43b6ae270608e6..0000000000000000000000000000000000000000
--- a/library/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
- ShadowLayout
-
diff --git a/library/src/main/resources/base/element/string.json b/library/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..211a936b6a562815c346636393376e8f1a72a08e
--- /dev/null
+++ b/library/src/main/resources/base/element/string.json
@@ -0,0 +1,8 @@
+{
+ "string": [
+ {
+ "name": "library_library",
+ "value": "library_library"
+ }
+ ]
+}
diff --git a/library/src/main/resources/base/graphic/background_ability_button.xml b/library/src/main/resources/base/graphic/background_ability_button.xml
new file mode 100644
index 0000000000000000000000000000000000000000..85f568500da2d4307161b345693b8497a7eb404f
--- /dev/null
+++ b/library/src/main/resources/base/graphic/background_ability_button.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/library/src/main/resources/base/graphic/ic_done.xml b/library/src/main/resources/base/graphic/ic_done.xml
new file mode 100644
index 0000000000000000000000000000000000000000..94cc5b58a25a25a4693137200a53344bc0ec719f
--- /dev/null
+++ b/library/src/main/resources/base/graphic/ic_done.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/library/src/test/java/com/gigamole/library/ExampleTest.java b/library/src/test/java/com/gigamole/library/ExampleTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..32996c72195a54502094d7fb9337d1b1fc729a84
--- /dev/null
+++ b/library/src/test/java/com/gigamole/library/ExampleTest.java
@@ -0,0 +1,9 @@
+package com.gigamole.library;
+
+import org.junit.Test;
+
+public class ExampleTest {
+ @Test
+ public void onStart() {
+ }
+}
diff --git a/settings.gradle b/settings.gradle
index 33069973b21ca48fd9db7889bf3865384837327a..d0c7ee8440156d4a9324ac5357770747425fef57 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1 +1 @@
-include ':app', ':library'
+include ':entry', ':library'