diff --git a/README.md b/README.md
index beadfb16f6f9362ddfdd76045e028737b90a334a..bf8eb2a23c07a9f608119804c65b7705472da664 100644
--- a/README.md
+++ b/README.md
@@ -1,62 +1,127 @@
# AutoVerticalTextview
-垂直滚动的textview,继承自TextSwitcher,抽出一个依赖库供以后备用
-
-
-### 配置方法
-
-项目*build.gradle*文件内:
-````
- allprojects {
- repositories {
- ...
- maven { url "https://jitpack.io" }
- }
- }
-
-````
-module内*build.gradle*添加依赖:
- ````
- dependencies {
- compile 'com.github.paradoxie:AutoVerticalTextview:0.1'
- }
-
-````
-### 使用方法
-
-xml文件里:
-````
-
-````
-
-activity里:
-````
- TextView.setTextList(titleList);//加入显示内容,集合类型
- TextView.setText(26, 5, Color.RED);//设置属性,具体跟踪源码
- TextView.setTextStillTime(3000);//设置停留时长间隔
- TextView.setAnimTime(300);//设置进入和退出的时间间隔
- //对单条文字的点击监听
+
+**本项目基于开源项目AutoVerticalTextview 进行openharmony的移植和开发,可以通过项目标签以及github地址( https://github.com/paradoxie/AutoVerticalTextview )追踪到原安卓项目版本**
+
+#### 项目介绍
+- 项目名称:AutoVerticalTextview
+- 所属系列:openharmony的第三方组件适配移植
+- 功能:垂直滚动的textview
+- 项目移植状态:主功能完成
+- 调用差异:无
+- 开发版本:sdk5,DevEco Studio2.1 beta3
+- 项目作者和维护人:李同洲
+- 联系方式:litongzhou050@chinasoftinc.com
+- 原项目Doc地址:https://github.com/paradoxie/AutoVerticalTextview
+- 基线版本:AutoVerticalTextview组件 tag 0.1
+
+#### 效果演示
+
+
+
+
+#### 安装教程
+
+1.下载library的har包autoscrolltextview-release.har(位于:)。
+
+2.启动 DevEco Studio,将下载的har包,导入工程目录“entry->libs”下。
+
+3.在module级别下的build.gradle文件中添加依赖,在dependencies标签中增加对libs目录下jar包的引用。
+
+ ```
+ dependencies {
+ implementation fileTree(dir: 'libs', include: ['*.jar', '*.har'])
+ ......
+ }
+ ```
+
+在sdk5,DevEco Studio2.1 beta3下项目可直接运行
+如无法运行,删除项目.gradle,.idea,build,gradle,build.gradle文件,
+并依据自己的版本创建新项目,将新项目的对应文件复制到根目录下
+
+#### 使用说明
+
+将自定义view添加到XML中,使用方法如下:
+```java
+
+```
+
+完整调用:
+
+```java
+ ArrayList titleList = new ArrayList();
+ titleList.add("你是天上最受111");
+ titleList.add("我是丑人脸上22的鼻上的鼻上的鼻涕222");
+ titleList.add("你发出完美的声音333");
+ titleList.add("我被默默揩去44我被默默揩去444");
+ titleList.add("你冷酷外表画意555");
+ titleList.add("我已经够胖还胖还胖还吃东西666");
+
+ VerticalTextview TextView = (VerticalTextview)findComponentById(ResourceTable.Id_verticalText);
+ TextView.setTextList(titleList);
+ TextView.setText(56, 10,Color.BLUE.getValue());//设置属性
+ TextView.setTextStillTime(1500);//设置停留时长间隔
+ TextView.setAnimTime(1000);//设置进入和退出的时间间隔
TextView.setOnItemClickListener(new VerticalTextview.OnItemClickListener() {
- @Override
- public void onItemClick(int position) {
- // TO DO
- }
- });
-
-````
- //开始滚动
- @Override
- protected void onResume() {
- super.onResume();
- TextView.startAutoScroll();
- }
- //停止滚动
- @Override
- protected void onPause() {
- super.onPause();
- TextView.stopAutoScroll();
+ @Override
+ public void onItemClick(int position) {
+ ResUtils.showToast("点击了 : " + titleList.get(position));
}
-````
\ No newline at end of file
+ });
+```
+
+
+
+
+##### 关于 [VerticalTextview](https://gitee.com/chinasoft_ohos/AutoVerticalTextview/blob/master/autoscrolltextview/src/main/java/com/paradoxie/autoscrolltextview/VerticalTextview.java)
+
+
+| Method | Description |
+| :-------------------------- | :------------------------------- |
+| setTextList | 设置显示文字 |
+| setText | 设置显示文字大小、内边距、文字颜色 |
+| setAnimTime | 设置进入和退出的时间间隔 |
+| setOnItemClickListener | 设置点击事件 |
+| startAutoScroll | 设置开始滚动 |
+| stopAutoScroll | 设置停止滚动 |
+
+
+
+
+#### 测试信息
+
+CodeCheck代码测试无异常
+
+CloudTest代码测试无异常
+
+火绒安全病毒安全检测通过
+
+当前版本demo功能与安卓原组件基本无差异
+
+测试员:徐栋
+
+#### 版本迭代
+
+- v0.0.1_alpha
+
+### License
+
+```
+Copyright 2018 samlss
+
+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.
+```
diff --git a/app/.gitignore b/app/.gitignore
deleted file mode 100644
index 796b96d1c402326528b4ba3c12ee9d92d0e212e9..0000000000000000000000000000000000000000
--- a/app/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build
diff --git a/app/build.gradle b/app/build.gradle
deleted file mode 100644
index b9f3128aa1f2290700ec7074988fdb994fcf6729..0000000000000000000000000000000000000000
--- a/app/build.gradle
+++ /dev/null
@@ -1,27 +0,0 @@
-apply plugin: 'com.android.application'
-
-android {
- compileSdkVersion 24
- buildToolsVersion "24.0.0"
-
- defaultConfig {
- applicationId "com.paradoxie.autoverticaltextview"
- minSdkVersion 14
- targetSdkVersion 24
- versionCode 1
- versionName "1.0"
- }
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
- }
- }
-}
-
-dependencies {
- compile fileTree(dir: 'libs', include: ['*.jar'])
- testCompile 'junit:junit:4.12'
- compile 'com.android.support:appcompat-v7:24.0.0'
- compile 'com.github.paradoxie:AutoVerticalTextview:0.1'
-}
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
deleted file mode 100644
index 5fcd592d4ef47d91ba66309dbc59a040f457d8f8..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/xiehehe/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/paradoxie/autoverticaltextview/ApplicationTest.java b/app/src/androidTest/java/com/paradoxie/autoverticaltextview/ApplicationTest.java
deleted file mode 100644
index 22021fa5b081c0774a791f2bfecac6394cc921ea..0000000000000000000000000000000000000000
--- a/app/src/androidTest/java/com/paradoxie/autoverticaltextview/ApplicationTest.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.paradoxie.autoverticaltextview;
-
-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 65199107aa26c005535fe6459eed3d5b7030ff9a..0000000000000000000000000000000000000000
--- a/app/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/java/com/paradoxie/autoverticaltextview/MainActivity.java b/app/src/main/java/com/paradoxie/autoverticaltextview/MainActivity.java
deleted file mode 100644
index 28715bce4d68e19995fc58107cbc2cdf616e5ca9..0000000000000000000000000000000000000000
--- a/app/src/main/java/com/paradoxie/autoverticaltextview/MainActivity.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package com.paradoxie.autoverticaltextview;
-
-import android.graphics.Color;
-import android.os.Bundle;
-import android.support.v7.app.AppCompatActivity;
-import android.widget.Toast;
-
-import com.paradoxie.autoscrolltextview.VerticalTextview;
-
-import java.util.ArrayList;
-
-public class MainActivity extends AppCompatActivity {
- private VerticalTextview TextView;
- private ArrayList titleList = new ArrayList();
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- init();
- }
-
- private void init() {
- TextView = (VerticalTextview) findViewById(R.id.text);
- titleList.add("你是天上最受宠的一架钢琴");
- titleList.add("我是丑人脸上的鼻涕");
- titleList.add("你发出完美的声音");
- titleList.add("我被默默揩去");
- titleList.add("你冷酷外表下藏着诗情画意");
- titleList.add("我已经够胖还吃东西");
- titleList.add("你踏着七彩祥云离去");
- titleList.add("我被留在这里");
- TextView.setTextList(titleList);
- TextView.setText(26, 5, Color.RED);//设置属性
- TextView.setTextStillTime(3000);//设置停留时长间隔
- TextView.setAnimTime(300);//设置进入和退出的时间间隔
- TextView.setOnItemClickListener(new VerticalTextview.OnItemClickListener() {
- @Override
- public void onItemClick(int position) {
- Toast.makeText(MainActivity.this, "点击了 : " + titleList.get(position), Toast.LENGTH_SHORT).show();
- }
- });
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- TextView.startAutoScroll();
- }
-
- @Override
- protected void onPause() {
- super.onPause();
- TextView.stopAutoScroll();
- }
-}
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 6fe76e9e57d070e2f52700695c2dcd64b0abefb4..0000000000000000000000000000000000000000
--- a/app/src/main/res/layout/activity_main.xml
+++ /dev/null
@@ -1,18 +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 47c82246738c4d056e8030d3a259206f42e8e15d..0000000000000000000000000000000000000000
--- a/app/src/main/res/values/dimens.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
- 16dp
- 16dp
-
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
deleted file mode 100644
index 5df5d0ad6eb85fe32f2a8d026c33cf625a80ef50..0000000000000000000000000000000000000000
--- a/app/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
- AutoVerticalTextview
-
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/paradoxie/autoverticaltextview/ExampleUnitTest.java b/app/src/test/java/com/paradoxie/autoverticaltextview/ExampleUnitTest.java
deleted file mode 100644
index 7a304a863c271c26e6423c6bda1f089bc79d079c..0000000000000000000000000000000000000000
--- a/app/src/test/java/com/paradoxie/autoverticaltextview/ExampleUnitTest.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.paradoxie.autoverticaltextview;
-
-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/autoscrolltextview/build.gradle b/autoscrolltextview/build.gradle
index 46c017901cb4a7eed780ec6daed018b881d9dc16..ab88c3009d8c2ddd387481757f1eb81ba8c834fe 100644
--- a/autoscrolltextview/build.gradle
+++ b/autoscrolltextview/build.gradle
@@ -1,25 +1,13 @@
-apply plugin: 'com.android.library'
-
-android {
- compileSdkVersion 24
- buildToolsVersion "24.0.0"
-
+apply plugin: 'com.huawei.ohos.library'
+ohos {
+ compileSdkVersion 5
defaultConfig {
- minSdkVersion 14
- targetSdkVersion 24
- versionCode 1
- versionName "1.0"
- }
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
- }
+ compatibleSdkVersion 4
}
+
}
dependencies {
- compile fileTree(dir: 'libs', include: ['*.jar'])
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
- compile 'com.android.support:appcompat-v7:24.0.0'
}
diff --git a/autoscrolltextview/proguard-rules.pro b/autoscrolltextview/proguard-rules.pro
deleted file mode 100644
index 5fcd592d4ef47d91ba66309dbc59a040f457d8f8..0000000000000000000000000000000000000000
--- a/autoscrolltextview/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/xiehehe/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/autoscrolltextview/src/main/AndroidManifest.xml b/autoscrolltextview/src/main/AndroidManifest.xml
deleted file mode 100644
index 22882ddc82492372cafd7666a39d500fc41938cb..0000000000000000000000000000000000000000
--- a/autoscrolltextview/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
diff --git a/autoscrolltextview/src/main/config.json b/autoscrolltextview/src/main/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..5fac0317b655ca1735faca05c4436f3d2d5788b7
--- /dev/null
+++ b/autoscrolltextview/src/main/config.json
@@ -0,0 +1,27 @@
+{
+ "app": {
+ "bundleName": "com.paradoxie.autoverticaltextview",
+ "vendor": "paradoxie",
+ "version": {
+ "code": 1,
+ "name": "1.0"
+ },
+ "apiVersion": {
+ "compatible": 4,
+ "target": 5,
+ "releaseType": "Beta1"
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "com.paradoxie.autoscrolltextview",
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "autoscrolltextview",
+ "moduleType": "har"
+ }
+ }
+}
\ No newline at end of file
diff --git a/autoscrolltextview/src/main/java/com/paradoxie/autoscrolltextview/VerticalTextview.java b/autoscrolltextview/src/main/java/com/paradoxie/autoscrolltextview/VerticalTextview.java
index 4dac100c7a57b637ae44587fa51e0db5078933d7..4619787de98be930f6ef4f3e951c0d696d30fd30 100644
--- a/autoscrolltextview/src/main/java/com/paradoxie/autoscrolltextview/VerticalTextview.java
+++ b/autoscrolltextview/src/main/java/com/paradoxie/autoscrolltextview/VerticalTextview.java
@@ -1,81 +1,93 @@
-package com.paradoxie.autoscrolltextview;/**
- * Created by xiehehe on 16/7/19.
- */
-
-import android.content.Context;
-import android.graphics.Color;
-import android.os.Handler;
-import android.os.Message;
-import android.util.AttributeSet;
-import android.view.Gravity;
-import android.view.View;
-import android.view.animation.AccelerateInterpolator;
-import android.view.animation.Animation;
-import android.view.animation.TranslateAnimation;
-import android.widget.TextSwitcher;
-import android.widget.TextView;
-import android.widget.ViewSwitcher;
+package com.paradoxie.autoscrolltextview;
+
+import ohos.agp.animation.Animator;
+import ohos.agp.animation.AnimatorProperty;
+import ohos.agp.colors.RgbColor;
+import ohos.agp.components.*;
+import ohos.agp.components.element.Element;
+import ohos.agp.components.element.ShapeElement;
+import ohos.agp.utils.Color;
+import ohos.agp.utils.LayoutAlignment;
+import ohos.app.Context;
+import ohos.eventhandler.EventHandler;
+import ohos.eventhandler.EventRunner;
+import ohos.eventhandler.InnerEvent;
+import ohos.hiviewdfx.HiLog;
+import ohos.hiviewdfx.HiLogLabel;
import java.util.ArrayList;
-/**
- * User: xiehehe
- * Date: 2016-07-19
- * Time: 22:45
- * FIXME
- */
-public class VerticalTextview extends TextSwitcher implements ViewSwitcher.ViewFactory {
+public class VerticalTextview extends DependentLayout {
+
+ private static final HiLogLabel LABEL = new HiLogLabel(HiLog.DEBUG, 0x00201, "MY_TAG");
private static final int FLAG_START_AUTO_SCROLL = 0;
private static final int FLAG_STOP_AUTO_SCROLL = 1;
- private static final int STATE_PAUSE = 2;
- private static final int STATE_SCROLL = 3;
-
- private float mTextSize = 16;
- private int mPadding = 5;
- private int textColor = Color.BLACK;
-
- private int mScrollState = STATE_PAUSE;
-
- /**
- * @param textSize textsize
- * @param padding padding
- * @param textColor textcolor
- */
- public void setText(float textSize, int padding, int textColor) {
- mTextSize = textSize;
- mPadding = padding;
- this.textColor = textColor;
- }
+ private int mTextSize = 16;
private OnItemClickListener itemClickListener;
private Context mContext;
- private int currentId = -1;
+ private int currentId = 0;
+ private int clickId = 0;
private ArrayList textList;
- private Handler handler;
+ private EventHandler handler;
+ private Text t1,t2,t3;
+ private long animDuration;
+ private boolean isFirst = true;
+ private int layoutHeight = 20;
- public VerticalTextview(Context context) {
- this(context, null);
+ public VerticalTextview(Context context, AttrSet attrSet) {
+ super(context, attrSet);
mContext = context;
+ textList = new ArrayList();
+
+ makeView();
}
- public VerticalTextview(Context context, AttributeSet attrs) {
- super(context, attrs);
- mContext = context;
- textList = new ArrayList();
+ public void setText(int textSize, int padding){
+ this.setText(textSize,padding,0);
+ }
+
+ public void setText(int textSize, int padding, int textColor){
+ setText(textSize,padding,padding,padding,padding,textColor);
+ }
+
+ public void setText(int textSize, int left, int top, int right, int bottom, int textColor) {
+ mTextSize = textSize;
+
+ if(textColor!=0){
+ t1.setTextColor(new Color(textColor));
+ t2.setTextColor(new Color(textColor));
+ t3.setTextColor(new Color(textColor));
+ }
+
+ t1.setTextSize(textSize);
+ t2.setTextSize(textSize);
+ t3.setTextSize(textSize);
+
+ t1.setPadding(left,top,right,bottom);
+ t2.setPadding(left,top,right,bottom);
+ t3.setPadding(left,top,right,bottom);
+
+ setBindStateChangedListener(new BindStateChangedListener() {
+ @Override
+ public void onComponentBoundToWindow(Component component) {
+ t3.setWidth(getWidth());
+ t3.setHeight(getHeight());
+ }
+
+ @Override
+ public void onComponentUnboundFromWindow(Component component) {
+ if(handler!=null){
+ handler.removeAllEvent();
+ }
+ }
+ });
}
public void setAnimTime(long animDuration) {
- setFactory(this);
- Animation in = new TranslateAnimation(0, 0, animDuration, 0);
- in.setDuration(animDuration);
- in.setInterpolator(new AccelerateInterpolator());
- Animation out = new TranslateAnimation(0, 0, 0, -animDuration);
- out.setDuration(animDuration);
- out.setInterpolator(new AccelerateInterpolator());
- setInAnimation(in);
- setOutAnimation(out);
+ this.animDuration = animDuration;
}
/**
@@ -84,23 +96,142 @@ public class VerticalTextview extends TextSwitcher implements ViewSwitcher.ViewF
* @param time
*/
public void setTextStillTime(final long time) {
- handler = new Handler() {
+ EventRunner runner = EventRunner.create(true);// create()的参数是 true时,则为托管模式
+ // 需要对 EventRunner 的实例进行校验,因为创建 EventRunner 可能失败,如创建线程失败时,创建 EventRunner 失败。
+ if (runner == null) {
+ return;
+ }
+ handler = new EventHandler(runner){
+ // 重写实现processEvent方法
@Override
- public void handleMessage(Message msg) {
- switch (msg.what) {
+ public void processEvent(InnerEvent event) {
+ super.processEvent(event);
+ if (event == null) {
+ return;
+ }
+ int eventId = event.eventId;
+ switch (eventId) {
case FLAG_START_AUTO_SCROLL:
+ // 待执行的操作,由开发者定义
if (textList.size() > 0) {
- currentId++;
- setText(textList.get(currentId % textList.size()));
+
+ runUI(new Runnable() {
+ @Override
+ public void run() {
+
+ clickId++;
+ if(clickId==textList.size()){
+ clickId =0;
+ }
+
+ t1.setWidth(getWidth());
+ t1.setHeight(getHeight());
+ t2.setWidth(getWidth());
+ t2.setHeight(getHeight());
+
+ int height2 = t1.getHeight();
+ AnimatorProperty out = createAnimatorProperty();
+ out.moveFromY(0).moveToY(-height2).setDuration(animDuration);
+ out.setTarget(t1);
+ out.start();
+
+ int height = t2.getHeight();
+ AnimatorProperty out2 = createAnimatorProperty();
+ out2.moveFromY(height).moveToY(0).setDuration(animDuration);
+ out2.setTarget(t2);
+ out2.setStateChangedListener(new Animator.StateChangedListener() {
+ @Override
+ public void onStart(Animator animator) {
+ if(t1.getVisibility() != VISIBLE){
+ t1.setVisibility(VISIBLE);
+ }
+ if(t2.getVisibility() != VISIBLE){
+ t2.setVisibility(VISIBLE);
+ }
+
+
+ handler.postTask(new Runnable() {
+ @Override
+ public void run() {
+ mContext.getUITaskDispatcher().asyncDispatch(new Runnable() {
+ @Override
+ public void run() {
+ t3.setVisibility(INVISIBLE);
+ }
+ });
+ }
+ }, 60);
+ }
+
+ @Override
+ public void onStop(Animator animator) {
+
+ }
+
+ @Override
+ public void onCancel(Animator animator) {
+
+ }
+
+ @Override
+ public void onEnd(Animator animator) {
+ mContext.getUITaskDispatcher().asyncDispatch(new Runnable() {
+ @Override
+ public void run() {
+ t3.setText(textList.get(currentId));
+ t3.setVisibility(VISIBLE);
+
+ t1.setVisibility(INVISIBLE);
+ t2.setVisibility(INVISIBLE);
+
+ t1.setText(textList.get(currentId));
+
+ if(currentId==textList.size()-1){
+ t2.setText(textList.get(0));
+ }else{
+ t2.setText(textList.get(currentId+1));
+ }
+
+ clickId = currentId;
+ currentId++;
+ if(currentId==textList.size()){
+ currentId =0;
+ }
+ }
+ });
+
+ }
+
+ @Override
+ public void onPause(Animator animator) {
+
+ }
+
+ @Override
+ public void onResume(Animator animator) {
+
+ }
+ });
+ out2.start();
+ }
+ });
+ if(isFirst){
+ isFirst = false;
+ handler.sendEvent(FLAG_START_AUTO_SCROLL, time);
+ }else{
+ handler.sendEvent(FLAG_START_AUTO_SCROLL, animDuration+time);
+ }
+
}
- handler.sendEmptyMessageDelayed(FLAG_START_AUTO_SCROLL, time);
+
break;
case FLAG_STOP_AUTO_SCROLL:
- handler.removeMessages(FLAG_START_AUTO_SCROLL);
+ handler.removeAllEvent();
break;
}
}
};
+
}
/**
@@ -111,81 +242,114 @@ public class VerticalTextview extends TextSwitcher implements ViewSwitcher.ViewF
public void setTextList(ArrayList titles) {
textList.clear();
textList.addAll(titles);
- currentId = -1;
+ currentId = 0;
+ if(textList!= null && textList.size()>0){
+ t1.setText(textList.get(currentId));
+ t3.setText(textList.get(currentId));
+
+ if(textList.size()>1) {
+ t2.setText(textList.get(currentId+1));
+ currentId++;
+ }
+ }
+
}
/**
* start auto scroll
*/
- public void startAutoScroll() {
- mScrollState = STATE_SCROLL;
- handler.sendEmptyMessage(FLAG_START_AUTO_SCROLL);
+ public void startAutoScroll()
+ {
+ if(textList!= null && textList.size()>1){
+
+ if(getHeight()!=0){
+ t3.setWidth(getWidth());
+ t3.setHeight(getHeight());
+ }
+
+ t1.setVisibility(INVISIBLE);
+ t2.setVisibility(INVISIBLE);
+ t3.setVisibility(VISIBLE);
+ handler.sendEvent(FLAG_START_AUTO_SCROLL);
+ }
+
}
/**
* stop auto scroll
*/
public void stopAutoScroll() {
- mScrollState = STATE_PAUSE;
- handler.sendEmptyMessage(FLAG_STOP_AUTO_SCROLL);
+ handler.sendEvent(FLAG_STOP_AUTO_SCROLL);
}
- @Override
- public View makeView() {
- TextView t = new TextView(mContext);
- t.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT);
- t.setMaxLines(1);
- t.setPadding(mPadding, mPadding, mPadding, mPadding);
- t.setTextColor(textColor);
- t.setTextSize(mTextSize);
-
- t.setClickable(true);
- t.setOnClickListener(new OnClickListener() {
+ private void makeView() {
+
+ t1 = new Text(mContext);
+ DirectionalLayout.LayoutConfig layoutConfig = new DirectionalLayout.LayoutConfig(DirectionalLayout.LayoutConfig.MATCH_CONTENT,
+ DirectionalLayout.LayoutConfig.MATCH_CONTENT);
+ layoutConfig.alignment = LayoutAlignment.VERTICAL_CENTER|LayoutAlignment.LEFT;
+ t1.setLayoutConfig(layoutConfig);
+ t1.setMaxTextLines(1);
+ t1.setTruncationMode(Text.TruncationMode.ELLIPSIS_AT_END);
+ t1.setTextSize(mTextSize);
+ addComponent(t1);
+
+ t2 = new Text(mContext);
+ DirectionalLayout.LayoutConfig layoutConfig2 = new DirectionalLayout.LayoutConfig(
+ DirectionalLayout.LayoutConfig.MATCH_CONTENT,
+ DirectionalLayout.LayoutConfig.MATCH_CONTENT);
+ layoutConfig2.alignment = LayoutAlignment.VERTICAL_CENTER|LayoutAlignment.LEFT;
+ t2.setTruncationMode(Text.TruncationMode.ELLIPSIS_AT_END);
+ t2.setLayoutConfig(layoutConfig2);
+ t2.setMaxTextLines(1);
+ t2.setTextSize(mTextSize);
+ addComponent(t2);
+
+ t3 = new Text(mContext);
+ DirectionalLayout.LayoutConfig layoutConfig3 = new DirectionalLayout.LayoutConfig(
+ DirectionalLayout.LayoutConfig.MATCH_CONTENT,
+ DirectionalLayout.LayoutConfig.MATCH_CONTENT);
+ layoutConfig3.alignment = LayoutAlignment.VERTICAL_CENTER|LayoutAlignment.LEFT;
+
+ Element element = getBackgroundElement();
+ if(element == null){
+ ShapeElement element2 = new ShapeElement();
+ element2.setRgbColor(new RgbColor(255, 255, 255));
+ t3.setBackground(element2);
+ }else{
+ t3.setBackground(element);
+ }
+ t3.setTruncationMode(Text.TruncationMode.ELLIPSIS_AT_END);
+ t3.setLayoutConfig(layoutConfig3);
+ t3.setMaxTextLines(1);
+ t3.setTextSize(mTextSize);
+ addComponent(t3);
+
+ this.setClickedListener(new ClickedListener() {
@Override
- public void onClick(View v) {
- if (itemClickListener != null && textList.size() > 0 && currentId != -1) {
- itemClickListener.onItemClick(currentId % textList.size());
+ public void onClick(Component component) {
+ if (itemClickListener != null && textList.size() > 0) {
+ itemClickListener.onItemClick(clickId );
}
}
});
- return t;
}
- /**
- * set onclick listener
- *
- * @param itemClickListener listener
- */
public void setOnItemClickListener(OnItemClickListener itemClickListener) {
this.itemClickListener = itemClickListener;
}
- /**
- * item click listener
- */
public interface OnItemClickListener {
- /**
- * callback
- *
- * @param position position
- */
void onItemClick(int position);
}
- public boolean isScroll(){
- return mScrollState ==STATE_SCROLL;
- }
- public boolean isPause(){
- return mScrollState == STATE_PAUSE;
+ private static void runUI(Runnable runnable){
+ // 切换到主线程
+ EventRunner runner = EventRunner.getMainEventRunner();
+ EventHandler eventHandler = new EventHandler(runner);
+ //切换任务
+ eventHandler.postSyncTask(runnable);
}
- //memory leancks.
- @Override
- protected void onDetachedFromWindow() {
- super.onDetachedFromWindow();
- if(handler!=null){
- handler.removeCallbacksAndMessages(null);
- }
- }
}
diff --git a/autoscrolltextview/src/main/res/values/strings.xml b/autoscrolltextview/src/main/res/values/strings.xml
deleted file mode 100644
index aef947aa6df5c5e4494b30c0c857c67ef0d6ed46..0000000000000000000000000000000000000000
--- a/autoscrolltextview/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
- AutoscrollTextview
-
diff --git a/autoscrolltextview/src/main/resources/base/element/string.json b/autoscrolltextview/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..fae43378cb2dcacabd2f81477ccdb0ea2a1cc7ba
--- /dev/null
+++ b/autoscrolltextview/src/main/resources/base/element/string.json
@@ -0,0 +1,8 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "autoscrolltextview"
+ }
+ ]
+}
diff --git a/autoscrolltextview/src/main/resources/base/graphic/background_btn_element.xml b/autoscrolltextview/src/main/resources/base/graphic/background_btn_element.xml
new file mode 100644
index 0000000000000000000000000000000000000000..5af0ca97d46dc20fea0f4f57aa1215130ab1c599
--- /dev/null
+++ b/autoscrolltextview/src/main/resources/base/graphic/background_btn_element.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/autoscrolltextview/src/test/java/com/paradoxie/autoscrolltextview/ExampleUnitTest.java b/autoscrolltextview/src/test/java/com/paradoxie/autoscrolltextview/ExampleUnitTest.java
deleted file mode 100644
index 49a81a28062a8ffc1e4c3fbf9b84e0f3f2892438..0000000000000000000000000000000000000000
--- a/autoscrolltextview/src/test/java/com/paradoxie/autoscrolltextview/ExampleUnitTest.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.paradoxie.autoscrolltextview;
-
-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 317f714cd400abfe6ca871ab359218501b93f5b3..0f37d1b371f1632aaf2af4a2814463596cc0ddf0 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,24 +1,37 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
+apply plugin: 'com.huawei.ohos.app'
+
+ohos {
+ compileSdkVersion 5
+ defaultConfig {
+ compatibleSdkVersion 5
+ }
+}
buildscript {
repositories {
+ maven {
+ url 'https://mirrors.huaweicloud.com/repository/maven/'
+ }
+ maven {
+ url 'https://developer.huawei.com/repo/'
+ }
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.1.2'
-
- // NOTE: Do not place your application dependencies here; they belong
- // in the individual module build.gradle files
+ classpath 'com.huawei.ohos:hap:2.4.2.5'
+ classpath 'com.huawei.ohos:decctest:1.0.0.6'
}
}
allprojects {
repositories {
+ maven {
+ url 'https://mirrors.huaweicloud.com/repository/maven/'
+ }
+ maven {
+ url 'https://developer.huawei.com/repo/'
+ }
jcenter()
- maven { url "https://jitpack.io" }
}
}
-
-task clean(type: Delete) {
- delete rootProject.buildDir
-}
diff --git a/entry/build.gradle b/entry/build.gradle
new file mode 100644
index 0000000000000000000000000000000000000000..96e4562aef94e92c7d3a8c6f9d5183237b5599df
--- /dev/null
+++ b/entry/build.gradle
@@ -0,0 +1,17 @@
+apply plugin: 'com.huawei.ohos.hap'
+ohos {
+ signingConfigs {
+
+ }
+ compileSdkVersion 5
+ defaultConfig {
+ compatibleSdkVersion 5
+ }
+}
+
+dependencies {
+ implementation fileTree(dir: 'libs', include: ['*.jar', '*.har'])
+ testCompile 'junit:junit:4.12'
+
+ implementation project(':autoscrolltextview')
+}
diff --git a/entry/src/main/config.json b/entry/src/main/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..f16022f1342e26fb81993ea7fe43c62ba7adcb15
--- /dev/null
+++ b/entry/src/main/config.json
@@ -0,0 +1,49 @@
+{
+ "app": {
+ "bundleName": "com.paradoxie.autoverticaltextview",
+ "vendor": "paradoxie",
+ "version": {
+ "code": 1,
+ "name": "1.0"
+ },
+ "apiVersion": {
+ "compatible": 5,
+ "target": 5,
+ "releaseType": "Beta1"
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "com.paradoxie.autoverticaltextview",
+ "name": ".MyApplication",
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "entry",
+ "moduleType": "entry"
+ },
+ "abilities": [
+ {
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "orientation": "unspecified",
+ "name": "com.paradoxie.autoverticaltextview.MainAbility",
+ "icon": "$media:icon",
+ "description": "$string:mainability_description",
+ "label": "AutoVerticalTextView",
+ "type": "page",
+ "launchType": "standard"
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/entry/src/main/java/com/paradoxie/autoverticaltextview/MainAbility.java b/entry/src/main/java/com/paradoxie/autoverticaltextview/MainAbility.java
new file mode 100644
index 0000000000000000000000000000000000000000..8ef8a9162e501a1830e768229e08c52d92bc33ab
--- /dev/null
+++ b/entry/src/main/java/com/paradoxie/autoverticaltextview/MainAbility.java
@@ -0,0 +1,13 @@
+package com.paradoxie.autoverticaltextview;
+
+import com.paradoxie.autoverticaltextview.slice.MainAbilitySlice;
+import ohos.aafwk.ability.Ability;
+import ohos.aafwk.content.Intent;
+
+public class MainAbility extends Ability {
+ @Override
+ public void onStart(Intent intent) {
+ super.onStart(intent);
+ super.setMainRoute(MainAbilitySlice.class.getName());
+ }
+}
diff --git a/entry/src/main/java/com/paradoxie/autoverticaltextview/MyApplication.java b/entry/src/main/java/com/paradoxie/autoverticaltextview/MyApplication.java
new file mode 100644
index 0000000000000000000000000000000000000000..8328e61542bb737fd984b757ab1b4da4fe071e07
--- /dev/null
+++ b/entry/src/main/java/com/paradoxie/autoverticaltextview/MyApplication.java
@@ -0,0 +1,20 @@
+package com.paradoxie.autoverticaltextview;
+
+import ohos.aafwk.ability.AbilityPackage;
+import ohos.app.Context;
+
+public class MyApplication extends AbilityPackage {
+
+ private static Context mContext;
+
+ @Override
+ public void onInitialize() {
+ super.onInitialize();
+ mContext = getApplicationContext();
+ }
+
+ public static Context getAppContext(){
+ return mContext;
+ }
+
+}
diff --git a/entry/src/main/java/com/paradoxie/autoverticaltextview/slice/MainAbilitySlice.java b/entry/src/main/java/com/paradoxie/autoverticaltextview/slice/MainAbilitySlice.java
new file mode 100644
index 0000000000000000000000000000000000000000..75873110180054198d9bc83edf740a02049ecab5
--- /dev/null
+++ b/entry/src/main/java/com/paradoxie/autoverticaltextview/slice/MainAbilitySlice.java
@@ -0,0 +1,64 @@
+package com.paradoxie.autoverticaltextview.slice;
+
+import com.paradoxie.autoscrolltextview.VerticalTextview;
+import com.paradoxie.autoverticaltextview.ResourceTable;
+import ohos.aafwk.ability.AbilitySlice;
+import ohos.aafwk.ability.OnClickListener;
+import ohos.aafwk.content.Intent;
+import ohos.agp.components.Component;
+import ohos.agp.components.Text;
+import ohos.agp.utils.Color;
+
+import java.util.ArrayList;
+
+public class MainAbilitySlice extends AbilitySlice {
+
+ private VerticalTextview TextView;
+ private ArrayList titleList = new ArrayList();
+
+
+ @Override
+ public void onStart(Intent intent) {
+ super.onStart(intent);
+ super.setUIContent(ResourceTable.Layout_ability_main);
+
+ init();
+
+ }
+
+ public void init() {
+ TextView = (VerticalTextview)findComponentById(ResourceTable.Id_verticalText);
+ titleList.add("你是天上最受111");
+ titleList.add("我是丑人脸上22的鼻上的鼻上的鼻涕222");
+ titleList.add("你发出完美的声音333");
+ titleList.add("我被默默揩去44我被默默揩去444");
+ titleList.add("你冷酷外表画意555");
+ titleList.add("我已经够胖还胖还胖还吃东西666");
+// titleList.add("你踏着七彩祥云离去777");
+// titleList.add("我被留在这里888");
+ TextView.setTextList(titleList);
+ TextView.setText(56, 10,Color.BLUE.getValue());//设置属性
+ TextView.setTextStillTime(1500);//设置停留时长间隔
+ TextView.setAnimTime(1000);//设置进入和退出的时间间隔
+ TextView.setOnItemClickListener(new VerticalTextview.OnItemClickListener() {
+ @Override
+ public void onItemClick(int position) {
+ ResUtils.showToast("点击了 : " + titleList.get(position));
+ }
+ });
+
+
+ }
+
+ @Override
+ public void onActive() {
+ super.onActive();
+ TextView.startAutoScroll();
+ }
+
+ @Override
+ public void onForeground(Intent intent) {
+ super.onForeground(intent);
+ TextView.stopAutoScroll();
+ }
+}
diff --git a/entry/src/main/java/com/paradoxie/autoverticaltextview/slice/ResUtils.java b/entry/src/main/java/com/paradoxie/autoverticaltextview/slice/ResUtils.java
new file mode 100644
index 0000000000000000000000000000000000000000..34740adf0537e9f72e70e69c3cdc7507dcd1d7cf
--- /dev/null
+++ b/entry/src/main/java/com/paradoxie/autoverticaltextview/slice/ResUtils.java
@@ -0,0 +1,61 @@
+package com.paradoxie.autoverticaltextview.slice;
+
+import com.paradoxie.autoverticaltextview.MyApplication;
+import com.paradoxie.autoverticaltextview.ResourceTable;
+import ohos.agp.components.DirectionalLayout;
+import ohos.agp.components.LayoutScatter;
+import ohos.agp.components.Text;
+import ohos.agp.utils.LayoutAlignment;
+import ohos.agp.window.dialog.ToastDialog;
+import ohos.app.Context;
+import ohos.hiviewdfx.HiLog;
+import ohos.hiviewdfx.HiLogLabel;
+
+public class ResUtils {
+
+ private static final HiLogLabel LABEL = new HiLogLabel(HiLog.DEBUG, 0x00201, "TAG");
+
+
+ /**
+ * ResourceTable.String_
+ */
+ public static String getString(int resid){
+ String str = "id异常";
+
+ try {
+ str = MyApplication.getAppContext().getResourceManager().getElement(resid).getString();
+ } catch (Exception e) {
+ return str;
+ }
+ return str;
+ }
+
+ public static void LogE(String format, Object... args){
+ HiLog.error(LABEL,format,args);
+ }
+
+ public static void LogLine(){
+ LogLine("");
+ }
+
+ public static void LogLine(String log){
+ HiLog.error(LABEL,"======================="+log+"============================");
+ }
+
+ public static void LogEResId(Context mContext,int resId, Object... args){
+ HiLog.error(LABEL,getString(resId),args);
+ }
+
+
+ public static void showToast(String msg){
+ DirectionalLayout layout = (DirectionalLayout) LayoutScatter.getInstance(MyApplication.getAppContext())
+ .parse(ResourceTable.Layout_layout_toast, null, false);
+ Text text = (Text) layout.findComponentById(ResourceTable.Id_msg_toast);
+ text.setText(msg);
+ new ToastDialog(MyApplication.getAppContext())
+ .setComponent(layout)
+ .setSize(DirectionalLayout.LayoutConfig.MATCH_CONTENT, DirectionalLayout.LayoutConfig.MATCH_CONTENT)
+ .setAlignment(LayoutAlignment.CENTER)
+ .show();
+ }
+}
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..941bed75acad65a8b8effeafff5e3b7764099727
--- /dev/null
+++ b/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,16 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "AutoVerticalTextView"
+ },
+ {
+ "name": "mainability_description",
+ "value": "Java_Phone_Empty Feature Ability"
+ },
+ {
+ "name": "HelloWorld",
+ "value": "Hello World"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/entry/src/main/resources/base/graphic/background_ability_main.xml b/entry/src/main/resources/base/graphic/background_ability_main.xml
new file mode 100644
index 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_btn_element.xml b/entry/src/main/resources/base/graphic/background_btn_element.xml
new file mode 100644
index 0000000000000000000000000000000000000000..ad2ce6fad41c85693976644edd89f68ebb35daba
--- /dev/null
+++ b/entry/src/main/resources/base/graphic/background_btn_element.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..d248f0396c640b8b1102837d2d27006c75c13a00
--- /dev/null
+++ b/entry/src/main/resources/base/layout/ability_main.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/entry/src/main/resources/base/layout/layout_toast.xml b/entry/src/main/resources/base/layout/layout_toast.xml
new file mode 100644
index 0000000000000000000000000000000000000000..a454273f00b094a7cf219396d7f620d3a614f321
--- /dev/null
+++ b/entry/src/main/resources/base/layout/layout_toast.xml
@@ -0,0 +1,19 @@
+
+
+
+
\ 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/gradle.properties b/gradle.properties
index 1d3591c8a4c9c29578c36c87f80c05a6aea3ee3f..0daf1830fbdef07e50a44d74210c8c82f1b66278 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,18 +1,10 @@
# 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
\ No newline at end of file
+# If the Chinese output is garbled, please configure the following parameter.
+# org.gradle.jvmargs=-Dfile.encoding=GBK
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 122a0dca2e800b3ccf474321fc5e63551f507d29..f59159e865d4b59feb1b8c44b001f62fc5d58df4 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,5 @@
-#Mon Dec 28 10:00:20 PST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
+distributionUrl=https\://repo.huaweicloud.com/gradle/gradle-6.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
diff --git a/gradlew b/gradlew
index 9d82f78915133e1c35a6ea51252590fb38efac2f..2fe81a7d95e4f9ad2c9b2a046707d36ceb3980b3 100755
--- 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,20 +22,38 @@
##
##############################################################################
-# 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"`
+# 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 ( ) {
+warn () {
echo "$*"
}
-die ( ) {
+die () {
echo
echo "$*"
echo
@@ -30,6 +64,7 @@ die ( ) {
cygwin=false
msys=false
darwin=false
+nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
@@ -40,26 +75,11 @@ case "`uname`" in
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.
@@ -85,7 +105,7 @@ location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+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
@@ -105,8 +125,8 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
+# 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"`
@@ -134,27 +154,30 @@ if $cygwin ; then
else
eval `echo args$i`="\"$arg\""
fi
- i=$((i+1))
+ 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" ;;
+ 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 8a0b282aa6885fb573c106b3551f7275c5f17e8e..62bd9b9ccefea2b65ae41e5d9a545e2021b90a1d 100644
--- a/gradlew.bat
+++ b/gradlew.bat
@@ -1,3 +1,19 @@
+@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
@@ -8,14 +24,17 @@
@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 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
@@ -46,10 +65,9 @@ echo location of your Java installation.
goto fail
:init
-@rem Get command-line arguments, handling Windowz variants
+@rem Get command-line arguments, handling Windows 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.
@@ -60,11 +78,6 @@ set _SKIP=2
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
diff --git a/printscreen/verticaltextview.png b/printscreen/verticaltextview.png
new file mode 100644
index 0000000000000000000000000000000000000000..d2218d867d4ef9f8a8e06ce5dc1706ff8ec5a06e
Binary files /dev/null and b/printscreen/verticaltextview.png differ
diff --git a/settings.gradle b/settings.gradle
index c35574c86146d27224b12f6fc1c4f50cf99c5a1a..6170c08d1f8130e3678aac95425138099af3eead 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1 +1 @@
-include ':app', ':autoscrolltextview'
+include ':entry', ':autoscrolltextview'