diff --git a/README.md b/README.md index 53ce6ef72e2df84c0528ba7b3a313e98fb13e39e..34ab5e204419fbde5cabed0d476e851d9f356bff 100755 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ - 所属系列:openharmony的第三方组件适配移植 - 功能:实现可以开始/停止,并且可以自定义时间的定时器 - 项目移植状态:主功能完成 -- 调用差异:新库使用js-ui框架实现 +- 调用差异:无 - 开发版本:sdk6,DevEco Studio 2.2 Beta1 - 基线版本:Release v1.1 @@ -36,7 +36,7 @@ dependencies { #### 使用说明 使用该库非常简单,只需直接调用自定义组件即可。 -1,布局中直接引用自定义组件 +- 1,布局中直接引用自定义组件 ```xml ``` 里面直接可以设置自定义组件的属性:属性如下 +```java app:easyCountBackgroundColor="#ffFFFFFF" // 背景色 app:easyCountRectBorderColor="#ffE5E5E5"// 边框颜色 app:easyCountRectRadius="0"// 圆角大小 @@ -67,17 +68,42 @@ app:easyCountMinute="0"// 分 app:easyCountSecond="7"// 秒 app:ifRectRadius="1"// 是否圆角 app:ifsetdivision="1"// 间隔颜色是否设置 +``` -2,启动倒计时 - easyCountDownTextureView.start(); - -3,停止倒计时 - easyCountDownTextureView.stop(); +- 2,启动倒计时 +```java + easyCountDownTextureView.start(); +``` -4,倒计时完成回调 -void onCountDownCompleted(); - -5,设置时间函数 +- 3,停止倒计时 +```java + easyCountDownTextureView.stop(); +``` +- 4,倒计时完成回调 +```java + /** + * When count down start + */ + void onCountDownStart(); + + /** + * When count down time error + */ + void onCountDownTimeError(); + + /** + * When count down stop + * + * @param millisInFuture millisInFuture + */ + void onCountDownStop(long millisInFuture); + + /** + * When count down completed + */ + void onCountDownCompleted(); +``` +- 5,设置时间函数 ```java public void setTimeHour(final int timeHour) { this.timeHour = timeHour; diff --git a/build.gradle b/build.gradle index ba8e823d760fa82c3461fb52c6dee92b2007858d..2544173e701f32f5d7a21cd10bcac2cd6af2e124 100644 --- a/build.gradle +++ b/build.gradle @@ -19,8 +19,8 @@ buildscript { } } dependencies { - classpath 'com.huawei.ohos:hap:2.4.5.5' - classpath 'com.huawei.ohos:decctest:1.2.5.1' + classpath 'com.huawei.ohos:hap:3.0.3.4' + classpath 'com.huawei.ohos:decctest:1.2.6.0' } } diff --git a/easycountdowntextureview/src/main/java/com/camnter/easycountdowntextureview/EasyCountDownTextureView.java b/easycountdowntextureview/src/main/java/com/camnter/easycountdowntextureview/EasyCountDownTextureView.java index 4ebb7b90b43607055c33d0f3020cfcd4ed132873..6c92fd689856a7995e31482cf3ff7cf5c84a4594 100644 --- a/easycountdowntextureview/src/main/java/com/camnter/easycountdowntextureview/EasyCountDownTextureView.java +++ b/easycountdowntextureview/src/main/java/com/camnter/easycountdowntextureview/EasyCountDownTextureView.java @@ -206,24 +206,82 @@ public class EasyCountDownTextureView extends DirectionalLayout { timeHour--; } } - if (timeSecond <= 0 && timeMinute <= 0 && timeHour <= 0) { - timer.cancel(); - InnerEvent normalInnerEvent = InnerEvent.get(NUMBER1001, timeSecond, null); - myHandler.sendEvent(normalInnerEvent, 0, EventHandler.Priority.IMMEDIATE); - } else { - InnerEvent normalInnerEvent = InnerEvent.get(NUMBER1001, timeSecond, null); - myHandler.sendEvent(normalInnerEvent, 0, EventHandler.Priority.IMMEDIATE); - } + setTime(); } }, 0, NUMBER1000); } + private void setTime(){ + if (timeSecond <= 0 && timeMinute <= 0 && timeHour <= 0) { + timer.cancel(); + InnerEvent normalInnerEvent = InnerEvent.get(NUMBER1001, timeSecond, null); + myHandler.sendEvent(normalInnerEvent, 0, EventHandler.Priority.IMMEDIATE); + } else { + InnerEvent normalInnerEvent = InnerEvent.get(NUMBER1001, timeSecond, null); + myHandler.sendEvent(normalInnerEvent, 0, EventHandler.Priority.IMMEDIATE); + } + } + + /** + * setTimeHour + * + * @param timeH timeH + */ + public void setTimeHour(final int timeH) { + this.timeHour = timeH; + } + + /** + * setTimeMinute + * + * @param timeM timeM + */ + public void setTimeMinute(final int timeM) { + this.timeMinute = timeM; + } + + /** + * setTimeSecond + * + * @param timeS timeS + */ + public void setTimeSecond(final int timeS) { + this.timeSecond = timeS; + } + + /** + * 开始 + */ + public void start() { + if (timer == null) { + timeStart(); + } + } + + /** + * 结束 + */ + public void stop() { + if (timer != null) { + timer.cancel(); + timer = null; + } + } + + /** + * setEasyCountDownListener + * + * @param easyCountDownLis easyCountDownLis + */ + public void setEasyCountDownListener(EasyCountDownListener easyCountDownLis) { + this.easyCountDownListener = easyCountDownLis; + } /** * 更新UI的 Handler类 * * @since 2021-09-23 */ - private class MyEventHandler extends EventHandler { + private final class MyEventHandler extends EventHandler { private MyEventHandler(EventRunner runner) { super(runner); } @@ -273,41 +331,6 @@ public class EasyCountDownTextureView extends DirectionalLayout { } } - public void setTimeHour(final int timeHour) { - this.timeHour = timeHour; - } - - public void setTimeMinute(final int timeMinute) { - this.timeMinute = timeMinute; - } - - public void setTimeSecond(final int timeSecond) { - this.timeSecond = timeSecond; - } - - /** - * 开始 - */ - public void start() { - if (timer == null) { - timeStart(); - } - } - - /** - * 结束 - */ - public void stop() { - if (timer != null) { - timer.cancel(); - timer = null; - } - } - - public void setEasyCountDownListener(EasyCountDownListener easyCountDownListener) { - this.easyCountDownListener = easyCountDownListener; - } - /** * EasyCountDownListener * diff --git a/entry/src/main/config.json b/entry/src/main/config.json index 2b99a28264eda03b420705f5c6ec08862f15a56c..3817c8b0cf5145ce48964f7dc4b737fed1e42450 100644 --- a/entry/src/main/config.json +++ b/entry/src/main/config.json @@ -1,6 +1,6 @@ { "app": { - "bundleName": "com.yinghe.testwb", + "bundleName": "com.camnter.easycountdowntextureview.demo", "vendor": "example", "version": { "code": 1000000, @@ -11,7 +11,7 @@ "module": { "package": "com.camnter.easycountdowntextureview.demo", "name": ".MyApplication", - "mainAbility": "com.camnter.easycountdowntextureview.demo.MainAbility", + "mainAbility": "com.camnter.easycountdowntextureview.demo.MainJavaAbility", "deviceType": [ "phone", "tablet", @@ -36,7 +36,7 @@ ] } ], - "name": "com.camnter.easycountdowntextureview.demo.MainAbility", + "name": "com.camnter.easycountdowntextureview.demo.MainJavaAbility", "icon": "$media:icon", "description": "$string:mainability_description", "label": "$string:app_name", @@ -54,7 +54,7 @@ }, { "orientation": "unspecified", - "name": "com.camnter.easycountdowntextureview.demo.MainJavaAbility", + "name": "com.camnter.easycountdowntextureview.demo.MainAbility", "icon": "$media:icon", "description": "$string:app_name", "label": "$string:app_name", @@ -89,21 +89,6 @@ "launchType": "standard" } ], - "js": [ - { - "pages": [ - "pages/index/index", - "pages/show/show", - "pages/setting/setting", - "pages/completed/completed" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": true - } - } - ], "metaData": { "customizeData": [ { diff --git a/entry/src/main/java/com/camnter/easycountdowntextureview/demo/CompletedAbility.java b/entry/src/main/java/com/camnter/easycountdowntextureview/demo/CompletedAbility.java index 60db36d8b7aa1c256010525bfeec8aca8a89dbfe..4c72c175a6cbc10524e9378da0efd7f886bd5984 100644 --- a/entry/src/main/java/com/camnter/easycountdowntextureview/demo/CompletedAbility.java +++ b/entry/src/main/java/com/camnter/easycountdowntextureview/demo/CompletedAbility.java @@ -12,6 +12,11 @@ import ohos.agp.window.service.WindowManager; * @since 2021-09-23 */ public class CompletedAbility extends Ability { + /** + * onStart + * + * @param intent intent + */ @Override public void onStart(Intent intent) { super.onStart(intent); diff --git a/entry/src/main/java/com/camnter/easycountdowntextureview/demo/CustomText.java b/entry/src/main/java/com/camnter/easycountdowntextureview/demo/CustomText.java index 384e7bf35bd31201866f52cc5e9d576faef2354c..81199db727bd6f5fd61839bbb5197d921e746c09 100644 --- a/entry/src/main/java/com/camnter/easycountdowntextureview/demo/CustomText.java +++ b/entry/src/main/java/com/camnter/easycountdowntextureview/demo/CustomText.java @@ -84,7 +84,6 @@ public class CustomText extends Button { public Optional getAttr(int i) { return Optional.empty(); } - @Override public Optional getAttr(String s) { return Optional.empty(); diff --git a/entry/src/main/java/com/camnter/easycountdowntextureview/demo/FunctionAbility.java b/entry/src/main/java/com/camnter/easycountdowntextureview/demo/FunctionAbility.java index 89f039786afbc1474bafd7a1b32eae3ec93fc7fc..6f4860b8664428b2bf83582645ea80e8f96576d9 100644 --- a/entry/src/main/java/com/camnter/easycountdowntextureview/demo/FunctionAbility.java +++ b/entry/src/main/java/com/camnter/easycountdowntextureview/demo/FunctionAbility.java @@ -26,12 +26,20 @@ import ohos.agp.window.service.WindowManager; * @since 2021-09-23 */ public class FunctionAbility extends AceAbility { + /** + * onStart + * + * @param intent intent + */ @Override public void onStart(Intent intent) { super.onStart(intent); WindowManager.getInstance().getTopWindow().get().setStatusBarColor(Color.getIntColor("#2F3F9D")); // 设置状态栏颜色 } + /** + * onStop + */ @Override public void onStop() { super.onStop(); diff --git a/entry/src/main/java/com/camnter/easycountdowntextureview/demo/MainAbility.java b/entry/src/main/java/com/camnter/easycountdowntextureview/demo/MainAbility.java index a546747e377c7e6d64dfe799c2097bc2c7be7971..9f72611edcaf6b27290a58d0beaf0acc8537ee09 100644 --- a/entry/src/main/java/com/camnter/easycountdowntextureview/demo/MainAbility.java +++ b/entry/src/main/java/com/camnter/easycountdowntextureview/demo/MainAbility.java @@ -28,6 +28,11 @@ import ohos.agp.window.service.WindowManager; * @since 2021-08-10 */ public class MainAbility extends Ability { + /** + * onStart + * + * @param intent intent + */ @Override public void onStart(Intent intent) { super.onStart(intent); @@ -35,6 +40,9 @@ public class MainAbility extends Ability { WindowManager.getInstance().getTopWindow().get().setStatusBarColor(Color.getIntColor("#2F3F9D")); // 设置状态栏颜色 } + /** + * onActive + */ @Override protected void onActive() { super.onActive(); diff --git a/entry/src/main/java/com/camnter/easycountdowntextureview/demo/MainJavaAbility.java b/entry/src/main/java/com/camnter/easycountdowntextureview/demo/MainJavaAbility.java index 3d2e34ec9506d363afb2669a1a37a022141e0c96..eae2812e1f162ca0cc9d23fbf21691b8ae6afda3 100644 --- a/entry/src/main/java/com/camnter/easycountdowntextureview/demo/MainJavaAbility.java +++ b/entry/src/main/java/com/camnter/easycountdowntextureview/demo/MainJavaAbility.java @@ -27,6 +27,11 @@ import ohos.agp.window.service.WindowManager; * @since 2021-09-23 */ public class MainJavaAbility extends Ability { + /** + * onStart + * + * @param intent intent + */ @Override public void onStart(Intent intent) { super.onStart(intent); diff --git a/entry/src/main/java/com/camnter/easycountdowntextureview/demo/MyApplication.java b/entry/src/main/java/com/camnter/easycountdowntextureview/demo/MyApplication.java index 78b24e8f0c4306919d5261b939cc5d9a67ca1836..78cdcd8c067d4029317a28541dba06b6dfe1c802 100644 --- a/entry/src/main/java/com/camnter/easycountdowntextureview/demo/MyApplication.java +++ b/entry/src/main/java/com/camnter/easycountdowntextureview/demo/MyApplication.java @@ -23,6 +23,9 @@ import ohos.aafwk.ability.AbilityPackage; * @since 2021-08-10 */ public class MyApplication extends AbilityPackage { + /** + * onInitialize + */ @Override public void onInitialize() { super.onInitialize(); diff --git a/entry/src/main/java/com/camnter/easycountdowntextureview/demo/SettingAbility.java b/entry/src/main/java/com/camnter/easycountdowntextureview/demo/SettingAbility.java index 83ffcf8001f345ff51d1fe594eaa94f7c9568f61..3c9e01ab5facd2e620deab7733dc773d6f3b944b 100644 --- a/entry/src/main/java/com/camnter/easycountdowntextureview/demo/SettingAbility.java +++ b/entry/src/main/java/com/camnter/easycountdowntextureview/demo/SettingAbility.java @@ -12,6 +12,11 @@ import ohos.agp.window.service.WindowManager; * @since 2021-09-23 */ public class SettingAbility extends Ability { + /** + * onStart + * + * @param intent intent + */ @Override public void onStart(Intent intent) { super.onStart(intent); diff --git a/entry/src/main/java/com/camnter/easycountdowntextureview/demo/ShowAbility.java b/entry/src/main/java/com/camnter/easycountdowntextureview/demo/ShowAbility.java index 2aa12c2104957d7dc4bbf869432875414f0fa2bf..d16cef683e1c076d8ae284e7ba356330a1cc0e36 100644 --- a/entry/src/main/java/com/camnter/easycountdowntextureview/demo/ShowAbility.java +++ b/entry/src/main/java/com/camnter/easycountdowntextureview/demo/ShowAbility.java @@ -12,6 +12,11 @@ import ohos.agp.window.service.WindowManager; * @since 2021-09-23 */ public class ShowAbility extends Ability { + /** + * onStart + * + * @param intent intent + */ @Override public void onStart(Intent intent) { super.onStart(intent); diff --git a/entry/src/main/java/com/camnter/easycountdowntextureview/demo/adapter/MainAdapter.java b/entry/src/main/java/com/camnter/easycountdowntextureview/demo/adapter/MainAdapter.java index b38f322080228acd1139c4be417a5869151ab3dc..d0d179dfcc68b3c896d4a12ceff093b6c84c08b5 100644 --- a/entry/src/main/java/com/camnter/easycountdowntextureview/demo/adapter/MainAdapter.java +++ b/entry/src/main/java/com/camnter/easycountdowntextureview/demo/adapter/MainAdapter.java @@ -31,11 +31,22 @@ public class MainAdapter extends BaseItemProvider { mInflater = LayoutScatter.getInstance(ability); } + /** + * getCount + * + * @return getCount + */ @Override public int getCount() { return items == null ? 0 : items.length; } + /** + * getItem + * + * @param position position + * @return getItem + */ @Override public Object getItem(int position) { if (items != null && position >= 0 && position < items.length) { @@ -44,11 +55,25 @@ public class MainAdapter extends BaseItemProvider { return Collections.emptyList(); } + /** + * getItemId + * + * @param position position + * @return getItemId + */ @Override public long getItemId(int position) { return position; } + /** + * getComponent + * + * @param position position + * @param component component + * @param componentContainer componentContainer + * @return getComponent + */ @Override public Component getComponent(int position, Component component, ComponentContainer componentContainer) { final Component cpt; @@ -76,8 +101,8 @@ public class MainAdapter extends BaseItemProvider { * * @since 2021-09-23 */ - static class ViewHolder { - Text title; + static final class ViewHolder { + private Text title; private ViewHolder(Component view) { title = (Text) view.findComponentById(ResourceTable.Id_title); diff --git a/entry/src/main/java/com/camnter/easycountdowntextureview/demo/slice/CompletedAbilitySlice.java b/entry/src/main/java/com/camnter/easycountdowntextureview/demo/slice/CompletedAbilitySlice.java index 8fd01adefe42115fdb1653df39c6eb2fc6e8c245..a95936313309b06a147c58f557462ba7a0e15dbb 100644 --- a/entry/src/main/java/com/camnter/easycountdowntextureview/demo/slice/CompletedAbilitySlice.java +++ b/entry/src/main/java/com/camnter/easycountdowntextureview/demo/slice/CompletedAbilitySlice.java @@ -35,6 +35,11 @@ public class CompletedAbilitySlice extends AbilitySlice implements EasyCountDown private EasyCountDownTextureView easyCountDownTextureView1; private EasyCountDownTextureView easyCountDownTextureView2; + /** + * onStart + * + * @param intent intent + */ @Override public void onStart(Intent intent) { super.onStart(intent); @@ -46,6 +51,9 @@ public class CompletedAbilitySlice extends AbilitySlice implements EasyCountDown easyCountDownTextureView2.setEasyCountDownListener(this); } + /** + * onActive + */ @Override public void onActive() { super.onActive(); @@ -53,11 +61,19 @@ public class CompletedAbilitySlice extends AbilitySlice implements EasyCountDown easyCountDownTextureView2.start(); } + /** + * onForeground + * + * @param intent intent + */ @Override public void onForeground(Intent intent) { super.onForeground(intent); } + /** + * onStop + */ @Override protected void onStop() { super.onStop(); @@ -65,18 +81,32 @@ public class CompletedAbilitySlice extends AbilitySlice implements EasyCountDown easyCountDownTextureView2.stop(); } + /** + * onCountDownStart + */ @Override public void onCountDownStart() { } + /** + * onCountDownTimeError + */ @Override public void onCountDownTimeError() { } + /** + * onCountDownStop + * + * @param millisInFuture millisInFuture + */ @Override public void onCountDownStop(long millisInFuture) { } + /** + * onCountDownCompleted + */ @Override public void onCountDownCompleted() { showToast(this, "[CompletedActivity] [onCountDownCompleted]"); diff --git a/entry/src/main/java/com/camnter/easycountdowntextureview/demo/slice/MainAbilitySlice.java b/entry/src/main/java/com/camnter/easycountdowntextureview/demo/slice/MainAbilitySlice.java index 2db69f902d8051070494a0b78873008f0fcac045..2896e67b171a461700ab7ff441970345f6f5910c 100644 --- a/entry/src/main/java/com/camnter/easycountdowntextureview/demo/slice/MainAbilitySlice.java +++ b/entry/src/main/java/com/camnter/easycountdowntextureview/demo/slice/MainAbilitySlice.java @@ -40,6 +40,11 @@ public class MainAbilitySlice extends AbilitySlice { private MainAdapter adapter; private ListContainer llview; + /** + * onStart + * + * @param intent intent + */ @Override public void onStart(Intent intent) { super.onStart(intent); @@ -63,11 +68,19 @@ public class MainAbilitySlice extends AbilitySlice { }); } + /** + * onActive + */ @Override public void onActive() { super.onActive(); } + /** + * onForeground + * + * @param intent intent + */ @Override public void onForeground(Intent intent) { super.onForeground(intent); diff --git a/entry/src/main/java/com/camnter/easycountdowntextureview/demo/slice/SettingAbilitySlice.java b/entry/src/main/java/com/camnter/easycountdowntextureview/demo/slice/SettingAbilitySlice.java index 53458ee9a26d9c870b6d36841aa286ab58ce2d32..caf78c54426adb7a652b8a4242d8ff0b2caea7e9 100644 --- a/entry/src/main/java/com/camnter/easycountdowntextureview/demo/slice/SettingAbilitySlice.java +++ b/entry/src/main/java/com/camnter/easycountdowntextureview/demo/slice/SettingAbilitySlice.java @@ -47,12 +47,20 @@ public class SettingAbilitySlice extends AbilitySlice implements Component.Click this.findComponentById(ResourceTable.Id_setting_stop_button).setClickedListener(this); } + /** + * onActive + */ @Override public void onActive() { super.onActive(); easyCountDownTextureView.start(); } + /** + * onForeground + * + * @param intent intent + */ @Override public void onForeground(Intent intent) { super.onForeground(intent); @@ -61,6 +69,11 @@ public class SettingAbilitySlice extends AbilitySlice implements Component.Click } } + /** + * onClick + * + * @param component component + */ @Override public void onClick(Component component) { switch (component.getId()) { diff --git a/entry/src/main/java/com/camnter/easycountdowntextureview/demo/slice/ShowAbilitySlice.java b/entry/src/main/java/com/camnter/easycountdowntextureview/demo/slice/ShowAbilitySlice.java index 6080838956c0b12f0114862d719a5e6a8ea0a918..107bd1dd9c01a67642b5f1c5df1882fd0859c537 100644 --- a/entry/src/main/java/com/camnter/easycountdowntextureview/demo/slice/ShowAbilitySlice.java +++ b/entry/src/main/java/com/camnter/easycountdowntextureview/demo/slice/ShowAbilitySlice.java @@ -28,6 +28,11 @@ import ohos.aafwk.content.Intent; public class ShowAbilitySlice extends AbilitySlice { private EasyCountDownTextureView easyCountDownTextureView; + /** + * onStart + * + * @param intent intent + */ @Override public void onStart(Intent intent) { super.onStart(intent); @@ -35,12 +40,20 @@ public class ShowAbilitySlice extends AbilitySlice { easyCountDownTextureView = (EasyCountDownTextureView) findComponentById(ResourceTable.Id_easycountdown); } + /** + * onActive + */ @Override public void onActive() { super.onActive(); easyCountDownTextureView.start(); } + /** + * onForeground + * + * @param intent intent + */ @Override public void onForeground(Intent intent) { super.onForeground(intent); diff --git a/entry/src/main/js/default/app.js b/entry/src/main/js/default/app.js deleted file mode 100644 index aedcefe0054c6e16c40491f4d1abc20a4dc1c6ef..0000000000000000000000000000000000000000 --- a/entry/src/main/js/default/app.js +++ /dev/null @@ -1,8 +0,0 @@ -export default { - onCreate() { - console.info('AceApplication onCreate'); - }, - onDestroy() { - console.info('AceApplication onDestroy'); - } -}; diff --git a/entry/src/main/js/default/common/components/countdown/countdown.css b/entry/src/main/js/default/common/components/countdown/countdown.css deleted file mode 100644 index 4c1cd9468385a45495027240adef69d82fe5fc06..0000000000000000000000000000000000000000 --- a/entry/src/main/js/default/common/components/countdown/countdown.css +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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. - */ -.container { - width: 454px; -} - -.title { - border-radius: 5px; -} -.title text{ - width: 100%; - height: 100%; - text-align: center; -} -.dian{ - text-align: center; -} \ No newline at end of file diff --git a/entry/src/main/js/default/common/components/countdown/countdown.hml b/entry/src/main/js/default/common/components/countdown/countdown.hml deleted file mode 100644 index 7a65d114eb178352e62b8fc73461d982a34c7a23..0000000000000000000000000000000000000000 --- a/entry/src/main/js/default/common/components/countdown/countdown.hml +++ /dev/null @@ -1,37 +0,0 @@ - -

-
- - {{hours<10?'0'+hours:hours}} - -
- - : - -
- - {{minutes<10?'0'+minutes:minutes}} - -
- - : - -
- - {{seconds<10?'0'+seconds:seconds}} - -
-
\ No newline at end of file diff --git a/entry/src/main/js/default/common/components/countdown/countdown.js b/entry/src/main/js/default/common/components/countdown/countdown.js deleted file mode 100644 index 30a27416338eda2f8208a2ebcdef2079d2bf9614..0000000000000000000000000000000000000000 --- a/entry/src/main/js/default/common/components/countdown/countdown.js +++ /dev/null @@ -1,194 +0,0 @@ -/* - * 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. - */ -export default { - data() { - return { - hours: this.hours, - minutes: this.minutes, - seconds: this.seconds, - milliseconds: this.milliseconds, - width: this.width, - height: this.height, - spacing: this.spacing, - flot: true, - color: this.color, - bgc: this.bgc, - weight: this.weight, - font: this.font, - } - }, - props: { - hours: { - default: 0, - }, - minutes: { - default: 0 - }, - seconds: { - default: 0 - }, - milliseconds: { - default: 0 - }, - width: { - default: '30px' - }, - height: { - default: '30px' - }, - spacing: { - default: '10px' - }, - color: { - default: '#fff' - }, - bgc: { - default: '#000' - }, - weight: { - default: 400 - }, - font: { - default: '20px' - } - }, - onReady() { - this.startAndRestoreTime() - if (this.milliseconds > 0) { - this.seconds = Math.floor(this.milliseconds / 1000) % 60 - this.minutes = Math.floor(this.milliseconds / 1000 / 60) % 60 - this.hours = Math.floor(this.milliseconds / 1000 / 60 / 60) - } else { - this.milliseconds = this.seconds * 1000 + this.minutes * 1000 * 60 + this.hours * 1000 * 60 * 60 - } - if (this.minutes > 60) { - this.hours = Number(this.hours) + Math.floor(this.minutes / 60) - this.minutes = this.minutes - Math.floor(this.minutes / 60) * 60 - } - if (this.seconds <= 0) { - this.seconds = 0 - } else if (this.seconds > 60) { - this.minutes = this.minutes + Math.floor(this.seconds / 60) - this.seconds = this.seconds % 60 - } - }, - //设置小时的函数 - setTimeHour(h) { - if (h < 0) { - this.hours = 0 - } else { - this.hours = h - } - }, - //设置分钟数 - setTimeMinute(m) { - // this.minutes=m - if (m > 60) { - this.hours = Number(this.hours) + Math.floor(m / 60) - this.minutes = this.minutes + m % 60 - } else if (m <= 0) { - this.minutes = 0 - } else { - this.minutes = m - } - }, - //设置秒数 - setTimeSecond(s) { - if (s > 60) { - this.minutes = Number(this.minutes) + Math.floor(s / 60) - this.seconds = this.seconds + s % 60 - } else if (s <= 0) { - this.seconds = 0 - } else { - this.seconds = s - } - if (this.seconds > 60) { - this.minutes = Number(this.minutes) + Math.floor(this.seconds / 60) - this.seconds = this.seconds % 60 - } - if (this.minutes > 60) { - this.hours = Number(this.hours) + Math.floor(this.minutes / 60) - this.minutes = this.minutes % 60 - } - }, - //设置毫秒数 - setTime(timeMillis) { - if (timeMillis > 0) { - this.seconds = Math.floor(timeMillis / 1000) % 60 - this.minutes = Math.floor(timeMillis / 1000 / 60) % 60 - this.hours = Math.floor(this.timeMillis / 1000 / 60 / 60) - } else { - return - } - }, - //开始倒计时 - startAndRestoreTime() { - this.flot = true - this.$emit('onCountDownStart') - this.timer = setInterval(() => { - //当小时,分钟,秒钟,三者有一个大于等于零的时候 - if (this.hours >= 0 || this.minutes >= 0 || this.seconds >= 0) { - //判断他们三个全部都等于0 退出 - if (this.hours == 0 && this.minutes == 0 && this.seconds == 0) { - this.$emit('onCountDownCompleted') - this.flot = false - clearInterval(this.timer) - } else { - //当他们三个有一个不为0的时候 - if (this.seconds > 0) { - //如果秒钟大于0的时候让他自身减1 - this.seconds = Number(this.seconds) - 1 - } else { - //当秒钟等于0的时候,并且分钟不为零的时候 - if (this.minutes > 0) { - //分钟不为0让分钟减1 - this.minutes = Number(this.minutes) - 1 - } else { - //分钟为0的时候 - if (this.hours > 0) { - //小时数大于0的时候让他减1 - this.hours = Number(this.hours) - 1 - } else { - //三个数值都为零 - this.$emit('onCountDownCompleted') - this.flot = false - clearInterval(this.timer) - } - this.minutes = 59 - } - this.seconds = 59 - } - } - } else { - //当时间有任意一个小于0的时候报错 - this.flot = false - this.$emit('onCountDownTimeError') - clearInterval(this.timer) - } - }, 1000) - }, - //停止倒计时 - stopAndRecordTime() { - this.$emit('onCountDownStop', { - 'millisInFuture': this.milliseconds - }) - this.flot = false - clearInterval(this.timer) - }, - //倒计时是否结束 - isRunningState() { - return this.flot - } -} \ No newline at end of file diff --git a/entry/src/main/js/default/common/images/Wallpaper.png b/entry/src/main/js/default/common/images/Wallpaper.png deleted file mode 100644 index 60d4841a80eb20c63de74306cb7f8350d6a85c48..0000000000000000000000000000000000000000 Binary files a/entry/src/main/js/default/common/images/Wallpaper.png and /dev/null differ diff --git a/entry/src/main/js/default/common/images/a.png b/entry/src/main/js/default/common/images/a.png deleted file mode 100644 index f64c942db7a213ad81401de930d56e74d3003cbf..0000000000000000000000000000000000000000 Binary files a/entry/src/main/js/default/common/images/a.png and /dev/null 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 deleted file mode 100644 index 86fc07358eea5c1474bc833fca07c6d4d8698a89..0000000000000000000000000000000000000000 Binary files a/entry/src/main/js/default/common/images/bg-tv.jpg and /dev/null differ diff --git a/entry/src/main/js/default/i18n/en-US.json b/entry/src/main/js/default/i18n/en-US.json deleted file mode 100644 index e63c70d978a3a53be988388c87182f81785e170c..0000000000000000000000000000000000000000 --- a/entry/src/main/js/default/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "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 deleted file mode 100644 index de6ee5748322f44942c1b003319d8e66c837675f..0000000000000000000000000000000000000000 --- a/entry/src/main/js/default/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/entry/src/main/js/default/pages/completed/completed.css b/entry/src/main/js/default/pages/completed/completed.css deleted file mode 100644 index 8b957140a3eb002106fb386c17ce49387ab1aa3c..0000000000000000000000000000000000000000 --- a/entry/src/main/js/default/pages/completed/completed.css +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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. - */ -.container { - display: flex; - flex-direction: column; - padding: 20px; -} -.con{ - flex-direction: column; -} -.container div{ - margin-bottom: 10px; -} -.titlethem { - width: 100%; - height: 50px; - background-color: #3E51B3; -} -.titleinfo{ - font-size: 18px; - margin-left: 15px; - color: white; -} \ No newline at end of file diff --git a/entry/src/main/js/default/pages/completed/completed.hml b/entry/src/main/js/default/pages/completed/completed.hml deleted file mode 100644 index 2c85d5107835eb1b7ab77b3a83d05734b34d3b96..0000000000000000000000000000000000000000 --- a/entry/src/main/js/default/pages/completed/completed.hml +++ /dev/null @@ -1,65 +0,0 @@ - - - -

-
- - EasyCountDownTextureView - -
- -
-
- -
- -
- -
- -
-
\ No newline at end of file diff --git a/entry/src/main/js/default/pages/completed/completed.js b/entry/src/main/js/default/pages/completed/completed.js deleted file mode 100644 index 807ea904a21ee49e4c88bedb0867a6aafdb13d86..0000000000000000000000000000000000000000 --- a/entry/src/main/js/default/pages/completed/completed.js +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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. - */ -import prompt from '@system.prompt'; -export default { - data: { - time:{ - hours:'0', - minutes:'0', - seconds:'6', - milliseconds:'0' - }, - time2:{ - hours:'0', - minutes:'0', - seconds:'12', - milliseconds:0 - }, - width:'28px', - height:'28px', - spacing:'8px', - bgc1:'#eeeeee', - bgc2:'#eedddd', - color:'#ff0000', - weight:500, - font:'18px' - }, - onInit(){ - }, - onCountDownCompleted(){ -// console.log('倒计时执行结束') - prompt.showToast({ - message: `[CompletedAbility] [onCountDownCompleted]`, - duration: 2000, - }); - } -} diff --git a/entry/src/main/js/default/pages/index/index.css b/entry/src/main/js/default/pages/index/index.css deleted file mode 100644 index 6f08707157da1d960740c07d03c94bcfb32f9261..0000000000000000000000000000000000000000 --- a/entry/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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. - */ -.container { - flex-direction: column; -} - -.title { - padding-left: 10px; - width: 100%; - font-size: 18px; - font-weight: 600; - line-height: 22px; - color: #33cc00; - border-bottom: 1px solid #ccc; - height: 50px; -} - -.titlethem { - width: 100%; - height: 50px; - background-color: #3E51B3; -} -.titleinfo{ - font-size: 18px; - margin-left: 15px; - color: white; -} \ No newline at end of file diff --git a/entry/src/main/js/default/pages/index/index.hml b/entry/src/main/js/default/pages/index/index.hml deleted file mode 100644 index 141116f42dfdacabc793370f439bf34c97716b39..0000000000000000000000000000000000000000 --- a/entry/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,33 +0,0 @@ - -

-
- - EasyCountDownTextureView - -
- - - ShowAbility - - - - SettingAbility - - - - CompletedAbility - -
diff --git a/entry/src/main/js/default/pages/index/index.js b/entry/src/main/js/default/pages/index/index.js deleted file mode 100644 index 9952246f5e63b7251f7030b5fd581fa815c67f9c..0000000000000000000000000000000000000000 --- a/entry/src/main/js/default/pages/index/index.js +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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. - */ -import router from '@system.router' -export default { - data: { - title: "" - }, - onCreate() { - this.title = this.$t('strings.world'); - - }, - push(url){ - router.push({ - uri:`pages/${url}/${url}` - }) - } -} diff --git a/entry/src/main/js/default/pages/setting/setting.css b/entry/src/main/js/default/pages/setting/setting.css deleted file mode 100644 index 140eeda53bde85eece4a02ed8db40fad95401541..0000000000000000000000000000000000000000 --- a/entry/src/main/js/default/pages/setting/setting.css +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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. - */ -.container { - display: flex; - flex-direction: column; - justify-content: space-between; - flex-wrap:wrap; - padding: 20px; - height: 100%; -} -.con{ - flex-direction: column; -} -.title { - font-size: 30px; - text-align: center; - width: 200px; - height: 100px; -} -.btn{ - position: absolute; - right: 10px; - top: 20px; - width: 60px; - height: 60px; -} -.btn-box{ -/* background-color: skyblue;*/ - height: 200px; - width: 300px; - display: flex; - flex-direction: column; -} -.btn1{ - flex: 1; - margin-bottom: 30px; - display: flex; - justify-content: space-between; - flex-wrap:wrap; -} -.btn2{ - flex: 1; - display: flex; - justify-content: space-between; - flex-wrap:wrap; -} -.btn1 text{ - padding: 10px; - background-color: #999; - font-size: 18px; - width: 90px; - text-align: center; - border-radius: 5px; - color: #000; -} -.btn2 text{ - flex: 1; - padding: 10px 20px; - background-color: #999; - font-size: 18px; - width: 90px; - text-align: center; - border-radius: 5px; - color: #000; -} -.titlethem { - width: 100%; - height: 50px; - background-color: #3E51B3; -} -.titleinfo{ - font-size: 18px; - margin-left: 15px; - color: white; -} \ No newline at end of file diff --git a/entry/src/main/js/default/pages/setting/setting.hml b/entry/src/main/js/default/pages/setting/setting.hml deleted file mode 100644 index bfe54b3c899eaa49e07cf82cad671c90962e51de..0000000000000000000000000000000000000000 --- a/entry/src/main/js/default/pages/setting/setting.hml +++ /dev/null @@ -1,71 +0,0 @@ - - - -

-
- - EasyCountDownTextureView - -
- -
-
- -
-
-
-
- - START - - - STOP - -
-
- - H=01 - - - M=01 - - - S=01 - -
-
-
- -
-
\ No newline at end of file diff --git a/entry/src/main/js/default/pages/setting/setting.js b/entry/src/main/js/default/pages/setting/setting.js deleted file mode 100644 index 0394e54003c3d8501500b7c07abe7562b812c5d3..0000000000000000000000000000000000000000 --- a/entry/src/main/js/default/pages/setting/setting.js +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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. - */ -export default { - data: { - time:{ - hours:'26', - minutes:'6', - seconds:'26', - milliseconds:'0' - }, - flot:true, - width:'40px', - height:'40px', - spacing:'10px', - bgc:'#cccccc', - color:'#0099ff', - weight:500, - font:'20px' - }, - start(){ - if(this.$child('componter').flot){ - return - }else{ - this.$child('componter')['startAndRestoreTime']() - } - }, - stop(){ - if(!this.$child('componter').flot){ - return - }else{ - this.$child('componter')['stopAndRecordTime']() - } - }, - shi(num){ - this.$child('componter')['setTimeHour'](num) - }, - fen(num){ - this.$child('componter')['setTimeMinute'](num) - }, - miao(num){ - this.$child('componter')['setTimeSecond'](num) - }, - onCountDownStop(e){ - console.log(JSON.stringify(e)) - } -} diff --git a/entry/src/main/js/default/pages/show/show.css b/entry/src/main/js/default/pages/show/show.css deleted file mode 100644 index c6b496c1f689212fa206e2f3436e8fa060d846de..0000000000000000000000000000000000000000 --- a/entry/src/main/js/default/pages/show/show.css +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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. - */ -.container { - width: 454px; -/* height: 80px;*/ - padding: 20px 10px; - position: relative; - display: flex; - flex-direction: column; -} - -.con{ - flex-direction: column; -} - -.btn{ - position: absolute; - right: 10px; - top: 20px; - width: 60px; - height: 60px; -} -image{ - - width: 300px; -/* border: 1px solid #222;*/ -} -/*.zujian{*/ -/* position: absolute;*/ -/* top: 20px;*/ -/* left: 10px;*/ -/*}*/ -.titlethem { - width: 100%; - height: 50px; - background-color: #3E51B3; -} -.titleinfo{ - font-size: 18px; - margin-left: 15px; - color: white; -} \ No newline at end of file diff --git a/entry/src/main/js/default/pages/show/show.hml b/entry/src/main/js/default/pages/show/show.hml deleted file mode 100644 index eea6ad0942d16b05c21c7a4c6baf145329a82110..0000000000000000000000000000000000000000 --- a/entry/src/main/js/default/pages/show/show.hml +++ /dev/null @@ -1,42 +0,0 @@ - - - -

-
- - EasyCountDownTextureView - -
-
- - - - - - -
-
diff --git a/entry/src/main/js/default/pages/show/show.js b/entry/src/main/js/default/pages/show/show.js deleted file mode 100644 index fcce8a656703164ac3ce36aa670de027de7462f3..0000000000000000000000000000000000000000 --- a/entry/src/main/js/default/pages/show/show.js +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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. - */ -import router from '@system.router' -export default { - data: { - time:{ - hours:'6', - minutes:'6', - seconds:'26', - milliseconds:'0' - }, - width:'20px', - height:'20px', - spacing:'5px', - bgc:'#0000000', - color:'#ffffff', - weight:900, - font:'12px' - }, - fanhui(){ - router.replace({ - uri: 'pages/index/index' - }); - }, - onCountDownStart(){ - console.log(111) - } -}