From dc07271ef3325eca86cf0d4d976eaf1d4c9a59b5 Mon Sep 17 00:00:00 2001 From: 251309-lirui Date: Mon, 19 Jul 2021 18:23:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E6=AC=A1=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 2 + README.OPENSOURCE | 16 ++ README.md | 86 ++++-- app/build.gradle | 27 -- app/proguard-rules.pro | 17 -- .../sampleloaderview/ApplicationTest.java | 13 - app/src/main/AndroidManifest.xml | 21 -- .../sampleloaderview/MainActivity.java | 79 ------ .../ic_mail_outline_grey_500_18dp.png | Bin 302 -> 0 bytes .../drawable-hdpi/ic_phone_grey_500_18dp.png | Bin 332 -> 0 bytes app/src/main/res/layout/activity_main.xml | 94 ------- app/src/main/res/mipmap-hdpi/ic_launcher.png | Bin 3418 -> 0 bytes app/src/main/res/mipmap-mdpi/ic_launcher.png | Bin 2206 -> 0 bytes app/src/main/res/mipmap-xhdpi/ic_launcher.png | Bin 4842 -> 0 bytes .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin 7718 -> 0 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.png | Bin 10486 -> 0 bytes app/src/main/res/values-w820dp/dimens.xml | 6 - app/src/main/res/values/colors.xml | 6 - app/src/main/res/values/dimens.xml | 7 - app/src/main/res/values/strings.xml | 4 - app/src/main/res/values/styles.xml | 11 - .../sampleloaderview/ExampleUnitTest.java | 15 -- build.gradle | 39 +-- {app => entry}/.gitignore | 0 entry/build.gradle | 28 ++ entry/proguard-rules.pro | 1 + entry/src/main/config.json | 45 ++++ .../sampleloaderview/MainAbility.java | 80 ++++++ .../sampleloaderview/MyApplication.java | 10 + .../main/resources/base/element/string.json | 25 ++ .../base/graphic/background_ability_main.xml | 6 + .../base/graphic/background_button.xml | 8 + .../resources/base/layout/ability_main.xml | 100 +++++++ entry/src/main/resources/base/media/icon.png | Bin 0 -> 6790 bytes .../src/main/resources/base/media}/trump.png | Bin .../src/main/resources/en/element/string.json | 20 ++ .../media}/ic_mail_outline_grey_500_18dp.png | Bin .../mdpi/media}/ic_phone_grey_500_18dp.png | Bin .../media}/ic_mail_outline_grey_500_18dp.png | Bin .../xldpi/media}/ic_phone_grey_500_18dp.png | Bin .../media}/ic_mail_outline_grey_500_18dp.png | Bin .../xxldpi/media}/ic_phone_grey_500_18dp.png | Bin .../media}/ic_mail_outline_grey_500_18dp.png | Bin .../xxxldpi/media}/ic_phone_grey_500_18dp.png | Bin .../src/main/resources/zh/element/string.json | 16 ++ .../sampleloaderview/ExampleOhosTest.java | 17 ++ .../sampleloaderview/ExampleTest.java | 9 + gif/loadview.gif | Bin 0 -> 1246053 bytes gradle.properties | 19 +- gradle/wrapper/gradle-wrapper.jar | Bin 53636 -> 58694 bytes gradle/wrapper/gradle-wrapper.properties | 3 +- gradlew | 247 ++++++++++-------- gradlew.bat | 193 +++++++------- loaderviewlibrary/build.gradle | 43 +-- loaderviewlibrary/consumer-rules.pro | 1 + loaderviewlibrary/proguard-rules.pro | 18 +- .../loaderviewlibrary/ApplicationTest.java | 13 - .../src/main/AndroidManifest.xml | 5 - loaderviewlibrary/src/main/config.json | 23 ++ .../loaderviewlibrary/LoaderTextView.java | 112 -------- .../elyeproj/loaderviewlibrary/AttrValue.java | 139 ++++++++++ .../loaderviewlibrary/LoaderConstant.java | 8 +- .../loaderviewlibrary/LoaderController.java | 94 ++++--- .../loaderviewlibrary/LoaderImageView.java | 121 +++++---- .../loaderviewlibrary/LoaderTextView.java | 147 +++++++++++ .../loaderviewlibrary/LoaderView.java | 6 +- .../LoaderViewValueAnimator.java | 65 +++++ .../src/main/res/values/attrs.xml | 10 - .../src/main/res/values/colors.xml | 5 - .../src/main/res/values/strings.xml | 2 - .../main/resources/base/element/color.json | 28 ++ .../main/resources/base/element/string.json | 8 + .../loaderviewlibrary/ExampleUnitTest.java | 15 -- .../loaderviewlibrary/ExampleTest.java | 9 + scripts/publish-module.gradle | 77 ------ scripts/publish-root.gradle | 36 --- settings.gradle | 2 +- 77 files changed, 1267 insertions(+), 990 deletions(-) create mode 100644 CHANGELOG.md create mode 100644 README.OPENSOURCE delete mode 100644 app/build.gradle delete mode 100644 app/proguard-rules.pro delete mode 100644 app/src/androidTest/java/com/elyeproj/sampleloaderview/ApplicationTest.java delete mode 100644 app/src/main/AndroidManifest.xml delete mode 100644 app/src/main/java/com/elyeproj/sampleloaderview/MainActivity.java delete mode 100644 app/src/main/res/drawable-hdpi/ic_mail_outline_grey_500_18dp.png delete mode 100644 app/src/main/res/drawable-hdpi/ic_phone_grey_500_18dp.png delete mode 100644 app/src/main/res/layout/activity_main.xml delete mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher.png delete mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher.png delete mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher.png delete mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher.png delete mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher.png delete mode 100644 app/src/main/res/values-w820dp/dimens.xml delete mode 100644 app/src/main/res/values/colors.xml delete mode 100644 app/src/main/res/values/dimens.xml delete mode 100644 app/src/main/res/values/strings.xml delete mode 100644 app/src/main/res/values/styles.xml delete mode 100644 app/src/test/java/com/elyeproj/sampleloaderview/ExampleUnitTest.java rename {app => entry}/.gitignore (100%) create mode 100644 entry/build.gradle create mode 100644 entry/proguard-rules.pro create mode 100644 entry/src/main/config.json create mode 100644 entry/src/main/java/es/guiguegon/elyeproj/sampleloaderview/MainAbility.java create mode 100644 entry/src/main/java/es/guiguegon/elyeproj/sampleloaderview/MyApplication.java create mode 100644 entry/src/main/resources/base/element/string.json create mode 100644 entry/src/main/resources/base/graphic/background_ability_main.xml create mode 100644 entry/src/main/resources/base/graphic/background_button.xml create mode 100644 entry/src/main/resources/base/layout/ability_main.xml create mode 100644 entry/src/main/resources/base/media/icon.png rename {app/src/main/res/drawable => entry/src/main/resources/base/media}/trump.png (100%) create mode 100644 entry/src/main/resources/en/element/string.json rename {app/src/main/res/drawable-mdpi => entry/src/main/resources/mdpi/media}/ic_mail_outline_grey_500_18dp.png (100%) rename {app/src/main/res/drawable-mdpi => entry/src/main/resources/mdpi/media}/ic_phone_grey_500_18dp.png (100%) rename {app/src/main/res/drawable-xhdpi => entry/src/main/resources/xldpi/media}/ic_mail_outline_grey_500_18dp.png (100%) rename {app/src/main/res/drawable-xhdpi => entry/src/main/resources/xldpi/media}/ic_phone_grey_500_18dp.png (100%) rename {app/src/main/res/drawable-xxhdpi => entry/src/main/resources/xxldpi/media}/ic_mail_outline_grey_500_18dp.png (100%) rename {app/src/main/res/drawable-xxhdpi => entry/src/main/resources/xxldpi/media}/ic_phone_grey_500_18dp.png (100%) rename {app/src/main/res/drawable-xxxhdpi => entry/src/main/resources/xxxldpi/media}/ic_mail_outline_grey_500_18dp.png (100%) rename {app/src/main/res/drawable-xxxhdpi => entry/src/main/resources/xxxldpi/media}/ic_phone_grey_500_18dp.png (100%) create mode 100644 entry/src/main/resources/zh/element/string.json create mode 100644 entry/src/ohosTest/java/es/guiguegon/elyeproj/sampleloaderview/ExampleOhosTest.java create mode 100644 entry/src/test/java/es/guiguegon/elyeproj/sampleloaderview/ExampleTest.java create mode 100644 gif/loadview.gif mode change 100755 => 100644 gradlew create mode 100644 loaderviewlibrary/consumer-rules.pro delete mode 100644 loaderviewlibrary/src/androidTest/java/com/elyeproj/loaderviewlibrary/ApplicationTest.java delete mode 100644 loaderviewlibrary/src/main/AndroidManifest.xml create mode 100644 loaderviewlibrary/src/main/config.json delete mode 100644 loaderviewlibrary/src/main/java/com/elyeproj/loaderviewlibrary/LoaderTextView.java create mode 100644 loaderviewlibrary/src/main/java/es/guiguegon/elyeproj/loaderviewlibrary/AttrValue.java rename loaderviewlibrary/src/main/java/{com => es/guiguegon}/elyeproj/loaderviewlibrary/LoaderConstant.java (83%) rename loaderviewlibrary/src/main/java/{com => es/guiguegon}/elyeproj/loaderviewlibrary/LoaderController.java (59%) rename loaderviewlibrary/src/main/java/{com => es/guiguegon}/elyeproj/loaderviewlibrary/LoaderImageView.java (36%) create mode 100644 loaderviewlibrary/src/main/java/es/guiguegon/elyeproj/loaderviewlibrary/LoaderTextView.java rename loaderviewlibrary/src/main/java/{com => es/guiguegon}/elyeproj/loaderviewlibrary/LoaderView.java (90%) create mode 100644 loaderviewlibrary/src/main/java/es/guiguegon/elyeproj/loaderviewlibrary/LoaderViewValueAnimator.java delete mode 100644 loaderviewlibrary/src/main/res/values/attrs.xml delete mode 100644 loaderviewlibrary/src/main/res/values/colors.xml delete mode 100644 loaderviewlibrary/src/main/res/values/strings.xml create mode 100644 loaderviewlibrary/src/main/resources/base/element/color.json create mode 100644 loaderviewlibrary/src/main/resources/base/element/string.json delete mode 100644 loaderviewlibrary/src/test/java/com/elyeproj/loaderviewlibrary/ExampleUnitTest.java create mode 100644 loaderviewlibrary/src/test/java/es/guiguegon/elyeproj/loaderviewlibrary/ExampleTest.java delete mode 100644 scripts/publish-module.gradle delete mode 100644 scripts/publish-root.gradle diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..5952c6e --- /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 0000000..3a4004d --- /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 b3e22fd..cdc541f 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,49 @@ -# Loader View for Android +# SineView -[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Loader%20View%20for%20Android-brightgreen.svg?style=flat)](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 -![Loader Image](https://static.wixstatic.com/media/d748c3_28381c0f110f4dc68fcd340b503f86a2~mv2.gif) +- 所属系列: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 a07ffff..0000000 --- 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 7712922..0000000 --- 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 20822bb..0000000 --- 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 f41e818..0000000 --- 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 4dfc2f5..0000000 --- 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 GIT binary patch literal 0 HcmV?d00001 literal 302 zcmV+}0nz@6P)NklI5uNhpL0=nGeL1iLtB! z%6984M>NC4kpJ9FIpW#g@U6b_EexgDRF0i$^URW|nP-N>m&Zn+a07*qoM6N<$f_hnZ A_W%F@ 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 GIT binary patch literal 0 HcmV?d00001 literal 332 zcmV-S0ki&zP)#{6=-4EY#{!R1$WcJvY9w6n?(!D+HhF5gBF&h;;`%` z5HnKSGE*Fufv_&MEn@}Z&p3Q0MvHv58qJ~?K&(ZpOznqektQum5EdZ52eoWDJ&LO& zB;VQ4+A?M!J_EJvE)et6x*!H6^&e0Rw?c!Lrlo!gQgANCW1$of>l4cO#JH#($--?w zEPy6&0K{*h@~?q-C$#41L9Z={v5XO|%)Af8_E0%}B#W@&ndDZUpdkH;WDqFxzrkbC ze`tM3c1^7Z#HR^ZKsC!?*&+d&C1`FLvZcO2yb_2%;jnBrEgC$a+QJxG^0WZ)3~24H eHZq%XG{peZBg9Ho5y(FP0000 - - - - - - - - - - - - - - - - - - - - -