diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000000000000000000000000000000000000..5952c6e97b31c0457096020ce337c731b5c97b9c
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,2 @@
+## 0.0.1-SNAPSHOT
+ohos 第一个版本,实现了原库的全部api
\ No newline at end of file
diff --git a/README.OPENSOURCE b/README.OPENSOURCE
new file mode 100644
index 0000000000000000000000000000000000000000..3a4004d6f8a1e7a69ae25640ba5e112d3d047ffc
--- /dev/null
+++ b/README.OPENSOURCE
@@ -0,0 +1,16 @@
+[
+
+ {
+ "Name":"loaderviewlibrary",
+
+ "License":"Apache License 2.0",
+
+ "License File":"LICENSE",
+
+ "Version Number":"3.0.0",
+
+ "Upstream URL":"https://github.com/elye/loaderviewlibrary",
+
+ "Description":"为 TextView 和 ImageView 提供在显示任何文本或图像之前显示微光(动画加载器)的能力"
+ }
+]
\ No newline at end of file
diff --git a/README.md b/README.md
index b3e22fd27ffa29ce067180a6c7118015924b9714..cdc541f3026e45fdfa5698b1ab0a128cef4bcf2e 100644
--- a/README.md
+++ b/README.md
@@ -1,13 +1,49 @@
-# Loader View for Android
+# SineView
-[](http://android-arsenal.com/details/1/4243)
+### 项目介绍
-## What It Is
-Provide both TextView and ImageView the ability to show shimmer (animation loader) before any text or image is shown. Useful when waiting for data to be loaded from the network. Example below
+- 项目名称:loaderviewlibrary
-
+- 所属系列:openharmony的第三方组件适配移植
-## Features / Usage
+- 功能:为 TextView 和 ImageView 提供在显示任何文本或图像之前显示微光(动画加载器)的能力
+
+- 项目移植状态:主功能完成
+
+- 调用差异:无
+
+- 开发版本:sdk6,DevEco Studio2.2 Beta1
+
+- 基线版本:Release 3.0.0
+
+
+### 效果演示
+
+
+
+### 安装教程
+1.在项目根目录下的build.gradle文件中,
+ ```
+ allprojects {
+ repositories {
+ maven {
+ url 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
+ }
+ }
+ }
+```
+2.在entry模块的build.gradle文件中,
+ ```
+ dependencies {
+ ......
+ }
+```
+
+在sdk6,DevEco Studio2.2 Beta1下项目可直接运行
+如无法运行,删除项目.gradle,.idea,build,gradle,build.gradle文件,
+并依据自己的版本创建新项目,将新项目的对应文件复制到根目录下
+
+### 使用说明
1. Loader View for TextView defined in layout XML
```xml
@@ -66,42 +102,36 @@ Provide both TextView and ImageView the ability to show shimmer (animation loade
android:layout_height="wrap_content"
app:custom_color="@android:color/holo_green_dark" />
```
-
+
10. Reset and show shimmer (animation loader) again by calling the below API
```java
myLoaderTextView.resetLoader();
myLoaderImageView.resetLoader();
```
-## Requirement
-Android SDK API Version 15 and above.
+### 测试信息
-## Importing the Library
-On your root `build.gradle`, add `mavenCentral()` to the `allprojects` section.
-On your module `build.gradle`, add
+CodeCheck代码测试无异常
- dependencies {
- implementation 'io.github.elye:loaderviewlibrary:3.0.0'
- }
+CloudTest代码测试无异常
+
+病毒安全检测通过
+
+当前版本demo功能与原组件基本无差异
-## What's new in 3.0.0
-1. Moved from JCenter to mavenCenter
-2. Fix some null crash issue
+### 版本迭代
-**Note: only version 3.0.0 has been moved to mavenCenter**
+- 0.0.1-SNAPSHOT
-## What's new in 2.0.0
-1. Migrate to AndroidX
-2. Fix issue of preventing partial overlay if view reused quickly in RecyclerView
+### 版权和许可信息
-## What's new in 1.5.0
-1. Add custom color attribute
+```
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at:
+ http://www.apache.org/licenses/LICENSE-2.0
-## Licence
+ 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.
-Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or 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.
diff --git a/app/build.gradle b/app/build.gradle
deleted file mode 100644
index a07ffff8ec11a392fe9ac5d80293ef75c7a9942c..0000000000000000000000000000000000000000
--- a/app/build.gradle
+++ /dev/null
@@ -1,27 +0,0 @@
-apply plugin: 'com.android.application'
-
-android {
- compileSdkVersion 30
- buildToolsVersion '29.0.2'
-
- defaultConfig {
- applicationId "com.elyeproj.sampleloaderview"
- minSdkVersion 15
- targetSdkVersion 30
- versionCode 1
- versionName "1.0"
- }
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
- }
- }
-}
-
-dependencies {
- implementation fileTree(dir: 'libs', include: ['*.jar'])
- testImplementation 'junit:junit:4.13.2'
- implementation project(':loaderviewlibrary')
- implementation 'androidx.appcompat:appcompat:1.2.0'
-}
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
deleted file mode 100644
index 7712922297b8c6b9d0d0293dc522159b89b26704..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 /Users/elye/Library/Android/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/elyeproj/sampleloaderview/ApplicationTest.java b/app/src/androidTest/java/com/elyeproj/sampleloaderview/ApplicationTest.java
deleted file mode 100644
index 20822bbea3a9be74062e890a09b52a8fca9eafd3..0000000000000000000000000000000000000000
--- a/app/src/androidTest/java/com/elyeproj/sampleloaderview/ApplicationTest.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.elyeproj.sampleloaderview;
-
-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 f41e818919f351ccb9867a559924c12ea7d5a605..0000000000000000000000000000000000000000
--- a/app/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/java/com/elyeproj/sampleloaderview/MainActivity.java b/app/src/main/java/com/elyeproj/sampleloaderview/MainActivity.java
deleted file mode 100644
index 4dfc2f5496095dcbab64ac126c0412c3106e9961..0000000000000000000000000000000000000000
--- a/app/src/main/java/com/elyeproj/sampleloaderview/MainActivity.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package com.elyeproj.sampleloaderview;
-
-import android.os.AsyncTask;
-import android.os.Bundle;
-import android.view.View;
-import android.widget.ImageView;
-import android.widget.TextView;
-import androidx.appcompat.app.AppCompatActivity;
-import com.elyeproj.loaderviewlibrary.LoaderImageView;
-import com.elyeproj.loaderviewlibrary.LoaderTextView;
-
-public class MainActivity extends AppCompatActivity {
-
- private int WAIT_DURATION = 5000;
- private DummyWait dummyWait;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- loadData();
- }
-
- private void loadData() {
- if (dummyWait != null) {
- dummyWait.cancel(true);
- }
- dummyWait = new DummyWait();
- dummyWait.execute();
- }
-
- private void postLoadData() {
- ((TextView)findViewById(R.id.txt_name)).setText("Mr. Donald Trump");
- ((TextView)findViewById(R.id.txt_title)).setText("President of United State (2017 - now)");
- ((TextView)findViewById(R.id.txt_phone)).setText("+001 2345 6789");
- ((TextView)findViewById(R.id.txt_email)).setText("donald.trump@donaldtrump.com");
- ((ImageView)findViewById(R.id.image_icon)).setImageResource(R.drawable.trump);
- }
-
- public void resetLoader(View view) {
- ((LoaderTextView)findViewById(R.id.txt_name)).resetLoader();
- ((LoaderTextView)findViewById(R.id.txt_title)).resetLoader();
- ((LoaderTextView)findViewById(R.id.txt_phone)).resetLoader();
- ((LoaderTextView)findViewById(R.id.txt_email)).resetLoader();
- ((LoaderImageView)findViewById(R.id.image_icon)).resetLoader();
- loadData();
- }
-
- class DummyWait extends AsyncTask {
- @Override
- protected void onPreExecute() {
- super.onPreExecute();
- }
-
- @Override
- protected Void doInBackground(Void... params) {
- try {
- Thread.sleep(WAIT_DURATION);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- return null;
- }
-
- @Override
- protected void onPostExecute(Void result) {
- super.onPostExecute(result);
- postLoadData();
- }
- }
-
- @Override
- protected void onDestroy() {
- super.onDestroy();
- if (dummyWait != null) {
- dummyWait.cancel(true);
- }
- }
-}
diff --git a/app/src/main/res/drawable-hdpi/ic_mail_outline_grey_500_18dp.png b/app/src/main/res/drawable-hdpi/ic_mail_outline_grey_500_18dp.png
deleted file mode 100644
index 661b099eba79578d93c62b46782d902d6b3040f3..0000000000000000000000000000000000000000
Binary files a/app/src/main/res/drawable-hdpi/ic_mail_outline_grey_500_18dp.png and /dev/null differ
diff --git a/app/src/main/res/drawable-hdpi/ic_phone_grey_500_18dp.png b/app/src/main/res/drawable-hdpi/ic_phone_grey_500_18dp.png
deleted file mode 100644
index 8ee8d97aee60f02ef48bd31bbbb3ad696349c630..0000000000000000000000000000000000000000
Binary files a/app/src/main/res/drawable-hdpi/ic_phone_grey_500_18dp.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 8300f2536111bd0f839598a972bfa6c4c22a843e..0000000000000000000000000000000000000000
--- a/app/src/main/res/layout/activity_main.xml
+++ /dev/null
@@ -1,94 +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/colors.xml b/app/src/main/res/values/colors.xml
deleted file mode 100644
index 3ab3e9cbce07f7cdc941fc8ba424c05e83ed80f0..0000000000000000000000000000000000000000
--- a/app/src/main/res/values/colors.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
- #3F51B5
- #303F9F
- #FF4081
-
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
deleted file mode 100644
index 4fcac924f91eec186e2ded1ce12161e70390fe01..0000000000000000000000000000000000000000
--- a/app/src/main/res/values/dimens.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
- 16dp
- 16dp
- 12sp
- 15sp
-
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
deleted file mode 100644
index 7026cf5845306ca77dc4450a982f9ed3492d7333..0000000000000000000000000000000000000000
--- a/app/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
- Sample Loader View
- Reset Loaders
-
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
deleted file mode 100644
index 5885930df6d10edf3d6df40d6556297d11f953da..0000000000000000000000000000000000000000
--- a/app/src/main/res/values/styles.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
diff --git a/app/src/test/java/com/elyeproj/sampleloaderview/ExampleUnitTest.java b/app/src/test/java/com/elyeproj/sampleloaderview/ExampleUnitTest.java
deleted file mode 100644
index 3450d8a60a2c29e26fafc919db7ce709c596b804..0000000000000000000000000000000000000000
--- a/app/src/test/java/com/elyeproj/sampleloaderview/ExampleUnitTest.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.elyeproj.sampleloaderview;
-
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * To work on unit tests, switch the Test Artifact in the Build Variants view.
- */
-public class ExampleUnitTest {
- @Test
- public void addition_isCorrect() throws Exception {
- assertEquals(4, 2 + 2);
- }
-}
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index 783665b8578e72a6431074ff8f733240375d81f7..3ae2dfc2e8aff7b1d4b0cec7e6b52904c2c8a1fb 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,29 +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 6
+ }
+}
buildscript {
repositories {
- maven { url "https://plugins.gradle.org/m2/" }
- google()
- mavenCentral()
+ maven {
+ url 'https://repo.huaweicloud.com/repository/maven/'
+ }
+ maven {
+ url 'https://developer.huawei.com/repo/'
+ }
+ jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:4.1.3'
- classpath 'io.github.gradle-nexus:publish-plugin:1.1.0'
- // NOTE: Do not place your application dependencies here; they belong
- // in the individual module build.gradle files
+ classpath 'com.huawei.ohos:hap:2.4.5.0'
+ classpath 'com.huawei.ohos:decctest:1.2.4.1'
}
}
-apply plugin: 'io.github.gradle-nexus.publish-plugin'
-apply from: "${rootDir}/scripts/publish-root.gradle"
-
allprojects {
repositories {
+ maven {
+ url 'https://repo.huaweicloud.com/repository/maven/'
+ }
+ maven {
+ url 'https://developer.huawei.com/repo/'
+ }
jcenter()
- google()
}
}
-
-task clean(type: Delete) {
- delete rootProject.buildDir
-}
diff --git a/app/.gitignore b/entry/.gitignore
similarity index 100%
rename from app/.gitignore
rename to entry/.gitignore
diff --git a/entry/build.gradle b/entry/build.gradle
new file mode 100644
index 0000000000000000000000000000000000000000..b9583ce82cfe5d20b1a44b2ce3a7d9516738a5fa
--- /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'
+ compile project(path: ':loaderviewlibrary')
+}
+decc {
+ supportType = ['html', 'xml']
+}
diff --git a/entry/proguard-rules.pro b/entry/proguard-rules.pro
new file mode 100644
index 0000000000000000000000000000000000000000..f7666e47561d514b2a76d5a7dfbb43ede86da92a
--- /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 0000000000000000000000000000000000000000..57ced0c6cd098f1f7cdc58e74a7f09b06c1d0aee
--- /dev/null
+++ b/entry/src/main/config.json
@@ -0,0 +1,45 @@
+{
+ "app": {
+ "bundleName": "es.guiguegon.elyeproj.sampleloaderview",
+ "vendor": "guiguegon",
+ "version": {
+ "code": 1000000,
+ "name": "1.0.0"
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "es.guiguegon.elyeproj.sampleloaderview",
+ "name": ".MyApplication",
+ "mainAbility": "es.guiguegon.elyeproj.sampleloaderview.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": "es.guiguegon.elyeproj.sampleloaderview.MainAbility",
+ "icon": "$media:icon",
+ "label": "$string:app_name",
+ "type": "page",
+ "launchType": "standard"
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/entry/src/main/java/es/guiguegon/elyeproj/sampleloaderview/MainAbility.java b/entry/src/main/java/es/guiguegon/elyeproj/sampleloaderview/MainAbility.java
new file mode 100644
index 0000000000000000000000000000000000000000..2a3c63bb17832620a122b673caebe7cf3dde6714
--- /dev/null
+++ b/entry/src/main/java/es/guiguegon/elyeproj/sampleloaderview/MainAbility.java
@@ -0,0 +1,80 @@
+package es.guiguegon.elyeproj.sampleloaderview;
+
+import es.guiguegon.elyeproj.loaderviewlibrary.LoaderImageView;
+import es.guiguegon.elyeproj.loaderviewlibrary.LoaderTextView;
+import ohos.aafwk.ability.Ability;
+import ohos.aafwk.content.Intent;
+import ohos.agp.components.Button;
+import ohos.agp.components.Component;
+import ohos.agp.components.element.PixelMapElement;
+import ohos.app.dispatcher.TaskDispatcher;
+import ohos.global.resource.NotExistException;
+import ohos.global.resource.Resource;
+
+import java.io.IOException;
+
+public class MainAbility extends Ability implements Component.ClickedListener {
+
+ private int WAIT_DURATION = 5000;
+ private LoaderImageView icon_img;
+ private LoaderTextView name;
+ private LoaderTextView title;
+ private LoaderTextView phone;
+ private LoaderTextView email;
+ private Button btn_reset;
+ private TaskDispatcher taskDispatcher;
+
+ @Override
+ public void onStart(Intent intent) {
+ super.onStart(intent);
+ super.setUIContent(ResourceTable.Layout_ability_main);
+ icon_img = (LoaderImageView) findComponentById(ResourceTable.Id_image_icon);
+ name = (LoaderTextView) findComponentById(ResourceTable.Id_txt_names);
+ title = (LoaderTextView) findComponentById(ResourceTable.Id_txt_title);
+ phone = (LoaderTextView) findComponentById(ResourceTable.Id_txt_phone);
+ email = (LoaderTextView) findComponentById(ResourceTable.Id_txt_email);
+ btn_reset = (Button) findComponentById(ResourceTable.Id_btn_reset);
+ btn_reset.setClickedListener(this::onClick);
+ loadData();
+ }
+
+ private void loadData() {
+ taskDispatcher = getUITaskDispatcher();
+ taskDispatcher.delayDispatch(new Runnable() {
+ @Override
+ public void run() {
+ postLoadData();
+ }
+ }, WAIT_DURATION);
+ }
+
+ private void postLoadData() {
+ name.setText("Mr. Donald Trump");
+ try {
+ Resource resource = getResourceManager().getResource(ResourceTable.Media_trump);
+ PixelMapElement pixelMapElement = new PixelMapElement(resource);
+ icon_img.setImageElement(pixelMapElement);
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (NotExistException e) {
+ e.printStackTrace();
+ }
+ title.setText("President of United State (2017 - now)");
+ phone.setText("+001 2345 6789");
+ email.setText(ResourceTable.String_email);
+ }
+
+ public void resetLoader() {
+ name.resetLoader();
+ title.resetLoader();
+ phone.resetLoader();
+ email.resetLoader();
+ icon_img.resetLoader();
+ loadData();
+ }
+
+ @Override
+ public void onClick(Component component) {
+ resetLoader();
+ }
+}
diff --git a/entry/src/main/java/es/guiguegon/elyeproj/sampleloaderview/MyApplication.java b/entry/src/main/java/es/guiguegon/elyeproj/sampleloaderview/MyApplication.java
new file mode 100644
index 0000000000000000000000000000000000000000..cc07c3ce685e8b1cd343fcbbef840c2f3ad1250f
--- /dev/null
+++ b/entry/src/main/java/es/guiguegon/elyeproj/sampleloaderview/MyApplication.java
@@ -0,0 +1,10 @@
+package es.guiguegon.elyeproj.sampleloaderview;
+
+import ohos.aafwk.ability.AbilityPackage;
+
+public class MyApplication extends AbilityPackage {
+ @Override
+ public void onInitialize() {
+ super.onInitialize();
+ }
+}
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..054d96f09a76c5f94f37a83c7102575aae2898e8
--- /dev/null
+++ b/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,25 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "LoaderViewLibrary"
+ },
+ {
+ "name": "mainability_description",
+ "value": "Java_Empty Ability"
+ },
+ {
+ "name": "mainability_HelloWorld",
+ "value": "Hello World"
+ },
+
+ {
+ "name": "btn_reset",
+ "value": "RESET LOADERS"
+ },
+ {
+ "name": "email",
+ "value": "donald.trump@donaldtrump.com"
+ }
+ ]
+}
\ 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/graphic/background_button.xml b/entry/src/main/resources/base/graphic/background_button.xml
new file mode 100644
index 0000000000000000000000000000000000000000..2f2bf99213763afc70bb1ca348e429a15cf79ca4
--- /dev/null
+++ b/entry/src/main/resources/base/graphic/background_button.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
\ 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..5c06820f407c8918e68be6dc3a83570ad12b0f60
--- /dev/null
+++ b/entry/src/main/resources/base/layout/ability_main.xml
@@ -0,0 +1,100 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
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/app/src/main/res/drawable/trump.png b/entry/src/main/resources/base/media/trump.png
similarity index 100%
rename from app/src/main/res/drawable/trump.png
rename to entry/src/main/resources/base/media/trump.png
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..ce885f719b6cccc686ff823b691509f4317d4a16
--- /dev/null
+++ b/entry/src/main/resources/en/element/string.json
@@ -0,0 +1,20 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "LoaderViewLibrary"
+ },
+ {
+ "name": "entry_MainAbility",
+ "value": "entry_MainAbility"
+ },
+ {
+ "name": "mainability_description",
+ "value": "Java_Empty Ability"
+ },
+ {
+ "name": "mainability_HelloWorld",
+ "value": "Hello World"
+ }
+ ]
+}
diff --git a/app/src/main/res/drawable-mdpi/ic_mail_outline_grey_500_18dp.png b/entry/src/main/resources/mdpi/media/ic_mail_outline_grey_500_18dp.png
similarity index 100%
rename from app/src/main/res/drawable-mdpi/ic_mail_outline_grey_500_18dp.png
rename to entry/src/main/resources/mdpi/media/ic_mail_outline_grey_500_18dp.png
diff --git a/app/src/main/res/drawable-mdpi/ic_phone_grey_500_18dp.png b/entry/src/main/resources/mdpi/media/ic_phone_grey_500_18dp.png
similarity index 100%
rename from app/src/main/res/drawable-mdpi/ic_phone_grey_500_18dp.png
rename to entry/src/main/resources/mdpi/media/ic_phone_grey_500_18dp.png
diff --git a/app/src/main/res/drawable-xhdpi/ic_mail_outline_grey_500_18dp.png b/entry/src/main/resources/xldpi/media/ic_mail_outline_grey_500_18dp.png
similarity index 100%
rename from app/src/main/res/drawable-xhdpi/ic_mail_outline_grey_500_18dp.png
rename to entry/src/main/resources/xldpi/media/ic_mail_outline_grey_500_18dp.png
diff --git a/app/src/main/res/drawable-xhdpi/ic_phone_grey_500_18dp.png b/entry/src/main/resources/xldpi/media/ic_phone_grey_500_18dp.png
similarity index 100%
rename from app/src/main/res/drawable-xhdpi/ic_phone_grey_500_18dp.png
rename to entry/src/main/resources/xldpi/media/ic_phone_grey_500_18dp.png
diff --git a/app/src/main/res/drawable-xxhdpi/ic_mail_outline_grey_500_18dp.png b/entry/src/main/resources/xxldpi/media/ic_mail_outline_grey_500_18dp.png
similarity index 100%
rename from app/src/main/res/drawable-xxhdpi/ic_mail_outline_grey_500_18dp.png
rename to entry/src/main/resources/xxldpi/media/ic_mail_outline_grey_500_18dp.png
diff --git a/app/src/main/res/drawable-xxhdpi/ic_phone_grey_500_18dp.png b/entry/src/main/resources/xxldpi/media/ic_phone_grey_500_18dp.png
similarity index 100%
rename from app/src/main/res/drawable-xxhdpi/ic_phone_grey_500_18dp.png
rename to entry/src/main/resources/xxldpi/media/ic_phone_grey_500_18dp.png
diff --git a/app/src/main/res/drawable-xxxhdpi/ic_mail_outline_grey_500_18dp.png b/entry/src/main/resources/xxxldpi/media/ic_mail_outline_grey_500_18dp.png
similarity index 100%
rename from app/src/main/res/drawable-xxxhdpi/ic_mail_outline_grey_500_18dp.png
rename to entry/src/main/resources/xxxldpi/media/ic_mail_outline_grey_500_18dp.png
diff --git a/app/src/main/res/drawable-xxxhdpi/ic_phone_grey_500_18dp.png b/entry/src/main/resources/xxxldpi/media/ic_phone_grey_500_18dp.png
similarity index 100%
rename from app/src/main/res/drawable-xxxhdpi/ic_phone_grey_500_18dp.png
rename to entry/src/main/resources/xxxldpi/media/ic_phone_grey_500_18dp.png
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..fdc4bd140b689dfcb287ba35be2d478105f47f72
--- /dev/null
+++ b/entry/src/main/resources/zh/element/string.json
@@ -0,0 +1,16 @@
+{
+ "string": [
+ {
+ "name": "entry_MainAbility",
+ "value": "entry_MainAbility"
+ },
+ {
+ "name": "mainability_description",
+ "value": "Java_Empty Ability"
+ },
+ {
+ "name": "mainability_HelloWorld",
+ "value": "你好,世界"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/entry/src/ohosTest/java/es/guiguegon/elyeproj/sampleloaderview/ExampleOhosTest.java b/entry/src/ohosTest/java/es/guiguegon/elyeproj/sampleloaderview/ExampleOhosTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..8597c91fb5130b64ee571f43f02032a1678fb3a7
--- /dev/null
+++ b/entry/src/ohosTest/java/es/guiguegon/elyeproj/sampleloaderview/ExampleOhosTest.java
@@ -0,0 +1,17 @@
+package es.guiguegon.elyeproj.sampleloaderview;
+
+import ohos.aafwk.ability.delegation.AbilityDelegatorRegistry;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class ExampleOhosTest {
+ @Test
+ public void testBundleName() {
+ final String actualBundleName = AbilityDelegatorRegistry.getArguments().getTestBundleName();
+ assertEquals("es.guiguegon.elyeproj.sampleloaderview", actualBundleName);
+ }
+
+
+
+}
\ No newline at end of file
diff --git a/entry/src/test/java/es/guiguegon/elyeproj/sampleloaderview/ExampleTest.java b/entry/src/test/java/es/guiguegon/elyeproj/sampleloaderview/ExampleTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..b3dfc8bf147b3d6cf8fe69ff2e8f99835e7e16a8
--- /dev/null
+++ b/entry/src/test/java/es/guiguegon/elyeproj/sampleloaderview/ExampleTest.java
@@ -0,0 +1,9 @@
+package es.guiguegon.elyeproj.sampleloaderview;
+
+import org.junit.Test;
+
+public class ExampleTest {
+ @Test
+ public void onStart() {
+ }
+}
diff --git a/gif/loadview.gif b/gif/loadview.gif
new file mode 100644
index 0000000000000000000000000000000000000000..f9e921e344b29ca43c8f02845744db58664d08bd
Binary files /dev/null and b/gif/loadview.gif differ
diff --git a/gradle.properties b/gradle.properties
index 211fb54d6f3021d6edcb3fe9f3805f0f759a199e..be492496f9a20ac2d980ef4fc30061f4184c1c40 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,20 +1,13 @@
# Project-wide Gradle settings.
-
-# IDE (e.g. Android Studio) users:
+# IDE (e.g. DevEco 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
-
-android.useAndroidX=true
+# If the Chinese output is garbled, please configure the following parameter.
+# This function is enabled by default when the DevEco Studio builds the hap/app,if you need disable gradle parallel,you should set org.gradle.parallel false.
+# more information see https://docs.gradle.org/current/userguide/performance.html
+# org.gradle.parallel=false
+# org.gradle.jvmargs=-Dfile.encoding=GBK
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index 13372aef5e24af05341d49695ee84e5f9b594659..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 baf4ff9eeb4f1f148cfa1836d20a937a77531981..f59159e865d4b59feb1b8c44b001f62fc5d58df4 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,5 @@
-#Wed Apr 24 20:51:45 AEST 2019
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-6.5-all.zip
diff --git a/gradlew b/gradlew
old mode 100755
new mode 100644
index 9d82f78915133e1c35a6ea51252590fb38efac2f..536f0272dd995f3afdb5e34e0f42bdf3d1986c22
--- a/gradlew
+++ b/gradlew
@@ -1,4 +1,20 @@
-#!/usr/bin/env bash
+#!/usr/bin/env sh
+
+#
+# Copyright 2015 the original author or authors.
+#
+# 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
+#
+# https://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.
+#
##############################################################################
##
@@ -6,155 +22,162 @@
##
##############################################################################
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
+# 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\")/" >/dev/null
+APP_HOME="$(pwd -P)"
+cd "$SAVED" >/dev/null
APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
+APP_BASE_NAME=$(basename "$0")
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
-warn ( ) {
- echo "$*"
+warn() {
+ echo "$*"
}
-die ( ) {
- echo
- echo "$*"
- echo
- exit 1
+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
- ;;
+nonstop=false
+case "$(uname)" in
+CYGWIN*)
+ cygwin=true
+ ;;
+Darwin*)
+ darwin=true
+ ;;
+MINGW*)
+ msys=true
+ ;;
+NONSTOP*)
+ nonstop=true
+ ;;
esac
-# 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\"`/" >/dev/null
-APP_HOME="`pwd -P`"
-cd "$SAVED" >/dev/null
-
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
+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
+ 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.
+ 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"
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "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\""
+ 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"`
- JAVACMD=`cygpath --unix "$JAVACMD"`
-
- # 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)"
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if [ "$cygwin" = "true" -o "$msys" = "true" ]; then
+ APP_HOME=$(cygpath --path --mixed "$APP_HOME")
+ CLASSPATH=$(cygpath --path --mixed "$CLASSPATH")
+ JAVACMD=$(cygpath --unix "$JAVACMD")
+
+ # 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
- # 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
+ i=$(expr $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=("$@")
+# Escape application args
+save() {
+ for i; do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/"; done
+ echo " "
}
-eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
-JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+APP_ARGS=$(save "$@")
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
-exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
+exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
index aec99730b4e8fcd90b57a0e8e01544fea7c31a89..62bd9b9ccefea2b65ae41e5d9a545e2021b90a1d 100644
--- a/gradlew.bat
+++ b/gradlew.bat
@@ -1,90 +1,103 @@
-@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
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
+@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
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@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="-Xmx64m" "-Xms64m"
+
+@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 Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_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=%*
+
+: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/loaderviewlibrary/build.gradle b/loaderviewlibrary/build.gradle
index 8ca15348bf1e55b32c7fb75d843b0c9644c75552..d60f8a01fc14cf2f7cc9f3756627f481a9d4efd1 100644
--- a/loaderviewlibrary/build.gradle
+++ b/loaderviewlibrary/build.gradle
@@ -1,43 +1,22 @@
-apply plugin: 'com.android.library'
-
-ext {
- PUBLISH_GROUP_ID = 'io.github.elye'
- PUBLISH_VERSION = '3.0.0'
- PUBLISH_ARTIFACT_ID = 'loaderviewlibrary'
- PUBLISH_DESCRIPTION = 'LoaderView Android SDK'
- PUBLISH_URL = 'https://github.com/elye/loaderviewlibrary'
- PUBLISH_LICENSE_NAME = 'Apache License'
- PUBLISH_LICENSE_URL = 'https://github.com/elye/loaderviewlibrary/blob/master/LICENSE'
- PUBLISH_DEVELOPER_ID = 'elye'
- PUBLISH_DEVELOPER_NAME = 'Elye Project'
- PUBLISH_DEVELOPER_EMAIL = 'elye.project@gmail.com'
- PUBLISH_SCM_CONNECTION = 'scm:git:github.com/elye/loaderviewlibrary.git'
- PUBLISH_SCM_DEVELOPER_CONNECTION = 'scm:git:ssh://github.com/elye/loaderviewlibrary.git'
- PUBLISH_SCM_URL = 'https://github.com/elye/loaderviewlibrary/tree/master'
-}
-
-apply from: "${rootProject.projectDir}/scripts/publish-module.gradle"
-
-android {
- compileSdkVersion 30
- buildToolsVersion '29.0.2'
-
+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 15
- targetSdkVersion 30
- versionCode 14
- versionName "2.0.0"
+ compatibleSdkVersion 5
}
buildTypes {
release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ proguardOpt {
+ proguardEnabled false
+ rulesFiles 'proguard-rules.pro'
+ }
}
}
+
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
- testImplementation 'junit:junit:4.13.2'
- implementation 'androidx.appcompat:appcompat:1.2.0'
+ testImplementation 'junit:junit:4.13'
}
diff --git a/loaderviewlibrary/consumer-rules.pro b/loaderviewlibrary/consumer-rules.pro
new file mode 100644
index 0000000000000000000000000000000000000000..9dccc613bc71b04b83531f550bdab2fb667ecfc9
--- /dev/null
+++ b/loaderviewlibrary/consumer-rules.pro
@@ -0,0 +1 @@
+# Add har specific ProGuard rules for consumer here.
\ No newline at end of file
diff --git a/loaderviewlibrary/proguard-rules.pro b/loaderviewlibrary/proguard-rules.pro
index 7712922297b8c6b9d0d0293dc522159b89b26704..f7666e47561d514b2a76d5a7dfbb43ede86da92a 100644
--- a/loaderviewlibrary/proguard-rules.pro
+++ b/loaderviewlibrary/proguard-rules.pro
@@ -1,17 +1 @@
-# Add project specific ProGuard rules here.
-# By default, the flags in this file are appended to flags specified
-# in /Users/elye/Library/Android/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 *;
-#}
+# config module specific ProGuard rules here.
\ No newline at end of file
diff --git a/loaderviewlibrary/src/androidTest/java/com/elyeproj/loaderviewlibrary/ApplicationTest.java b/loaderviewlibrary/src/androidTest/java/com/elyeproj/loaderviewlibrary/ApplicationTest.java
deleted file mode 100644
index 130bc9074744840a84c77d1c3ca6cd76d8345020..0000000000000000000000000000000000000000
--- a/loaderviewlibrary/src/androidTest/java/com/elyeproj/loaderviewlibrary/ApplicationTest.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.elyeproj.loaderviewlibrary;
-
-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/loaderviewlibrary/src/main/AndroidManifest.xml b/loaderviewlibrary/src/main/AndroidManifest.xml
deleted file mode 100644
index a7e8047a062e37c46268a4bbffa2a4d09e19716a..0000000000000000000000000000000000000000
--- a/loaderviewlibrary/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
diff --git a/loaderviewlibrary/src/main/config.json b/loaderviewlibrary/src/main/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..7e9590eab258ba5933115f25bad7e6f4ffce0d19
--- /dev/null
+++ b/loaderviewlibrary/src/main/config.json
@@ -0,0 +1,23 @@
+{
+ "app": {
+ "bundleName": "es.guiguegon.elyeproj.sampleloaderview",
+ "vendor": "guiguegon",
+ "version": {
+ "code": 1000000,
+ "name": "1.0.0"
+ }
+ },
+ "deviceConfig": {
+ },
+ "module": {
+ "package": "es.guiguegon.elyeproj.loaderviewlibrary",
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "loaderviewlibrary",
+ "moduleType": "har"
+ }
+ }
+}
\ No newline at end of file
diff --git a/loaderviewlibrary/src/main/java/com/elyeproj/loaderviewlibrary/LoaderTextView.java b/loaderviewlibrary/src/main/java/com/elyeproj/loaderviewlibrary/LoaderTextView.java
deleted file mode 100644
index fd84fb59d9a7eb4babdca3fbdd745082ce8f41a5..0000000000000000000000000000000000000000
--- a/loaderviewlibrary/src/main/java/com/elyeproj/loaderviewlibrary/LoaderTextView.java
+++ /dev/null
@@ -1,112 +0,0 @@
-package com.elyeproj.loaderviewlibrary;
-
-/*
- * Copyright 2016 Elye 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.
- */
-
-import android.content.Context;
-import android.content.res.TypedArray;
-import android.graphics.Canvas;
-import android.graphics.Paint;
-import android.graphics.Typeface;
-import android.text.TextUtils;
-import android.util.AttributeSet;
-import androidx.appcompat.widget.AppCompatTextView;
-import androidx.core.content.ContextCompat;
-
-public class LoaderTextView extends AppCompatTextView implements LoaderView {
-
- private LoaderController loaderController;
- private int defaultColorResource;
- private int darkerColorResource;
-
- public LoaderTextView(Context context) {
- super(context);
- init(null);
- }
-
- public LoaderTextView(Context context, AttributeSet attrs) {
- super(context, attrs);
- init(attrs);
- }
-
- public LoaderTextView(Context context, AttributeSet attrs, int defStyleAttr) {
- super(context, attrs, defStyleAttr);
- init(attrs);
- }
-
- private void init(AttributeSet attrs) {
- loaderController = new LoaderController(this);
- TypedArray typedArray = getContext().obtainStyledAttributes(attrs, R.styleable.loader_view, 0, 0);
- loaderController.setWidthWeight(typedArray.getFloat(R.styleable.loader_view_width_weight, LoaderConstant.MAX_WEIGHT));
- loaderController.setHeightWeight(typedArray.getFloat(R.styleable.loader_view_height_weight, LoaderConstant.MAX_WEIGHT));
- loaderController.setUseGradient(typedArray.getBoolean(R.styleable.loader_view_use_gradient, LoaderConstant.USE_GRADIENT_DEFAULT));
- loaderController.setCorners(typedArray.getInt(R.styleable.loader_view_corners, LoaderConstant.CORNER_DEFAULT));
- defaultColorResource = typedArray.getColor(R.styleable.loader_view_custom_color, ContextCompat.getColor(getContext(), R.color.default_color));
- darkerColorResource = typedArray.getColor(R.styleable.loader_view_custom_color, ContextCompat.getColor(getContext(), R.color.darker_color));
- typedArray.recycle();
- }
-
- @Override
- protected void onSizeChanged(int width, int height, int oldWidth, int oldHeight) {
- super.onSizeChanged(width, height, oldWidth, oldHeight);
- loaderController.onSizeChanged();
- }
-
- public void resetLoader() {
- if (!TextUtils.isEmpty(getText())) {
- super.setText(null);
- loaderController.startLoading();
- }
- }
-
- @Override
- protected void onDraw(Canvas canvas) {
- super.onDraw(canvas);
- loaderController.onDraw(canvas, getCompoundPaddingLeft(),
- getCompoundPaddingTop(),
- getCompoundPaddingRight(),
- getCompoundPaddingBottom());
- }
-
- @Override
- public void setText(CharSequence text, BufferType type) {
- super.setText(text, type);
- if (loaderController != null) {
- loaderController.stopLoading();
- }
- }
-
- @Override
- public void setRectColor(Paint rectPaint) {
- final Typeface typeface = getTypeface();
- if (typeface != null && typeface.getStyle()== Typeface.BOLD ) {
- rectPaint.setColor(darkerColorResource);
- } else {
- rectPaint.setColor(defaultColorResource);
- }
- }
-
- @Override
- public boolean valueSet() {
- return !TextUtils.isEmpty(getText());
- }
-
- @Override
- protected void onDetachedFromWindow() {
- super.onDetachedFromWindow();
- loaderController.removeAnimatorUpdateListener();
- }
-}
diff --git a/loaderviewlibrary/src/main/java/es/guiguegon/elyeproj/loaderviewlibrary/AttrValue.java b/loaderviewlibrary/src/main/java/es/guiguegon/elyeproj/loaderviewlibrary/AttrValue.java
new file mode 100644
index 0000000000000000000000000000000000000000..6b726f569e94eb00754e3359c9724b1e70c87525
--- /dev/null
+++ b/loaderviewlibrary/src/main/java/es/guiguegon/elyeproj/loaderviewlibrary/AttrValue.java
@@ -0,0 +1,139 @@
+/*
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain an copy of the License at
+ *
+ * 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 es.guiguegon.elyeproj.loaderviewlibrary;
+
+import ohos.agp.components.Attr;
+import ohos.agp.components.AttrSet;
+import ohos.agp.components.element.Element;
+import ohos.agp.utils.Color;
+import ohos.app.Context;
+import ohos.hiviewdfx.HiLog;
+import ohos.hiviewdfx.HiLogLabel;
+
+/**
+ * AttrValue
+ *
+ * @ProjectName: sinview
+ * @ClassName: AttrValue
+ * @Description:
+ * @Author: lr
+ * @CreateDate: 2021/5/28 10:27
+ * @since 2021-05-28
+ */
+public class AttrValue {
+ private static HiLogLabel logLabel = new HiLogLabel(HiLog.LOG_APP, 0x001, "AttrValue");
+ private static final int CONSTANT = 160;
+ private AttrValue() {
+ }
+
+ /**
+ * getattrset
+ *
+ * @param attrSet AttrSet
+ * @param key String
+ * @param defValue T
+ * @param T
+ * @return T
+ */
+ public static T get(AttrSet attrSet, String key, T defValue) {
+ if (attrSet == null || !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;
+ }
+ }
+ /**
+ * getLayout
+ *
+ * @param attrSet AttrSet
+ * @param key String
+ * @param def int
+ * @return int
+ */
+ public static int getLayout(AttrSet attrSet, String key, int def) {
+ if (attrSet.getAttr(key).isPresent()) {
+ int layoutId = def;
+ String value = attrSet.getAttr(key).get().getStringValue();
+ if (value != null) {
+ String subLayoutId = value.substring(value.indexOf(":"));
+ HiLog.info(logLabel, "getLayout", subLayoutId);
+ layoutId = Integer.parseInt(subLayoutId);
+ }
+ return layoutId;
+ }
+ return def;
+ }
+
+ /**
+ * getDimension
+ *
+ * @param attrSet AttrSet
+ * @param key String
+ * @param defDimensionValue int
+ * @return int
+ */
+ 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();
+ }
+
+ /**
+ * isEmpty
+ *
+ * @param str String
+ * @return boolean
+ * */
+ public static boolean isEmpty(String str){
+ boolean isEmpty;
+ if(str == null || str.equals("")){
+ isEmpty = true;
+ }else {
+ isEmpty = false;
+ }
+ return isEmpty;
+ }
+
+ /**
+ * px转vp
+ *
+ * @param context 上下文
+ * @param px px
+ * @return vp
+ */
+ public static int pxTovp(Context context, float px) {
+ return (Math.round(px) / (context.getResourceManager().getDeviceCapability().screenDensity / CONSTANT));
+ }
+
+}
diff --git a/loaderviewlibrary/src/main/java/com/elyeproj/loaderviewlibrary/LoaderConstant.java b/loaderviewlibrary/src/main/java/es/guiguegon/elyeproj/loaderviewlibrary/LoaderConstant.java
similarity index 83%
rename from loaderviewlibrary/src/main/java/com/elyeproj/loaderviewlibrary/LoaderConstant.java
rename to loaderviewlibrary/src/main/java/es/guiguegon/elyeproj/loaderviewlibrary/LoaderConstant.java
index b44b09d5f74844747d3ccee209149630d02cc03f..7fc1f592bf2d287558c21a7808787e0837af67a7 100644
--- a/loaderviewlibrary/src/main/java/com/elyeproj/loaderviewlibrary/LoaderConstant.java
+++ b/loaderviewlibrary/src/main/java/es/guiguegon/elyeproj/loaderviewlibrary/LoaderConstant.java
@@ -1,6 +1,4 @@
-package com.elyeproj.loaderviewlibrary;
-
-import android.graphics.Color;
+package es.guiguegon.elyeproj.loaderviewlibrary;
/*
* Copyright 2016 Elye Project
@@ -18,8 +16,10 @@ import android.graphics.Color;
* limitations under the License.
*/
+import ohos.agp.utils.Color;
+
class LoaderConstant {
- public final static int COLOR_DEFAULT_GRADIENT = Color.rgb(245, 245, 245);
+ public final static Color COLOR_DEFAULT_GRADIENT = new Color(Color.rgb(245, 245, 245));
public final static float MIN_WEIGHT = 0.0f;
public final static float MAX_WEIGHT = 1.0f;
public final static int CORNER_DEFAULT = 0;
diff --git a/loaderviewlibrary/src/main/java/com/elyeproj/loaderviewlibrary/LoaderController.java b/loaderviewlibrary/src/main/java/es/guiguegon/elyeproj/loaderviewlibrary/LoaderController.java
similarity index 59%
rename from loaderviewlibrary/src/main/java/com/elyeproj/loaderviewlibrary/LoaderController.java
rename to loaderviewlibrary/src/main/java/es/guiguegon/elyeproj/loaderviewlibrary/LoaderController.java
index cc6d9ab3ccb6539ba91ed2109a88737a84794039..e602bc45566971167878cf43cf6b79eeab369606 100644
--- a/loaderviewlibrary/src/main/java/com/elyeproj/loaderviewlibrary/LoaderController.java
+++ b/loaderviewlibrary/src/main/java/es/guiguegon/elyeproj/loaderviewlibrary/LoaderController.java
@@ -1,13 +1,4 @@
-package com.elyeproj.loaderviewlibrary;
-
-import android.animation.ObjectAnimator;
-import android.animation.ValueAnimator;
-import android.graphics.Canvas;
-import android.graphics.LinearGradient;
-import android.graphics.Paint;
-import android.graphics.RectF;
-import android.graphics.Shader;
-import android.view.animation.LinearInterpolator;
+package es.guiguegon.elyeproj.loaderviewlibrary;
/*
* Copyright 2016 Elye Project
@@ -25,30 +16,43 @@ import android.view.animation.LinearInterpolator;
* limitations under the License.
*/
-class LoaderController implements ValueAnimator.AnimatorUpdateListener {
+import ohos.agp.animation.Animator;
+import ohos.agp.animation.AnimatorValue;
+import ohos.agp.render.Canvas;
+import ohos.agp.render.LinearShader;
+import ohos.agp.render.Paint;
+import ohos.agp.render.Shader;
+import ohos.agp.utils.Color;
+import ohos.agp.utils.Point;
+import ohos.agp.utils.RectFloat;
+import ohos.app.Context;
+
+class LoaderController implements AnimatorValue.ValueUpdateListener {
private LoaderView loaderView;
private Paint rectPaint;
- private LinearGradient linearGradient;
+ private LinearShader linearGradient;
private float progress;
- private ValueAnimator valueAnimator;
+ private LoaderViewValueAnimator valueAnimator;
private float widthWeight = LoaderConstant.MAX_WEIGHT;
private float heightWeight = LoaderConstant.MAX_WEIGHT;
+ private int width;
+ private int height;
private boolean useGradient = LoaderConstant.USE_GRADIENT_DEFAULT;
private int corners = LoaderConstant.CORNER_DEFAULT;
+ private final static int ANIMATION_CYCLE_DURATION = 2000; //milis
- private final static int MAX_COLOR_CONSTANT_VALUE = 255;
- private final static int ANIMATION_CYCLE_DURATION = 750; //milis
-
- public LoaderController(LoaderView view) {
+ public LoaderController(LoaderView view,Context mContext) {
loaderView = view;
init();
}
private void init() {
- rectPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG);
+ rectPaint = new Paint();
+ rectPaint.setAntiAlias(true);
+ rectPaint.setFilterBitmap(true);
loaderView.setRectColor(rectPaint);
- setValueAnimator(0.5f, 1, ObjectAnimator.INFINITE);
+ setValueAnimator(0.1f, 1, Animator.INFINITE);
}
public void onDraw(Canvas canvas) {
@@ -56,15 +60,15 @@ class LoaderController implements ValueAnimator.AnimatorUpdateListener {
}
public void onDraw(Canvas canvas, float left_pad, float top_pad, float right_pad, float bottom_pad) {
- float margin_height = canvas.getHeight() * (1 - heightWeight) / 2;
- rectPaint.setAlpha((int) (progress * MAX_COLOR_CONSTANT_VALUE));
+ float margin_height = height * (1 - heightWeight) / 2;
+ rectPaint.setAlpha(progress);
if (useGradient) {
- prepareGradient(canvas.getWidth() * widthWeight);
+ prepareGradient(width * widthWeight);
}
- canvas.drawRoundRect(new RectF(0 + left_pad,
+ canvas.drawRoundRect(new RectFloat(0 + left_pad,
margin_height + top_pad,
- canvas.getWidth() * widthWeight - right_pad,
- canvas.getHeight() - margin_height - bottom_pad),
+ width * widthWeight - right_pad,
+ height - margin_height - bottom_pad),
corners, corners,
rectPaint);
}
@@ -76,15 +80,17 @@ class LoaderController implements ValueAnimator.AnimatorUpdateListener {
private void prepareGradient(float width) {
if (linearGradient == null) {
- linearGradient = new LinearGradient(0, 0, width, 0, rectPaint.getColor(),
- LoaderConstant.COLOR_DEFAULT_GRADIENT, Shader.TileMode.MIRROR);
+ Point[] points = new Point[]{new Point(0,0),new Point(width,0)};
+ Color[] colors = new Color[]{rectPaint.getColor(),LoaderConstant.COLOR_DEFAULT_GRADIENT};
+ linearGradient = new LinearShader(points,null,colors,
+ Shader.TileMode.MIRROR_TILEMODE);
}
- rectPaint.setShader(linearGradient);
+ rectPaint.setShader(linearGradient, Paint.ShaderType.LINEAR_SHADER);
}
public void startLoading() {
if (valueAnimator != null && !loaderView.valueSet()) {
- valueAnimator.cancel();
+ valueAnimator.stop();
init();
valueAnimator.start();
}
@@ -123,25 +129,31 @@ class LoaderController implements ValueAnimator.AnimatorUpdateListener {
}
private void setValueAnimator(float begin, float end, int repeatCount) {
- valueAnimator = ValueAnimator.ofFloat(begin, end);
- valueAnimator.setRepeatCount(repeatCount);
+ valueAnimator = LoaderViewValueAnimator.ofFloat(begin, end);
+ valueAnimator.setLoopedCount(repeatCount);
valueAnimator.setDuration(ANIMATION_CYCLE_DURATION);
- valueAnimator.setRepeatMode(ValueAnimator.REVERSE);
- valueAnimator.setInterpolator(new LinearInterpolator());
- valueAnimator.addUpdateListener(this);
- }
-
- @Override
- public void onAnimationUpdate(ValueAnimator valueAnimator) {
- progress = (float) valueAnimator.getAnimatedValue();
- loaderView.invalidate();
+ valueAnimator.setCurveType(Animator.CurveType.LINEAR);
+ valueAnimator.setValueUpdateListener(this);
}
public void removeAnimatorUpdateListener() {
if (valueAnimator != null) {
- valueAnimator.removeUpdateListener(this);
valueAnimator.cancel();
}
progress = 0f;
}
+
+ public void setWidth(int width) {
+ this.width = width;
+ }
+
+ public void setHeight(int height) {
+ this.height = height;
+ }
+
+ @Override
+ public void onUpdate(AnimatorValue animatorValue, float v) {
+ progress = v;
+ loaderView.invalidate();
+ }
}
diff --git a/loaderviewlibrary/src/main/java/com/elyeproj/loaderviewlibrary/LoaderImageView.java b/loaderviewlibrary/src/main/java/es/guiguegon/elyeproj/loaderviewlibrary/LoaderImageView.java
similarity index 36%
rename from loaderviewlibrary/src/main/java/com/elyeproj/loaderviewlibrary/LoaderImageView.java
rename to loaderviewlibrary/src/main/java/es/guiguegon/elyeproj/loaderviewlibrary/LoaderImageView.java
index 07962730a66586ccacbe058a1752d26fd4bc9a86..36e0547ac8539dc41ce35f5f09ae36b61b163a81 100644
--- a/loaderviewlibrary/src/main/java/com/elyeproj/loaderviewlibrary/LoaderImageView.java
+++ b/loaderviewlibrary/src/main/java/es/guiguegon/elyeproj/loaderviewlibrary/LoaderImageView.java
@@ -1,4 +1,4 @@
-package com.elyeproj.loaderviewlibrary;
+package es.guiguegon.elyeproj.loaderviewlibrary;
/*
* Copyright 2016 Elye Project
@@ -16,106 +16,113 @@ package com.elyeproj.loaderviewlibrary;
* limitations under the License.
*/
-import android.content.Context;
-import android.content.res.TypedArray;
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.graphics.Paint;
-import android.graphics.drawable.Drawable;
-import android.graphics.drawable.Icon;
-import android.util.AttributeSet;
-import androidx.appcompat.widget.AppCompatImageView;
-import androidx.core.content.ContextCompat;
-
-public class LoaderImageView extends AppCompatImageView implements LoaderView {
+import ohos.agp.components.AttrSet;
+import ohos.agp.components.Component;
+import ohos.agp.components.Image;
+import ohos.agp.components.element.Element;
+import ohos.agp.components.element.PixelMapElement;
+import ohos.agp.components.element.ShapeElement;
+import ohos.agp.render.Canvas;
+import ohos.agp.render.Paint;
+import ohos.agp.utils.Color;
+import ohos.app.Context;
+import ohos.media.image.PixelMap;
+import ohos.media.image.common.Size;
+
+public class LoaderImageView extends Image implements LoaderView, Component.DrawTask, Component.BindStateChangedListener {
private LoaderController loaderController;
- private int defaultColorResource;
+ private Color defaultColorResource;
+ private Context mContext;
public LoaderImageView(Context context) {
super(context);
- init(null);
+ this.mContext = context;
}
- public LoaderImageView(Context context, AttributeSet attrs) {
- super(context, attrs);
- init(attrs);
+ public LoaderImageView(Context context, AttrSet attrSet) {
+ super(context, attrSet);
+ this.mContext = context;
+ init(attrSet);
+ loaderController.onSizeChanged();
}
- public LoaderImageView(Context context, AttributeSet attrs, int defStyleAttr) {
- super(context, attrs, defStyleAttr);
- init(attrs);
+ public LoaderImageView(Context context, AttrSet attrSet, String styleName) {
+ super(context, attrSet, styleName);
+ this.mContext = context;
+ init(attrSet);
+ loaderController.onSizeChanged();
}
- private void init(AttributeSet attrs) {
- loaderController = new LoaderController(this);
- TypedArray typedArray = getContext().obtainStyledAttributes(attrs, R.styleable.loader_view, 0, 0);
- loaderController.setUseGradient(typedArray.getBoolean(R.styleable.loader_view_use_gradient, LoaderConstant.USE_GRADIENT_DEFAULT));
- loaderController.setCorners(typedArray.getInt(R.styleable.loader_view_corners, LoaderConstant.CORNER_DEFAULT));
- defaultColorResource = typedArray.getColor(R.styleable.loader_view_custom_color, ContextCompat.getColor(getContext(), R.color.default_color));
- typedArray.recycle();
+ private void init(AttrSet attrs) {
+ defaultColorResource = AttrValue.get(attrs, "custom_color", new Color(ResourceTable.Color_default_color));
+ loaderController = new LoaderController(this,mContext);
+ loaderController.setUseGradient(AttrValue.get(attrs, "use_gradient", LoaderConstant.USE_GRADIENT_DEFAULT));
+ loaderController.setCorners(AttrValue.get(attrs, "corners", LoaderConstant.CORNER_DEFAULT));
}
public void resetLoader() {
- if (getDrawable() != null) {
- super.setImageDrawable(null);
+ if (getImageElement() != null) {
+ this.setPixelMap(null);
loaderController.startLoading();
}
}
@Override
- protected void onSizeChanged(int width, int height, int oldWidth, int oldHeight) {
- super.onSizeChanged(width, height, oldWidth, oldHeight);
- loaderController.onSizeChanged();
+ public void setRectColor(Paint rectPaint) {
+ rectPaint.setColor(defaultColorResource);
}
@Override
- protected void onDraw(Canvas canvas) {
- super.onDraw(canvas);
- loaderController.onDraw(canvas);
+ public boolean valueSet() {
+ return (getImageElement() != null);
}
@Override
- public void setRectColor(Paint rectPaint) {
- rectPaint.setColor(defaultColorResource);
+ public void setPixelMap(PixelMap pixelMap) {
+ super.setPixelMap(pixelMap);
+ if (loaderController != null) {
+ loaderController.stopLoading();
+ }
}
@Override
- public boolean valueSet() {
- return (getDrawable() != null);
+ public void setImageElement(Element element) {
+ super.setImageElement(element);
+ if (loaderController != null) {
+ loaderController.stopLoading();
+ }
}
@Override
- public void setImageBitmap(Bitmap bm) {
- super.setImageBitmap(bm);
- if (loaderController != null)
+ public void setPixelMap(int resId) {
+ super.setPixelMap(resId);
+ if (loaderController != null) {
loaderController.stopLoading();
+ }
}
@Override
- public void setImageDrawable(Drawable drawable) {
- super.setImageDrawable(drawable);
- if (loaderController != null)
- loaderController.stopLoading();
+ public void invalidate() {
+ super.invalidate();
+ addDrawTask(this::onDraw);
}
@Override
- public void setImageIcon(Icon icon) {
- super.setImageIcon(icon);
- if (loaderController != null)
- loaderController.stopLoading();
+ public void onDraw(Component component, Canvas canvas) {
+ System.out.println("------ getWidth() = " + getWidth());
+ loaderController.setWidth(getWidth());
+ loaderController.setHeight(getHeight());
+ loaderController.onDraw(canvas);
}
@Override
- public void setImageResource(int resId) {
- super.setImageResource(resId);
- if (loaderController != null)
- loaderController.stopLoading();
+ public void onComponentBoundToWindow(Component component) {
+
}
@Override
- protected void onDetachedFromWindow() {
- super.onDetachedFromWindow();
+ public void onComponentUnboundFromWindow(Component component) {
loaderController.removeAnimatorUpdateListener();
}
}
diff --git a/loaderviewlibrary/src/main/java/es/guiguegon/elyeproj/loaderviewlibrary/LoaderTextView.java b/loaderviewlibrary/src/main/java/es/guiguegon/elyeproj/loaderviewlibrary/LoaderTextView.java
new file mode 100644
index 0000000000000000000000000000000000000000..205912ff358854e58edfa86b55903c6620441f59
--- /dev/null
+++ b/loaderviewlibrary/src/main/java/es/guiguegon/elyeproj/loaderviewlibrary/LoaderTextView.java
@@ -0,0 +1,147 @@
+package es.guiguegon.elyeproj.loaderviewlibrary;
+
+/*
+ * Copyright 2016 Elye 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.
+ */
+
+import ohos.agp.components.AttrSet;
+import ohos.agp.components.Component;
+import ohos.agp.components.Text;
+import ohos.agp.components.element.Element;
+import ohos.agp.render.Canvas;
+import ohos.agp.render.Paint;
+import ohos.agp.text.Font;
+import ohos.agp.utils.Color;
+import ohos.app.Context;
+import ohos.app.dispatcher.TaskDispatcher;
+
+public class LoaderTextView extends Text implements LoaderView, Component.DrawTask, Component.BindStateChangedListener {
+
+ private LoaderController loaderController;
+ private Color defaultColorResource;
+ private Color darkerColorResource;
+ private Context mContext;
+
+ public LoaderTextView(Context context) {
+ super(context);
+ this.mContext = context;
+ }
+
+ public LoaderTextView(Context context, AttrSet attrSet) {
+ super(context, attrSet);
+ this.mContext = context;
+ init(attrSet);
+ loaderController.onSizeChanged();
+ }
+
+ public LoaderTextView(Context context, AttrSet attrSet, String styleName) {
+ super(context, attrSet, styleName);
+ this.mContext = context;
+ init(attrSet);
+ loaderController.onSizeChanged();
+ }
+
+ private void init(AttrSet attrs) {
+ defaultColorResource = AttrValue.get(attrs, "custom_color", new Color(ResourceTable.Color_default_color));
+ darkerColorResource = AttrValue.get(attrs, "custom_color", new Color(ResourceTable.Color_darker_color));
+ loaderController = new LoaderController(this,mContext);
+ loaderController.setWidthWeight(AttrValue.get(attrs, "width_weight", LoaderConstant.MAX_WEIGHT));
+ loaderController.setHeightWeight(AttrValue.get(attrs, "height_weight", LoaderConstant.MAX_WEIGHT));
+ loaderController.setUseGradient(AttrValue.get(attrs, "use_gradient", LoaderConstant.USE_GRADIENT_DEFAULT));
+ loaderController.setCorners(AttrValue.get(attrs, "corners", LoaderConstant.CORNER_DEFAULT));
+ }
+
+ public void resetLoader() {
+ if (!AttrValue.isEmpty(getText())) {
+ super.setText(null);
+ loaderController.startLoading();
+ }
+ }
+
+ @Override
+ public void setText(String text) {
+ super.setText(text);
+ if (loaderController != null) {
+ loaderController.stopLoading();
+ }
+ }
+
+ @Override
+ public void setRectColor(Paint rectPaint) {
+ if (getFont() != null && getFont().getWeight() == Font.BOLD) {
+ rectPaint.setColor(darkerColorResource);
+ } else {
+ rectPaint.setColor(defaultColorResource);
+ }
+ }
+
+ @Override
+ public void invalidate() {
+ super.invalidate();
+ addDrawTask(this::onDraw);
+ }
+
+ @Override
+ public boolean valueSet() {
+ return !AttrValue.isEmpty(getText());
+ }
+
+ @Override
+ public void onDraw(Component component, Canvas canvas) {
+
+ loaderController.setWidth(getWidth());
+ loaderController.setHeight(getHeight());
+ Element leftElement = getLeftElement();
+ Element topElement = getTopElement();
+ Element rightElement = getRightElement();
+ Element botoomElement = getBottonElement();
+
+ int leftPadding = getPaddingLeft();
+ int topPadding = getPaddingTop();
+ int rightPadding = getPaddingRight();
+ int bottomPadding = getPaddingBottom();
+
+ if(leftElement != null){
+ leftPadding += leftElement.getWidth();
+ }
+
+ if(topElement != null){
+ topPadding += topElement.getHeight();
+ }
+
+ if(rightElement != null){
+ rightPadding += rightElement.getWidth();
+ }
+
+ if(botoomElement != null){
+ bottomPadding += botoomElement.getHeight();
+ }
+
+ loaderController.onDraw(canvas, leftPadding,
+ topPadding,
+ rightPadding,
+ bottomPadding);
+ }
+
+ @Override
+ public void onComponentBoundToWindow(Component component) {
+
+ }
+
+ @Override
+ public void onComponentUnboundFromWindow(Component component) {
+ loaderController.removeAnimatorUpdateListener();
+ }
+}
diff --git a/loaderviewlibrary/src/main/java/com/elyeproj/loaderviewlibrary/LoaderView.java b/loaderviewlibrary/src/main/java/es/guiguegon/elyeproj/loaderviewlibrary/LoaderView.java
similarity index 90%
rename from loaderviewlibrary/src/main/java/com/elyeproj/loaderviewlibrary/LoaderView.java
rename to loaderviewlibrary/src/main/java/es/guiguegon/elyeproj/loaderviewlibrary/LoaderView.java
index e68868042acbea76548286890070547eb54359f0..1102b612f0c383b17f1062a1d2e91fd05341ad23 100644
--- a/loaderviewlibrary/src/main/java/com/elyeproj/loaderviewlibrary/LoaderView.java
+++ b/loaderviewlibrary/src/main/java/es/guiguegon/elyeproj/loaderviewlibrary/LoaderView.java
@@ -1,6 +1,4 @@
-package com.elyeproj.loaderviewlibrary;
-
-import android.graphics.Paint;
+package es.guiguegon.elyeproj.loaderviewlibrary;
/*
* Copyright 2016 Elye Project
@@ -18,6 +16,8 @@ import android.graphics.Paint;
* limitations under the License.
*/
+import ohos.agp.render.Paint;
+
interface LoaderView {
void setRectColor(Paint rectPaint);
diff --git a/loaderviewlibrary/src/main/java/es/guiguegon/elyeproj/loaderviewlibrary/LoaderViewValueAnimator.java b/loaderviewlibrary/src/main/java/es/guiguegon/elyeproj/loaderviewlibrary/LoaderViewValueAnimator.java
new file mode 100644
index 0000000000000000000000000000000000000000..a5c286f760b3d7470379f113ad10a079a1d5d67e
--- /dev/null
+++ b/loaderviewlibrary/src/main/java/es/guiguegon/elyeproj/loaderviewlibrary/LoaderViewValueAnimator.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain an copy of the License at
+ *
+ * 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 es.guiguegon.elyeproj.loaderviewlibrary;
+
+import ohos.agp.animation.AnimatorValue;
+
+/**
+ * SinValueAnimator
+ *
+ * @ProjectName: sinview
+ * @ClassName: SinValueAnimator
+ * @Description:
+ * @Author: lr
+ * @CreateDate: 2021/5/28 10:27
+ * @since 2021-05-28
+ */
+public class LoaderViewValueAnimator extends AnimatorValue {
+ private float start = 0;
+ private float end = 1;
+ private float values = 0.0f;
+ private ValueUpdateListener myValueUpdateListener;
+
+ private LoaderViewValueAnimator() {
+ super.setValueUpdateListener(new ValueUpdateListener() {
+ @Override
+ public void onUpdate(AnimatorValue animatorValue, float value) {
+ values = value * (end - start) + start;
+ if (myValueUpdateListener != null) {
+ myValueUpdateListener.onUpdate(animatorValue, values);
+ }
+ }
+ });
+ }
+ /**
+ * 获取一个自定义初始值和结束值的数值动画对象
+ *
+ * @param start 起始值
+ * @param end 结束值
+ * @return 自定义初始值和结束值的数值动画对象
+ */
+ public static LoaderViewValueAnimator ofFloat(float start, float end) {
+ LoaderViewValueAnimator myValueAnimator = new LoaderViewValueAnimator();
+ myValueAnimator.start = start;
+ myValueAnimator.end = end;
+ return myValueAnimator;
+ }
+
+ @Override
+ public void setValueUpdateListener(ValueUpdateListener listener) {
+ this.myValueUpdateListener = listener;
+ }
+}
diff --git a/loaderviewlibrary/src/main/res/values/attrs.xml b/loaderviewlibrary/src/main/res/values/attrs.xml
deleted file mode 100644
index 8a71522564e53468e635c036221aa80cf5aa58e7..0000000000000000000000000000000000000000
--- a/loaderviewlibrary/src/main/res/values/attrs.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/loaderviewlibrary/src/main/res/values/colors.xml b/loaderviewlibrary/src/main/res/values/colors.xml
deleted file mode 100644
index 5415e20602ee936ab756d5649ab339552554fdbc..0000000000000000000000000000000000000000
--- a/loaderviewlibrary/src/main/res/values/colors.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
- #D7D7D7
- #B4B4B4
-
diff --git a/loaderviewlibrary/src/main/res/values/strings.xml b/loaderviewlibrary/src/main/res/values/strings.xml
deleted file mode 100644
index 8542005550c7c87f5b6679a433515d5f43cd921a..0000000000000000000000000000000000000000
--- a/loaderviewlibrary/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
diff --git a/loaderviewlibrary/src/main/resources/base/element/color.json b/loaderviewlibrary/src/main/resources/base/element/color.json
new file mode 100644
index 0000000000000000000000000000000000000000..751b85580ac188f2049a998ace7eced17b020621
--- /dev/null
+++ b/loaderviewlibrary/src/main/resources/base/element/color.json
@@ -0,0 +1,28 @@
+{
+ "color": [
+ {
+ "name": "default_color",
+ "value": "#D7D7D7"
+ },
+ {
+ "name": "darker_color",
+ "value": "#B4B4B4"
+ },
+ {
+ "name": "holo_green_dark",
+ "value": "#ff669900"
+ },
+ {
+ "name": "red",
+ "value": "#fc2121"
+ },
+ {
+ "name": "blue",
+ "value": "#0051ff"
+ },
+ {
+ "name": "withe",
+ "value": "#ffffff"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/loaderviewlibrary/src/main/resources/base/element/string.json b/loaderviewlibrary/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..bd56da370043fedb627feb2efa20f47e41917564
--- /dev/null
+++ b/loaderviewlibrary/src/main/resources/base/element/string.json
@@ -0,0 +1,8 @@
+{
+ "string": [
+ {
+ "name": "loaderviewlibrary_library",
+ "value": "loaderviewlibrary_library"
+ }
+ ]
+}
diff --git a/loaderviewlibrary/src/test/java/com/elyeproj/loaderviewlibrary/ExampleUnitTest.java b/loaderviewlibrary/src/test/java/com/elyeproj/loaderviewlibrary/ExampleUnitTest.java
deleted file mode 100644
index c971288ebcf595725971b19d53a02a3c75a47424..0000000000000000000000000000000000000000
--- a/loaderviewlibrary/src/test/java/com/elyeproj/loaderviewlibrary/ExampleUnitTest.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.elyeproj.loaderviewlibrary;
-
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * To work on unit tests, switch the Test Artifact in the Build Variants view.
- */
-public class ExampleUnitTest {
- @Test
- public void addition_isCorrect() throws Exception {
- assertEquals(4, 2 + 2);
- }
-}
\ No newline at end of file
diff --git a/loaderviewlibrary/src/test/java/es/guiguegon/elyeproj/loaderviewlibrary/ExampleTest.java b/loaderviewlibrary/src/test/java/es/guiguegon/elyeproj/loaderviewlibrary/ExampleTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..6768d25bc86f630121be4f30fcd8498efa11ee60
--- /dev/null
+++ b/loaderviewlibrary/src/test/java/es/guiguegon/elyeproj/loaderviewlibrary/ExampleTest.java
@@ -0,0 +1,9 @@
+package es.guiguegon.elyeproj.loaderviewlibrary;
+
+import org.junit.Test;
+
+public class ExampleTest {
+ @Test
+ public void onStart() {
+ }
+}
diff --git a/scripts/publish-module.gradle b/scripts/publish-module.gradle
deleted file mode 100644
index 7dc77e1ca72fcb93ce5901ea2af8f447e8cf0b42..0000000000000000000000000000000000000000
--- a/scripts/publish-module.gradle
+++ /dev/null
@@ -1,77 +0,0 @@
-apply plugin: 'maven-publish'
-apply plugin: 'signing'
-
-task androidSourcesJar(type: Jar) {
- archiveClassifier.set('sources')
- if (project.plugins.findPlugin("com.android.library")) {
- from android.sourceSets.main.java.srcDirs
- } else {
- from sourceSets.main.java.srcDirs
- }
-}
-
-artifacts {
- archives androidSourcesJar
-}
-
-group = PUBLISH_GROUP_ID
-version = PUBLISH_VERSION
-
-afterEvaluate {
- publishing {
- publications {
- release(MavenPublication) {
- // The coordinates of the library, being set from variables that
- // we'll set up later
- groupId PUBLISH_GROUP_ID
- artifactId PUBLISH_ARTIFACT_ID
- version PUBLISH_VERSION
-
- // Two artifacts, the `aar` (or `jar`) and the sources
- if (project.plugins.findPlugin("com.android.library")) {
- from components.release
- } else {
- artifact("$buildDir/libs/${project.getName()}-${version}.jar")
- }
-
- artifact androidSourcesJar
-
- // Mostly self-explanatory metadata
- pom {
- name = PUBLISH_ARTIFACT_ID
- description = PUBLISH_DESCRIPTION
- url = PUBLISH_URL
- licenses {
- license {
- name = PUBLISH_LICENSE_NAME
- url = PUBLISH_LICENSE_URL
- }
- }
- developers {
- developer {
- id = PUBLISH_DEVELOPER_ID
- name = PUBLISH_DEVELOPER_NAME
- email = PUBLISH_DEVELOPER_EMAIL
- }
- }
-
- // Version control info - if you're using GitHub, follow the
- // format as seen here
- scm {
- connection = PUBLISH_SCM_CONNECTION
- developerConnection = PUBLISH_SCM_DEVELOPER_CONNECTION
- url = PUBLISH_SCM_URL
- }
- }
- }
- }
- }
-}
-
-ext["signing.keyId"] = rootProject.ext["signing.keyId"]
-ext["signing.password"] = rootProject.ext["signing.password"]
-ext["signing.secretKeyRingFile"] = rootProject.ext["signing.secretKeyRingFile"]
-
-signing {
- sign publishing.publications
-}
diff --git a/scripts/publish-root.gradle b/scripts/publish-root.gradle
deleted file mode 100644
index caec3a3620af6bd7023c42b8d8eb06576f536273..0000000000000000000000000000000000000000
--- a/scripts/publish-root.gradle
+++ /dev/null
@@ -1,36 +0,0 @@
-// Create variables with empty default values
-ext["signing.keyId"] = ''
-ext["signing.password"] = ''
-ext["signing.secretKeyRingFile"] = ''
-ext["ossrhUsername"] = ''
-ext["ossrhPassword"] = ''
-ext["sonatypeStagingProfileId"] = ''
-
-File secretPropsFile = project.rootProject.file('local.properties')
-if (secretPropsFile.exists()) {
- // Read local.properties file first if it exists
- Properties p = new Properties()
- new FileInputStream(secretPropsFile).withCloseable { is -> p.load(is) }
- p.each { name, value -> ext[name] = value }
-} else {
- // Use system environment variables
- ext["ossrhUsername"] = System.getenv('OSSRH_USERNAME')
- ext["ossrhPassword"] = System.getenv('OSSRH_PASSWORD')
- ext["sonatypeStagingProfileId"] = System.getenv('SONATYPE_STAGING_PROFILE_ID')
- ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID')
- ext["signing.password"] = System.getenv('SIGNING_PASSWORD')
- ext["signing.secretKeyRingFile"] = System.getenv('SIGNING_SECRET_KEY_RING_FILE')
-}
-
-// Set up Sonatype repository
-nexusPublishing {
- repositories {
- sonatype {
- stagingProfileId = sonatypeStagingProfileId
- username = ossrhUsername
- password = ossrhPassword
- nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
- snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
- }
- }
-}
diff --git a/settings.gradle b/settings.gradle
index ad1826009b3bf6c06b3d866ba984cc213919a1f1..2609b599f85d75c862a3707305e2d6431c41d752 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1 +1 @@
-include ':app', ':loaderviewlibrary'
+include ':entry', ':loaderviewlibrary'