diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index bdb0cabc87cf50106df6e15097dff816c8c3eb34..0000000000000000000000000000000000000000 --- a/.gitattributes +++ /dev/null @@ -1,17 +0,0 @@ -# Auto detect text files and perform LF normalization -* text=auto - -# Custom for Visual Studio -*.cs diff=csharp - -# Standard to msysgit -*.doc diff=astextplain -*.DOC diff=astextplain -*.docx diff=astextplain -*.DOCX diff=astextplain -*.dot diff=astextplain -*.DOT diff=astextplain -*.pdf diff=astextplain -*.PDF diff=astextplain -*.rtf diff=astextplain -*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore index c81986cbb899da46882e0e2d944c1bd8ce537532..c2892a188e06ba15c0e0ef3ee3d8eb81f2d42dd9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,16 @@ +*.iml .gradle -/gradle -/.idea +.idea /local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store /build -/iml -*.iml -build /captures +.externalNativeBuild +/entry/.preview +.cxx diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..2df93e2eeb60bdce6f4b21f826da892cfba33593 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,4 @@ +### 0.0.1-SNAPSHOT + 支持一些关键字可以用下划线单击文本视图 + 完整实现了源库全部API + diff --git a/README.OPENSOURCE b/README.OPENSOURCE new file mode 100644 index 0000000000000000000000000000000000000000..477d8dc36454183c7496fac47d6838e420348f10 --- /dev/null +++ b/README.OPENSOURCE @@ -0,0 +1,17 @@ +[ + + { + "Name":"AutoSpannableTextView", + + "License":"无", + + "License File":"无", + + "Version Number":"v1.0.1", + + "Upstream URL":"https://github.com/wangshaolei/AutoSpannableTextView", + + "Description":"支持一些关键词可以用下划线文本视图单击" + } + +] \ No newline at end of file diff --git a/README.md b/README.md index c6df8482f07e20484fd4f7602bf7d9e26203d441..e35aab38a210b26fd1980c22e67912f50718fc26 100644 --- a/README.md +++ b/README.md @@ -1,67 +1,85 @@ -# AutoSpannableTextView -Support some of the key words can be clicked with the underline TextView
- - -Step1: - -```xml - - //key word with color and underline, and split with ','(en) - //word and underline's color - //underline with true and false - //start with image 's TextView - - - //default - - + +#### AutoSpannableTextView + +#### 项目介绍 + +* 项目名称: AutoSpannableTextView +* 所属系列:openharmony的第三方组件适配移植 +* 功能:支持一些关键词可以用下划线文本视图单击 +* 项目移植状态:主功能完成 +* 调用差异:JS +* 开发版本:sdk6,DevEco Studio 2.2 bate1 +* 基线版本:Release v1.0.1 + +#### 效果演示 + + + +#### 安装教程 +直接引入主界面即可使用 + +#### 使用说明 +1. 在hml代码中,点击事件的目标元素添加自定义属性idx,绑定点击事件textClick ``` -
- -Step2: - -```xml - //style1 - - //style2 - +
+ 我已核对付款金额,仔细阅读并同意 + + "购买须知" + + 及团购 + + "用户条款" + +
+``` +2. JS 中声明绑定事件textClick +在JS中,data中声明全局变量idx,通过点击事件,获取到当前被点击到的元素的idx的值,赋值给全局变量idx +hml中通过三元表达式,动态绑定classs属性 ``` -Step3: - -```java - - //style1 - autoLinkStyleTextView.setOnClickCallBack(new AutoLinkStyleTextView.ClickCallBack() { - @Override - public void onClick(int position) { - if (position == 0) { - Toast.makeText(MainActivity.this, "购买须知", Toast.LENGTH_SHORT).show(); - } else if (position == 1) { - Toast.makeText(MainActivity.this, "用户条款", Toast.LENGTH_SHORT).show(); +textClick(event){ + if(event.target.attr.value==undefined || event.target.attr.idx==undefined){ + this.isClick=false; + } + if(this.isClick==false){ + this.isClick=true; + this.idx=-1; + if(event.target.attr.idx){ + if(this.idx!=event.target.attr.idx){ + this.idx=event.target.attr.idx; + }else{ + this.idx=-1; } } - }); - - //style2 - setStartImageText(tvStartImage.getText()); + if(event.target.attr.value){ + this.title=event.target.attr.value.replace(/^\"|\"$/g,''); + let that=this; + setTimeout(()=>{ + this.title=""; + this.isClick=false; + },1500); + }else{ + this.title=""; + } + } + setTimeout(()=>{ + this.isClick=false; + },1500); +} ``` -![](https://github.com/wangshaolei/UnderLineLinkTextView/blob/master/img/1.png) -![](https://github.com/wangshaolei/UnderLineLinkTextView/blob/master/img/2.png) -![](https://github.com/wangshaolei/UnderLineLinkTextView/blob/master/img/3.png) +#### 测试信息 + +CodeCheck代码测试无异常 + +CloudTest代码测试无异常 + +病毒安全检测通过 + +当前版本demo功能与原组件基本无差异 + + +#### 版本迭代 + +* 0.0.1-SNAPSHOT + diff --git a/app/build.gradle b/app/build.gradle deleted file mode 100644 index a12083995a2ae48a3567f6754b002fe9e35fbb69..0000000000000000000000000000000000000000 --- a/app/build.gradle +++ /dev/null @@ -1,25 +0,0 @@ -apply plugin: 'com.android.application' - -android { - compileSdkVersion 25 - buildToolsVersion "25.0.2" - - defaultConfig { - applicationId "com.len" - minSdkVersion 16 - targetSdkVersion 25 - versionCode 101 - versionName "1.0.1" - } - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - } - } -} - -dependencies { - compile fileTree(include: ['*.jar'], dir: 'libs') - compile project(':library') -} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro deleted file mode 100644 index a6f67b6f3f381d9ec6a1678eb57ffbc61e3470a2..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 H:\AndroidStudio\sdk/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the proguardFiles -# directive in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} diff --git a/app/src/androidTest/java/com/len/ApplicationTest.java b/app/src/androidTest/java/com/len/ApplicationTest.java deleted file mode 100644 index 517e1bbd189970cb8830ca4c4e33a1c1ebb189bf..0000000000000000000000000000000000000000 --- a/app/src/androidTest/java/com/len/ApplicationTest.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.len; - -import android.app.Application; -import android.test.ApplicationTestCase; - -/** - * Testing Fundamentals - */ -public class ApplicationTest extends ApplicationTestCase { - public ApplicationTest() { - super(Application.class); - } -} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml deleted file mode 100644 index 107cd87cdfcfe14069bdf780b69b8feca2e94e9a..0000000000000000000000000000000000000000 --- a/app/src/main/AndroidManifest.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/java/com/len/MainActivity.java b/app/src/main/java/com/len/MainActivity.java deleted file mode 100644 index 688812537641130a2cba821fa480b36865454a86..0000000000000000000000000000000000000000 --- a/app/src/main/java/com/len/MainActivity.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.len; - -import android.os.Bundle; -import android.support.v7.app.AppCompatActivity; -import android.widget.Toast; - -import com.len.library.AutoLinkStyleTextView; - -public class MainActivity extends AppCompatActivity { - private AutoLinkStyleTextView autoLinkStyleTextView, tvStartImage; - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main); - autoLinkStyleTextView = (AutoLinkStyleTextView) findViewById(R.id.tv); - autoLinkStyleTextView.setOnClickCallBack(new AutoLinkStyleTextView.ClickCallBack() { - @Override - public void onClick(int position) { - if (position == 0) { - Toast.makeText(MainActivity.this, "购买须知", Toast.LENGTH_SHORT).show(); - } else if (position == 1) { - Toast.makeText(MainActivity.this, "用户条款", Toast.LENGTH_SHORT).show(); - } - } - }); - tvStartImage = (AutoLinkStyleTextView) findViewById(R.id.tv_start_image); - tvStartImage.setStartImageText(tvStartImage.getText()); - } -} 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 836b49aea8d10bd6cf97bd9eae4a42c305a179d4..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/activity_main.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png deleted file mode 100644 index cde69bcccec65160d92116f20ffce4fce0b5245c..0000000000000000000000000000000000000000 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png deleted file mode 100644 index c133a0cbd379f5af6dbf1a899a0293ca5eccfad0..0000000000000000000000000000000000000000 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png deleted file mode 100644 index bfa42f0e7b91d006d22352c9ff2f134e504e3c1d..0000000000000000000000000000000000000000 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png deleted file mode 100644 index 324e72cdd7480cb983fa1bcc7ce686e51ef87fe7..0000000000000000000000000000000000000000 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png deleted file mode 100644 index aee44e138434630332d88b1680f33c4b24c70ab3..0000000000000000000000000000000000000000 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ diff --git a/app/src/main/res/values-w820dp/dimens.xml b/app/src/main/res/values-w820dp/dimens.xml deleted file mode 100644 index 63fc816444614bd64f68a372d1f93211628ee51d..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-w820dp/dimens.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - 64dp - diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml deleted file mode 100644 index 3ab3e9cbce07f7cdc941fc8ba424c05e83ed80f0..0000000000000000000000000000000000000000 --- a/app/src/main/res/values/colors.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - #3F51B5 - #303F9F - #FF4081 - diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml deleted file mode 100644 index 47c82246738c4d056e8030d3a259206f42e8e15d..0000000000000000000000000000000000000000 --- a/app/src/main/res/values/dimens.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - 16dp - 16dp - diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml deleted file mode 100644 index 2aab541eaf0b6174544264ae90db44f610c72538..0000000000000000000000000000000000000000 --- a/app/src/main/res/values/strings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - AutoSpannableTextView - diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml deleted file mode 100644 index 5885930df6d10edf3d6df40d6556297d11f953da..0000000000000000000000000000000000000000 --- a/app/src/main/res/values/styles.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - diff --git a/app/src/test/java/com/len/ExampleUnitTest.java b/app/src/test/java/com/len/ExampleUnitTest.java deleted file mode 100644 index b131dde537525805b2203c5420fa93e21a035c88..0000000000000000000000000000000000000000 --- a/app/src/test/java/com/len/ExampleUnitTest.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.len; - -import org.junit.Test; - -import static org.junit.Assert.*; - -/** - * To work on unit tests, switch the Test Artifact in the Build Variants view. - */ -public class ExampleUnitTest { - @Test - public void addition_isCorrect() throws Exception { - assertEquals(4, 2 + 2); - } -} \ No newline at end of file diff --git a/build.gradle b/build.gradle index 1ea4bd05500327c0032ade1bb0cb00e0fa032c22..fd383b9ad5f8cb6947c897734ddc7d7681395fe9 100644 --- a/build.gradle +++ b/build.gradle @@ -1,23 +1,38 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. +apply plugin: 'com.huawei.ohos.app' + +//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#ZH-CN_TOPIC_0000001154985555__section1112183053510 +ohos { + compileSdkVersion 6 + defaultConfig { + compatibleSdkVersion 5 + } +} buildscript { repositories { + maven { + url 'https://repo.huaweicloud.com/repository/maven/' + } + maven { + url 'https://developer.huawei.com/repo/' + } jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:2.3.0' - - // NOTE: Do not place your application dependencies here; they belong - // in the individual module build.gradle files + classpath 'com.huawei.ohos:hap:2.4.5.0' + classpath 'com.huawei.ohos:decctest:1.2.4.1' } } allprojects { repositories { + maven { + url 'https://repo.huaweicloud.com/repository/maven/' + } + maven { + url 'https://developer.huawei.com/repo/' + } jcenter() } } - -task clean(type: Delete) { - delete rootProject.buildDir -} diff --git a/app/.gitignore b/entry/.gitignore similarity index 100% rename from app/.gitignore rename to entry/.gitignore diff --git a/entry/build.gradle b/entry/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..745190e7004e0d3919e73aa8d0dd4d15c249d830 --- /dev/null +++ b/entry/build.gradle @@ -0,0 +1,38 @@ +apply plugin: 'com.huawei.ohos.hap' +apply plugin: 'com.huawei.ohos.decctest' +//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#ZH-CN_TOPIC_0000001154985555__section1112183053510 +ohos { + signingConfigs { + debug { + storeFile file('C:\\Users\\273341tianshuai\\.ohos\\config\\auto_debug_2850086000492781927.p12') + storePassword '000000185FFCA58CE3E0E9E125691AC897C3619BF77BA98A889ACE60FE95DB51FB40FC07ECFAFD45' + keyAlias = 'debugKey' + keyPassword '00000018318F1CC2D82A5C1BB6D84C5418DFE19CEB5F04215F1E71D1609BA415068B3D9DD7E47E36' + signAlg = 'SHA256withECDSA' + profile file('C:\\Users\\273341tianshuai\\.ohos\\config\\auto_debug_len_2850086000492781927.p7b') + certpath file('C:\\Users\\273341tianshuai\\.ohos\\config\\auto_debug_2850086000492781927.cer') + } + } + compileSdkVersion 6 + defaultConfig { + compatibleSdkVersion 5 + } + buildTypes { + release { + proguardOpt { + proguardEnabled false + rulesFiles 'proguard-rules.pro' + } + } + } + +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar', '*.har']) + testImplementation 'junit:junit:4.13' + ohosTestImplementation 'com.huawei.ohos.testkit:runner:1.0.0.100' +} +decc { + supportType = ['html', 'xml'] +} diff --git a/entry/package.json b/entry/package.json new file mode 100644 index 0000000000000000000000000000000000000000..0967ef424bce6791893e9a57bb952f80fd536e93 --- /dev/null +++ b/entry/package.json @@ -0,0 +1 @@ +{} 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..69e96b53560b2b4c30bed9d0b613d10494b2f83e --- /dev/null +++ b/entry/src/main/config.json @@ -0,0 +1,66 @@ +{ + "app": { + "bundleName": "com.len", + "vendor": "len", + "version": { + "code": 1000000, + "name": "1.0.0" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.len", + "name": ".MyApplication", + "mainAbility": "com.len.MainAbility", + "deviceType": [ + "phone" + ], + "metaData": { + "customizeData": [ + { + "name": "hwc-theme", + "value": "androidhwext:style/Theme.Emui.NoTitleBar", + "extra": "" + } + ] + }, + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.len.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": true + } + } + ] + } +} \ No newline at end of file diff --git a/entry/src/main/java/com/len/MainAbility.java b/entry/src/main/java/com/len/MainAbility.java new file mode 100644 index 0000000000000000000000000000000000000000..4b13df5ef82567b9e41bdf228a4a0905fa73c95e --- /dev/null +++ b/entry/src/main/java/com/len/MainAbility.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain an copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.len; + +import ohos.ace.ability.AceAbility; +import ohos.aafwk.content.Intent; + +/** + * MainAbility + * + * @author:username + * @since 2021-06-28 + */ +public class MainAbility extends AceAbility { + @Override + public void onStart(Intent intent) { + super.onStart(intent); + } + + @Override + public void onStop() { + super.onStop(); + } +} diff --git a/entry/src/main/java/com/len/MyApplication.java b/entry/src/main/java/com/len/MyApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..56e24113d935a722a45dcf47aa24dca192bf9275 --- /dev/null +++ b/entry/src/main/java/com/len/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 an copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.len; + +import ohos.aafwk.ability.AbilityPackage; + +/** + * MyApplication + * + * @author:username + * @since 2021-06-28 + */ +public class MyApplication extends AbilityPackage { + @Override + public void onInitialize() { + super.onInitialize(); + } +} diff --git a/entry/src/main/js/default/app.js b/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..aedcefe0054c6e16c40491f4d1abc20a4dc1c6ef --- /dev/null +++ b/entry/src/main/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/entry/src/main/js/default/common/images/Wallpaper.png b/entry/src/main/js/default/common/images/Wallpaper.png new file mode 100644 index 0000000000000000000000000000000000000000..60d4841a80eb20c63de74306cb7f8350d6a85c48 Binary files /dev/null and b/entry/src/main/js/default/common/images/Wallpaper.png differ diff --git a/entry/src/main/js/default/common/images/bg-tv.jpg b/entry/src/main/js/default/common/images/bg-tv.jpg new file mode 100644 index 0000000000000000000000000000000000000000..86fc07358eea5c1474bc833fca07c6d4d8698a89 Binary files /dev/null and b/entry/src/main/js/default/common/images/bg-tv.jpg differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_qupai_subject_information.png b/entry/src/main/js/default/common/images/huodong.png similarity index 100% rename from app/src/main/res/mipmap-xhdpi/ic_qupai_subject_information.png rename to entry/src/main/js/default/common/images/huodong.png diff --git a/entry/src/main/js/default/i18n/en-US.json b/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/entry/src/main/js/default/i18n/zh-CN.json b/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/entry/src/main/js/default/pages/index/index.css b/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..1a37a4bfdf92fc7293d9c42bd4b0aa052392fc2c --- /dev/null +++ b/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,107 @@ + +.container { + + flex-direction: column; + +} +.header{ + display: flex; + align-items: center; + width: 100%; + padding: 20px 15px; + background-color: #4050B5; + +} +.header-text{ + font-size: 26px; + color: #ffffff; + font-weight: 700; +} +.title { + font-size: 18px; + color: #000000; + opacity: 0.9; +} +.content-box{ + width:100%; + display:flex; + flex-direction: column; + padding:0px 20px; + color:#303030; + font-size:14px; + +} +.content-list{ + width:100%; + display:flex; + flex-wrap:wrap; + margin-top: 20px; + +} +.content-list text{ + color:#303030; + font-size:16px; + +} +.content-list .text{ + color:#f23218; + border-bottom: 1px solid #f23218; + +} +.content-list .text3{ + display: grid; + line-height: 18px; + color:#f23218; + font-size: 16px; + border-top: 1px solid #f23218; + border-bottom: 1px solid #f23218; +} +.content-list .text-l{ + line-height: 18px; + color:#f23218; + font-size: 16px; + margin-right: 8px; + +} +.huodong-img{ + width: 64px; + height: 20px; + margin-right: 8px; +} +.text-bg{ + background-color: #FCB0CA; +} +.bg-null{ + background-color: rgba(255,3,3,0); +} +.fixed-bottom-box{ + position: fixed; + bottom: 8%; + left: 50%; + text-align: center; + + +} +.fixed-bottom-box text{ + transform: translateX(-50%); + font-size: 16px; + color: #6A6A6A; + padding: 20px 30px; + border-radius: 50px; + background-color: #EFEFEF; +} +@media screen and (device-type: tablet) and (orientation: landscape) { + +} + +@media screen and (device-type: wearable) { + +} + +@media screen and (device-type: tv) { + +} + +@media screen and (device-type: phone) and (orientation: landscape) { + +} diff --git a/entry/src/main/js/default/pages/index/index.hml b/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..2606b3aa76cc6ac223abcb8619fb688777b6e8f2 --- /dev/null +++ b/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,24 @@ +
+
+ AutoSpannableTextView +
+
+
+ 我已核对付款金额,仔细阅读并同意 + "购买须知" + 及团购 + "用户条款" +
+
+ + + + + 活动介绍,开始以图片开头 +
+
+
+ {{title}} +
+
+ diff --git a/entry/src/main/js/default/pages/index/index.js b/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..39dbfd29354cf7aa78cc466cde2fbb8100afc8d3 --- /dev/null +++ b/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,43 @@ +import prompt from '@system.prompt'; +export default { + data: { + // idx初始值 + idx:-1, + title:"", + // 是否允许多次点击 + isClick:false + + }, + onInit() { + + }, + textClick(event){ + if(event.target.attr.value==undefined || event.target.attr.idx==undefined){ + this.isClick=false; + } + if(this.isClick==false){ + this.isClick=true; + this.idx=-1; + if(event.target.attr.idx){ + if(this.idx!=event.target.attr.idx){ + this.idx=event.target.attr.idx; + }else{ + this.idx=-1; + } + } + if(event.target.attr.value){ + this.title=event.target.attr.value.replace(/^\"|\"$/g,''); + let that=this; + setTimeout(()=>{ + this.title=""; + this.isClick=false; + },1500); + }else{ + this.title=""; + } + } + setTimeout(()=>{ + this.isClick=false; + },1500); + } +} 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..0bae6bd40f7360d5d818998221b199d3ec0f69c0 --- /dev/null +++ b/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "mainability_description", + "value": "JS_Empty Ability" + } + ] +} \ 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/js/default/app.js b/entry/src/ohosTest/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..55b67e96deb821033f71d30b6fff05efdeb0d901 --- /dev/null +++ b/entry/src/ohosTest/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('TestApplication onCreate'); + }, + onDestroy() { + console.info('TestApplication onDestroy'); + } +}; diff --git a/entry/src/ohosTest/js/default/i18n/en-US.json b/entry/src/ohosTest/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..55561b83737c3c31d082fbfa11e5fc987a351104 --- /dev/null +++ b/entry/src/ohosTest/js/default/i18n/en-US.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + }, + "Files": { + } +} \ No newline at end of file diff --git a/entry/src/ohosTest/js/default/i18n/zh-CN.json b/entry/src/ohosTest/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..cce1af06761a42add0cac1a0567aa3237eda8cb4 --- /dev/null +++ b/entry/src/ohosTest/js/default/i18n/zh-CN.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + }, + "Files": { + } +} \ No newline at end of file diff --git a/entry/src/ohosTest/js/default/pages/index/index.css b/entry/src/ohosTest/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/entry/src/ohosTest/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/entry/src/ohosTest/js/default/pages/index/index.hml b/entry/src/ohosTest/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/entry/src/ohosTest/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/entry/src/ohosTest/js/default/pages/index/index.js b/entry/src/ohosTest/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..6b01273d356c91ea7126d96f5ecf438dada94f8c --- /dev/null +++ b/entry/src/ohosTest/js/default/pages/index/index.js @@ -0,0 +1,40 @@ +import file from '@system.file' +import app from '@system.app' +import device from '@system.device' +import router from '@system.router' +import {Core, ExpectExtend, ReportExtend, InstrumentLog} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + const instrumentLog = new InstrumentLog({ + 'id': 'report' + }) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.addService('report', instrumentLog) + core.init() + core.subscribeEvent('spec', instrumentLog) + core.subscribeEvent('suite', instrumentLog) + core.subscribeEvent('task', instrumentLog) + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/entry/src/ohosTest/js/test/ExampleJsunit.test.js b/entry/src/ohosTest/js/test/ExampleJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..b6d74caed96ddede98edd1bc9292f6568cd1cfd1 --- /dev/null +++ b/entry/src/ohosTest/js/test/ExampleJsunit.test.js @@ -0,0 +1,10 @@ +import app from '@system.app' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +describe('appInfoTest', function () { + it('app_info_test_001', 0, function () { + var info = app.getInfo() + expect(info.versionName).assertEqual('1.0') + expect(info.versionCode).assertEqual('3') + }) +}) \ No newline at end of file diff --git a/entry/src/ohosTest/js/test/List.test.js b/entry/src/ohosTest/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..305eb5bb254cd4802afaffebe68fca2f9436159f --- /dev/null +++ b/entry/src/ohosTest/js/test/List.test.js @@ -0,0 +1 @@ +require('./ExampleJsunit.test.js') \ No newline at end of file diff --git a/entry/src/ohosTest/resources/base/element/string.json b/entry/src/ohosTest/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..fed00ff35613d89f255e0929542705878fc8033c --- /dev/null +++ b/entry/src/ohosTest/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AutoSpannableTextView" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + } + ] +} diff --git a/entry/src/ohosTest/resources/base/media/icon.png b/entry/src/ohosTest/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/entry/src/ohosTest/resources/base/media/icon.png differ diff --git a/gif/1.gif b/gif/1.gif new file mode 100644 index 0000000000000000000000000000000000000000..74324e0c0b4ac6604de4b729a9b4d149c2b924a8 Binary files /dev/null and b/gif/1.gif differ diff --git a/gradle.properties b/gradle.properties index 1d3591c8a4c9c29578c36c87f80c05a6aea3ee3f..be492496f9a20ac2d980ef4fc30061f4184c1c40 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,18 +1,13 @@ # Project-wide Gradle settings. - -# IDE (e.g. Android Studio) users: +# IDE (e.g. DevEco Studio) users: # Gradle settings configured through the IDE *will override* # any settings specified in this file. - # For more details on how to configure your build environment visit # http://www.gradle.org/docs/current/userguide/build_environment.html - # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. -# Default value: -Xmx10248m -XX:MaxPermSize=256m -# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 - -# When configured, Gradle will run in incubating parallel mode. -# This option should only be used with decoupled projects. More details, visit -# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true \ No newline at end of file +# If the Chinese output is garbled, please configure the following parameter. +# This function is enabled by default when the DevEco Studio builds the hap/app,if you need disable gradle parallel,you should set org.gradle.parallel false. +# more information see https://docs.gradle.org/current/userguide/performance.html +# org.gradle.parallel=false +# org.gradle.jvmargs=-Dfile.encoding=GBK \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..490fda8577df6c95960ba7077c43220e5bb2c0d9 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..f59159e865d4b59feb1b8c44b001f62fc5d58df4 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +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 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/img/1.png b/img/1.png index 8503192a02b406423363256e26c5d3c6ad90e776..8bdf9ff0e7c8c8cc66de1b05415f21ef471bcbd8 100644 Binary files a/img/1.png and b/img/1.png differ diff --git a/img/2.png b/img/2.png index f01ce38f7fbd51739979758de269fcea47f33406..37eb3a1df3bd91db47a34bc2a4dfcb422eacea03 100644 Binary files a/img/2.png and b/img/2.png differ diff --git a/img/3.png b/img/3.png deleted file mode 100644 index 99cede6a5fef6731fe800fe8440d3dd1291f2091..0000000000000000000000000000000000000000 Binary files a/img/3.png and /dev/null differ diff --git a/library/.gitignore b/library/.gitignore deleted file mode 100644 index 796b96d1c402326528b4ba3c12ee9d92d0e212e9..0000000000000000000000000000000000000000 --- a/library/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build diff --git a/library/build.gradle b/library/build.gradle deleted file mode 100644 index 0ab6ead652899a57d73fd176b97e0f5dcfda14d8..0000000000000000000000000000000000000000 --- a/library/build.gradle +++ /dev/null @@ -1,24 +0,0 @@ -apply plugin: 'com.android.library' - -android { - compileSdkVersion 25 - buildToolsVersion "25.0.2" - - defaultConfig { - minSdkVersion 16 - targetSdkVersion 25 - versionCode 1 - versionName "1.0" - } - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - } - } -} - -dependencies { - compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.android.support:appcompat-v7:25.3.1' -} diff --git a/library/proguard-rules.pro b/library/proguard-rules.pro deleted file mode 100644 index a6f67b6f3f381d9ec6a1678eb57ffbc61e3470a2..0000000000000000000000000000000000000000 --- a/library/proguard-rules.pro +++ /dev/null @@ -1,17 +0,0 @@ -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in H:\AndroidStudio\sdk/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the proguardFiles -# directive in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} diff --git a/library/src/main/AndroidManifest.xml b/library/src/main/AndroidManifest.xml deleted file mode 100644 index 8a18437bcf370b7a190a9d44f7511c249a11c49c..0000000000000000000000000000000000000000 --- a/library/src/main/AndroidManifest.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - diff --git a/library/src/main/java/com/len/library/AutoLinkStyleTextView.java b/library/src/main/java/com/len/library/AutoLinkStyleTextView.java deleted file mode 100644 index 63787fb464f000e89989113149604a9b8b428f1d..0000000000000000000000000000000000000000 --- a/library/src/main/java/com/len/library/AutoLinkStyleTextView.java +++ /dev/null @@ -1,134 +0,0 @@ -package com.len.library; - -import android.content.Context; -import android.content.res.TypedArray; -import android.graphics.Canvas; -import android.graphics.Color; -import android.graphics.Paint; -import android.graphics.drawable.Drawable; -import android.support.v7.widget.AppCompatTextView; -import android.text.Spannable; -import android.text.SpannableString; -import android.text.Spanned; -import android.text.TextPaint; -import android.text.TextUtils; -import android.text.method.LinkMovementMethod; -import android.text.style.ClickableSpan; -import android.text.style.ImageSpan; -import android.util.AttributeSet; -import android.view.View; - - -/** - * Created by Shaolei on 2016/10/1. - * 添加链接textview - */ -public class AutoLinkStyleTextView extends AppCompatTextView { - - private static final int TYPE_START_IMAGE = 0; - private static final int TYPE_CONTENT_TEXT = 1; - - private static int styleType = TYPE_CONTENT_TEXT; - private static int defaultColor = Color.parseColor("#f23218"); - private String defaultTextValue = null; - private boolean hasUnderLine = true; - private int startImageDes; - - private ClickCallBack mClickCallBack; - - public AutoLinkStyleTextView(Context context) { - this(context, null); - } - - public AutoLinkStyleTextView(Context context, AttributeSet attrs) { - this(context, attrs, 0); - } - - public AutoLinkStyleTextView(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - init(context, attrs, defStyleAttr); - } - - private void init(Context context, AttributeSet attrs, int defStyleAttr) { - TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.AutoLinkStyleTextView, defStyleAttr, 0); - styleType = typedArray.getInt(R.styleable.AutoLinkStyleTextView_AutoLinkStyleTextView_type, TYPE_CONTENT_TEXT); - defaultTextValue = typedArray.getString(R.styleable.AutoLinkStyleTextView_AutoLinkStyleTextView_text_value); - defaultColor = typedArray.getColor(R.styleable.AutoLinkStyleTextView_AutoLinkStyleTextView_default_color, defaultColor); - hasUnderLine = typedArray.getBoolean(R.styleable.AutoLinkStyleTextView_AutoLinkStyleTextView_has_under_line, hasUnderLine); - startImageDes = typedArray.getResourceId(R.styleable.AutoLinkStyleTextView_AutoLinkStyleTextView_start_image, 0); - addStyle(); - typedArray.recycle(); - } - - /** - * 部分文字链接的通过xml设置静态渲染 - */ - private void addStyle() { - if (!TextUtils.isEmpty(defaultTextValue) && defaultTextValue.contains(",")) { - String[] values = defaultTextValue.split(","); - SpannableString spannableString = new SpannableString(getText().toString().trim()); - for (int i = 0; i < values.length; i++) { - final int position = i; - spannableString.setSpan(new ClickableSpan() { - @Override - public void onClick(View widget) { - if (mClickCallBack != null) mClickCallBack.onClick(position); - } - - @Override - public void updateDrawState(TextPaint ds) { - super.updateDrawState(ds); - ds.setColor(defaultColor); - ds.setUnderlineText(hasUnderLine); - } - }, getText().toString().trim().indexOf(values[i]), getText().toString().trim().indexOf(values[i]) + values[i].length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); - } - setText(spannableString); - setMovementMethod(LinkMovementMethod.getInstance()); - } - } - - /** - * 以image开头风格的需要动态调用这个方法 - * 图片和文字已经过居中适配 - * @param text - */ - public void setStartImageText(CharSequence text){ - if (styleType == TYPE_START_IMAGE && !TextUtils.isEmpty(text) && startImageDes != 0) { - SpannableString spannableString = new SpannableString(" " + text); - CenteredImageSpan span = new CenteredImageSpan(getContext(), startImageDes); - spannableString.setSpan(span, 0, 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); - setText(spannableString); - } - } - - private class CenteredImageSpan extends ImageSpan { - - private CenteredImageSpan(Context context, final int drawableRes) { - super(context, drawableRes); - } - - @Override - public void draw(Canvas canvas, CharSequence text, - int start, int end, float x, - int top, int y, int bottom, Paint paint) { - // image to draw - Drawable b = getDrawable(); - // font metrics of text to be replaced - Paint.FontMetricsInt fm = paint.getFontMetricsInt(); - int transY = (y + fm.descent + y + fm.ascent) / 2 - b.getBounds().bottom / 2; - canvas.save(); - canvas.translate(x, transY); - b.draw(canvas); - canvas.restore(); - } - } - - public void setOnClickCallBack(ClickCallBack clickCallBack) { - this.mClickCallBack = clickCallBack; - } - - public interface ClickCallBack { - void onClick(int position); - } -} diff --git a/library/src/main/res/values/attrs.xml b/library/src/main/res/values/attrs.xml deleted file mode 100644 index 3b3edb496662d4d6d4597dc3beebbe50ed03eda2..0000000000000000000000000000000000000000 --- a/library/src/main/res/values/attrs.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/library/src/main/res/values/strings.xml b/library/src/main/res/values/strings.xml deleted file mode 100644 index 49fc91e1dd831bf7eb837809f992376b78077d4d..0000000000000000000000000000000000000000 --- a/library/src/main/res/values/strings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - library - diff --git a/settings.gradle b/settings.gradle index 33069973b21ca48fd9db7889bf3865384837327a..4773db73233a570c2d0c01a22e75321acfbf7a07 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1 @@ -include ':app', ':library' +include ':entry'