From b3074ae0f9892fb02c06672cbaccf1edb23d21fb Mon Sep 17 00:00:00 2001 From: dirk41 <1378902882@qq.com> Date: Tue, 6 Jul 2021 10:40:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 +++--- build.gradle | 6 +++--- entry/build.gradle | 2 +- entry/src/main/config.json | 8 ++------ .../com/protectsoft/webviewcodedemo/Constants.java | 9 ++++----- .../protectsoft/webviewcodedemo/MainAbility.java | 9 ++++----- .../protectsoft/webviewcodedemo/MyApplication.java | 9 ++++----- .../protectsoft/webviewcodedemo/ShowAbility.java | 9 ++++----- library/build.gradle | 5 +++-- library/src/main/config.json | 5 ----- .../java/com/protectsoft/webviewcode/Codeview.java | 13 ++++--------- .../java/com/protectsoft/webviewcode/Settings.java | 10 +++++----- 12 files changed, 37 insertions(+), 54 deletions(-) diff --git a/README.md b/README.md index b747165..67e7e90 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ - 功能:代码块高亮显示。 - 项目移植状态:主功能完成 - 调用差异:无 -- 开发版本:sdk5,DevEco Studio 2.1 Release +- 开发版本:sdk6,DevEco Studio 2.2 Beta1 - 基线版本:Release 2 #### 效果演示 @@ -30,7 +30,7 @@ dependencies { ...... } ``` -在sdk5,DevEco Studio 2.1 Release下项目可直接运行 如无法运行,删除项目.gradle,.idea,build,gradle,build.gradle文件, 并依据自己的版本创建新项目,将新项目的对应文件复制到根目录下 +在sdk6,DevEco Studio 2.2 Beta1下项目可直接运行 如无法运行,删除项目.gradle,.idea,build,gradle,build.gradle文件, 并依据自己的版本创建新项目,将新项目的对应文件复制到根目录下 #### 使用说明 @@ -120,7 +120,7 @@ CodeCheck代码测试无异常 CloudTest代码测试无异常 -火绒安全病毒安全检测通过 +病毒安全检测通过 当前版本demo功能与原组件基本无差异 diff --git a/build.gradle b/build.gradle index 3c52aa1..8e7d5ed 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'com.huawei.ohos.app' ohos { - compileSdkVersion 5 + compileSdkVersion 6 defaultConfig { compatibleSdkVersion 5 } @@ -19,8 +19,8 @@ buildscript { jcenter() } dependencies { - classpath 'com.huawei.ohos:hap:2.4.4.2' - classpath 'com.huawei.ohos:decctest:1.0.0.7' + classpath 'com.huawei.ohos:hap:2.4.5.0' + classpath 'com.huawei.ohos:decctest:1.2.4.1' } } diff --git a/entry/build.gradle b/entry/build.gradle index c32d31f..d3e5d96 100644 --- a/entry/build.gradle +++ b/entry/build.gradle @@ -1,7 +1,7 @@ apply plugin: 'com.huawei.ohos.hap' apply plugin: 'com.huawei.ohos.decctest' ohos { - compileSdkVersion 5 + compileSdkVersion 6 defaultConfig { compatibleSdkVersion 5 } diff --git a/entry/src/main/config.json b/entry/src/main/config.json index 9fe69b2..18b0121 100644 --- a/entry/src/main/config.json +++ b/entry/src/main/config.json @@ -5,11 +5,6 @@ "version": { "code": 1000000, "name": "1.0.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Release" } }, "deviceConfig": {}, @@ -22,7 +17,8 @@ "distro": { "deliveryWithInstall": true, "moduleName": "entry", - "moduleType": "entry" + "moduleType": "entry", + "installationFree":true }, "abilities": [ { diff --git a/entry/src/main/java/com/protectsoft/webviewcodedemo/Constants.java b/entry/src/main/java/com/protectsoft/webviewcodedemo/Constants.java index 1d406e5..d6e9f57 100644 --- a/entry/src/main/java/com/protectsoft/webviewcodedemo/Constants.java +++ b/entry/src/main/java/com/protectsoft/webviewcodedemo/Constants.java @@ -1,12 +1,11 @@ /* - * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved. - *

+ * 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 - *

+ * + * 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. diff --git a/entry/src/main/java/com/protectsoft/webviewcodedemo/MainAbility.java b/entry/src/main/java/com/protectsoft/webviewcodedemo/MainAbility.java index d6c2411..3a8e310 100644 --- a/entry/src/main/java/com/protectsoft/webviewcodedemo/MainAbility.java +++ b/entry/src/main/java/com/protectsoft/webviewcodedemo/MainAbility.java @@ -1,12 +1,11 @@ /* - * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved. - *

+ * 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 - *

+ * + * 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. diff --git a/entry/src/main/java/com/protectsoft/webviewcodedemo/MyApplication.java b/entry/src/main/java/com/protectsoft/webviewcodedemo/MyApplication.java index d6152a8..2ebdf24 100644 --- a/entry/src/main/java/com/protectsoft/webviewcodedemo/MyApplication.java +++ b/entry/src/main/java/com/protectsoft/webviewcodedemo/MyApplication.java @@ -1,12 +1,11 @@ /* - * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved. - *

+ * 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 - *

+ * + * 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. diff --git a/entry/src/main/java/com/protectsoft/webviewcodedemo/ShowAbility.java b/entry/src/main/java/com/protectsoft/webviewcodedemo/ShowAbility.java index 3bea5d6..181a13b 100644 --- a/entry/src/main/java/com/protectsoft/webviewcodedemo/ShowAbility.java +++ b/entry/src/main/java/com/protectsoft/webviewcodedemo/ShowAbility.java @@ -1,12 +1,11 @@ /* - * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved. - *

+ * 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 - *

+ * + * 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. diff --git a/library/build.gradle b/library/build.gradle index d65602b..7a7c5fa 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -1,6 +1,7 @@ apply plugin: 'com.huawei.ohos.library' + ohos { - compileSdkVersion 5 + compileSdkVersion 6 defaultConfig { compatibleSdkVersion 5 } @@ -12,7 +13,7 @@ ohos { } } } - + } dependencies { diff --git a/library/src/main/config.json b/library/src/main/config.json index 69cff05..4af5031 100644 --- a/library/src/main/config.json +++ b/library/src/main/config.json @@ -5,11 +5,6 @@ "version": { "code": 1000000, "name": "1.0.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Release" } }, "deviceConfig": { diff --git a/library/src/main/java/com/protectsoft/webviewcode/Codeview.java b/library/src/main/java/com/protectsoft/webviewcode/Codeview.java index fb2a8f2..4fb65b8 100644 --- a/library/src/main/java/com/protectsoft/webviewcode/Codeview.java +++ b/library/src/main/java/com/protectsoft/webviewcode/Codeview.java @@ -29,14 +29,13 @@ public class Codeview { */ private static final int NUM_4 = 4; private static volatile Codeview singleton = null; - private static String[] htmlWrapper; - private static List contents; + private static String[] htmlWrapper = new String[]{"","","","",""};; + private static List contents = new ArrayList<>();; private final Context mContext; private boolean isTextWrap = false; - private String style; - private String language; + private String style = DEFAULT_STYLE; + private String language = DEFAULT_LANG;; private Object mWebview; - /** * Codeview * @@ -44,10 +43,6 @@ public class Codeview { */ public Codeview(Context context) { mContext = context; - htmlWrapper = new String[]{"","","","",""}; - contents = new ArrayList<>(); - language = DEFAULT_LANG; - style = DEFAULT_STYLE; } /** diff --git a/library/src/main/java/com/protectsoft/webviewcode/Settings.java b/library/src/main/java/com/protectsoft/webviewcode/Settings.java index 7d225fe..00a6d3a 100644 --- a/library/src/main/java/com/protectsoft/webviewcode/Settings.java +++ b/library/src/main/java/com/protectsoft/webviewcode/Settings.java @@ -15,7 +15,7 @@ public final class Settings { * * @since 2021-04-30 */ - public final class Lang { + public static final class Lang { /** * JAVA */ @@ -55,7 +55,7 @@ public final class Settings { * * @since 2021-04-30 */ - public final class WithStyle { + public static final class WithStyle { /** * DEFAULT */ @@ -143,7 +143,7 @@ public final class Settings { * * @since 2021-04-30 */ - public final class MimeType { + public static final class MimeType { /** * TEXT_HTML */ @@ -159,7 +159,7 @@ public final class Settings { * * @since 2021-04-30 */ - public final class Charset { + public static final class Charset { /** * UTF_8 */ @@ -171,7 +171,7 @@ public final class Settings { * * @since 2021-04-30 */ - public final class TextWrap { + public static final class TextWrap { /** * PRE_WRAP */ -- Gitee