diff --git a/.gitignore b/.gitignore
index b8363dd8f02e393670d570d88b0969cf410cd284..0526d3faec963dfb6502e219bcca516287c7c891 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,39 +1,15 @@
-# Built application files
-*.ap_
-
-# Files for the ART/Dalvik VM
-*.dex
-
-# Java class files
-*.class
-
-# Generated files
-bin/
-gen/
-out/
-
-# Gradle files
-.gradle/
-build/
-
-# Local configuration file (sdk path, etc)
-local.properties
-
-# Proguard folder generated by Eclipse
-proguard/
-
-# Log Files
-*.log
-
-# Android Studio Navigation editor temp files
-.navigation/
-
-# Android Studio captures folder
-captures/
-
-# Intellij
*.iml
-.idea/workspace.xml
-
-# Keystore files
-*.jks
+/local.properties
+/.idea
+/.idea/caches
+/.idea/libraries
+/.idea/modules.xml
+/.idea/workspace.xml
+/.idea/navEditor.xml
+/.idea/assetWizardSettings.xml
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+.cxx
+/.gradle
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
deleted file mode 100644
index 9070d82b02fefc4866d5834ffbcfcd73baeadc42..0000000000000000000000000000000000000000
--- a/.idea/gradle.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
deleted file mode 100644
index 2ad7c15dbeb8084d2f1509c3a2e5cdf7cb2be88d..0000000000000000000000000000000000000000
--- a/.idea/misc.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
deleted file mode 100644
index 00079d20a7dae66b7576507d9f3b8b99f2e3f0f0..0000000000000000000000000000000000000000
--- a/.idea/modules.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
deleted file mode 100644
index 35eb1ddfbbc029bcab630581847471d7f238ec53..0000000000000000000000000000000000000000
--- a/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/README.md b/README.md
index 707afa9d570f82af7d238d593d84edcc30bfd36d..b523807a1c5778cb3ea23e151174b5e2c1d6a076 100644
--- a/README.md
+++ b/README.md
@@ -1,126 +1,133 @@
-# StateButton
+# RoundCorners
-###中文版这里: https://github.com/niniloveyou/StateButton/blob/master/README_CHINESE.md
+**本项目是基于开源项目RoundCorners进行鸿蒙化的移植和开发的,可以通过项目标签以及github地址
+( https://github.com/niniloveyou/StateButton )追踪到原安卓项目版本**
-Do you hate to write a background for each button?
+### 项目介绍
-Do you hate to write a bunch of selector?
+- 项目名称:RoundCorners工具类
+- 所属系列:openharmony第三方组件适配移植
+- 功能:button点击效果
+- 项目移植状态:移植完成
+- 调用差异:无
+- 开发版本:sdk5,DevEco Studio2.1 beta3
+- 项目作者和维护人:王鹏
+- 联系方式:wangpeng067@chinasoftinc.com
+- 原项目Doc地址:https://github.com/niniloveyou/StateButton
+- 编程语言:Java
-That's why I'm writing this view.
+### 效果演示
+
+
+
+### 安装教程
-Here to download demo
-----------
-https://github.com/niniloveyou/StateButton/blob/master/demo.apk
+1. 在项目根目录下的build.gradle文件中添加。
+```
+allproject{
+
+}
+```
+2. 在entry模块下的build.gradle文件中添加依赖。
+```
+dependencies{
+
+}
+```
-Screenshot
-----------
-
+如无法运行,删除项目.gradle,.idea,build,gradle,build.gradle文件,
-
+并依据自己的版本创建新项目,将新项目的对应文件复制到根目录下
-### Download
-```
- allprojects {
- repositories {
- ......
- maven { url 'https://jitpack.io' }
- }
- }
- implementation 'com.github.niniloveyou:StateButton:v1.0.0'
-
-```
-
-Customizable attributes
------------------------
-
-| Attribute | default value | xml | java |
-|------------------------|------------------------|--------------------------|-------------------------------------|
-| normalTextColor | original text color | normalTextColor | setNormalTextColor(int color) |
-| pressedTextColor | original text color | pressedTextColor | setPressedTextColor(int color) |
-| unableTextColor | original text color | unableTextColor | setUnableTextColor(int color) |
-| strokeDashWidth | 0 | strokeDashWidth | setStrokeDash(int dashWidth, int dashGap) |
-| strokeDashGap | 0 | strokeDashGap | setStrokeDash(int dashWidth, int dashGap) |
-| normalStrokeWidth | 0 | normalStrokeWidth | setNormalStrokeWidth(int widht) |
-| pressedStrokeWidth | 0 | pressedStrokeWidth | setPressedStrokeWidth(int widht) |
-| unableStrokeWidth | 0 | unableStrokeWidth | setUnableStrokeWidth(int widht) |
-| normalStrokeColor | 0 | normalStrokeColor | setNormalStrokeColor(int color) |
-| pressedStrokeColor | 0 | pressedStrokeColor | setPressedStrokeColor(int color) |
-| unableStrokeColor | 0 | unableStrokeColor | setUnableStrokeColor(int color) |
-| normalBackgroundColor | 0 | normalBackgroundColor | setNormalBackgroundColor(int color) |
-| pressedBackgroundColor | 0 | pressedBackgroundColor | setPressedBackgroundColor(int color) |
-| unableBackgroundColor | 0 | unableBackgroundColor | setUnableBackgroundColor(int color) |
-| radius | 0 | radius | setRadius(int radius) / setRadius(float[] radii) |
-| round | false | round | setRound(boolean round) |
-| animationDuration | 0ms | animationDuration | setAnimationDuration(int duration) |
-
-Usage
------
-If the default values of custom attribues did not meet your requirement, you can easily re-config that attributes. This is sample code that you can refer. you can also browse demo app for more details.
-
-### via xml (sample)
-- Define `xmlns:app="http://schemas.android.com/apk/res-auto"` on root of your xml file
+### 使用说明
+
+StateButton
+
+1. 布局文件定义,提供控件:StateButton
```xml
-
+
+
+
```
+2.在MainAbilitySlice中添加代码
+```java
+diffRadiusElement = (ShapeElement) differentRadius.getBackgroundElement();
+diffRadiusElement.setCornerRadiiArray(new float[]{0, 0, 20, 20, 30, 30, 70, 70});
+differentRadius.setBackground(diffRadiusElement);
-Developed By
--------
-deadline
+withDashElement = (ShapeElement) withDash.getBackgroundElement();
+withDashElement.setDashPathEffectValues(new float[]{20,20,20,20},5.0f);
+withDashElement.setStroke(10, white);
+withDash.setBackground(withDashElement);
+```
+
+### 测试信息
+
+CodeCheck代码测试无异常
+
+CloudTest代码测试无异常
-Blog : http://www.jianshu.com/users/25e80ace21b8/latest_articles
+火绒安全病毒安全检测通过
-MIT License
--------
+当前版本demo功能与安卓原组件基本无差异
- Copyright (c) 2016 deadline
+测试员:常小俊
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
+### 版本迭代
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
+- v0.0.1_alpha
+
+### 版权和许可信息
+
+```
+ Copyright (c) 2016 deadline
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+```
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
-
diff --git a/README_CHINESE.md b/README_CHINESE.md
deleted file mode 100644
index 4c5b3bc2d63343ac437cce5d3ba05e235feaae62..0000000000000000000000000000000000000000
--- a/README_CHINESE.md
+++ /dev/null
@@ -1,117 +0,0 @@
-# StateButton
-
-你有没有讨厌给每种类型的button写一个drawable(selector)
-
-我是写的够够的, 这也是为什么我要写这个小控件的原因。
-
-demo 下载地址:
-----------
-https://github.com/niniloveyou/StateButton/blob/master/demo.apk
-
-截图:
-----------
-
-
-
-
-
-### Download
-```
- allprojects {
- repositories {
- ......
- maven { url 'https://jitpack.io' }
- }
- }
- implementation 'com.github.niniloveyou:StateButton:v1.0.0'
-
-```
-Customizable attributes
------------------------
-
-| Attribute | default value | xml | java |
-|------------------------|------------------------|--------------------------|-------------------------------------|
-| normalTextColor | original text color | normalTextColor | setNormalTextColor(int color) |
-| pressedTextColor | original text color | pressedTextColor | setPressedTextColor(int color) |
-| unableTextColor | original text color | unableTextColor | setUnableTextColor(int color) |
-| strokeDashWidth | 0 | strokeDashWidth | setStrokeDash(int dashWidth, int dashGap) |
-| strokeDashGap | 0 | strokeDashGap | setStrokeDash(int dashWidth, int dashGap) |
-| normalStrokeWidth | 0 | normalStrokeWidth | setNormalStrokeWidth(int widht) |
-| pressedStrokeWidth | 0 | pressedStrokeWidth | setPressedStrokeWidth(int widht) |
-| unableStrokeWidth | 0 | unableStrokeWidth | setUnableStrokeWidth(int widht) |
-| normalStrokeColor | 0 | normalStrokeColor | setNormalStrokeColor(int color) |
-| pressedStrokeColor | 0 | pressedStrokeColor | setPressedStrokeColor(int color) |
-| unableStrokeColor | 0 | unableStrokeColor | setUnableStrokeColor(int color) |
-| normalBackgroundColor | 0 | normalBackgroundColor | setNormalBackgroundColor(int color) |
-| pressedBackgroundColor | 0 | pressedBackgroundColor | setPressedBackgroundColor(int color) |
-| unableBackgroundColor | 0 | unableBackgroundColor | setUnableBackgroundColor(int color) |
-| radius | 0 | radius | setRadius(int radius) / setRadius(float[] radii) |
-| round | false | round | setRound(boolean round) |
-| animationDuration | 0ms | animationDuration | setAnimationDuration(int duration) |
-
-
-### xml中定义了以下属性
-- Define `xmlns:app="http://schemas.android.com/apk/res-auto"` on root of your xml file
-
-```xml
-
-```
-
-
-
-Developed By
--------
-deadline
-
-Blog : http://www.jianshu.com/users/25e80ace21b8/latest_articles
-
-MIT License
--------
-
- Copyright (c) 2016 deadline
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
-
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 6827976143cc9738c9b21553163429767575a995..0000000000000000000000000000000000000000
--- a/app/build.gradle
+++ /dev/null
@@ -1,32 +0,0 @@
-apply plugin: 'com.android.application'
-apply plugin: 'kotlin-android'
-apply plugin: 'kotlin-android-extensions'
-
-android {
- compileSdkVersion 28
- buildToolsVersion "28.0.3"
-
- defaultConfig {
- applicationId "deadline.statebutton"
- minSdkVersion 15
- targetSdkVersion 28
- versionCode 1
- versionName "1.0"
- }
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
- }
- }
-}
-
-dependencies {
- compile fileTree(dir: 'libs', include: ['*.jar'])
- implementation project(':libary')
- compile 'com.android.support:appcompat-v7:28.0.0'
- compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
-}
-repositories {
- mavenCentral()
-}
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
deleted file mode 100644
index 61f14a6830e40376ab79262ae6b8873c6a3028b4..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 F:\AndroidSDK/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/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
deleted file mode 100644
index 8f232d27e26c4f776d653ac30c2b1c1ffbb6729b..0000000000000000000000000000000000000000
--- a/app/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/src/main/java/deadline/statebutton/MainActivity.kt b/app/src/main/java/deadline/statebutton/MainActivity.kt
deleted file mode 100644
index 121a1c30d63a12acac1acfe0e8c7421220d1f997..0000000000000000000000000000000000000000
--- a/app/src/main/java/deadline/statebutton/MainActivity.kt
+++ /dev/null
@@ -1,64 +0,0 @@
-package deadline.statebutton
-
-import android.graphics.Color
-import android.support.v7.app.AppCompatActivity
-import android.os.Bundle
-import android.view.View
-import android.widget.TextView
-import android.widget.Toast
-import com.deadline.statebutton.StateButton
-import com.deadline.statebutton.StateConfig
-import com.deadline.statebutton.setState
-
-class MainActivity : AppCompatActivity() {
-
- lateinit var text: StateButton
-
- lateinit var background: StateButton
-
- lateinit var radius: StateButton
-
- lateinit var stroke: StateButton
-
- lateinit var dash: StateButton
-
- lateinit var tvExtend: TextView
-
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
-
-
- //设置不同状态下文字变色
- text = findViewById(R.id.text_test) as StateButton
- text.setOnClickListener { text.isEnabled = false }
-
- //最常用的设置不同背景
- background = findViewById(R.id.background_test) as StateButton
- background.setOnClickListener { background.isEnabled = false }
-
- //设置四个角不同的圆角
- radius = findViewById(R.id.different_radius_test) as StateButton
- radius.setRadius(floatArrayOf(0f, 0f, 20f, 20f, 40f, 40f, 60f, 60f))
-
-
- //设置不同状态下边框颜色,宽度
- stroke = findViewById(R.id.stroke_test) as StateButton
- stroke.setOnClickListener { stroke.isEnabled = false }
-
- //设置间断
- dash = findViewById(R.id.dash_test) as StateButton
- dash.setOnClickListener { dash.isEnabled = false }
-
- tvExtend = findViewById(R.id.tv_extend)
- tvExtend.setOnClickListener { Toast.makeText(this@MainActivity, "lalala", Toast.LENGTH_SHORT).show() }
-
- tvExtend.setState(StateConfig.newBuilder()
- .setNormalBackgroundColor(Color.GRAY)
- .setPressedBackgroundColor(Color.DKGRAY)
- .setNormalTextColor(Color.WHITE)
- .setPressedTextColor(Color.parseColor("#80ffffff"))
- .setRadius(20f)
- .build())
- }
-}
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 cde259f2594e565eecbe0220e1b0e00aad4edf2e..0000000000000000000000000000000000000000
--- a/app/src/main/res/layout/activity_main.xml
+++ /dev/null
@@ -1,186 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
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 1d38a76f38d1c93668e84bc5a37209144449adec..0000000000000000000000000000000000000000
--- a/app/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
- StateButton
-
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
deleted file mode 100644
index 1e1eb5c41e482e3e03c715759b65012b5d5adac3..0000000000000000000000000000000000000000
--- a/app/src/main/res/values/styles.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
diff --git a/build.gradle b/build.gradle
index 56bfaec3ec0f5f7f4e5890aaa6dab28c1f8d9b7e..e463f147c46e9b38e8fe2fb8e3f3059b899a057d 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,28 +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 {
- ext.kotlin_version = '1.2.51'
repositories {
+ maven {
+ url 'https://repo.huaweicloud.com/repository/maven/'
+ }
+ maven {
+ url 'https://developer.huawei.com/repo/'
+ }
jcenter()
- google()
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.2.1'
- classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
- classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
- classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
- // 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.7'
+ classpath 'com.huawei.ohos:decctest:1.0.0.6'
}
}
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/changeLog.md b/changeLog.md
new file mode 100644
index 0000000000000000000000000000000000000000..4c7ce466846655b07dd7244a074f74e6c1f24533
--- /dev/null
+++ b/changeLog.md
@@ -0,0 +1,56 @@
+# 基本功能:
+- 扩展属性测试Button: 点击后有提示信息弹窗
+- ChangeTextColor:
+ - 按下文字颜色改变;
+ - 抬起文字颜色改变,且再次触摸颜色不再改变;
+ - 若移出Button范围,颜色恢复,且抬起后文字颜色不改变;且再次按下后,文字颜色会改变。
+- ChangeBackGround:
+ - 按下背景颜色改变;
+ - 抬起背景颜色改变,且再次触摸颜色不再改变;
+ - 若移出Button范围,颜色恢复,且抬起后背景颜色不改变;且再次按下后,背景颜色会改变。
+- WithRadius:
+ - Button有圆角;
+ - 按下背景颜色改变;
+ - 抬起背景颜色改变,且再次触摸颜色不再改变;
+ - 若移出Button范围,颜色恢复,且抬起后背景颜色不改变;且再次按下后,背景颜色会改变。
+ - 若移出Button范围,颜色恢复,且抬起后背景颜色不改变;且再次按下后,背景颜色会改变。
+- RoundRadius:
+ - 胶囊Button
+ - 按下背景颜色改变;
+ - 抬起背景颜色改变,且再次触摸颜色不再改变;
+ - 若移出Button范围,颜色恢复,且抬起后背景颜色不改变;且再次按下后,背景颜色会改变。
+ - 若移出Button范围,颜色恢复,且抬起后背景颜色不改变;且再次按下后,背景颜色会改变。
+- DifferentRadius:
+ - 四个角圆角角度不同;
+ - 按下背景颜色改变;
+ - 抬起背景颜色改变,且再次触摸颜色不再改变;
+ - 若移出Button范围,颜色恢复,且抬起后背景颜色不改变;且再次按下后,背景颜色会改变。
+- WithDash:
+ - 虚线边框;
+ - 按下边框颜色改变,文字颜色改变;
+ - 抬起边框颜色改变,文字颜色改变,且再次触摸颜色不再改变;
+ - 若移出Button范围,颜色恢复,且抬起后背景颜色不改变;且再次按下后,边框颜色改变,文字颜色改变。
+- WithStroke:
+ - 实线边框;
+ - 按下边框颜色改变,文字颜色改变;
+ - 抬起边框颜色改变,文字颜色改变,且再次触摸颜色不再改变;
+ - 若移出Button范围,颜色恢复,且抬起后背景颜色不改变;且再次按下后,边框颜色改变,文字颜色改变。
+- Keep Stroke:
+ - 实线边框;
+ - 按下边框保持,背景颜色改变;
+ - 抬起边框保持,背景颜色恢复,且再次触摸颜色不再改变;
+ - 若移出Button范围,颜色恢复,且抬起后背景颜色不改变;且再次按下后,边框保持,背景颜色改变。
+- STROKE BACKGROUND:
+ - 实线边框;
+ - 按下边框消失,背景颜色改变;
+ - 抬起边框恢复,背景颜色恢复,且再次触摸颜色可再改变;
+ - 若移出Button范围,颜色恢复,且抬起后背景颜色不改变;且再次按下后,边框消失,背景颜色改变
+- STROKE BACKGROUND ANIMATION:
+ - 实线边框;
+ - 按下边框消失,背景颜色改变;
+ - 抬起边框恢复,背景颜色恢复,且再次触摸颜色可再改变;
+ - 若移出Button范围,颜色恢复,且抬起后背景颜色不改变;且再次按下后,边框消失,背景颜色改变
+# 修改点:
+1. 无
+# 遗留问题(暂不支持的功能):
+1. 无
\ No newline at end of file
diff --git a/demo.apk b/demo.apk
deleted file mode 100644
index 1c69ec7cc73ce55f2b04826e16b1ed1fb55c0800..0000000000000000000000000000000000000000
Binary files a/demo.apk and /dev/null differ
diff --git a/entry/.gitignore b/entry/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..3244a7aa60cb7f74f269e64238916b6124d8372a
--- /dev/null
+++ b/entry/.gitignore
@@ -0,0 +1,14 @@
+*.iml
+/.gradle
+/local.properties
+/.idea/caches
+/.idea/libraries
+/.idea/modules.xml
+/.idea/workspace.xml
+/.idea/navEditor.xml
+/.idea/assetWizardSettings.xml
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+.cxx
diff --git a/entry/build.gradle b/entry/build.gradle
new file mode 100644
index 0000000000000000000000000000000000000000..7775c58612096f8e93f7812d158dcb7f55324e56
--- /dev/null
+++ b/entry/build.gradle
@@ -0,0 +1,26 @@
+apply plugin: 'com.huawei.ohos.hap'
+apply plugin: 'com.huawei.ohos.decctest'
+ohos {
+ compileSdkVersion 5
+ defaultConfig {
+ compatibleSdkVersion 5
+ }
+ buildTypes {
+ release {
+ proguardOpt {
+ proguardEnabled false
+ rulesFiles 'proguard-rules.pro'
+ }
+ }
+ }
+}
+
+dependencies {
+ implementation fileTree(dir: 'libs', include: ['*.jar', '*.har'])
+ implementation project(path: ':statebutton')
+ testImplementation 'junit:junit:4.13'
+ ohosTestImplementation 'com.huawei.ohos.testkit:runner:1.0.0.100'
+}
+decc {
+ supportType = ['html', 'xml']
+}
diff --git a/entry/proguard-rules.pro b/entry/proguard-rules.pro
new file mode 100644
index 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..a851aac2280ce5fab82a8b9019fc268fd4a42d1f
--- /dev/null
+++ b/entry/src/main/config.json
@@ -0,0 +1,48 @@
+{
+ "app": {
+ "bundleName": "com.deadline.statebutton",
+ "vendor": "deadline",
+ "version": {
+ "code": 1,
+ "name": "1.0"
+ },
+ "apiVersion": {
+ "compatible": 5,
+ "target": 5
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "com.deadline.statebutton",
+ "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.deadline.statebutton.MainAbility",
+ "icon": "$media:icon",
+ "description": "$string:mainability_description",
+ "label": "$string:app_name",
+ "type": "page",
+ "launchType": "standard"
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/entry/src/main/java/com/deadline/statebutton/MainAbility.java b/entry/src/main/java/com/deadline/statebutton/MainAbility.java
new file mode 100644
index 0000000000000000000000000000000000000000..9a5c253f0b48c049f4bc3f0c1349a9633778dfeb
--- /dev/null
+++ b/entry/src/main/java/com/deadline/statebutton/MainAbility.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.deadline.statebutton;
+
+import com.deadline.statebutton.slice.MainAbilitySlice;
+import ohos.aafwk.ability.Ability;
+import ohos.aafwk.content.Intent;
+
+/**
+ * MainAbility
+ *
+ * @author wangpeng
+ * @since 2021-04-21
+ */
+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/deadline/statebutton/MyApplication.java b/entry/src/main/java/com/deadline/statebutton/MyApplication.java
new file mode 100644
index 0000000000000000000000000000000000000000..9bf0d2a4ab3349f0a270526ba8604cff9867a69d
--- /dev/null
+++ b/entry/src/main/java/com/deadline/statebutton/MyApplication.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.deadline.statebutton;
+
+import ohos.aafwk.ability.AbilityPackage;
+
+/**
+ * MyApplication
+ *
+ * @author wangpeng
+ * @since 2021-04-21
+ */
+public class MyApplication extends AbilityPackage {
+ @Override
+ public void onInitialize() {
+ super.onInitialize();
+ }
+}
diff --git a/entry/src/main/java/com/deadline/statebutton/slice/MainAbilitySlice.java b/entry/src/main/java/com/deadline/statebutton/slice/MainAbilitySlice.java
new file mode 100644
index 0000000000000000000000000000000000000000..c218e2f3f49cdda238dfafdb14d30c597bbf7be5
--- /dev/null
+++ b/entry/src/main/java/com/deadline/statebutton/slice/MainAbilitySlice.java
@@ -0,0 +1,194 @@
+/*
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.deadline.statebutton.slice;
+
+import ohos.aafwk.ability.AbilitySlice;
+import ohos.aafwk.content.Intent;
+import ohos.agp.colors.RgbColor;
+import ohos.agp.components.ComponentContainer;
+import ohos.agp.components.DirectionalLayout;
+import ohos.agp.components.Text;
+import ohos.agp.components.Button;
+import ohos.agp.components.Component;
+import ohos.agp.components.element.ShapeElement;
+import ohos.agp.utils.Color;
+import ohos.agp.utils.LayoutAlignment;
+import ohos.agp.utils.TextAlignment;
+import ohos.agp.window.dialog.ToastDialog;
+import ohos.hiviewdfx.HiLog;
+import ohos.hiviewdfx.HiLogLabel;
+
+import com.deadline.statebutton.ResourceTable;
+import com.deadline.statebutton.StateButton;
+
+/**
+ * MainAbilitySlice
+ *
+ * @author wangpeng
+ * @since 2021-04-21
+ */
+public class MainAbilitySlice extends AbilitySlice implements Component.ClickedListener {
+ private static final HiLogLabel LABEL = new HiLogLabel(HiLog.LOG_APP, 0x000110, "MainAbilitySlice");
+ private static final int TEXT_SIZE = 40;
+ private static final int DURATION_TIME = 2000;
+ private static final int TOAST_DIALOG_RADIUS = 3000;
+ private static final int DIALOG_PADDING = 20;
+ private static final int STROKE_WIDTH = 10;
+ private static final float WITH_DASH_PHASE = 5f;
+
+ private static final float DIFF_RADII_TOP_LEFT_RADIUS = 0;
+ private static final float DIFF_RADII_TOP_RIGHT_RADIUS = 20;
+ private static final float DIFF_RADII_BOTTOM_RIGHT_RADIUS = 30;
+ private static final float DIFF_RADII_BOTTOM_LEFT_RADIUS = 70;
+ private static final float WITH_DASH_INTERVALS = 20;
+ private static final int NUMBER3 = 3;
+ private static final int NUMBER8 = 8;
+ private static final int NUMBER16 = 16;
+ private static final int ALPHA = 95;
+ private ShapeElement diffRadiusElement;
+ private ShapeElement withDashElement;
+ private ShapeElement whitStrokeElement;
+ private ShapeElement keepStrokeElement;
+ private ShapeElement strokeBackgroundElement;
+ private ShapeElement strokeBackgroundAnimationElement;
+ private RgbColor white;
+
+ // 扩展属性测试button
+ private Button extendButton;
+
+ // 改变字体颜色button
+ private StateButton changeTextColor;
+
+ // 改变背景颜色属性
+ private StateButton changeBackGround;
+
+ // 圆角
+ private StateButton withRadius;
+ private StateButton roundRadius;
+ private StateButton differentRadius;
+ private StateButton withDash;
+ private StateButton withStroke;
+ private StateButton keepStroke;
+ private StateButton strokeBackground;
+ private StateButton strokeBackgroundAnimation;
+
+ @Override
+ public void onStart(Intent intent) {
+ super.onStart(intent);
+ super.setUIContent(ResourceTable.Layout_ability_main);
+ initButton();
+ }
+
+ // 初始化Button参数
+ private void initButton() {
+ float[] differentRadiiArray = new float[]{
+ DIFF_RADII_TOP_LEFT_RADIUS, DIFF_RADII_TOP_LEFT_RADIUS,
+ DIFF_RADII_TOP_RIGHT_RADIUS, DIFF_RADII_TOP_RIGHT_RADIUS,
+ DIFF_RADII_BOTTOM_RIGHT_RADIUS, DIFF_RADII_BOTTOM_RIGHT_RADIUS,
+ DIFF_RADII_BOTTOM_LEFT_RADIUS, DIFF_RADII_BOTTOM_LEFT_RADIUS};
+ float[] withDashIntervals = new float[]{WITH_DASH_INTERVALS, WITH_DASH_INTERVALS,
+ WITH_DASH_INTERVALS, WITH_DASH_INTERVALS};
+ white = RgbColor.fromArgbInt(Color.WHITE.getValue());
+ extendButton = (Button) findComponentById(ResourceTable.Id_extend_attribute);
+ changeTextColor = (StateButton) findComponentById(ResourceTable.Id_change_text_color);
+ changeBackGround = (StateButton) findComponentById(ResourceTable.Id_change_background_color);
+ withRadius = (StateButton) findComponentById(ResourceTable.Id_with_radius);
+ roundRadius = (StateButton) findComponentById(ResourceTable.Id_round_radius);
+
+ differentRadius = (StateButton) findComponentById(ResourceTable.Id_different_radius);
+ withDash = (StateButton) findComponentById(ResourceTable.Id_with_dash);
+ withStroke = (StateButton) findComponentById(ResourceTable.Id_with_stroke);
+ keepStroke = (StateButton) findComponentById(ResourceTable.Id_keep_stroke);
+ strokeBackground = (StateButton) findComponentById(ResourceTable.Id_stroke_background);
+ strokeBackgroundAnimation = (StateButton) findComponentById(ResourceTable.Id_stroke_background_animation);
+
+ diffRadiusElement = (ShapeElement) differentRadius.getBackgroundElement();
+ diffRadiusElement.setCornerRadiiArray(differentRadiiArray);
+ differentRadius.setBackground(diffRadiusElement);
+
+ withDashElement = (ShapeElement) withDash.getBackgroundElement();
+ withDashElement.setDashPathEffectValues(withDashIntervals, WITH_DASH_PHASE);
+ withDashElement.setStroke(STROKE_WIDTH, white);
+ withDash.setBackground(withDashElement);
+
+ whitStrokeElement = (ShapeElement) withStroke.getBackgroundElement();
+ whitStrokeElement.setStroke(STROKE_WIDTH, white);
+ withStroke.setBackground(whitStrokeElement);
+
+ keepStrokeElement = (ShapeElement) keepStroke.getBackgroundElement();
+ keepStrokeElement.setStroke(STROKE_WIDTH, white);
+ keepStroke.setBackground(keepStrokeElement);
+
+ strokeBackgroundElement = (ShapeElement) strokeBackground.getBackgroundElement();
+ strokeBackgroundElement.setStroke(STROKE_WIDTH, white);
+ strokeBackground.setBackground(strokeBackgroundElement);
+
+ strokeBackgroundAnimationElement = (ShapeElement) strokeBackgroundAnimation.getBackgroundElement();
+ strokeBackgroundAnimationElement.setStroke(STROKE_WIDTH, white);
+ strokeBackgroundAnimation.setBackground(strokeBackgroundAnimationElement);
+
+ // 设置点击事件监听
+ extendButton.setClickedListener(this::onClick);
+ }
+
+ @Override
+ public void onClick(Component component) {
+ switch (component.getId()) {
+ // 扩展属性测试
+ case ResourceTable.Id_extend_attribute:
+ ShapeElement shapeElement = new ShapeElement();
+ shapeElement.setRgbColor(new RgbColor(Color.BLACK.getValue() >> NUMBER16,
+ Color.BLACK.getValue() >> NUMBER8, Color.BLACK.getValue() >> NUMBER3));
+ shapeElement.setAlpha(ALPHA);
+ DirectionalLayout directionalLayout = new DirectionalLayout(getContext());
+ directionalLayout.setBackground(shapeElement);
+
+ directionalLayout.setLayoutConfig(new ComponentContainer
+ .LayoutConfig(ComponentContainer.LayoutConfig.MATCH_CONTENT,
+ ComponentContainer.LayoutConfig.MATCH_CONTENT));
+ directionalLayout.setAlignment(LayoutAlignment.CENTER);
+ Text dialog = new Text(getContext());
+ dialog.setText("lalala");
+ dialog.setTextColor(Color.WHITE);
+ dialog.setTextAlignment(TextAlignment.HORIZONTAL_CENTER);
+ dialog.setTextSize(TEXT_SIZE, Text.TextSizeType.PX);
+ dialog.setPadding(DIALOG_PADDING, DIALOG_PADDING, DIALOG_PADDING, DIALOG_PADDING);
+ directionalLayout.addComponent(dialog);
+ new ToastDialog(getContext())
+ .setSize(ComponentContainer.LayoutConfig.MATCH_CONTENT,
+ ComponentContainer.LayoutConfig.MATCH_CONTENT)
+ .setComponent(directionalLayout)
+ .setDuration(DURATION_TIME)
+ .setCornerRadius(TOAST_DIALOG_RADIUS)
+ // Toast显示在界面底部
+ .setAlignment(LayoutAlignment.BOTTOM)
+ .show();
+ break;
+ default:
+ HiLog.info(LABEL, "onClick");
+ }
+ }
+
+ @Override
+ public void onActive() {
+ super.onActive();
+ }
+
+ @Override
+ public void onForeground(Intent intent) {
+ super.onForeground(intent);
+ }
+}
diff --git a/entry/src/main/resources/base/element/color.json b/entry/src/main/resources/base/element/color.json
new file mode 100644
index 0000000000000000000000000000000000000000..8e76598c0c46a8f3099bcdeec7dfd5e85ff56404
--- /dev/null
+++ b/entry/src/main/resources/base/element/color.json
@@ -0,0 +1,61 @@
+{
+ "color":[
+ {
+ "name":"red",
+ "value":"#ff0000"
+ },
+ {
+ "name": "green",
+ "value": "#ff669900"
+ },
+ {
+ "name":"green_d",
+ "value":"#008577"
+ },
+ {
+ "name":"green_dd",
+ "value":"#00574B"
+ },
+ {
+ "name":"colorAccent",
+ "value":"#D81B60"
+ },
+ {
+ "name": "white",
+ "value": "#ffffffff"
+ },
+ {
+ "name": "black",
+ "value": "#000000"
+ },
+ {
+ "name": "red_dark",
+ "value": "#Ca0000"
+ },
+ {
+ "name": "blue_dark",
+ "value": "#0099cc"
+ },
+ {
+ "name": "blue",
+ "value": "#0099cc"
+ },
+ {
+ "name": "orange",
+ "value": "#ff8800"
+ },
+ {
+ "name": "gray",
+ "value": "#aaaaaa"
+ },
+ {
+ "name": "gray_dark",
+ "value": "##181818"
+ },
+ {
+ "name": "gray_40",
+ "value": "#40a7a7a7"
+ }
+ ]
+}
+
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..2f8c09c73877560be2afa05bc791a5514be946dd
--- /dev/null
+++ b/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,16 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "HM_StateButton"
+ },
+ {
+ "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/different_radius_button.xml b/entry/src/main/resources/base/graphic/different_radius_button.xml
new file mode 100644
index 0000000000000000000000000000000000000000..e845fd8581c4928511fa1ab96020093917db5a5e
--- /dev/null
+++ b/entry/src/main/resources/base/graphic/different_radius_button.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/entry/src/main/resources/base/graphic/extend_button.xml b/entry/src/main/resources/base/graphic/extend_button.xml
new file mode 100644
index 0000000000000000000000000000000000000000..c103b9107ca3bffc7f19b958bc2a9ee5210d83ef
--- /dev/null
+++ b/entry/src/main/resources/base/graphic/extend_button.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/entry/src/main/resources/base/graphic/round_radius_button.xml b/entry/src/main/resources/base/graphic/round_radius_button.xml
new file mode 100644
index 0000000000000000000000000000000000000000..019b448ed1e916c461d5d14f764a4946d10bcb25
--- /dev/null
+++ b/entry/src/main/resources/base/graphic/round_radius_button.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/entry/src/main/resources/base/graphic/with_radius_button.xml b/entry/src/main/resources/base/graphic/with_radius_button.xml
new file mode 100644
index 0000000000000000000000000000000000000000..f5a9555ad1309f5a064e3f3a95cbef9412b3d31e
--- /dev/null
+++ b/entry/src/main/resources/base/graphic/with_radius_button.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/entry/src/main/resources/base/graphic/with_stroke_radius_button.xml b/entry/src/main/resources/base/graphic/with_stroke_radius_button.xml
new file mode 100644
index 0000000000000000000000000000000000000000..1ff17c7f3ed96da66dc01dcd5fdc67e790d2d227
--- /dev/null
+++ b/entry/src/main/resources/base/graphic/with_stroke_radius_button.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
\ 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..54da8d503a37aa0b5a8cdeb13f2c614840c94432
--- /dev/null
+++ b/entry/src/main/resources/base/layout/ability_main.xml
@@ -0,0 +1,177 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ 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/entry/src/ohosTest/config.json b/entry/src/ohosTest/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..e3ff2e51d4e8b7a907db94d1c1fb5822b8a3c4fb
--- /dev/null
+++ b/entry/src/ohosTest/config.json
@@ -0,0 +1,41 @@
+{
+ "app": {
+ "bundleName": "com.deadline.statebutton",
+ "vendor": "deadline",
+ "version": {
+ "code": 1,
+ "name": "1.0"
+ },
+ "apiVersion": {
+ "compatible": 5,
+ "target": 5,
+ "releaseType": "Beta1"
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "com.deadline.statebutton",
+ "name": "testModule",
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "entry_test",
+ "moduleType": "feature",
+ "installationFree": true
+ },
+ "abilities": [
+ {
+ "name": "decc.testkit.runner.EntryAbility",
+ "description": "Test Entry Ability",
+ "icon": "$media:icon",
+ "label": "$string:app_name",
+ "launchType": "standard",
+ "orientation": "landscape",
+ "visible": true,
+ "type": "page"
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/entry/src/ohosTest/java/com/deadline/statebutton/ExampleOhosTest.java b/entry/src/ohosTest/java/com/deadline/statebutton/ExampleOhosTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..75fd041addc7b33ee0ff46f57667b3e2069f93aa
--- /dev/null
+++ b/entry/src/ohosTest/java/com/deadline/statebutton/ExampleOhosTest.java
@@ -0,0 +1,14 @@
+package com.deadline.statebutton;
+
+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("com.deadline.statebutton", actualBundleName);
+ }
+}
\ No newline at end of file
diff --git a/entry/src/test/java/com/deadline/statebutton/ExampleTest.java b/entry/src/test/java/com/deadline/statebutton/ExampleTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..3510e7c10660e9e29734e4f2c9aa7f34e108bfde
--- /dev/null
+++ b/entry/src/test/java/com/deadline/statebutton/ExampleTest.java
@@ -0,0 +1,9 @@
+package com.deadline.statebutton;
+
+import org.junit.Test;
+
+public class ExampleTest {
+ @Test
+ public void onStart() {
+ }
+}
diff --git a/gif/0.gif b/gif/0.gif
new file mode 100644
index 0000000000000000000000000000000000000000..109664a3ca7ec61ed87fb417f5d6e7ddae868baf
Binary files /dev/null and b/gif/0.gif 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 05ef575b0cd0173fc735f2857ce4bd594ce4f6bd..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 4b78188db2e35c3f8709c0ba16b5582c11090282..f59159e865d4b59feb1b8c44b001f62fc5d58df4 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,5 @@
-#Wed Jan 23 09:38:23 CST 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-4.6-all.zip
diff --git a/gradlew b/gradlew
index 9d82f78915133e1c35a6ea51252590fb38efac2f..2fe81a7d95e4f9ad2c9b2a046707d36ceb3980b3 100644
--- 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/image.png b/image.png
deleted file mode 100644
index fdb1e18d02429c7ca9fffc03b564cbda1f2d63b3..0000000000000000000000000000000000000000
Binary files a/image.png and /dev/null differ
diff --git a/libary/.gitignore b/libary/.gitignore
deleted file mode 100644
index 796b96d1c402326528b4ba3c12ee9d92d0e212e9..0000000000000000000000000000000000000000
--- a/libary/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build
diff --git a/libary/build.gradle b/libary/build.gradle
deleted file mode 100644
index 38bd77626d0c08db345b17f81c2ddc71f972be2a..0000000000000000000000000000000000000000
--- a/libary/build.gradle
+++ /dev/null
@@ -1,34 +0,0 @@
-apply plugin: 'com.android.library'
-apply plugin: 'kotlin-android'
-apply plugin: 'kotlin-android-extensions'
-apply plugin: 'com.github.dcendents.android-maven'
-
-group = 'com.github.niniloveyou'
-
-android {
- compileSdkVersion 28
-
-
-
- defaultConfig {
- minSdkVersion 14
- targetSdkVersion 28
- versionCode 1
- versionName "1.0"
-
- }
-
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
- }
- }
-
-}
-
-dependencies {
- implementation fileTree(dir: 'libs', include: ['*.jar'])
- implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
- implementation 'com.android.support:appcompat-v7:28.0.0'
-}
diff --git a/libary/proguard-rules.pro b/libary/proguard-rules.pro
deleted file mode 100644
index f1b424510da51fd82143bc74a0a801ae5a1e2fcd..0000000000000000000000000000000000000000
--- a/libary/proguard-rules.pro
+++ /dev/null
@@ -1,21 +0,0 @@
-# Add project specific ProGuard rules here.
-# You can control the set of applied configuration files using the
-# proguardFiles setting in build.gradle.
-#
-# For more details, see
-# http://developer.android.com/guide/developing/tools/proguard.html
-
-# 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 *;
-#}
-
-# Uncomment this to preserve the line number information for
-# debugging stack traces.
-#-keepattributes SourceFile,LineNumberTable
-
-# If you keep the line number information, uncomment this to
-# hide the original source file name.
-#-renamesourcefileattribute SourceFile
diff --git a/libary/src/main/AndroidManifest.xml b/libary/src/main/AndroidManifest.xml
deleted file mode 100644
index 1fefe7ac64961ea6768376e09f26d80aabafe7c1..0000000000000000000000000000000000000000
--- a/libary/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,2 +0,0 @@
-
diff --git a/libary/src/main/java/com/deadline/statebutton/StateButton.java b/libary/src/main/java/com/deadline/statebutton/StateButton.java
deleted file mode 100644
index 4908edb3b4a594f4ad64e4bd7452b212daf0734a..0000000000000000000000000000000000000000
--- a/libary/src/main/java/com/deadline/statebutton/StateButton.java
+++ /dev/null
@@ -1,301 +0,0 @@
-package com.deadline.statebutton;
-
-import android.content.Context;
-import android.content.res.ColorStateList;
-import android.content.res.TypedArray;
-import android.graphics.drawable.Drawable;
-import android.graphics.drawable.GradientDrawable;
-import android.graphics.drawable.StateListDrawable;
-import android.support.annotation.ColorInt;
-import android.support.annotation.FloatRange;
-import android.support.annotation.IntRange;
-import android.support.v7.widget.AppCompatButton;
-import android.util.AttributeSet;
-
-/**
- * @author deadline
- * @time 2016-11-07
- */
-
-public class StateButton extends AppCompatButton {
-
- //text color
- private int mNormalTextColor = 0;
- private int mPressedTextColor = 0;
- private int mUnableTextColor = 0;
- ColorStateList mTextColorStateList;
-
- //animation duration
- private int mDuration = 0;
-
- //radius
- private float mRadius = 0;
- private boolean mRound;
-
- //stroke
- private float mStrokeDashWidth = 0;
- private float mStrokeDashGap = 0;
- private int mNormalStrokeWidth = 0;
- private int mPressedStrokeWidth = 0;
- private int mUnableStrokeWidth = 0;
- private int mNormalStrokeColor = 0;
- private int mPressedStrokeColor = 0;
- private int mUnableStrokeColor = 0;
-
- //background color
- private int mNormalBackgroundColor = 0;
- private int mPressedBackgroundColor = 0;
- private int mUnableBackgroundColor = 0;
-
- private GradientDrawable mNormalBackground;
- private GradientDrawable mPressedBackground;
- private GradientDrawable mUnableBackground;
-
- private int[][] states;
-
- StateListDrawable mStateBackground;
-
- public StateButton(Context context) {
- this(context, null);
- }
-
- public StateButton(Context context, AttributeSet attrs) {
- this(context, attrs, android.support.v7.appcompat.R.attr.buttonStyle);
- }
-
- public StateButton(Context context, AttributeSet attrs, int defStyleAttr) {
- super(context, attrs, defStyleAttr);
- setup(attrs);
- }
-
- private void setup(AttributeSet attrs) {
-
- states = new int[4][];
-
- Drawable drawable = getBackground();
- if(drawable != null && drawable instanceof StateListDrawable){
- mStateBackground = (StateListDrawable) drawable;
- }else{
- mStateBackground = new StateListDrawable();
- }
-
- mNormalBackground = new GradientDrawable();
- mPressedBackground = new GradientDrawable();
- mUnableBackground = new GradientDrawable();
-
- //pressed, focused, normal, unable
- states[0] = new int[] { android.R.attr.state_enabled, android.R.attr.state_pressed };
- states[1] = new int[] { android.R.attr.state_enabled, android.R.attr.state_focused };
- states[3] = new int[] { -android.R.attr.state_enabled};
- states[2] = new int[] { android.R.attr.state_enabled };
-
- TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.StateButton);
-
- //get original text color as default
- //set text color
- mTextColorStateList = getTextColors();
- int mDefaultNormalTextColor = mTextColorStateList.getColorForState(states[2], getCurrentTextColor());
- int mDefaultPressedTextColor = mTextColorStateList.getColorForState(states[0], getCurrentTextColor());
- int mDefaultUnableTextColor = mTextColorStateList.getColorForState(states[3], getCurrentTextColor());
- mNormalTextColor = a.getColor(R.styleable.StateButton_normalTextColor, mDefaultNormalTextColor);
- mPressedTextColor = a.getColor(R.styleable.StateButton_pressedTextColor, mDefaultPressedTextColor);
- mUnableTextColor = a.getColor(R.styleable.StateButton_unableTextColor, mDefaultUnableTextColor);
- setTextColor();
-
- //set animation duration
- mDuration = a.getInteger(R.styleable.StateButton_animationDuration, mDuration);
- mStateBackground.setEnterFadeDuration(mDuration);
- mStateBackground.setExitFadeDuration(mDuration);
-
- //set background color
- mNormalBackgroundColor = a.getColor(R.styleable.StateButton_normalBackgroundColor, 0);
- mPressedBackgroundColor = a.getColor(R.styleable.StateButton_pressedBackgroundColor, 0);
- mUnableBackgroundColor = a.getColor(R.styleable.StateButton_unableBackgroundColor, 0);
- mNormalBackground.setColor(mNormalBackgroundColor);
- mPressedBackground.setColor(mPressedBackgroundColor);
- mUnableBackground.setColor(mUnableBackgroundColor);
-
- //set radius
- mRadius = a.getDimensionPixelSize(R.styleable.StateButton_radius, 0);
- mRound = a.getBoolean(R.styleable.StateButton_round, false);
- mNormalBackground.setCornerRadius(mRadius);
- mPressedBackground.setCornerRadius(mRadius);
- mUnableBackground.setCornerRadius(mRadius);
-
- //set stroke
- mStrokeDashWidth = a.getDimensionPixelSize(R.styleable.StateButton_strokeDashWidth, 0);
- mStrokeDashGap = a.getDimensionPixelSize(R.styleable.StateButton_strokeDashWidth, 0);
- mNormalStrokeWidth = a.getDimensionPixelSize(R.styleable.StateButton_normalStrokeWidth, 0);
- mPressedStrokeWidth = a.getDimensionPixelSize(R.styleable.StateButton_pressedStrokeWidth, 0);
- mUnableStrokeWidth = a.getDimensionPixelSize(R.styleable.StateButton_unableStrokeWidth, 0);
- mNormalStrokeColor = a.getColor(R.styleable.StateButton_normalStrokeColor, 0);
- mPressedStrokeColor = a.getColor(R.styleable.StateButton_pressedStrokeColor, 0);
- mUnableStrokeColor = a.getColor(R.styleable.StateButton_unableStrokeColor, 0);
- setStroke();
-
- //set background
- mStateBackground.addState(states[0], mPressedBackground);
- mStateBackground.addState(states[1], mPressedBackground);
- mStateBackground.addState(states[3], mUnableBackground);
- mStateBackground.addState(states[2], mNormalBackground);
- setBackgroundDrawable(mStateBackground);
- a.recycle();
- }
-
-
- @Override
- protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- super.onMeasure(widthMeasureSpec, heightMeasureSpec);
- setRound(mRound);
- }
-
- /****************** stroke color *********************/
-
- public void setNormalStrokeColor(@ColorInt int normalStrokeColor) {
- this.mNormalStrokeColor = normalStrokeColor;
- setStroke(mNormalBackground, mNormalStrokeColor, mNormalStrokeWidth);
- }
-
- public void setPressedStrokeColor(@ColorInt int pressedStrokeColor) {
- this.mPressedStrokeColor = pressedStrokeColor;
- setStroke(mPressedBackground, mPressedStrokeColor, mPressedStrokeWidth);
- }
-
- public void setUnableStrokeColor(@ColorInt int unableStrokeColor) {
- this.mUnableStrokeColor = unableStrokeColor;
- setStroke(mUnableBackground, mUnableStrokeColor, mUnableStrokeWidth);
- }
-
- public void setStateStrokeColor(@ColorInt int normal, @ColorInt int pressed, @ColorInt int unable){
- mNormalStrokeColor = normal;
- mPressedStrokeColor = pressed;
- mUnableStrokeColor = unable;
- setStroke();
- }
-
- /****************** stroke width *********************/
-
- public void setNormalStrokeWidth(int normalStrokeWidth) {
- this.mNormalStrokeWidth = normalStrokeWidth;
- setStroke(mNormalBackground, mNormalStrokeColor, mNormalStrokeWidth);
- }
-
- public void setPressedStrokeWidth(int pressedStrokeWidth) {
- this.mPressedStrokeWidth = pressedStrokeWidth;
- setStroke(mPressedBackground, mPressedStrokeColor, mPressedStrokeWidth);
- }
-
- public void setUnableStrokeWidth(int unableStrokeWidth) {
- this.mUnableStrokeWidth = unableStrokeWidth;
- setStroke(mUnableBackground, mUnableStrokeColor, mUnableStrokeWidth);
- }
-
- public void setStateStrokeWidth(int normal, int pressed, int unable){
- mNormalStrokeWidth = normal;
- mPressedStrokeWidth = pressed;
- mUnableStrokeWidth= unable;
- setStroke();
- }
-
- public void setStrokeDash(float strokeDashWidth, float strokeDashGap) {
- this.mStrokeDashWidth = strokeDashWidth;
- this.mStrokeDashGap = strokeDashWidth;
- setStroke();
- }
-
- private void setStroke(){
- setStroke(mNormalBackground, mNormalStrokeColor, mNormalStrokeWidth);
- setStroke(mPressedBackground, mPressedStrokeColor, mPressedStrokeWidth);
- setStroke(mUnableBackground, mUnableStrokeColor, mUnableStrokeWidth);
- }
-
- private void setStroke(GradientDrawable mBackground, int mStrokeColor, int mStrokeWidth) {
- mBackground.setStroke(mStrokeWidth, mStrokeColor, mStrokeDashWidth, mStrokeDashGap);
- }
-
- /******************** radius *******************************/
-
- public void setRadius(@FloatRange(from = 0) float radius) {
- this.mRadius = radius;
- mNormalBackground.setCornerRadius(mRadius);
- mPressedBackground.setCornerRadius(mRadius);
- mUnableBackground.setCornerRadius(mRadius);
- }
-
- public void setRound(boolean round){
- this.mRound = round;
- int height = getMeasuredHeight();
- if(mRound){
- setRadius(height / 2f);
- }
- }
-
- public void setRadius(float[] radii){
- mNormalBackground.setCornerRadii(radii);
- mPressedBackground.setCornerRadii(radii);
- mUnableBackground.setCornerRadii(radii);
- }
-
- /******************** background color **********************/
-
- public void setStateBackgroundColor(@ColorInt int normal, @ColorInt int pressed, @ColorInt int unable){
- mNormalBackgroundColor = normal;
- mPressedBackgroundColor = pressed;
- mUnableBackgroundColor = unable;
- mNormalBackground.setColor(mNormalBackgroundColor);
- mPressedBackground.setColor(mPressedBackgroundColor);
- mUnableBackground.setColor(mUnableBackgroundColor);
- }
-
- public void setNormalBackgroundColor(@ColorInt int normalBackgroundColor) {
- this.mNormalBackgroundColor = normalBackgroundColor;
- mNormalBackground.setColor(mNormalBackgroundColor);
- }
-
- public void setPressedBackgroundColor(@ColorInt int pressedBackgroundColor) {
- this.mPressedBackgroundColor = pressedBackgroundColor;
- mPressedBackground.setColor(mPressedBackgroundColor);
- }
-
- public void setUnableBackgroundColor(@ColorInt int unableBackgroundColor) {
- this.mUnableBackgroundColor = unableBackgroundColor;
- mUnableBackground.setColor(mUnableBackgroundColor);
- }
-
- /*******************alpha animation duration********************/
- public void setAnimationDuration(@IntRange(from = 0)int duration){
- this.mDuration = duration;
- mStateBackground.setEnterFadeDuration(mDuration);
- }
-
- /*************** text color ***********************/
-
- private void setTextColor() {
- int[] colors = new int[] {mPressedTextColor, mPressedTextColor, mNormalTextColor, mUnableTextColor};
- mTextColorStateList = new ColorStateList(states, colors);
- setTextColor(mTextColorStateList);
- }
-
- public void setStateTextColor(@ColorInt int normal, @ColorInt int pressed, @ColorInt int unable){
- this.mNormalTextColor = normal;
- this.mPressedTextColor = pressed;
- this.mUnableTextColor = unable;
- setTextColor();
- }
-
- public void setNormalTextColor(@ColorInt int normalTextColor) {
- this.mNormalTextColor = normalTextColor;
- setTextColor();
-
- }
-
- public void setPressedTextColor(@ColorInt int pressedTextColor) {
- this.mPressedTextColor = pressedTextColor;
- setTextColor();
- }
-
- public void setUnableTextColor(@ColorInt int unableTextColor) {
- this.mUnableTextColor = unableTextColor;
- setTextColor();
- }
-}
diff --git a/libary/src/main/java/com/deadline/statebutton/ViewExtend.kt b/libary/src/main/java/com/deadline/statebutton/ViewExtend.kt
deleted file mode 100644
index 22ce8d71612b4abdbbfab6843e2deb0f4b4f613b..0000000000000000000000000000000000000000
--- a/libary/src/main/java/com/deadline/statebutton/ViewExtend.kt
+++ /dev/null
@@ -1,74 +0,0 @@
-package com.deadline.statebutton
-
-import android.content.res.ColorStateList
-import android.graphics.drawable.GradientDrawable
-import android.graphics.drawable.StateListDrawable
-import android.support.annotation.NonNull
-import android.support.v4.view.ViewCompat
-import android.view.View
-import android.widget.TextView
-
-/**
- * @author deadline
- * @time 2018/7/19
- */
-fun View.setState(@NonNull config: StateConfig) {
-
- //pressed, focused, normal, unable
- val states = arrayOf(intArrayOf(android.R.attr.state_enabled, android.R.attr.state_pressed),
- intArrayOf(android.R.attr.state_enabled, android.R.attr.state_focused),
- intArrayOf(-android.R.attr.state_enabled),
- intArrayOf(android.R.attr.state_enabled))
-
-
- val mNormalBackground = GradientDrawable()
- val mPressedBackground = GradientDrawable()
- val mUnableBackground = GradientDrawable()
-
- var mStateBackground: StateListDrawable? = null
- val drawable = background
- mStateBackground = if (drawable != null && drawable is StateListDrawable) drawable else StateListDrawable()
-
- applyState(mNormalBackground, config.normalBackgroundColor, config.radius,
- config.normalStrokeWidth, config.normalStrokeColor,
- config.strokeDashWidth, config.strokeDashGap)
-
- applyState(mPressedBackground, config.pressedBackgroundColor, config.radius,
- config.pressedStrokeWidth, config.pressedStrokeColor,
- config.strokeDashWidth, config.strokeDashGap)
-
- applyState(mUnableBackground, config.unableBackgroundColor, config.radius,
- config.unableStrokeWidth, config.unableStrokeColor,
- config.strokeDashWidth, config.strokeDashGap)
-
-
- if (this@setState is TextView) {
-
- val colors = intArrayOf(config.pressedTextColor, config.pressedTextColor, config.unableTextColor, config.normalTextColor)
- setTextColor(ColorStateList(states, colors))
- }
-
- mStateBackground.addState(states[0], mPressedBackground)
- mStateBackground.addState(states[1], mPressedBackground)
- mStateBackground.addState(states[2], mUnableBackground)
- mStateBackground.addState(states[3], mNormalBackground)
-
- mStateBackground.apply {
- setEnterFadeDuration(config.duration)
- }
-
- ViewCompat.setBackground(this@setState, mStateBackground)
-}
-
-private fun applyState(drawable: GradientDrawable,
- backgroundColor: Int, radius: Float,
- strokeWidth: Int, strokeColor: Int,
- strokeDashWidth: Float, strokeDashGap: Float) {
-
- drawable.apply {
- setStroke(strokeWidth, strokeColor, strokeDashWidth, strokeDashGap)
- setColor(backgroundColor)
- cornerRadius = radius
- }
-}
-
diff --git a/libary/src/main/res/values/attrs.xml b/libary/src/main/res/values/attrs.xml
deleted file mode 100644
index 76cf4ab43736f372ba6e2836e194afd767437bb5..0000000000000000000000000000000000000000
--- a/libary/src/main/res/values/attrs.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/libary/src/main/res/values/strings.xml b/libary/src/main/res/values/strings.xml
deleted file mode 100644
index b751a1bf875a02554a6ccf45956bbf73b1679512..0000000000000000000000000000000000000000
--- a/libary/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
- libarary
-
diff --git a/settings.gradle b/settings.gradle
index a7d3a2c732ec33c067a30e1105cf64c2c16674b1..cf41dec369885565aef502159fe2d2cded3a1a42 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1 +1 @@
-include ':app', ':libary'
+include ':entry', ':statebutton'
diff --git a/stateButton.gif b/stateButton.gif
deleted file mode 100644
index 5f203f73b019da2c45574b66f75123253f438228..0000000000000000000000000000000000000000
Binary files a/stateButton.gif and /dev/null differ
diff --git a/statebutton/.gitignore b/statebutton/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..3244a7aa60cb7f74f269e64238916b6124d8372a
--- /dev/null
+++ b/statebutton/.gitignore
@@ -0,0 +1,14 @@
+*.iml
+/.gradle
+/local.properties
+/.idea/caches
+/.idea/libraries
+/.idea/modules.xml
+/.idea/workspace.xml
+/.idea/navEditor.xml
+/.idea/assetWizardSettings.xml
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+.cxx
diff --git a/statebutton/build.gradle b/statebutton/build.gradle
new file mode 100644
index 0000000000000000000000000000000000000000..25ddf0cf1daa8f1533639ebc05ce352f4019b8ff
--- /dev/null
+++ b/statebutton/build.gradle
@@ -0,0 +1,21 @@
+apply plugin: 'com.huawei.ohos.library'
+ohos {
+ compileSdkVersion 5
+ defaultConfig {
+ compatibleSdkVersion 5
+ }
+ buildTypes {
+ release {
+ proguardOpt {
+ proguardEnabled false
+ rulesFiles 'proguard-rules.pro'
+ }
+ }
+ }
+
+}
+
+dependencies {
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+ testImplementation 'junit:junit:4.13'
+}
diff --git a/statebutton/proguard-rules.pro b/statebutton/proguard-rules.pro
new file mode 100644
index 0000000000000000000000000000000000000000..f7666e47561d514b2a76d5a7dfbb43ede86da92a
--- /dev/null
+++ b/statebutton/proguard-rules.pro
@@ -0,0 +1 @@
+# config module specific ProGuard rules here.
\ No newline at end of file
diff --git a/statebutton/src/main/config.json b/statebutton/src/main/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..23c0a4f476f22d2bccc9c21e8ba15bed1d8c0400
--- /dev/null
+++ b/statebutton/src/main/config.json
@@ -0,0 +1,28 @@
+{
+ "app": {
+ "bundleName": "com.deadline.statebutton",
+ "vendor": "deadline",
+ "version": {
+ "code": 1,
+ "name": "1.0"
+ },
+ "apiVersion": {
+ "compatible": 5,
+ "target": 5,
+ "releaseType": "Beta1"
+ }
+ },
+ "deviceConfig": {
+ },
+ "module": {
+ "package": "com.deadline.statebutton",
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "statebutton",
+ "moduleType": "har"
+ }
+ }
+}
\ No newline at end of file
diff --git a/statebutton/src/main/java/com/deadline/statebutton/StateButton.java b/statebutton/src/main/java/com/deadline/statebutton/StateButton.java
new file mode 100644
index 0000000000000000000000000000000000000000..eb26d90888afb6d423f31e8334c88b7593279a54
--- /dev/null
+++ b/statebutton/src/main/java/com/deadline/statebutton/StateButton.java
@@ -0,0 +1,381 @@
+package com.deadline.statebutton;
+
+import ohos.agp.window.service.Display;
+import ohos.agp.window.service.DisplayAttributes;
+import ohos.agp.window.service.DisplayManager;
+import ohos.app.Context;
+import ohos.agp.utils.Color;
+import ohos.agp.colors.RgbColor;
+import ohos.agp.components.AttrSet;
+import ohos.agp.components.Button;
+import ohos.agp.components.Component;
+import ohos.agp.components.element.ShapeElement;
+import ohos.global.resource.NotExistException;
+import ohos.global.resource.ResourceManager;
+import ohos.global.resource.WrongTypeException;
+import ohos.hiviewdfx.HiLog;
+import ohos.hiviewdfx.HiLogLabel;
+import ohos.multimodalinput.event.TouchEvent;
+
+import java.io.IOException;
+import java.util.Optional;
+
+public class StateButton extends Button implements Component.TouchEventListener {
+ private static final HiLogLabel LABEL = new HiLogLabel(HiLog.LOG_APP, 0x000110, "StateButton");
+
+ private ResourceManager resManager;
+ // button的name
+ private String buttonName;
+
+ // 抬起时形状(with radius/round radius/different radius)
+ private ShapeElement upElement;
+
+ // 移出button时形状(with radius/round radius/different radius)
+ private ShapeElement moveOutElement;
+
+ // 按下时形状(with radius/round radius/different radius)
+ private ShapeElement downElement;
+
+ // 抬起时颜色(with radius/round radius/different radius)
+ private RgbColor upColor;
+
+ // 移出button时颜色(with radius/round radius/different radius)
+ private RgbColor moveOutColor;
+
+ // 按下时颜色(with radius/round radius/different radius)
+ private RgbColor downColor;
+
+ private Color orange;
+
+ // CHANGE TEXT COLOR的字体颜色是否可以改变
+ private boolean changeTextColorCount = true;
+
+ // CHANGE BACKGROUND COUNT的背景颜色是否可以改变
+ private boolean changeBackGroundCount = true;
+
+ // WITH DASH COUNT的边框和字体颜色是否可以改变
+ private boolean withDashCount = true;
+
+ // WITH STROKE COUNT的边框和字体颜色是否可以改变
+ private boolean withStrokeCount = true;
+
+ // 是否移出button范围
+ private boolean moveOutOfButtonFlag = false;
+
+ // 屏幕宽度
+ private float displayWidth;
+
+ // 屏幕高度
+ private float displayHeight;
+
+ // 当前点击的button的宽度
+ private float buttonWidth;
+
+ // 当前点击的button的高度
+ private float buttonHeight;
+
+ // 按下时触摸X坐标
+ private float downTouchX;
+
+ // 按下时触摸X坐标
+ private float downTouchY;
+
+ // button左边界X坐标
+ private float leftX;
+
+ // button右边界X坐标
+ private float rightX;
+
+ // button上边界Y坐标
+ private float topY;
+
+ // button下边界Y坐标
+ private float bottomY;
+
+ /**
+ * 单参构造
+ *
+ * @param context
+ */
+ public StateButton(Context context) {
+ super(context);
+ }
+
+ /**
+ * 双参构造,默认走这个
+ *
+ * @param context
+ * @param attrSet
+ */
+ public StateButton(Context context, AttrSet attrSet) {
+ super(context, attrSet);
+
+ // 获取屏幕高度和宽度
+ Optional display = DisplayManager.getInstance().getDefaultDisplay(this.getContext());
+ DisplayAttributes displayAttributes = display.get().getAttributes();
+ displayWidth = displayAttributes.width;
+ displayHeight = displayAttributes.height;
+
+ // 初始化button
+ initButton(attrSet);
+
+ // 设置监听事件
+ this.setTouchEventListener(this::onTouchEvent);
+ }
+
+ private void initButton(AttrSet attrSet) {
+ buttonName = attrSet.getAttr("name").get().getStringValue();
+ resManager = this.getResourceManager();
+ try {
+ orange = new Color(resManager.getElement(ResourceTable.Color_orange).getColor());
+ } catch (IOException e) {
+ HiLog.error(LABEL, e + "");
+ } catch (NotExistException e) {
+ HiLog.error(LABEL, e + "");
+ } catch (WrongTypeException e) {
+ HiLog.error(LABEL, e + "");
+ }
+ }
+
+ /**
+ * 全参构造
+ *
+ * @param context
+ * @param attrSet
+ * @param styleName
+ */
+ public StateButton(Context context, AttrSet attrSet, String styleName) {
+ super(context, attrSet, styleName);
+ }
+
+ /**
+ * 触摸事件
+ *
+ * @param cpt
+ * @param touchEvent
+ * @return
+ */
+ @Override
+ public boolean onTouchEvent(Component cpt, TouchEvent touchEvent) {
+ switch (touchEvent.getAction()) {
+ case TouchEvent.PRIMARY_POINT_DOWN:
+
+ // 初次按下设置标记: 是否移出button范围
+ moveOutOfButtonFlag = false;
+ buttonWidth = this.getWidth();
+ buttonHeight = this.getHeight();
+ downTouchX = touchEvent.getPointerScreenPosition(0).getX();
+ downTouchY = touchEvent.getPointerScreenPosition(0).getY();
+
+ // 获取button横坐标范围
+ leftX = this.getLeft();
+ rightX = this.getRight();
+
+ // 计算button纵坐标范围 这里不用this.getTop,this.getBottom,返回值为距父组件的距离,该返回值不是距屏幕顶部的值
+ /*
+ public int getTop()
+ Obtains the top edge position of a component relative to the parent layout.
+ 这里的计算,假设点击位置都在button高度中心点击,移动偏移1/2高度,就当做移出button范围
+ 最上边的label和屏幕顶端状态栏还有高度
+ */
+ topY = downTouchY - buttonHeight / 2;
+ bottomY = downTouchY + buttonHeight / 2;
+
+ downElement = new ShapeElement();
+ downColor = new RgbColor(46, 64, 320);
+ if ("changeTextColor".equals(buttonName)) {
+ if (!changeTextColorCount) {
+ return false;
+ }
+ this.setTextColor(Color.RED);
+ } else if ("changeBackGround".equals(buttonName)) {
+ if (!changeBackGroundCount) {
+ return false;
+ }
+ ShapeElement cBackElement = (ShapeElement) cpt.getBackgroundElement();
+ cBackElement.setRgbColor(downColor);
+ } else if ("withRadius".equals(buttonName)) {
+ downElement.setCornerRadiiArray(new float[]{30, 30, 30, 30, 30, 30, 30, 30});
+ downElement.setRgbColor(downColor);
+ this.setBackground(downElement);
+ } else if ("roundRadius".equals(buttonName)) {
+ downElement.setCornerRadiiArray(new float[]{100, 100, 100, 100, 100, 100, 100, 100});
+ downElement.setRgbColor(downColor);
+ this.setBackground(downElement);
+ } else if ("differentRadius".equals(buttonName)) {
+ downElement.setCornerRadiiArray(new float[]{0, 0, 20, 20, 30, 30, 80, 80});
+ downElement.setRgbColor(downColor);
+ this.setBackground(downElement);
+ } else if ("keepStroke".equals(buttonName)) {
+ ShapeElement keepStrokeEle = (ShapeElement) cpt.getBackgroundElement();
+ keepStrokeEle.setRgbColor(downColor);
+ this.setBackground(keepStrokeEle);
+ } else if ("strokeBackground".equals(buttonName)) {
+ ShapeElement strokeBackgroundEle = (ShapeElement) cpt.getBackgroundElement();
+ strokeBackgroundEle.setStroke(0, strokeBackgroundEle.getStrokeColor());
+ strokeBackgroundEle.setRgbColor(downColor);
+ this.setBackground(strokeBackgroundEle);
+ } else if ("strokeBackgroundAnimation".equals(buttonName)) {
+ ShapeElement strokeBackgroundAnimation = (ShapeElement) cpt.getBackgroundElement();
+ strokeBackgroundAnimation.setStroke(0, strokeBackgroundAnimation.getStrokeColor());
+ strokeBackgroundAnimation.setRgbColor(downColor);
+ this.setBackground(strokeBackgroundAnimation);
+ } else if ("withDash".equals(buttonName)) {
+ if (!withDashCount) {
+ return false;
+ }
+ ShapeElement withDashElement = (ShapeElement) cpt.getBackgroundElement();
+ withDashElement.setStroke(withDashElement.getStrokeWidth(), RgbColor.fromArgbInt(Color.RED.getValue()));
+ this.setBackground(withDashElement);
+ this.setTextColor(Color.RED);
+ } else if ("withStroke".equals(buttonName)) {
+ if (!withStrokeCount) {
+ return false;
+ }
+ ShapeElement withStrokeElement = (ShapeElement) cpt.getBackgroundElement();
+ withStrokeElement.setStroke(withStrokeElement.getStrokeWidth(), RgbColor.fromArgbInt(Color.RED.getValue()));
+ this.setBackground(withStrokeElement);
+ this.setTextColor(Color.RED);
+ }
+ return true;
+ case TouchEvent.PRIMARY_POINT_UP:
+ // 控制点移出button后PointUp不生效
+ if (moveOutOfButtonFlag) {
+ return true;
+ }
+ upElement = new ShapeElement();
+ upColor = new RgbColor(46, 64, 159);
+ if ("changeTextColor".equals(buttonName)) {
+ changeTextColorCount = false;
+ this.setTextColor(orange);
+ } else if ("changeBackGround".equals(buttonName)) {
+ changeBackGroundCount = false;
+ ShapeElement cBackElement = (ShapeElement) cpt.getBackgroundElement();
+ cBackElement.setRgbColor(RgbColor.fromArgbInt(Color.RED.getValue()));
+ } else if (("withRadius").equals(buttonName)) {
+ upElement.setCornerRadiiArray(new float[]{30, 30, 30, 30, 30, 30, 30, 30});
+ upElement.setRgbColor(upColor);
+ this.setBackground(upElement);
+ } else if ("roundRadius".equals(buttonName)) {
+ upElement.setCornerRadiiArray(new float[]{100, 100, 100, 100, 100, 100, 100, 100});
+ upElement.setRgbColor(upColor);
+ this.setBackground(upElement);
+ } else if ("differentRadius".equals(buttonName)) {
+ upElement.setCornerRadiiArray(new float[]{0, 0, 20, 20, 30, 30, 80, 80});
+ upElement.setRgbColor(upColor);
+ this.setBackground(upElement);
+ } else if ("keepStroke".equals(buttonName)) {
+ ShapeElement keepStrokeEle = (ShapeElement) cpt.getBackgroundElement();
+ keepStrokeEle.setRgbColor(RgbColor.fromArgbInt(Color.BLACK.getValue()));
+ this.setBackground(keepStrokeEle);
+ } else if ("strokeBackground".equals(buttonName)) {
+ ShapeElement strokeBackground = (ShapeElement) cpt.getBackgroundElement();
+ strokeBackground.setStroke(10, strokeBackground.getStrokeColor());
+ strokeBackground.setRgbColor(RgbColor.fromArgbInt(Color.BLACK.getValue()));
+ this.setBackground(strokeBackground);
+ } else if ("strokeBackgroundAnimation".equals(buttonName)) {
+ ShapeElement strokeBackgroundAnimation = (ShapeElement) cpt.getBackgroundElement();
+ strokeBackgroundAnimation.setStroke(10, strokeBackgroundAnimation.getStrokeColor());
+ strokeBackgroundAnimation.setRgbColor(RgbColor.fromArgbInt(Color.BLACK.getValue()));
+ this.setBackground(strokeBackgroundAnimation);
+ } else if ("withDash".equals(buttonName)) {
+ withDashCount = false;
+ ShapeElement withDashElement = (ShapeElement) cpt.getBackgroundElement();
+ withDashElement.setStroke(withDashElement.getStrokeWidth(), RgbColor.fromArgbInt(orange.getValue()));
+ this.setBackground(withDashElement);
+ this.setTextColor(orange);
+ return false;
+ } else if ("withStroke".equals(buttonName)) {
+ withStrokeCount = false;
+ ShapeElement withStrokeElement = (ShapeElement) cpt.getBackgroundElement();
+ withStrokeElement.setStroke(withStrokeElement.getStrokeWidth(), RgbColor.fromArgbInt(orange.getValue()));
+ this.setBackground(withStrokeElement);
+ this.setTextColor(orange);
+ }
+ return true;
+ case TouchEvent.POINT_MOVE:
+ moveOutElement = new ShapeElement();
+ moveOutColor = new RgbColor(63, 78, 180);
+
+ // 移动中的触摸点坐标X
+ float newTouchX = touchEvent.getPointerScreenPosition(0).getX();
+
+ // 移动中的触摸点坐标Y
+ float newTouchY = touchEvent.getPointerScreenPosition(0).getY();
+ if (isOutOfButton(newTouchX, newTouchY)) {
+ moveOutOfButtonFlag = true;
+ if ("changeTextColor".equals(buttonName)) {
+ this.setTextColor(Color.WHITE);
+ } else if ("changeBackGround".equals(buttonName)) {
+ ShapeElement cBackElement = (ShapeElement) cpt.getBackgroundElement();
+ cBackElement.setRgbColor(moveOutColor);
+ } else if (("withRadius").equals(buttonName)) {
+ moveOutElement.setCornerRadiiArray(new float[]{30, 30, 30, 30, 30, 30, 30, 30});
+ moveOutElement.setRgbColor(moveOutColor);
+ this.setBackground(moveOutElement);
+ } else if ("roundRadius".equals(buttonName)) {
+ moveOutElement.setCornerRadiiArray(new float[]{100, 100, 100, 100, 100, 100, 100, 100});
+ moveOutElement.setRgbColor(moveOutColor);
+ this.setBackground(moveOutElement);
+ } else if ("differentRadius".equals(buttonName)) {
+ moveOutElement.setCornerRadiiArray(new float[]{0, 0, 20, 20, 30, 30, 80, 80});
+ moveOutElement.setRgbColor(moveOutColor);
+ this.setBackground(moveOutElement);
+ } else if ("keepStroke".equals(buttonName)) {
+ ShapeElement keepStrokeEle = (ShapeElement) cpt.getBackgroundElement();
+ keepStrokeEle.setRgbColor(RgbColor.fromArgbInt(Color.BLACK.getValue()));
+ this.setBackground(keepStrokeEle);
+ } else if ("strokeBackground".equals(buttonName)) {
+ ShapeElement strokeBackground = (ShapeElement) cpt.getBackgroundElement();
+ strokeBackground.setStroke(10, strokeBackground.getStrokeColor());
+ strokeBackground.setRgbColor(RgbColor.fromArgbInt(Color.BLACK.getValue()));
+ this.setBackground(strokeBackground);
+ } else if ("strokeBackgroundAnimation".equals(buttonName)) {
+ ShapeElement strokeBackgroundAnimation = (ShapeElement) cpt.getBackgroundElement();
+ strokeBackgroundAnimation.setStroke(10, strokeBackgroundAnimation.getStrokeColor());
+ strokeBackgroundAnimation.setRgbColor(RgbColor.fromArgbInt(Color.BLACK.getValue()));
+ this.setBackground(strokeBackgroundAnimation);
+ } else if ("withDash".equals(buttonName)) {
+ ShapeElement withDashElement = (ShapeElement) cpt.getBackgroundElement();
+ int width = withDashElement.getWidth();
+ withDashElement.setStroke(withDashElement.getStrokeWidth(), RgbColor.fromArgbInt(Color.WHITE.getValue()));
+ this.setBackground(withDashElement);
+ this.setTextColor(Color.WHITE);
+ } else if ("withStroke".equals(buttonName)) {
+ ShapeElement withStrokeElement = (ShapeElement) cpt.getBackgroundElement();
+ withStrokeElement.setStroke(withStrokeElement.getStrokeWidth(), RgbColor.fromArgbInt(Color.WHITE.getValue()));
+ this.setBackground(withStrokeElement);
+ this.setTextColor(Color.WHITE);
+ }
+ return false;
+ }
+ default:
+ }
+ return false;
+ }
+
+ /**
+ * 判断控制点是否在button范围内,X轴计算准确;
+ * Y轴计算不准确:这里的计算,假设点击位置都在button高度h的中心点击,
+ * 移动偏移1/2高度,就当做移出button范围.
+ * bug示例: 当点击位置位于button上边框附近时,向下滑动超过1/2h则会判断为移出button范围,
+ * 实际上并未超出button
+ * 最上边的label和屏幕顶端状态栏还有高度
+ *
+ * @param newTouchX
+ * @param newTouchY
+ * @return
+ */
+ private boolean isOutOfButton(float newTouchX, float newTouchY) {
+ if (newTouchX < leftX) {
+ return true;
+ } else if (newTouchX > rightX) {
+ return true;
+ } else if (newTouchY < topY) {
+ return true;
+ } else if (newTouchY > bottomY) {
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/libary/src/main/java/com/deadline/statebutton/StateConfig.java b/statebutton/src/main/java/com/deadline/statebutton/StateConfig.java
similarity index 65%
rename from libary/src/main/java/com/deadline/statebutton/StateConfig.java
rename to statebutton/src/main/java/com/deadline/statebutton/StateConfig.java
index dd1346b7cd85ea760a7888dea298347756f05503..6a447ee465424ee39f1fc1e6e4b8319b1ee8e7c1 100644
--- a/libary/src/main/java/com/deadline/statebutton/StateConfig.java
+++ b/statebutton/src/main/java/com/deadline/statebutton/StateConfig.java
@@ -1,23 +1,18 @@
package com.deadline.statebutton;
-import android.support.annotation.ColorInt;
-import android.support.annotation.FloatRange;
-import android.support.annotation.IntRange;
-
-public final class StateConfig {
-
- //animation duration
+public class StateConfig {
+ // 动画 animation duration
private int mDuration;
- //radius
+ // 半径 radius
private float mRadius;
- //text color
+ // text color
private int mNormalTextColor;
private int mPressedTextColor;
private int mUnableTextColor;
- //stroke
+ // stroke
private float mStrokeDashWidth;
private float mStrokeDashGap;
private int mNormalStrokeWidth;
@@ -27,7 +22,7 @@ public final class StateConfig {
private int mPressedStrokeColor;
private int mUnableStrokeColor;
- //background color
+ // 背景色background color
private int mNormalBackgroundColor;
private int mPressedBackgroundColor;
private int mUnableBackgroundColor;
@@ -51,75 +46,75 @@ public final class StateConfig {
this.mUnableBackgroundColor = builder.mUnableBackgroundColor;
}
- public int getNormalTextColor() {
+ private int getNormalTextColor() {
return mNormalTextColor;
}
- public int getPressedTextColor() {
+ private int getPressedTextColor() {
return mPressedTextColor;
}
- public int getUnableTextColor() {
+ private int getUnableTextColor() {
return mUnableTextColor;
}
- public int getDuration() {
+ private int getDuration() {
return mDuration;
}
- public float getRadius() {
+ private float getRadius() {
return mRadius;
}
- public float getStrokeDashWidth() {
+ private float getStrokeDashWidth() {
return mStrokeDashWidth;
}
- public float getStrokeDashGap() {
+ private float getStrokeDashGap() {
return mStrokeDashGap;
}
- public int getNormalStrokeWidth() {
+ private int getNormalStrokeWidth() {
return mNormalStrokeWidth;
}
- public int getPressedStrokeWidth() {
+ private int getPressedStrokeWidth() {
return mPressedStrokeWidth;
}
- public int getUnableStrokeWidth() {
+ private int getUnableStrokeWidth() {
return mUnableStrokeWidth;
}
- public int getNormalStrokeColor() {
+ private int getNormalStrokeColor() {
return mNormalStrokeColor;
}
- public int getPressedStrokeColor() {
+ private int getPressedStrokeColor() {
return mPressedStrokeColor;
}
- public int getUnableStrokeColor() {
+ private int getUnableStrokeColor() {
return mUnableStrokeColor;
}
- public int getNormalBackgroundColor() {
+ private int getNormalBackgroundColor() {
return mNormalBackgroundColor;
}
- public int getPressedBackgroundColor() {
+ private int getPressedBackgroundColor() {
return mPressedBackgroundColor;
}
- public int getUnableBackgroundColor() {
+ private int getUnableBackgroundColor() {
return mUnableBackgroundColor;
}
- public static Builder newBuilder() {
+ private static Builder newBuilder() {
return new Builder();
}
- public static class Builder {
+ private static class Builder {
//animation duration
private int mDuration;
@@ -148,111 +143,111 @@ public final class StateConfig {
private int mUnableBackgroundColor;
- public Builder setDuration(@IntRange(from = 0) int duration) {
+ private Builder setDuration( int duration) {
this.mDuration = duration;
return this;
}
- public Builder setRadius(@FloatRange(from = 0) float radius) {
+ private Builder setRadius(float radius) {
this.mRadius = radius;
return this;
}
- public Builder setNormalTextColor(@ColorInt int normalTextColor) {
+ private Builder setNormalTextColor(int normalTextColor) {
this.mNormalTextColor = normalTextColor;
return this;
}
- public Builder setPressedTextColor(@ColorInt int pressedTextColor) {
+ private Builder setPressedTextColor(int pressedTextColor) {
this.mPressedTextColor = pressedTextColor;
return this;
}
- public Builder setUnableTextColor(@ColorInt int unableTextColor) {
+ private Builder setUnableTextColor(int unableTextColor) {
this.mUnableTextColor = unableTextColor;
return this;
}
- public Builder setStrokeDashWidth(@FloatRange(from = 0) float strokeDashWidth) {
+ private Builder setStrokeDashWidth(float strokeDashWidth) {
this.mStrokeDashWidth = strokeDashWidth;
return this;
}
- public Builder setStrokeDashGap(@FloatRange(from = 0) float strokeDashGap) {
+ private Builder setStrokeDashGap(float strokeDashGap) {
this.mStrokeDashGap = strokeDashGap;
return this;
}
- public Builder setNormalStrokeWidth(@IntRange(from = 0) int normalStrokeWidth) {
+ private Builder setNormalStrokeWidth(int normalStrokeWidth) {
this.mNormalStrokeWidth = normalStrokeWidth;
return this;
}
- public Builder setPressedStrokeWidth(@IntRange(from = 0) int pressedStrokeWidth) {
+ private Builder setPressedStrokeWidth(int pressedStrokeWidth) {
this.mPressedStrokeWidth = pressedStrokeWidth;
return this;
}
- public Builder setUnableStrokeWidth(@IntRange(from = 0) int unableStrokeWidth) {
+ private Builder setUnableStrokeWidth(int unableStrokeWidth) {
this.mUnableStrokeWidth = unableStrokeWidth;
return this;
}
- public Builder setNormalStrokeColor(@ColorInt int normalStrokeColor) {
+ private Builder setNormalStrokeColor(int normalStrokeColor) {
this.mNormalStrokeColor = normalStrokeColor;
return this;
}
- public Builder setPressedStrokeColor(@ColorInt int pressedStrokeColor) {
+ private Builder setPressedStrokeColor(int pressedStrokeColor) {
this.mPressedStrokeColor = pressedStrokeColor;
return this;
}
- public Builder setUnableStrokeColor(@ColorInt int unableStrokeColor) {
+ private Builder setUnableStrokeColor(int unableStrokeColor) {
this.mUnableStrokeColor = mUnableStrokeColor;
return this;
}
- public Builder setNormalBackgroundColor(@ColorInt int normalBackgroundColor) {
+ private Builder setNormalBackgroundColor(int normalBackgroundColor) {
this.mNormalBackgroundColor = normalBackgroundColor;
return this;
}
- public Builder setPressedBackgroundColor(@ColorInt int pressedBackgroundColor) {
+ private Builder setPressedBackgroundColor(int pressedBackgroundColor) {
this.mPressedBackgroundColor = pressedBackgroundColor;
return this;
}
- public Builder setUnableBackgroundColor(@ColorInt int unableBackgroundColor) {
+ private Builder setUnableBackgroundColor(int unableBackgroundColor) {
this.mUnableBackgroundColor = unableBackgroundColor;
return this;
}
- public Builder setStateTextColor(@ColorInt int normal, @ColorInt int pressed, @ColorInt int unable){
+ private Builder setStateTextColor(int normal,int pressed,int unable){
this.mNormalTextColor = normal;
this.mPressedTextColor = pressed;
this.mUnableTextColor = unable;
return this;
}
- public Builder setStateBackgroundColor(@ColorInt int normal, @ColorInt int pressed, @ColorInt int unable){
+ private Builder setStateBackgroundColor(int normal, int pressed, int unable) {
mNormalBackgroundColor = normal;
mPressedBackgroundColor = pressed;
mUnableBackgroundColor = unable;
return this;
}
- public Builder setStateStrokeColor(@ColorInt int normal, @ColorInt int pressed, @ColorInt int unable){
+ private Builder setStateStrokeColor(int normal, int pressed, int unable) {
mNormalStrokeColor = normal;
mPressedStrokeColor = pressed;
mUnableStrokeColor = unable;
return this;
}
- public Builder() {
+ private Builder() {
}
- public StateConfig build() {
+ private StateConfig build() {
return new StateConfig(this);
}
}
diff --git a/libary/src/main/java/com/deadline/statebutton/StateImageView.java b/statebutton/src/main/java/com/deadline/statebutton/StateImageView.java
similarity index 36%
rename from libary/src/main/java/com/deadline/statebutton/StateImageView.java
rename to statebutton/src/main/java/com/deadline/statebutton/StateImageView.java
index be07ea1473b1ddc2bb5580b0cbe9c78f4290de39..4b0239c61f9699c25e726e1b45e3cbcee211e70d 100644
--- a/libary/src/main/java/com/deadline/statebutton/StateImageView.java
+++ b/statebutton/src/main/java/com/deadline/statebutton/StateImageView.java
@@ -1,66 +1,49 @@
package com.deadline.statebutton;
-import android.content.Context;
-import android.content.res.TypedArray;
-import android.graphics.drawable.Drawable;
-import android.graphics.drawable.StateListDrawable;
-import android.support.annotation.IntRange;
-import android.support.v7.widget.AppCompatImageView;
-import android.util.AttributeSet;
+import ohos.agp.components.AttrSet;
+import ohos.agp.components.Image;
+import ohos.agp.components.element.Element;
+import ohos.agp.components.element.StateElement;
+import ohos.app.Context;
-/**
- * Created by deadline on 2017/1/11.
- * 根据用户点击状态设置不同的图片
- */
+public class StateImageView extends Image {
+ private Element mNormalDrawable;
-public class StateImageView extends AppCompatImageView {
+ private Element mPressedDrawable;
- private Drawable mNormalDrawable;
-
- private Drawable mPressedDrawable;
-
- private Drawable mUnableDrawable;
+ private Element mUnableDrawable;
private int mDuration = 0;
private int[][] states;
- private StateListDrawable mStateBackground;
+ private StateElement mStateBackground;
- public StateImageView(Context context) {
+ private StateImageView(Context context) {
this(context, null);
}
- public StateImageView(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
+ private StateImageView(Context context, AttrSet attrSet) {
+ this(context, attrSet, "0");
+ context.getString(ResourceTable.String_app_name);
}
- public StateImageView(Context context, AttributeSet attrs, int defStyleAttr) {
- super(context, attrs, defStyleAttr);
-
+ private StateImageView(Context context, AttrSet attrSet, String defStyleAttr) {
+ super(context, attrSet, defStyleAttr);
states = new int[4][];
- states[0] = new int[] { android.R.attr.state_pressed, android.R.attr.state_enabled };
- states[1] = new int[] { android.R.attr.state_enabled, android.R.attr.state_focused };
- states[3] = new int[] { -android.R.attr.state_enabled };
- states[2] = new int[] { android.R.attr.state_enabled };
-
- Drawable drawable = getBackground();
- if(drawable != null && drawable instanceof StateListDrawable){
- mStateBackground = (StateListDrawable) drawable;
- }else{
- mStateBackground = new StateListDrawable();
+ Element drawable = getBackgroundElement();
+ if (drawable != null && drawable instanceof StateElement) {
+ mStateBackground = (StateElement) drawable;
+ } else {
+ mStateBackground = new StateElement();
}
-
- TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.StateImageView);
-
- mNormalDrawable = a.getDrawable(R.styleable.StateImageView_normalBackground);
- mPressedDrawable = a.getDrawable(R.styleable.StateImageView_pressedBackground);
- mUnableDrawable = a.getDrawable(R.styleable.StateImageView_unableBackground);
+ mNormalDrawable = attrSet.getAttr("normalBackground").get().getElement();
+ mPressedDrawable = attrSet.getAttr("pressedBackground").get().getElement();
+ mUnableDrawable = attrSet.getAttr("unableBackground").get().getElement();
setStateBackground(mNormalDrawable, mPressedDrawable, mUnableDrawable);
- mDuration = a.getInteger(R.styleable.StateImageView_AnimationDuration, mDuration);
+ mDuration = attrSet.getAttr("").get().getIntegerValue();
setAnimationDuration(mDuration);
- a.recycle();
}
/**
@@ -69,7 +52,7 @@ public class StateImageView extends AppCompatImageView {
* @param pressed
* @param unable
*/
- public void setStateBackground(Drawable normal, Drawable pressed, Drawable unable){
+ private void setStateBackground(Element normal, Element pressed, Element unable){
this.mNormalDrawable = normal;
this.mPressedDrawable = pressed;
this.mUnableDrawable = unable;
@@ -87,17 +70,18 @@ public class StateImageView extends AppCompatImageView {
if(mNormalDrawable != null) {
mStateBackground.addState(states[2], mNormalDrawable);
}
- setBackgroundDrawable(mStateBackground);
+ setBackground(mStateBackground);
}
/**
* 设置动画时长
+ *
* @param duration
+ *
*/
- public void setAnimationDuration(@IntRange(from = 0)int duration){
+ private void setAnimationDuration(int duration) {
this.mDuration = duration;
mStateBackground.setEnterFadeDuration(mDuration);
mStateBackground.setExitFadeDuration(mDuration);
}
-
}
diff --git a/statebutton/src/main/java/com/deadline/statebutton/ViewExtend.java b/statebutton/src/main/java/com/deadline/statebutton/ViewExtend.java
new file mode 100644
index 0000000000000000000000000000000000000000..2983bd2958d93873376d0e939f28c9fbd632b143
--- /dev/null
+++ b/statebutton/src/main/java/com/deadline/statebutton/ViewExtend.java
@@ -0,0 +1,50 @@
+package com.deadline.statebutton;
+
+import ohos.agp.components.AttrSet;
+import ohos.agp.components.Component;
+import ohos.agp.components.element.Element;
+import ohos.agp.render.Canvas;
+import ohos.agp.render.Paint;
+import ohos.agp.utils.Color;
+import ohos.app.Context;
+
+public class ViewExtend extends Component implements Component.DrawTask {
+
+ private Paint mPaint;
+
+ private ViewExtend(Context context) {
+ super(context);
+ }
+
+ private ViewExtend(Context context, AttrSet attrSet) {
+ super(context, attrSet);
+ init();
+ invalidate();
+ }
+
+ private ViewExtend(Context context, AttrSet attrSet, String styleName) {
+ super(context, attrSet, styleName);
+ }
+
+ private ViewExtend(Context context, AttrSet attrSet, int resId) {
+ super(context, attrSet, resId);
+ }
+
+ private void init() {
+ mPaint = new Paint();
+ mPaint.setColor(Color.RED);
+ mPaint.setStyle(Paint.Style.STROKE_STYLE);
+ mPaint.setStrokeWidth(10);
+ }
+
+ @Override
+ public void invalidate() {
+ super.invalidate();
+ addDrawTask(this::onDraw);
+ }
+
+ @Override
+ public void onDraw(Component component, Canvas canvas) {
+ Element backgroundElement = component.getBackgroundElement();
+ }
+}
diff --git a/statebutton/src/main/resources/base/element/color.json b/statebutton/src/main/resources/base/element/color.json
new file mode 100644
index 0000000000000000000000000000000000000000..5439e7f84d734b02d0f4d358afe952fb163d6859
--- /dev/null
+++ b/statebutton/src/main/resources/base/element/color.json
@@ -0,0 +1,17 @@
+{
+ "color":[
+ {
+ "name": "orange",
+ "value": "#ff8800"
+ },
+ {
+ "name":"blue",
+ "value":"#4050b5"
+ },
+ {
+ "name": "blue_dark",
+ "value": "#2e409f"
+ }
+ ]
+}
+
diff --git a/statebutton/src/main/resources/base/element/string.json b/statebutton/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..e632bc774381b941dd919e4862ec8bac63ae94b7
--- /dev/null
+++ b/statebutton/src/main/resources/base/element/string.json
@@ -0,0 +1,8 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "StateButton"
+ }
+ ]
+}
diff --git a/statebutton/src/test/java/com/deadline/statebutton/ExampleTest.java b/statebutton/src/test/java/com/deadline/statebutton/ExampleTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..3510e7c10660e9e29734e4f2c9aa7f34e108bfde
--- /dev/null
+++ b/statebutton/src/test/java/com/deadline/statebutton/ExampleTest.java
@@ -0,0 +1,9 @@
+package com.deadline.statebutton;
+
+import org.junit.Test;
+
+public class ExampleTest {
+ @Test
+ public void onStart() {
+ }
+}