+ * 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/.preview/merge_js_src/liteWearable/default/pages/show/show.hml b/entry/.preview/merge_js_src/liteWearable/default/pages/show/show.hml
new file mode 100644
index 0000000000000000000000000000000000000000..eea6ad0942d16b05c21c7a4c6baf145329a82110
--- /dev/null
+++ b/entry/.preview/merge_js_src/liteWearable/default/pages/show/show.hml
@@ -0,0 +1,42 @@
+
+
+
+ * 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/.preview/merge_js_src/wearable/default/pages/show/show.hml b/entry/.preview/merge_js_src/wearable/default/pages/show/show.hml
new file mode 100644
index 0000000000000000000000000000000000000000..eea6ad0942d16b05c21c7a4c6baf145329a82110
--- /dev/null
+++ b/entry/.preview/merge_js_src/wearable/default/pages/show/show.hml
@@ -0,0 +1,42 @@
+
+
+
+ * * 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. @@ -13,20 +13,23 @@ * limitations under the License. */ -package com.example.countdown; +package com.camnter.easycountdowntextureview.demo; -import ohos.ace.ability.AceAbility; import ohos.aafwk.content.Intent; +import ohos.ace.ability.AceAbility; +import ohos.agp.utils.Color; +import ohos.agp.window.service.WindowManager; /** - * MainAbility + * FunctionAbility * - * @since 2021-08-10 + * @since 2021-09-23 */ -public class MainAbility extends AceAbility { +public class FunctionAbility extends AceAbility { @Override public void onStart(Intent intent) { super.onStart(intent); + WindowManager.getInstance().getTopWindow().get().setStatusBarColor(Color.getIntColor("#2F3F9D")); // 设置状态栏颜色 } @Override diff --git a/entry/src/main/java/com/camnter/easycountdowntextureview/demo/MainAbility.java b/entry/src/main/java/com/camnter/easycountdowntextureview/demo/MainAbility.java new file mode 100644 index 0000000000000000000000000000000000000000..a546747e377c7e6d64dfe799c2097bc2c7be7971 --- /dev/null +++ b/entry/src/main/java/com/camnter/easycountdowntextureview/demo/MainAbility.java @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *
+ * http://www.apache.org/licenses/LICENSE-2.0 + *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.camnter.easycountdowntextureview.demo;
+
+import ohos.aafwk.ability.Ability;
+import ohos.aafwk.content.Intent;
+import ohos.aafwk.content.Operation;
+import ohos.agp.components.Component;
+import ohos.agp.utils.Color;
+import ohos.agp.window.service.WindowManager;
+
+/**
+ * MainAbility
+ *
+ * @since 2021-08-10
+ */
+public class MainAbility extends Ability {
+ @Override
+ public void onStart(Intent intent) {
+ super.onStart(intent);
+ super.setUIContent(ResourceTable.Layout_ability_function);
+ WindowManager.getInstance().getTopWindow().get().setStatusBarColor(Color.getIntColor("#2F3F9D")); // 设置状态栏颜色
+ }
+
+ @Override
+ protected void onActive() {
+ super.onActive();
+ findComponentById(ResourceTable.Id_btnJava).setClickedListener(new Component.ClickedListener() {
+ @Override
+ public void onClick(Component component) {
+ Intent intent = new Intent();
+ Operation operation = new Intent.OperationBuilder()
+ .withBundleName(getBundleName())
+ .withAbilityName(MainJavaAbility.class.getName())
+ .build();
+ intent.setOperation(operation);
+ startAbility(intent);
+ }
+ });
+ findComponentById(ResourceTable.Id_btnJS).setClickedListener(new Component.ClickedListener() {
+ @Override
+ public void onClick(Component component) {
+ Intent intent = new Intent();
+ Operation operation = new Intent.OperationBuilder()
+ .withBundleName(getBundleName())
+ .withAbilityName(FunctionAbility.class.getName())
+ .build();
+ intent.setOperation(operation);
+ startAbility(intent);
+ }
+ });
+ }
+}
diff --git a/entry/src/main/java/com/camnter/easycountdowntextureview/demo/MainJavaAbility.java b/entry/src/main/java/com/camnter/easycountdowntextureview/demo/MainJavaAbility.java
new file mode 100644
index 0000000000000000000000000000000000000000..3d2e34ec9506d363afb2669a1a37a022141e0c96
--- /dev/null
+++ b/entry/src/main/java/com/camnter/easycountdowntextureview/demo/MainJavaAbility.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.camnter.easycountdowntextureview.demo;
+
+import com.camnter.easycountdowntextureview.demo.slice.MainAbilitySlice;
+import ohos.aafwk.ability.Ability;
+import ohos.aafwk.content.Intent;
+import ohos.agp.utils.Color;
+import ohos.agp.window.service.WindowManager;
+
+/**
+ * MainJavaAbility
+ *
+ * @since 2021-09-23
+ */
+public class MainJavaAbility extends Ability {
+ @Override
+ public void onStart(Intent intent) {
+ super.onStart(intent);
+ super.setMainRoute(MainAbilitySlice.class.getName());
+ WindowManager.getInstance().getTopWindow().get().setStatusBarColor(Color.getIntColor("#2F3F9D")); // 设置状态栏颜色
+ }
+}
diff --git a/entry/src/main/java/com/example/countdown/MyApplication.java b/entry/src/main/java/com/camnter/easycountdowntextureview/demo/MyApplication.java
similarity index 91%
rename from entry/src/main/java/com/example/countdown/MyApplication.java
rename to entry/src/main/java/com/camnter/easycountdowntextureview/demo/MyApplication.java
index c65ebac80c8b63f93f799e3b0e81592aef3350be..78b24e8f0c4306919d5261b939cc5d9a67ca1836 100644
--- a/entry/src/main/java/com/example/countdown/MyApplication.java
+++ b/entry/src/main/java/com/camnter/easycountdowntextureview/demo/MyApplication.java
@@ -12,13 +12,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.example.countdown;
+
+package com.camnter.easycountdowntextureview.demo;
import ohos.aafwk.ability.AbilityPackage;
+
/**
* MainAbility
*
- * @since 2021-08-10
+ * @since 2021-08-10
*/
public class MyApplication extends AbilityPackage {
@Override
diff --git a/entry/src/main/java/com/camnter/easycountdowntextureview/demo/SettingAbility.java b/entry/src/main/java/com/camnter/easycountdowntextureview/demo/SettingAbility.java
new file mode 100644
index 0000000000000000000000000000000000000000..83ffcf8001f345ff51d1fe594eaa94f7c9568f61
--- /dev/null
+++ b/entry/src/main/java/com/camnter/easycountdowntextureview/demo/SettingAbility.java
@@ -0,0 +1,21 @@
+package com.camnter.easycountdowntextureview.demo;
+
+import com.camnter.easycountdowntextureview.demo.slice.SettingAbilitySlice;
+import ohos.aafwk.ability.Ability;
+import ohos.aafwk.content.Intent;
+import ohos.agp.utils.Color;
+import ohos.agp.window.service.WindowManager;
+
+/**
+ * SettingAbilitySlice
+ *
+ * @since 2021-09-23
+ */
+public class SettingAbility extends Ability {
+ @Override
+ public void onStart(Intent intent) {
+ super.onStart(intent);
+ super.setMainRoute(SettingAbilitySlice.class.getName());
+ WindowManager.getInstance().getTopWindow().get().setStatusBarColor(Color.getIntColor("#2F3F9D")); // 设置状态栏颜色
+ }
+}
diff --git a/entry/src/main/java/com/camnter/easycountdowntextureview/demo/ShowAbility.java b/entry/src/main/java/com/camnter/easycountdowntextureview/demo/ShowAbility.java
new file mode 100644
index 0000000000000000000000000000000000000000..2aa12c2104957d7dc4bbf869432875414f0fa2bf
--- /dev/null
+++ b/entry/src/main/java/com/camnter/easycountdowntextureview/demo/ShowAbility.java
@@ -0,0 +1,21 @@
+package com.camnter.easycountdowntextureview.demo;
+
+import com.camnter.easycountdowntextureview.demo.slice.ShowAbilitySlice;
+import ohos.aafwk.ability.Ability;
+import ohos.aafwk.content.Intent;
+import ohos.agp.utils.Color;
+import ohos.agp.window.service.WindowManager;
+
+/**
+ * SettingAbilitySlice
+ *
+ * @since 2021-09-23
+ */
+public class ShowAbility extends Ability {
+ @Override
+ public void onStart(Intent intent) {
+ super.onStart(intent);
+ super.setMainRoute(ShowAbilitySlice.class.getName());
+ WindowManager.getInstance().getTopWindow().get().setStatusBarColor(Color.getIntColor("#2F3F9D")); // 设置状态栏颜色
+ }
+}
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
new file mode 100644
index 0000000000000000000000000000000000000000..b38f322080228acd1139c4be417a5869151ab3dc
--- /dev/null
+++ b/entry/src/main/java/com/camnter/easycountdowntextureview/demo/adapter/MainAdapter.java
@@ -0,0 +1,87 @@
+package com.camnter.easycountdowntextureview.demo.adapter;
+
+import com.camnter.easycountdowntextureview.demo.ResourceTable;
+import ohos.aafwk.ability.Ability;
+import ohos.agp.components.BaseItemProvider;
+import ohos.agp.components.Component;
+import ohos.agp.components.ComponentContainer;
+import ohos.agp.components.LayoutScatter;
+import ohos.agp.components.Text;
+
+import java.util.Collections;
+
+/**
+ * 文件描述
+ *
+ * @since 2021-09-23
+ */
+public class MainAdapter extends BaseItemProvider {
+ private final Ability mActivity;
+ private final LayoutScatter mInflater;
+ private Component components;
+ private String[] items = {"ShowActivity", "SettingActivity", "CompletedActivity"};
+
+ /**
+ * 构造函数
+ *
+ * @param ability ability
+ */
+ public MainAdapter(Ability ability) {
+ mActivity = ability;
+ mInflater = LayoutScatter.getInstance(ability);
+ }
+
+ @Override
+ public int getCount() {
+ return items == null ? 0 : items.length;
+ }
+
+ @Override
+ public Object getItem(int position) {
+ if (items != null && position >= 0 && position < items.length) {
+ return items[position];
+ }
+ return Collections.emptyList();
+ }
+
+ @Override
+ public long getItemId(int position) {
+ return position;
+ }
+
+ @Override
+ public Component getComponent(int position, Component component, ComponentContainer componentContainer) {
+ final Component cpt;
+ ViewHolder holder;
+ if (component == null) {
+ cpt = mInflater.parse(ResourceTable.Layout_list_item_imager, componentContainer, false);
+ holder = new ViewHolder(cpt);
+
+ // 将获取到的子组件信息绑定到列表项的实例中
+ cpt.setTag(holder);
+ } else {
+ cpt = component;
+
+ // 从缓存中获取到列表项实例后,直接使用绑定的子组件信息进行数据填充。
+ holder = (ViewHolder) cpt.getTag();
+ }
+
+ holder.title.setText(items[position] + "");
+
+ return cpt;
+ }
+
+ /**
+ * ViewHolder
+ *
+ * @since 2021-09-23
+ */
+ static class ViewHolder {
+ Text title;
+
+ private ViewHolder(Component view) {
+ title = (Text) view.findComponentById(ResourceTable.Id_title);
+ view.setTag(this);
+ }
+ }
+}
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
new file mode 100644
index 0000000000000000000000000000000000000000..8fd01adefe42115fdb1653df39c6eb2fc6e8c245
--- /dev/null
+++ b/entry/src/main/java/com/camnter/easycountdowntextureview/demo/slice/CompletedAbilitySlice.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.camnter.easycountdowntextureview.demo.slice;
+
+import com.camnter.easycountdowntextureview.EasyCountDownTextureView;
+import com.camnter.easycountdowntextureview.demo.ResourceTable;
+import ohos.aafwk.ability.AbilitySlice;
+import ohos.aafwk.content.Intent;
+import ohos.agp.components.Component;
+import ohos.agp.components.ComponentContainer;
+import ohos.agp.components.LayoutScatter;
+import ohos.agp.components.Text;
+import ohos.agp.window.dialog.ToastDialog;
+import ohos.app.Context;
+
+/**
+ * CompletedAbilitySlice
+ *
+ * @since 2021-09-23
+ */
+public class CompletedAbilitySlice extends AbilitySlice implements EasyCountDownTextureView.EasyCountDownListener {
+ private EasyCountDownTextureView easyCountDownTextureView1;
+ private EasyCountDownTextureView easyCountDownTextureView2;
+
+ @Override
+ public void onStart(Intent intent) {
+ super.onStart(intent);
+ super.setUIContent(ResourceTable.Layout_ability_completed_activity);
+
+ easyCountDownTextureView1 = (EasyCountDownTextureView) findComponentById(ResourceTable.Id_easycountdown1);
+ easyCountDownTextureView2 = (EasyCountDownTextureView) findComponentById(ResourceTable.Id_easycountdown2);
+ easyCountDownTextureView1.setEasyCountDownListener(this);
+ easyCountDownTextureView2.setEasyCountDownListener(this);
+ }
+
+ @Override
+ public void onActive() {
+ super.onActive();
+ easyCountDownTextureView1.start();
+ easyCountDownTextureView2.start();
+ }
+
+ @Override
+ public void onForeground(Intent intent) {
+ super.onForeground(intent);
+ }
+
+ @Override
+ protected void onStop() {
+ super.onStop();
+ easyCountDownTextureView1.stop();
+ easyCountDownTextureView2.stop();
+ }
+
+ @Override
+ public void onCountDownStart() {
+ }
+
+ @Override
+ public void onCountDownTimeError() {
+ }
+
+ @Override
+ public void onCountDownStop(long millisInFuture) {
+ }
+
+ @Override
+ public void onCountDownCompleted() {
+ showToast(this, "[CompletedActivity] [onCountDownCompleted]");
+ }
+
+ /**
+ * 提示框
+ *
+ * @param var0 上下文
+ * @param var1 内容
+ */
+ public static void showToast(Context var0, String var1) {
+ Component var2 = LayoutScatter.getInstance(var0).parse(ResourceTable.Layout_layout_toast,
+ (ComponentContainer) null, false);
+ Text var3 = (Text) var2.findComponentById(ResourceTable.Id_text_msg_toast);
+ var3.setText(var1);
+ (new ToastDialog(var0)).setComponent(var2).setTransparent(true).show();
+ }
+}
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
new file mode 100644
index 0000000000000000000000000000000000000000..2db69f902d8051070494a0b78873008f0fcac045
--- /dev/null
+++ b/entry/src/main/java/com/camnter/easycountdowntextureview/demo/slice/MainAbilitySlice.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.camnter.easycountdowntextureview.demo.slice;
+
+import com.camnter.easycountdowntextureview.demo.CompletedAbility;
+import com.camnter.easycountdowntextureview.demo.ResourceTable;
+import com.camnter.easycountdowntextureview.demo.SettingAbility;
+import com.camnter.easycountdowntextureview.demo.ShowAbility;
+import com.camnter.easycountdowntextureview.demo.adapter.MainAdapter;
+import ohos.aafwk.ability.Ability;
+import ohos.aafwk.ability.AbilitySlice;
+import ohos.aafwk.content.Intent;
+import ohos.aafwk.content.Operation;
+import ohos.agp.components.Component;
+import ohos.agp.components.ListContainer;
+
+/**
+ * MainAbilitySlice
+ *
+ * @since 2021-09-23
+ */
+public class MainAbilitySlice extends AbilitySlice {
+ /**
+ * NUMBER2
+ */
+ public static final int NUMBER2 = 2;
+ private MainAdapter adapter;
+ private ListContainer llview;
+
+ @Override
+ public void onStart(Intent intent) {
+ super.onStart(intent);
+ super.setUIContent(ResourceTable.Layout_ability_main);
+ llview = (ListContainer) findComponentById(ResourceTable.Id_theListView);
+
+ adapter = new MainAdapter(getAbility());
+ llview.setItemProvider(adapter);
+
+ llview.setItemClickedListener(new ListContainer.ItemClickedListener() {
+ @Override
+ public void onItemClicked(ListContainer listContainer, Component component, int arg2, long l) {
+ if (arg2 == 0) {
+ startOpenAbility(getAbility(), ShowAbility.class.getName());
+ } else if (arg2 == 1) {
+ startOpenAbility(getAbility(), SettingAbility.class.getName());
+ } else if (arg2 == NUMBER2) {
+ startOpenAbility(getAbility(), CompletedAbility.class.getName());
+ }
+ }
+ });
+ }
+
+ @Override
+ public void onActive() {
+ super.onActive();
+ }
+
+ @Override
+ public void onForeground(Intent intent) {
+ super.onForeground(intent);
+ }
+
+ /**
+ * 页面跳转
+ *
+ * @param ability 上下文
+ * @param name 内容
+ */
+ public void startOpenAbility(Ability ability, String name) {
+ Intent intent = new Intent();
+ Operation operation = new Intent.OperationBuilder()
+ .withDeviceId("")
+ .withBundleName(ability.getBundleName())
+ .withAbilityName(name)
+ .build();
+ intent.setOperation(operation);
+ startAbility(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
new file mode 100644
index 0000000000000000000000000000000000000000..53458ee9a26d9c870b6d36841aa286ab58ce2d32
--- /dev/null
+++ b/entry/src/main/java/com/camnter/easycountdowntextureview/demo/slice/SettingAbilitySlice.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.camnter.easycountdowntextureview.demo.slice;
+
+import com.camnter.easycountdowntextureview.EasyCountDownTextureView;
+import com.camnter.easycountdowntextureview.demo.ResourceTable;
+import ohos.aafwk.ability.AbilitySlice;
+import ohos.aafwk.content.Intent;
+import ohos.agp.components.Component;
+
+/**
+ * SettingAbilitySlice
+ *
+ * @since 2021-09-23
+ */
+public class SettingAbilitySlice extends AbilitySlice implements Component.ClickedListener {
+ private EasyCountDownTextureView easyCountDownTextureView;
+
+ /**
+ * onStart
+ *
+ * @param intent intent
+ */
+ @Override
+ public void onStart(Intent intent) {
+ super.onStart(intent);
+ super.setUIContent(ResourceTable.Layout_ability_setting_activity);
+ easyCountDownTextureView = (EasyCountDownTextureView) findComponentById(ResourceTable.Id_easycountdown);
+
+ this.findComponentById(ResourceTable.Id_setting_hour_button).setClickedListener(this);
+ this.findComponentById(ResourceTable.Id_setting_minute_button).setClickedListener(this);
+ this.findComponentById(ResourceTable.Id_setting_second_button).setClickedListener(this);
+ this.findComponentById(ResourceTable.Id_setting_start_button).setClickedListener(this);
+ this.findComponentById(ResourceTable.Id_setting_stop_button).setClickedListener(this);
+ }
+
+ @Override
+ public void onActive() {
+ super.onActive();
+ easyCountDownTextureView.start();
+ }
+
+ @Override
+ public void onForeground(Intent intent) {
+ super.onForeground(intent);
+ if (null != easyCountDownTextureView) {
+ easyCountDownTextureView.stop();
+ }
+ }
+
+ @Override
+ public void onClick(Component component) {
+ switch (component.getId()) {
+ case ResourceTable.Id_setting_hour_button:
+ easyCountDownTextureView.setTimeHour(1);
+ break;
+ case ResourceTable.Id_setting_minute_button:
+ easyCountDownTextureView.setTimeMinute(1);
+ break;
+ case ResourceTable.Id_setting_second_button:
+ easyCountDownTextureView.setTimeSecond(1);
+ break;
+ case ResourceTable.Id_setting_start_button:
+ easyCountDownTextureView.start();
+ break;
+ case ResourceTable.Id_setting_stop_button:
+ easyCountDownTextureView.stop();
+ break;
+ default:
+ }
+ }
+}
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
new file mode 100644
index 0000000000000000000000000000000000000000..6080838956c0b12f0114862d719a5e6a8ea0a918
--- /dev/null
+++ b/entry/src/main/java/com/camnter/easycountdowntextureview/demo/slice/ShowAbilitySlice.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.camnter.easycountdowntextureview.demo.slice;
+
+import com.camnter.easycountdowntextureview.EasyCountDownTextureView;
+import com.camnter.easycountdowntextureview.demo.ResourceTable;
+import ohos.aafwk.ability.AbilitySlice;
+import ohos.aafwk.content.Intent;
+
+/**
+ * ShowAbilitySlice
+ *
+ * @since 2021-09-23
+ */
+public class ShowAbilitySlice extends AbilitySlice {
+ private EasyCountDownTextureView easyCountDownTextureView;
+
+ @Override
+ public void onStart(Intent intent) {
+ super.onStart(intent);
+ super.setUIContent(ResourceTable.Layout_ability_show_activity);
+ easyCountDownTextureView = (EasyCountDownTextureView) findComponentById(ResourceTable.Id_easycountdown);
+ }
+
+ @Override
+ public void onActive() {
+ super.onActive();
+ easyCountDownTextureView.start();
+ }
+
+ @Override
+ public void onForeground(Intent intent) {
+ super.onForeground(intent);
+ if (null != easyCountDownTextureView) {
+ easyCountDownTextureView.stop();
+ }
+ }
+}
diff --git a/entry/src/main/js/default/pages/completed/completed.css b/entry/src/main/js/default/pages/completed/completed.css
index 80534efd7ace5f43c787c3892a047c4f23cd778b..8b957140a3eb002106fb386c17ce49387ab1aa3c 100644
--- a/entry/src/main/js/default/pages/completed/completed.css
+++ b/entry/src/main/js/default/pages/completed/completed.css
@@ -17,6 +17,19 @@
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
index 976ea41412f548881814b4f2fb72eaeaf0e9228a..2c85d5107835eb1b7ab77b3a83d05734b34d3b96 100644
--- a/entry/src/main/js/default/pages/completed/completed.hml
+++ b/entry/src/main/js/default/pages/completed/completed.hml
@@ -14,45 +14,52 @@
*/-->