From f4da42939b026ace0c929fc4b43297eab2505d13 Mon Sep 17 00:00:00 2001
From: HYL123698745 <1252347619@qq.com>
Date: Mon, 19 Apr 2021 16:00:39 +0800
Subject: [PATCH 1/4] test
---
entry/build.gradle | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/entry/build.gradle b/entry/build.gradle
index badd2e1..466ac93 100644
--- a/entry/build.gradle
+++ b/entry/build.gradle
@@ -1,10 +1,11 @@
apply plugin: 'com.huawei.ohos.hap'
ohos {
+
compileSdkVersion 5
defaultConfig {
compatibleSdkVersion 5
}
-
+
}
dependencies {
--
Gitee
From 24b30e8380026f2bfe33b894a6bae484e59b1f2f Mon Sep 17 00:00:00 2001
From: HYL123698745 <1252347619@qq.com>
Date: Mon, 19 Apr 2021 16:02:52 +0800
Subject: [PATCH 2/4] test
---
entry/build.gradle | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/entry/build.gradle b/entry/build.gradle
index 466ac93..e235140 100644
--- a/entry/build.gradle
+++ b/entry/build.gradle
@@ -1,6 +1,16 @@
apply plugin: 'com.huawei.ohos.hap'
ohos {
-
+ signingConfigs {
+ debug {
+ storeFile file('E:\\HarmonyWorkSpace\\SOW-33\\共用\\root_1.p12')
+ storePassword '0000002045693FD8BED19E75819E60FBC4BA5F9295E17FDEDA8B53BEF29F6CE2E897471DD417898752A1E213402B2522'
+ keyAlias = 'hos_platform_os'
+ keyPassword '00000020A9E2800C943924849DE623AFB1D72B60D1C0A4CC26A22F7E3B3027FC4E015C830BD0804E1799B0FF2084721A'
+ signAlg = 'SHA256withECDSA'
+ profile file('E:\\HarmonyWorkSpace\\SOW-33\\三期key\\TimetableViewDebug (1).p7b')
+ certpath file('E:\\HarmonyWorkSpace\\SOW-33\\共用\\root.cer')
+ }
+ }
compileSdkVersion 5
defaultConfig {
compatibleSdkVersion 5
--
Gitee
From 2e4523077aeec242704ecb44fee03d79fe149473 Mon Sep 17 00:00:00 2001
From: HYL123698745 <1252347619@qq.com>
Date: Mon, 19 Apr 2021 16:04:52 +0800
Subject: [PATCH 3/4] test
---
.../com/chinasoft/ohos/dialog/DialogUtil.java | 35 ++-----------------
.../base/graphic/background_shape.xml | 3 +-
.../resources/base/layout/dialog_layout.xml | 2 +-
3 files changed, 5 insertions(+), 35 deletions(-)
diff --git a/entry/src/main/java/com/chinasoft/ohos/dialog/DialogUtil.java b/entry/src/main/java/com/chinasoft/ohos/dialog/DialogUtil.java
index 6b9e438..644c557 100644
--- a/entry/src/main/java/com/chinasoft/ohos/dialog/DialogUtil.java
+++ b/entry/src/main/java/com/chinasoft/ohos/dialog/DialogUtil.java
@@ -1,14 +1,11 @@
package com.chinasoft.ohos.dialog;
import com.chinasoft.ohos.ResourceTable;
-import com.zhuangfei.timetable.utils.ScreenUtils;
import ohos.agp.colors.RgbColor;
import ohos.agp.components.*;
import ohos.agp.components.element.ShapeElement;
import ohos.agp.utils.Color;
import ohos.agp.utils.LayoutAlignment;
-import ohos.agp.window.dialog.IDialog;
-import ohos.agp.window.dialog.ListDialog;
import ohos.agp.window.dialog.PopupDialog;
import ohos.agp.window.dialog.ToastDialog;
import ohos.app.Context;
@@ -39,16 +36,17 @@ public class DialogUtil {
mContent.setText(content);
ComponentContainer.LayoutConfig layoutConfig = new ComponentContainer.LayoutConfig();
+ layoutConfig.setMarginLeft(20);
+ layoutConfig.setMarginRight(20);
customToastLayout.setLayoutConfig(layoutConfig);
PopupDialog toastDialog = new PopupDialog(context,null);
toastDialog.setCustomComponent(customToastLayout);
toastDialog.setAutoClosable(false);
- toastDialog.setSize(ScreenUtils.getDisplayWidth(context) / 7 * 6, DirectionalLayout.LayoutConfig.MATCH_CONTENT);
+ toastDialog.setSize(ComponentContainer.LayoutConfig.MATCH_PARENT, DirectionalLayout.LayoutConfig.MATCH_CONTENT);
toastDialog.setAlignment(LayoutAlignment.CENTER);
toastDialog.show();
-
mBtConfim.setClickedListener(new Component.ClickedListener() {
@Override
public void onClick(Component component) {
@@ -57,31 +55,4 @@ public class DialogUtil {
});
}
- public static void showChoose(Context context, String[] item,String title) {
-// ComponentContainer customToastLayout = (ComponentContainer) LayoutScatter.getInstance(context).parse(ResourceTable.Layout_dialog_layout, null, false);
-// Text mTitle = (Text) customToastLayout.findComponentById(ResourceTable.Id_tv_title);
-// Text mContent = (Text) customToastLayout.findComponentById(ResourceTable.Id_tv_content);
-// Text mBtConfim = (Text) customToastLayout.findComponentById(ResourceTable.Id_tv_confim);
-//
-// mTitle.setText(title);
-// mContent.setText(content);
-//
-// ComponentContainer.LayoutConfig layoutConfig = new ComponentContainer.LayoutConfig();
-// customToastLayout.setLayoutConfig(layoutConfig);
-//
-// PopupDialog toastDialog = new PopupDialog(context,null);
-// toastDialog.setCustomComponent(customToastLayout);
-// toastDialog.setAutoClosable(false);
-// toastDialog.setSize(ScreenUtils.getDisplayWidth(context) / 7 * 6, DirectionalLayout.LayoutConfig.MATCH_CONTENT);
-// toastDialog.setAlignment(LayoutAlignment.CENTER);
-// toastDialog.show();
-//
-//
-// mBtConfim.setClickedListener(new Component.ClickedListener() {
-// @Override
-// public void onClick(Component component) {
-// toastDialog.hide();
-// }
-// });
- }
}
diff --git a/entry/src/main/resources/base/graphic/background_shape.xml b/entry/src/main/resources/base/graphic/background_shape.xml
index ef24b47..9aef3ae 100644
--- a/entry/src/main/resources/base/graphic/background_shape.xml
+++ b/entry/src/main/resources/base/graphic/background_shape.xml
@@ -1,6 +1,5 @@
-
+
\ No newline at end of file
diff --git a/entry/src/main/resources/base/layout/dialog_layout.xml b/entry/src/main/resources/base/layout/dialog_layout.xml
index 61ae8ae..a3f3a1d 100644
--- a/entry/src/main/resources/base/layout/dialog_layout.xml
+++ b/entry/src/main/resources/base/layout/dialog_layout.xml
@@ -1,7 +1,7 @@
--
Gitee
From 9714f26f2f148c89436c012503ed69f11c2638a8 Mon Sep 17 00:00:00 2001
From: HYL123698745 <1252347619@qq.com>
Date: Wed, 21 Apr 2021 15:57:36 +0800
Subject: [PATCH 4/4] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E5=86=85?=
=?UTF-8?q?=E5=AE=B9=E3=80=91=201.=E6=8F=90=E4=BA=A4readme.md=E6=96=87?=
=?UTF-8?q?=E4=BB=B6=202.=E4=BF=AE=E6=94=B9bug=203.=E6=8F=90=E4=BA=A4CHANG?=
=?UTF-8?q?ELOG=E6=96=87=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
CHANGELOG.md | 44 ++++++
README.md | 146 +++++++++---------
entry/build.gradle | 13 +-
entry/src/main/config.json | 3 +-
.../java/com/chinasoft/ohos/MainAbility.java | 5 +-
.../com/chinasoft/ohos/MyApplication.java | 5 +-
.../chinasoft/ohos/ability/AttrAbility.java | 5 +-
.../ohos/ability/BaseFucAbility.java | 5 +-
.../ohos/ability/ColorPoolAbility.java | 5 +-
.../ohos/ability/CustomWidthAbility.java | 5 +-
.../chinasoft/ohos/ability/DateAbility.java | 5 +-
.../ohos/ability/DateDelayAbility.java | 5 +-
.../ohos/ability/ElasticAbility.java | 5 +-
.../chinasoft/ohos/ability/ExtrasAbility.java | 5 +-
.../ohos/ability/FlaglayoutAbility.java | 5 +-
.../ohos/ability/ItemStyleAbility.java | 5 +-
.../ohos/ability/LocalConfigAbility.java | 5 +-
.../ohos/ability/NonViewAbility.java | 5 +-
.../chinasoft/ohos/ability/SimpleAbility.java | 5 +-
.../chinasoft/ohos/ability/SlideAbility.java | 5 +-
.../chinasoft/ohos/adapter/ChooseAdapter.java | 106 +++++++++++++
.../ohos/adapter/NonViewAdapter.java | 5 +-
.../chinasoft/ohos/base/BaseAbilitySlice.java | 2 +-
.../chinasoft/ohos/bean/WeekChooseBean.java | 42 +++++
.../ohos/dialog/ChooseWeekDialog.java | 131 ++++++++++++++++
.../com/chinasoft/ohos/dialog/DialogUtil.java | 21 +--
.../chinasoft/ohos/dialog/TipsDialogUtil.java | 55 +++++++
.../com/chinasoft/ohos/dialog/ToastUtil.java | 10 +-
.../ohos/dialog/ToastViewDialog.java | 5 +-
.../com/chinasoft/ohos/slice/AttrSlice.java | 5 +-
.../chinasoft/ohos/slice/BaseFuncSlice.java | 69 +++++----
.../chinasoft/ohos/slice/ColorPoolSlice.java | 27 +---
.../ohos/slice/CustomWidthSlice.java | 5 +-
.../chinasoft/ohos/slice/DateDelaySlice.java | 9 +-
.../com/chinasoft/ohos/slice/DateSlice.java | 5 +-
.../chinasoft/ohos/slice/ElasticSlice.java | 5 +-
.../com/chinasoft/ohos/slice/ExtrasSlice.java | 11 +-
.../chinasoft/ohos/slice/FlaglayoutSlice.java | 7 +-
.../chinasoft/ohos/slice/ItemStyleSlice.java | 7 +-
.../ohos/slice/LocalConfigSlice.java | 18 ++-
.../ohos/slice/MainAbilitySlice.java | 5 +-
.../chinasoft/ohos/slice/NonViewSlice.java | 5 +-
.../com/chinasoft/ohos/slice/SimpleSlice.java | 70 +++++++--
.../com/chinasoft/ohos/slice/SlideSlice.java | 5 +-
.../ohos/spinner/MaterialSpinner.java | 37 +++--
.../ohos/spinner/MaterialSpinnerAdapter.java | 5 +-
.../spinner/MaterialSpinnerBaseAdapter.java | 5 +-
.../ohos/spinner/TypedAttrUtils.java | 25 ++-
.../com/chinasoft/ohos/spinner/Utils.java | 5 +-
.../main/resources/base/element/color.json | 2 +-
.../base/graphic/background_shape.xml | 3 +-
.../base/graphic/choose_background.xml | 5 +
.../base/graphic/toast_background_shape.xml | 2 +-
.../base/layout/ability_base_func.xml | 46 ++++--
.../base/layout/ability_local_config.xml | 39 +++--
.../resources/base/layout/ability_main.xml | 113 +++++++++-----
.../resources/base/layout/ability_slide.xml | 3 +-
.../base/layout/choose_dialog_layout.xml | 49 ++++--
.../resources/base/layout/dialog_layout.xml | 15 +-
.../base/layout/header_base_func.xml | 2 -
.../resources/base/layout/item_choose.xml | 26 ++++
.../resources/base/layout/item_nonview.xml | 14 +-
.../resources/base/layout/list_spinner.xml | 14 ++
.../base/layout/tips_dialog_layout.xml | 40 +++++
.../base/layout/toast_dialog_layout.xml | 6 +-
.../resources/base/media/radio_button_off.png | Bin 0 -> 1009 bytes
.../resources/base/media/radio_button_on.png | Bin 0 -> 2029 bytes
.../java/com/chinasoft/ohos/ExampleTest.java | 5 +-
timetable/build.gradle | 6 -
.../zhuangfei/timetable/TimetableView.java | 9 ++
.../timetable/model/ScheduleColorPool.java | 2 +-
.../timetable/operater/SimpleOperater.java | 15 +-
.../timetable/utils/ScreenUtils.java | 5 +-
.../zhuangfei/timetable/view/WeekView.java | 4 +-
.../resources/base/layout/item_dateview.xml | 1 +
.../base/layout/item_dateview_first.xml | 1 +
.../resources/base/layout/item_weekview.xml | 3 +
.../resources/base/layout/view_weekview.xml | 3 +-
78 files changed, 1006 insertions(+), 420 deletions(-)
create mode 100644 CHANGELOG.md
create mode 100644 entry/src/main/java/com/chinasoft/ohos/adapter/ChooseAdapter.java
create mode 100644 entry/src/main/java/com/chinasoft/ohos/bean/WeekChooseBean.java
create mode 100644 entry/src/main/java/com/chinasoft/ohos/dialog/ChooseWeekDialog.java
create mode 100644 entry/src/main/java/com/chinasoft/ohos/dialog/TipsDialogUtil.java
create mode 100644 entry/src/main/resources/base/graphic/choose_background.xml
create mode 100644 entry/src/main/resources/base/layout/item_choose.xml
create mode 100644 entry/src/main/resources/base/layout/list_spinner.xml
create mode 100644 entry/src/main/resources/base/layout/tips_dialog_layout.xml
create mode 100644 entry/src/main/resources/base/media/radio_button_off.png
create mode 100644 entry/src/main/resources/base/media/radio_button_on.png
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..af9e824
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,44 @@
+## 0.0.1-SNAPSHOT
+* refactor: For module library Android-to-OpenHarmony
+
+## v2.0.7-beta
+* add file
+
+## v2.0.7
+* v2.0.7发布
+
+## v2.0.6
+* Merge remote-tracking branch 'remotes/origin/dev'
+
+
+## v2.0.5
+* Merge remote-tracking branch 'origin/master'
+
+
+## v2.0.4
+* Merge remote-tracking branch 'remotes/origin/dev'
+
+
+## v2.0.3
+* Merge pull request #17 from zfman/dev v2.0.3
+
+
+## v2.0.2
+* Update README.md
+
+
+## v2.0.1
+* Update README.md
+
+
+## v1.0.4
+* modify readme
+
+
+## v1.0.0
+* Update README.md
+
+
+## v1.0.1
+* Update README.md
+
diff --git a/README.md b/README.md
index 9122fe6..6f7efb2 100644
--- a/README.md
+++ b/README.md
@@ -29,7 +29,7 @@
- 课程颜色可指定
#### 效果演示
-
+
#### 安装教程
@@ -346,7 +346,9 @@ XML中添加控件:
```
##### 基础能力
-###### 配置属性
+
+ **配置属性**
+
我直接把这部分整个代码放出来了,分以下三步:
1. 获取控件
@@ -435,7 +437,8 @@ XML中添加控件:
}
```
-###### 删除课程
+**删除课程**
+
```java
/**
@@ -454,7 +457,8 @@ XML中添加控件:
```
-###### 添加课程
+**添加课程**
+
```java
/**
@@ -473,7 +477,8 @@ XML中添加控件:
}
```
-###### 非本周课程显示与隐藏
+**非本周课程显示与隐藏**
+
```java
/**
@@ -497,7 +502,8 @@ XML中添加控件:
}
```
-###### 最大节次设置
+**最大节次设置**
+
```java
/**
@@ -510,7 +516,8 @@ XML中添加控件:
```
-###### 节次时间显示与隐藏
+**节次时间显示与隐藏**
+
```java
/**
@@ -536,7 +543,8 @@ XML中添加控件:
}
```
-###### WeekView显示与隐藏
+**WeekView显示与隐藏**
+
```java
/**
@@ -554,7 +562,8 @@ XML中添加控件:
}
```
-###### 月份宽度设置
+**月份宽度设置**
+
```java
/**
@@ -573,7 +582,8 @@ XML中添加控件:
```
-###### 周末显示与隐藏
+**周末显示与隐藏**
+
```java
/**
@@ -594,7 +604,8 @@ XML中添加控件:
##### 周次选择控件
周次选择栏WeekView是控件实现的一个默认的周次选择控件,你可以使用它快速的拥有周次选择功能,TimetableView`本身是没有周次选择功能的,所以需要两者配合使用,完整代码参见 BaseFuncSlice
-###### 默认的周次选择栏
+**默认的周次选择栏**
+
1.添加控件
@@ -654,7 +665,8 @@ XML中添加控件:
.showView();
```
-###### 自定义周次选择栏
+**自定义周次选择栏**
+
你可以选择以下方法来实现周次选择栏的自定义:
- 任意定制,因为周次选择栏和课表是没有关系的,所以你可以任意实现
@@ -665,7 +677,8 @@ XML中添加控件:
本节主要演示如何对日期栏的属性设置以及自定义日期栏的步骤,通用步骤比如:添加控件、获取控件,设置数据源以及显示视图什么的都不再重复了,只讲解核心部分
完整代码参见 DateSlice
-###### 日期栏显示与隐藏
+**日期栏显示与隐藏**
+
```java
/**
@@ -684,7 +697,8 @@ XML中添加控件:
```
-###### 恢复默认日期栏
+**恢复默认日期栏**
+
```java
/**
@@ -696,7 +710,7 @@ XML中添加控件:
}
```
-###### 自定义日期栏
+**自定义日期栏**
Step1:自定义布局
@@ -790,7 +804,7 @@ Step2:自定义实现类
```
-###### 日期延迟显示案例
+**日期延迟显示案例**
需求:设定一个开学时间,在开学时间到来之前,一直显示开学时的第一周的日期
@@ -987,7 +1001,7 @@ Step2:自定义实现类
在课程视图的左侧有一列是侧边栏,本节演示如何对侧边栏的属性进行配置以及自定义侧边栏的步骤
完整代码参见 SlideSlice
-###### 准备
+**准备**
添加控件
@@ -1019,7 +1033,7 @@ Step2:自定义实现类
}
```
-###### 节次时间显示与隐藏
+**节次时间显示与隐藏**
```java
@@ -1049,7 +1063,7 @@ Step2:自定义实现类
}
```
-###### 修改侧边栏背景
+**修改侧边栏背景**
```java
@@ -1066,7 +1080,7 @@ Step2:自定义实现类
}
```
-###### 修改节次文本颜色
+**修改节次文本颜色**
```java
@@ -1082,7 +1096,7 @@ Step2:自定义实现类
}
```
-###### 修改时间文本颜色
+**修改时间文本颜色**
```java
@@ -1100,7 +1114,7 @@ Step2:自定义实现类
}
```
-###### 侧边栏效果重置
+**侧边栏效果重置**
```java
@@ -1114,7 +1128,7 @@ Step2:自定义实现类
}
```
-###### 自定义侧边栏
+**自定义侧边栏**
Step1:创建布局
@@ -1174,7 +1188,7 @@ Step2:设置监听
本节将演示如何配置课程项的样式,完整代码参见 ItemStyleSlice
-###### 非本周课程显示与隐藏
+**非本周课程显示与隐藏**
```java
@@ -1197,7 +1211,7 @@ Step2:设置监听
}
```
-###### 设置间距以及弧度
+**设置间距以及弧度**
```java
@@ -1213,7 +1227,7 @@ Step2:设置监听
}
```
-###### 设置单个角弧度
+**设置单个角弧度**
```java
@@ -1241,7 +1255,7 @@ Step2:设置监听
}
```
-###### 修改显示的文本
+**修改显示的文本**
```java
@@ -1264,7 +1278,7 @@ Step2:设置监听
```
-###### 设置非本周课的背景
+**设置非本周课的背景**
```java
@@ -1279,7 +1293,7 @@ Step2:设置监听
}
```
-###### 课程重叠的样式
+**课程重叠的样式**
```java
@@ -1304,32 +1318,7 @@ Step2:设置监听
}
```
-###### 课程重叠的样式
-
-```java
-
- /**
- * 修改课程重叠的样式,在该接口中,你可以自定义出很多的效果
- */
- protected void modifyOverlayStyle() {
- mTimetableView.callback(new OnItemBuildAdapter() {
- @Override
- public void onItemUpdate(StackLayout layout, Text textView, Text countTextView, Schedule schedule, ShapeElement gd) {
- super.onItemUpdate(layout, textView, countTextView, schedule, gd);
- /**
- * 可见说明重叠,取消角标,添加角度
- */
- if (countTextView.getVisibility() == Component.VISIBLE) {
- countTextView.setVisibility(Component.HIDE);
- gd.setCornerRadiiArray(new float[]{0, 0, 20, 20, 0, 0, 0, 0});
- }
- }
- });
- mTimetableView.updateView();
- }
-```
-
-###### 添加广告
+**添加广告**
广告一般是一张图片和一个链接,所以整体思路是这样的,首先向数据集里插入一条数据,数据的名字可以任意,但是必须和普通课程有所区分,根据这个名字可以判断出它是广告,然后给该数据设置上课周次、开始节次、持续节次;然后监听课程项的构建,如果监测到该课程是广告,那么将默认的课程布局remove掉,然后添加一个广告图片,再给它设置一个点击事件
@@ -1414,7 +1403,7 @@ Step2:设置监听
.showView();
```
-###### 中英文切换
+**中英文切换**
step1:英文日期栏
@@ -1507,12 +1496,12 @@ step3:设置监听
##### 课程颜色管理
-###### 颜色池
+**颜色池**
颜色池ScheduleColorPool的内部实现是控件维护的一个集合,它管理着课程项的颜色,负责对颜色的存取
完整代码参见 ColorPoolSlice
-###### 获取颜色池
+**获取颜色池**
以下代码的返回结果就是一个ScheduleColorPool实例对象
@@ -1521,7 +1510,7 @@ step3:设置监听
mTimetableView.colorPool();
```
-###### 指定颜色
+**指定颜色**
如果需要让所有课程只在某几种颜色中分配颜色,只需要清空颜色池并加入特定的颜色,在分配颜色时会循环分配颜色池中的颜色
@@ -1540,7 +1529,7 @@ step3:设置监听
}
```
-###### 重置颜色池
+**重置颜色池**
重置后,颜色池恢复到初始状态
@@ -1555,7 +1544,7 @@ step3:设置监听
}
```
-###### 追加颜色
+**追加颜色**
向颜色池中追加颜色,在为课程项分配颜色时,会按照颜色池中的顺序依次取出颜色,所以并不保证追加的颜色一定会被用到
@@ -1572,7 +1561,7 @@ step3:设置监听
}
```
-###### 设置非本周课程颜色
+**设置非本周课程颜色**
向颜色池中追加颜色,在为课程项分配颜色时,会按照颜色池中的顺序依次取出颜色,所以并不保证追加的颜色一定会被用到
@@ -1589,7 +1578,7 @@ step3:设置监听
}
```
-###### 指定课程的颜色
+**指定课程的颜色**
setIgnoreUserlessColor 用来设置颜色映射是否忽略非本周的课程颜色,如果设置为true,表示该课程在颜色映射中能够查找到,那么不管是本周还是非本周它都将显示映射中的颜色;如果设置为false,表示如果该课程在颜色映射中能够查找到,并且该课程是本周的,那么将该课程设置为映射中的颜色,如果非本周,则使用非本周颜色对其渲染
@@ -1614,7 +1603,7 @@ setIgnoreUserlessColor 用来设置颜色映射是否忽略非本周的课程颜
本节将演示如何实现一个有下拉反弹效果的课表界面,自定义View的知识不在本节的范围之内,有兴趣可以百度。
完整代码参见 ElasticSlice
-###### 自定义View
+**自定义View**
你需要先准备好一个自定义View,根据你的需求而定,可以参考以下的弹性滚动布局ElasticScrollView
@@ -1768,7 +1757,7 @@ setIgnoreUserlessColor 用来设置颜色映射是否忽略非本周的课程颜
}
```
-###### 布局文件
+**布局文件**
备一个布局文件,命名任意,将以下内容复制到布局文件中,然后将根控件换成自定义控件,注意ID不能改变
@@ -1788,7 +1777,7 @@ setIgnoreUserlessColor 用来设置颜色映射是否忽略非本周的课程颜
```
-###### 设置监听
+**设置监听**
```java
@@ -1824,7 +1813,7 @@ setIgnoreUserlessColor 用来设置颜色映射是否忽略非本周的课程颜
默认情况下,旗标布局是开启状态的,即不需要任何配置,在空白格子处点击会出现旗标布局,当然,它也可以关闭。
-###### 事件监听
+**事件监听**
OnSpaceItemClickListener是空白格子点击监听器,当用户点击空白格子时,会回调该接口中的方法并传入点击的格子的位置,然后需要将旗标布局移动到指定格子位置,OnSpaceItemClickAdapter是这个接口的默认实现,这部分一般不用开发者关心
@@ -1869,7 +1858,8 @@ OnSpaceItemClickListener是空白格子点击监听器,当用户点击空白
}
```
-###### 背景修改与重置
+**背景修改与重置**
+
```java
/**
@@ -1889,7 +1879,8 @@ OnSpaceItemClickListener是空白格子点击监听器,当用户点击空白
}
```
-###### 开启与关闭
+**开启与关闭**
+
```java
/**
@@ -1908,7 +1899,8 @@ OnSpaceItemClickListener是空白格子点击监听器,当用户点击空白
```
-###### 显示与隐藏
+**显示与隐藏**
+
```java
/**
@@ -1927,7 +1919,7 @@ OnSpaceItemClickListener是空白格子点击监听器,当用户点击空白
设置数据源时可以使用自定义的数据类型,但是必须实现ScheduleEnable接口,为什么呢?因为在TimetableView内部保存的数据格式是List的,接口只是起到一个转换的作用,点击事件会回调,会获取到点击位置的一个List集合,此时我们已经拿不到自定义的数据类型了,那么此时我想拿到这门课程的ID怎么办?
完整代码参见 ExtrasSlice
-###### 存入额外数据
+**存入额外数据**
Schedule中没有这个字段,自定义类型中有,所以在Schedule新增了一个extras字段,它是一个Map。所以现在这个问题可以这样解决:
@@ -2128,7 +2120,7 @@ Schedule中没有这个字段,自定义类型中有,所以在Schedule新增
}
```
-###### 读出额外数据
+**读出额外数据**
```java
@@ -2168,7 +2160,7 @@ Schedule中没有这个字段,自定义类型中有,所以在Schedule新增
控件提供了一个工具类,可以方便的以无界面的方式操作课程数据,本节演示如何使用工具类实现对课程颜色的可视化展示
完整代码参见 NonViewSlice
-###### 列表与适配器
+**列表与适配器**
在Slice的布局中放一个ListContainer
@@ -2347,7 +2339,7 @@ item_nonview.xml是ListView中每一项的布局,它的内容如下:
```
-###### 显示所有课程
+**显示所有课程**
```java
@@ -2361,7 +2353,7 @@ item_nonview.xml是ListView中每一项的布局,它的内容如下:
}
```
-###### 第一周有课的课程
+**第一周有课的课程**
```java
@@ -2385,7 +2377,7 @@ item_nonview.xml是ListView中每一项的布局,它的内容如下:
}
```
-###### 周一有课的课程
+**周一有课的课程**
```java
@@ -2411,7 +2403,7 @@ CloudTest代码测试无异常
当前版本demo功能与安卓原组件基本无差异
-测试员:陈翔
+测试员:陈翔,朱品,邓世雄
#### 版本迭代
diff --git a/entry/build.gradle b/entry/build.gradle
index 2337deb..3881a49 100644
--- a/entry/build.gradle
+++ b/entry/build.gradle
@@ -1,16 +1,5 @@
apply plugin: 'com.huawei.ohos.hap'
ohos {
- signingConfigs {
- debug {
- storeFile file('E:\\HarmonyWorkSpace\\SOW-33\\共用\\root_1.p12')
- storePassword '0000002045693FD8BED19E75819E60FBC4BA5F9295E17FDEDA8B53BEF29F6CE2E897471DD417898752A1E213402B2522'
- keyAlias = 'hos_platform_os'
- keyPassword '00000020A9E2800C943924849DE623AFB1D72B60D1C0A4CC26A22F7E3B3027FC4E015C830BD0804E1799B0FF2084721A'
- signAlg = 'SHA256withECDSA'
- profile file('E:\\HarmonyWorkSpace\\SOW-33\\三期key\\TimetableViewDebug (1).p7b')
- certpath file('E:\\HarmonyWorkSpace\\SOW-33\\共用\\root.cer')
- }
- }
compileSdkVersion 5
defaultConfig {
compatibleSdkVersion 5
@@ -22,6 +11,6 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar', '*.har'])
implementation project(path: ':timetable')
testCompile 'junit:junit:4.12'
+ compile project(path: ':timetable')
implementation 'com.alibaba:fastjson:1.2.55'
- implementation('com.gitee.chinasoft_ohos:timetable-view:0.0.1-SNAPSHOT')
}
diff --git a/entry/src/main/config.json b/entry/src/main/config.json
index 9f1ea6b..68c8a33 100644
--- a/entry/src/main/config.json
+++ b/entry/src/main/config.json
@@ -17,8 +17,7 @@
"package": "com.chinasoft.ohos",
"name": ".MyApplication",
"deviceType": [
- "phone",
- "tv"
+ "phone"
],
"reqPermissions": [
{
diff --git a/entry/src/main/java/com/chinasoft/ohos/MainAbility.java b/entry/src/main/java/com/chinasoft/ohos/MainAbility.java
index c1b4180..099fac3 100644
--- a/entry/src/main/java/com/chinasoft/ohos/MainAbility.java
+++ b/entry/src/main/java/com/chinasoft/ohos/MainAbility.java
@@ -1,17 +1,16 @@
/*
- * Copyright (C) 2021 The Chinese Software International Co., Ltd.
+ * 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.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
package com.chinasoft.ohos ;
diff --git a/entry/src/main/java/com/chinasoft/ohos/MyApplication.java b/entry/src/main/java/com/chinasoft/ohos/MyApplication.java
index a6e53da..fa0954d 100644
--- a/entry/src/main/java/com/chinasoft/ohos/MyApplication.java
+++ b/entry/src/main/java/com/chinasoft/ohos/MyApplication.java
@@ -1,17 +1,16 @@
/*
- * Copyright (C) 2021 The Chinese Software International Co., Ltd.
+ * 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.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
package com.chinasoft.ohos;
diff --git a/entry/src/main/java/com/chinasoft/ohos/ability/AttrAbility.java b/entry/src/main/java/com/chinasoft/ohos/ability/AttrAbility.java
index ffef86c..0c338a3 100644
--- a/entry/src/main/java/com/chinasoft/ohos/ability/AttrAbility.java
+++ b/entry/src/main/java/com/chinasoft/ohos/ability/AttrAbility.java
@@ -1,17 +1,16 @@
/*
- * Copyright (C) 2021 The Chinese Software International Co., Ltd.
+ * 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.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
package com.chinasoft.ohos.ability;
diff --git a/entry/src/main/java/com/chinasoft/ohos/ability/BaseFucAbility.java b/entry/src/main/java/com/chinasoft/ohos/ability/BaseFucAbility.java
index 05db7cf..f65301b 100644
--- a/entry/src/main/java/com/chinasoft/ohos/ability/BaseFucAbility.java
+++ b/entry/src/main/java/com/chinasoft/ohos/ability/BaseFucAbility.java
@@ -1,17 +1,16 @@
/*
- * Copyright (C) 2021 The Chinese Software International Co., Ltd.
+ * 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.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
package com.chinasoft.ohos.ability;
diff --git a/entry/src/main/java/com/chinasoft/ohos/ability/ColorPoolAbility.java b/entry/src/main/java/com/chinasoft/ohos/ability/ColorPoolAbility.java
index 6548574..c48f929 100644
--- a/entry/src/main/java/com/chinasoft/ohos/ability/ColorPoolAbility.java
+++ b/entry/src/main/java/com/chinasoft/ohos/ability/ColorPoolAbility.java
@@ -1,17 +1,16 @@
/*
- * Copyright (C) 2021 The Chinese Software International Co., Ltd.
+ * 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.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
package com.chinasoft.ohos.ability;
diff --git a/entry/src/main/java/com/chinasoft/ohos/ability/CustomWidthAbility.java b/entry/src/main/java/com/chinasoft/ohos/ability/CustomWidthAbility.java
index 11dcb15..aec39bf 100644
--- a/entry/src/main/java/com/chinasoft/ohos/ability/CustomWidthAbility.java
+++ b/entry/src/main/java/com/chinasoft/ohos/ability/CustomWidthAbility.java
@@ -1,17 +1,16 @@
/*
- * Copyright (C) 2021 The Chinese Software International Co., Ltd.
+ * 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.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
package com.chinasoft.ohos.ability;
diff --git a/entry/src/main/java/com/chinasoft/ohos/ability/DateAbility.java b/entry/src/main/java/com/chinasoft/ohos/ability/DateAbility.java
index 3c8eb88..dd23126 100644
--- a/entry/src/main/java/com/chinasoft/ohos/ability/DateAbility.java
+++ b/entry/src/main/java/com/chinasoft/ohos/ability/DateAbility.java
@@ -1,17 +1,16 @@
/*
- * Copyright (C) 2021 The Chinese Software International Co., Ltd.
+ * 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.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
package com.chinasoft.ohos.ability;
diff --git a/entry/src/main/java/com/chinasoft/ohos/ability/DateDelayAbility.java b/entry/src/main/java/com/chinasoft/ohos/ability/DateDelayAbility.java
index b49130d..dd844b8 100644
--- a/entry/src/main/java/com/chinasoft/ohos/ability/DateDelayAbility.java
+++ b/entry/src/main/java/com/chinasoft/ohos/ability/DateDelayAbility.java
@@ -1,17 +1,16 @@
/*
- * Copyright (C) 2021 The Chinese Software International Co., Ltd.
+ * 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.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
package com.chinasoft.ohos.ability;
diff --git a/entry/src/main/java/com/chinasoft/ohos/ability/ElasticAbility.java b/entry/src/main/java/com/chinasoft/ohos/ability/ElasticAbility.java
index e09de8e..2690fdd 100644
--- a/entry/src/main/java/com/chinasoft/ohos/ability/ElasticAbility.java
+++ b/entry/src/main/java/com/chinasoft/ohos/ability/ElasticAbility.java
@@ -1,17 +1,16 @@
/*
- * Copyright (C) 2021 The Chinese Software International Co., Ltd.
+ * 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.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
package com.chinasoft.ohos.ability;
diff --git a/entry/src/main/java/com/chinasoft/ohos/ability/ExtrasAbility.java b/entry/src/main/java/com/chinasoft/ohos/ability/ExtrasAbility.java
index d24e960..0c549c7 100644
--- a/entry/src/main/java/com/chinasoft/ohos/ability/ExtrasAbility.java
+++ b/entry/src/main/java/com/chinasoft/ohos/ability/ExtrasAbility.java
@@ -1,17 +1,16 @@
/*
- * Copyright (C) 2021 The Chinese Software International Co., Ltd.
+ * 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.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
package com.chinasoft.ohos.ability;
diff --git a/entry/src/main/java/com/chinasoft/ohos/ability/FlaglayoutAbility.java b/entry/src/main/java/com/chinasoft/ohos/ability/FlaglayoutAbility.java
index 2d40661..684cae1 100644
--- a/entry/src/main/java/com/chinasoft/ohos/ability/FlaglayoutAbility.java
+++ b/entry/src/main/java/com/chinasoft/ohos/ability/FlaglayoutAbility.java
@@ -1,17 +1,16 @@
/*
- * Copyright (C) 2021 The Chinese Software International Co., Ltd.
+ * 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.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
package com.chinasoft.ohos.ability;
diff --git a/entry/src/main/java/com/chinasoft/ohos/ability/ItemStyleAbility.java b/entry/src/main/java/com/chinasoft/ohos/ability/ItemStyleAbility.java
index e849d82..077174e 100644
--- a/entry/src/main/java/com/chinasoft/ohos/ability/ItemStyleAbility.java
+++ b/entry/src/main/java/com/chinasoft/ohos/ability/ItemStyleAbility.java
@@ -1,17 +1,16 @@
/*
- * Copyright (C) 2021 The Chinese Software International Co., Ltd.
+ * 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.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
package com.chinasoft.ohos.ability;
diff --git a/entry/src/main/java/com/chinasoft/ohos/ability/LocalConfigAbility.java b/entry/src/main/java/com/chinasoft/ohos/ability/LocalConfigAbility.java
index 8724aab..5717e65 100644
--- a/entry/src/main/java/com/chinasoft/ohos/ability/LocalConfigAbility.java
+++ b/entry/src/main/java/com/chinasoft/ohos/ability/LocalConfigAbility.java
@@ -1,17 +1,16 @@
/*
- * Copyright (C) 2021 The Chinese Software International Co., Ltd.
+ * 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.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
package com.chinasoft.ohos.ability;
diff --git a/entry/src/main/java/com/chinasoft/ohos/ability/NonViewAbility.java b/entry/src/main/java/com/chinasoft/ohos/ability/NonViewAbility.java
index 91c3bca..3bab634 100644
--- a/entry/src/main/java/com/chinasoft/ohos/ability/NonViewAbility.java
+++ b/entry/src/main/java/com/chinasoft/ohos/ability/NonViewAbility.java
@@ -1,17 +1,16 @@
/*
- * Copyright (C) 2021 The Chinese Software International Co., Ltd.
+ * 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.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
package com.chinasoft.ohos.ability;
diff --git a/entry/src/main/java/com/chinasoft/ohos/ability/SimpleAbility.java b/entry/src/main/java/com/chinasoft/ohos/ability/SimpleAbility.java
index a550910..2bedd66 100644
--- a/entry/src/main/java/com/chinasoft/ohos/ability/SimpleAbility.java
+++ b/entry/src/main/java/com/chinasoft/ohos/ability/SimpleAbility.java
@@ -1,17 +1,16 @@
/*
- * Copyright (C) 2021 The Chinese Software International Co., Ltd.
+ * 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.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
package com.chinasoft.ohos.ability;
diff --git a/entry/src/main/java/com/chinasoft/ohos/ability/SlideAbility.java b/entry/src/main/java/com/chinasoft/ohos/ability/SlideAbility.java
index 266b670..fc3785a 100644
--- a/entry/src/main/java/com/chinasoft/ohos/ability/SlideAbility.java
+++ b/entry/src/main/java/com/chinasoft/ohos/ability/SlideAbility.java
@@ -1,17 +1,16 @@
/*
- * Copyright (C) 2021 The Chinese Software International Co., Ltd.
+ * 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.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
package com.chinasoft.ohos.ability;
diff --git a/entry/src/main/java/com/chinasoft/ohos/adapter/ChooseAdapter.java b/entry/src/main/java/com/chinasoft/ohos/adapter/ChooseAdapter.java
new file mode 100644
index 0000000..04eccf6
--- /dev/null
+++ b/entry/src/main/java/com/chinasoft/ohos/adapter/ChooseAdapter.java
@@ -0,0 +1,106 @@
+/*
+ * 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.chinasoft.ohos.adapter;
+
+
+import com.chinasoft.ohos.ResourceTable;
+import com.chinasoft.ohos.bean.WeekChooseBean;
+import com.chinasoft.ohos.slice.CustomWidthSlice;
+import com.zhuangfei.timetable.model.Schedule;
+import com.zhuangfei.timetable.model.ScheduleColorPool;
+import ohos.agp.colors.RgbColor;
+import ohos.agp.components.*;
+import ohos.agp.components.element.PixelMapElement;
+import ohos.agp.components.element.ShapeElement;
+import ohos.app.Context;
+import ohos.global.resource.Element;
+import ohos.media.image.PixelMap;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by Liu ZhuangFei on 2018/6/18. BaseAdapter
+ */
+public class ChooseAdapter extends BaseItemProvider {
+
+ ArrayList datas;
+ Context context;
+ LayoutScatter inflater;
+ private CheckListen checkListen;
+
+ public ChooseAdapter(Context context, ArrayList data) {
+ this.context = context;
+ this.datas = data;
+ inflater = LayoutScatter.getInstance(context);
+ }
+
+ @Override
+ public int getCount() {
+ return datas.size();
+ }
+
+ @Override
+ public Object getItem(int i) {
+ return datas.get(i);
+ }
+
+ @Override
+ public long getItemId(int i) {
+ return i;
+ }
+
+ @Override
+ public Component getComponent(int i, Component convertView, ComponentContainer viewGroup) {
+ convertView = inflater.parse(ResourceTable.Layout_item_choose, null, false);
+ RadioButton mRbCheck = (RadioButton) convertView.findComponentById(ResourceTable.Id_rb_check);
+ Text mTvCheck = (Text) convertView.findComponentById(ResourceTable.Id_tv_check);
+
+ WeekChooseBean data = datas.get(i);
+
+ mTvCheck.setText(data.getWeek());
+
+ if (data.isSelect()) {
+ mRbCheck.setChecked(true);
+ } else {
+ mRbCheck.setChecked(false);
+ }
+
+ convertView.setClickedListener(new Component.ClickedListener() {
+ @Override
+ public void onClick(Component component) {
+ int index = i;
+ for (int ii = 0; ii < datas.size(); ii++) {
+ if (index == ii) {
+ datas.get(ii).setSelect(true);
+ } else {
+ datas.get(ii).setSelect(false);
+ }
+ }
+ notifyDataChanged();
+ checkListen.check(i);
+ }
+ });
+ return convertView;
+ }
+
+ public void setCheckListen(CheckListen listen) {
+ this.checkListen = listen;
+ }
+
+ public interface CheckListen {
+ void check(int index);
+ }
+}
diff --git a/entry/src/main/java/com/chinasoft/ohos/adapter/NonViewAdapter.java b/entry/src/main/java/com/chinasoft/ohos/adapter/NonViewAdapter.java
index 57e902b..cbef109 100644
--- a/entry/src/main/java/com/chinasoft/ohos/adapter/NonViewAdapter.java
+++ b/entry/src/main/java/com/chinasoft/ohos/adapter/NonViewAdapter.java
@@ -1,17 +1,16 @@
/*
- * Copyright (C) 2021 The Chinese Software International Co., Ltd.
+ * 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.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
package com.chinasoft.ohos.adapter;
diff --git a/entry/src/main/java/com/chinasoft/ohos/base/BaseAbilitySlice.java b/entry/src/main/java/com/chinasoft/ohos/base/BaseAbilitySlice.java
index 70161aa..e39f8be 100644
--- a/entry/src/main/java/com/chinasoft/ohos/base/BaseAbilitySlice.java
+++ b/entry/src/main/java/com/chinasoft/ohos/base/BaseAbilitySlice.java
@@ -16,6 +16,6 @@ public class BaseAbilitySlice extends AbilitySlice {
@Override
protected void onStart(Intent intent) {
super.onStart(intent);
- WindowManager.getInstance().getTopWindow().get().setStatusBarColor(Color.YELLOW.getValue());
+ WindowManager.getInstance().getTopWindow().get().setStatusBarColor(Color.rgb(220,126,44));
}
}
diff --git a/entry/src/main/java/com/chinasoft/ohos/bean/WeekChooseBean.java b/entry/src/main/java/com/chinasoft/ohos/bean/WeekChooseBean.java
new file mode 100644
index 0000000..d210163
--- /dev/null
+++ b/entry/src/main/java/com/chinasoft/ohos/bean/WeekChooseBean.java
@@ -0,0 +1,42 @@
+package com.chinasoft.ohos.bean;
+
+import ohos.agp.components.RadioButton;
+
+/**
+ * author :Administrator
+ * date : 2021/4/19 14:32
+ * package:com.chinasoft.ohos.bean
+ * description :
+ */
+public class WeekChooseBean {
+ private String week;
+ /**
+ * 0 未选择 1 选择
+ */
+ private boolean isSelect;
+ private RadioButton radioButton;
+
+ public String getWeek() {
+ return week;
+ }
+
+ public void setWeek(String week) {
+ this.week = week;
+ }
+
+ public boolean isSelect() {
+ return isSelect;
+ }
+
+ public void setSelect(boolean select) {
+ isSelect = select;
+ }
+
+ public RadioButton getRadioButton() {
+ return radioButton;
+ }
+
+ public void setRadioButton(RadioButton radioButton) {
+ this.radioButton = radioButton;
+ }
+}
diff --git a/entry/src/main/java/com/chinasoft/ohos/dialog/ChooseWeekDialog.java b/entry/src/main/java/com/chinasoft/ohos/dialog/ChooseWeekDialog.java
new file mode 100644
index 0000000..b830d69
--- /dev/null
+++ b/entry/src/main/java/com/chinasoft/ohos/dialog/ChooseWeekDialog.java
@@ -0,0 +1,131 @@
+/*
+ * 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.chinasoft.ohos.dialog;
+
+import com.chinasoft.ohos.ResourceTable;
+import com.chinasoft.ohos.adapter.ChooseAdapter;
+import com.chinasoft.ohos.bean.WeekChooseBean;
+import com.zhuangfei.timetable.utils.ScreenUtils;
+import ohos.agp.components.*;
+import ohos.agp.utils.LayoutAlignment;
+import ohos.agp.window.dialog.PopupDialog;
+import ohos.app.Context;
+
+import java.util.ArrayList;
+
+/**
+ * ChooseWeekDialog
+ *
+ * @since 2021-03-29
+ */
+public class ChooseWeekDialog{
+
+ private final int target;
+ private Context context;
+ private String title = null;
+ private ArrayList data = null;
+ private CancleClickListen mCancleClickListen;
+ private ConfimClickListen mConfimClickListen;
+ private int mIndex;
+
+ public ChooseWeekDialog(Context context, int target) {
+ this.target = target;
+ this.context = context;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public void setData(ArrayList data) {
+ this.data = data;
+ }
+
+ public void setCancleButton(CancleClickListen cancleClickListen) {
+ this.mCancleClickListen = cancleClickListen;
+ }
+
+ public void setmConfimClickListen(ConfimClickListen confimClickListen) {
+ this.mConfimClickListen = confimClickListen;
+ }
+
+ public void show() {
+ ComponentContainer customToastLayout = (ComponentContainer) LayoutScatter.getInstance(context).parse(ResourceTable.Layout_choose_dialog_layout, null, false);
+ Text mTitle = (Text) customToastLayout.findComponentById(ResourceTable.Id_tv_title);
+ ListContainer listContainer = (ListContainer) customToastLayout.findComponentById(ResourceTable.Id_lv_choose);
+ Text mBtCancle = (Text) customToastLayout.findComponentById(ResourceTable.Id_bt_cancle);
+ Text mBtConfim = (Text) customToastLayout.findComponentById(ResourceTable.Id_bt_confim);
+
+ if (title != null) {
+ mTitle.setText(title);
+ }
+ if (data != null) {
+ setAdapter(listContainer);
+ }
+
+ DirectionalLayout.LayoutConfig layoutConfig = new DirectionalLayout.LayoutConfig(DirectionalLayout.LayoutConfig.MATCH_PARENT,ScreenUtils.getDisplayHeight(context) / 7 * 6);
+ customToastLayout.setLayoutConfig(layoutConfig);
+
+
+ PopupDialog toastDialog = new PopupDialog(context, null);
+ toastDialog.setCustomComponent(customToastLayout);
+ toastDialog.setAutoClosable(false);
+ toastDialog.setSize(ScreenUtils.getDisplayWidth(context) / 6 * 5, DirectionalLayout.LayoutConfig.MATCH_CONTENT);
+ toastDialog.setAlignment(LayoutAlignment.CENTER);
+ toastDialog.show();
+ mBtCancle.setClickedListener(new Component.ClickedListener() {
+ @Override
+ public void onClick(Component component) {
+ mCancleClickListen.onCancleClick();
+ toastDialog.hide();
+ }
+ });
+ mBtConfim.setClickedListener(new Component.ClickedListener() {
+ @Override
+ public void onClick(Component component) {
+ mConfimClickListen.onConfimClick(mIndex);
+ toastDialog.hide();
+ }
+ });
+ }
+
+ private void setAdapter(ListContainer listContainer) {
+ for (int i = 0; i < data.size(); i++) {
+ if (i == target) {
+ data.get(i).setSelect(true);
+ } else {
+ data.get(i).setSelect(false);
+ }
+ }
+ ChooseAdapter adapter = new ChooseAdapter(context, data);
+ adapter.setCheckListen(new ChooseAdapter.CheckListen() {
+ @Override
+ public void check(int index) {
+ mIndex = index;
+ }
+ });
+ listContainer.setItemProvider(adapter);
+ listContainer.scrollTo(target);
+ adapter.notifyDataChanged();
+ }
+
+ public interface CancleClickListen {
+ void onCancleClick();
+ }
+
+ public interface ConfimClickListen {
+ void onConfimClick(int index);
+ }
+}
diff --git a/entry/src/main/java/com/chinasoft/ohos/dialog/DialogUtil.java b/entry/src/main/java/com/chinasoft/ohos/dialog/DialogUtil.java
index 644c557..9941600 100644
--- a/entry/src/main/java/com/chinasoft/ohos/dialog/DialogUtil.java
+++ b/entry/src/main/java/com/chinasoft/ohos/dialog/DialogUtil.java
@@ -1,11 +1,14 @@
package com.chinasoft.ohos.dialog;
import com.chinasoft.ohos.ResourceTable;
+import com.zhuangfei.timetable.utils.ScreenUtils;
import ohos.agp.colors.RgbColor;
import ohos.agp.components.*;
import ohos.agp.components.element.ShapeElement;
import ohos.agp.utils.Color;
import ohos.agp.utils.LayoutAlignment;
+import ohos.agp.window.dialog.IDialog;
+import ohos.agp.window.dialog.ListDialog;
import ohos.agp.window.dialog.PopupDialog;
import ohos.agp.window.dialog.ToastDialog;
import ohos.app.Context;
@@ -14,10 +17,8 @@ import ohos.app.Context;
* ToastUtil
*
* @since 2021-03-29
- *
*/
public class DialogUtil {
-
Context context;
@@ -26,7 +27,9 @@ public class DialogUtil {
}
- public static void show(Context context, String title,String content) {
+ public static void show(Context context, String title, String content, Component mBgComponent) {
+ mBgComponent.setVisibility(Component.VISIBLE);
+
ComponentContainer customToastLayout = (ComponentContainer) LayoutScatter.getInstance(context).parse(ResourceTable.Layout_dialog_layout, null, false);
Text mTitle = (Text) customToastLayout.findComponentById(ResourceTable.Id_tv_title);
Text mContent = (Text) customToastLayout.findComponentById(ResourceTable.Id_tv_content);
@@ -35,24 +38,24 @@ public class DialogUtil {
mTitle.setText(title);
mContent.setText(content);
- ComponentContainer.LayoutConfig layoutConfig = new ComponentContainer.LayoutConfig();
- layoutConfig.setMarginLeft(20);
- layoutConfig.setMarginRight(20);
+ ComponentContainer.LayoutConfig layoutConfig = new ComponentContainer.LayoutConfig(ComponentContainer.LayoutConfig.MATCH_PARENT, ComponentContainer.LayoutConfig.MATCH_CONTENT);
customToastLayout.setLayoutConfig(layoutConfig);
- PopupDialog toastDialog = new PopupDialog(context,null);
+
+ PopupDialog toastDialog = new PopupDialog(context, null);
toastDialog.setCustomComponent(customToastLayout);
toastDialog.setAutoClosable(false);
- toastDialog.setSize(ComponentContainer.LayoutConfig.MATCH_PARENT, DirectionalLayout.LayoutConfig.MATCH_CONTENT);
+ toastDialog.setSize(ScreenUtils.getDisplayWidth(context) / 7 * 6, DirectionalLayout.LayoutConfig.MATCH_CONTENT);
toastDialog.setAlignment(LayoutAlignment.CENTER);
toastDialog.show();
+
mBtConfim.setClickedListener(new Component.ClickedListener() {
@Override
public void onClick(Component component) {
toastDialog.hide();
+ mBgComponent.setVisibility(Component.HIDE);
}
});
}
-
}
diff --git a/entry/src/main/java/com/chinasoft/ohos/dialog/TipsDialogUtil.java b/entry/src/main/java/com/chinasoft/ohos/dialog/TipsDialogUtil.java
new file mode 100644
index 0000000..7c1014d
--- /dev/null
+++ b/entry/src/main/java/com/chinasoft/ohos/dialog/TipsDialogUtil.java
@@ -0,0 +1,55 @@
+package com.chinasoft.ohos.dialog;
+
+import com.chinasoft.ohos.ResourceTable;
+import com.zhuangfei.timetable.utils.ScreenUtils;
+import ohos.agp.colors.RgbColor;
+import ohos.agp.components.*;
+import ohos.agp.components.element.ShapeElement;
+import ohos.agp.utils.Color;
+import ohos.agp.utils.LayoutAlignment;
+import ohos.agp.window.dialog.BaseDialog;
+import ohos.agp.window.dialog.PopupDialog;
+import ohos.app.Context;
+
+/**
+ * ToastUtil
+ *
+ * @since 2021-03-29
+ */
+public class TipsDialogUtil {
+ private PopupDialog toastDialog;
+ Context context;
+
+
+ public TipsDialogUtil(Context context) {
+ this.context = context;
+ toastDialog = new PopupDialog(context, null);
+ }
+
+ /**
+ *
+ * @param context
+ * @param title
+ * @param content
+ */
+ public void show(Context context, String title, String content) {
+ ComponentContainer customToastLayout = (ComponentContainer) LayoutScatter.getInstance(context).parse(ResourceTable.Layout_tips_dialog_layout, null, false);
+ Text mTitle = (Text) customToastLayout.findComponentById(ResourceTable.Id_tv_title);
+ Text mContent = (Text) customToastLayout.findComponentById(ResourceTable.Id_tv_content);
+
+ mTitle.setText(title);
+ mContent.setText(content);
+
+
+ toastDialog.setCustomComponent(customToastLayout);
+ toastDialog.setAutoClosable(false);
+ toastDialog.setTransparent(true);
+ toastDialog.setSize(ScreenUtils.getDisplayWidth(context) / 7 * 6, DirectionalLayout.LayoutConfig.MATCH_CONTENT);
+ toastDialog.setAlignment(LayoutAlignment.CENTER);
+ toastDialog.show();
+ }
+
+ public void dismiss() {
+ toastDialog.hide();
+ }
+}
diff --git a/entry/src/main/java/com/chinasoft/ohos/dialog/ToastUtil.java b/entry/src/main/java/com/chinasoft/ohos/dialog/ToastUtil.java
index 68c0868..619e6d9 100644
--- a/entry/src/main/java/com/chinasoft/ohos/dialog/ToastUtil.java
+++ b/entry/src/main/java/com/chinasoft/ohos/dialog/ToastUtil.java
@@ -1,6 +1,7 @@
package com.chinasoft.ohos.dialog;
import com.chinasoft.ohos.ResourceTable;
+import com.zhuangfei.timetable.utils.ScreenUtils;
import ohos.agp.components.*;
import ohos.agp.utils.LayoutAlignment;
import ohos.agp.window.dialog.ToastDialog;
@@ -78,12 +79,17 @@ public class ToastUtil {
Text textView = (Text) customToastLayout.findComponentById(ResourceTable.Id_toast_text);
textView.setText(text);
+
+ DirectionalLayout.LayoutConfig layoutConfig = new DirectionalLayout.LayoutConfig(DirectionalLayout.LayoutConfig.MATCH_PARENT, DirectionalLayout.LayoutConfig.MATCH_CONTENT);
+ layoutConfig.setMarginBottom(50);
+ customToastLayout.setLayoutConfig(layoutConfig);
+
ToastDialog toastDialog = new ToastDialog(context);
toastDialog.setComponent(customToastLayout);
toastDialog.setCornerRadius(radius);
- toastDialog.setDuration(2000);
+ toastDialog.setDuration(5000);
toastDialog.setSize(ComponentContainer.LayoutConfig.MATCH_CONTENT, DirectionalLayout.LayoutConfig.MATCH_CONTENT);
- toastDialog.setAlignment(LayoutAlignment.BOTTOM);
+ toastDialog.setAlignment(LayoutAlignment.BOTTOM|LayoutAlignment.HORIZONTAL_CENTER);
toastDialog.show();
}
diff --git a/entry/src/main/java/com/chinasoft/ohos/dialog/ToastViewDialog.java b/entry/src/main/java/com/chinasoft/ohos/dialog/ToastViewDialog.java
index 2f99210..72a68f1 100644
--- a/entry/src/main/java/com/chinasoft/ohos/dialog/ToastViewDialog.java
+++ b/entry/src/main/java/com/chinasoft/ohos/dialog/ToastViewDialog.java
@@ -1,17 +1,16 @@
/*
- * Copyright (C) 2021 The Chinese Software International Co., Ltd.
+ * 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.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
package com.chinasoft.ohos.dialog;
diff --git a/entry/src/main/java/com/chinasoft/ohos/slice/AttrSlice.java b/entry/src/main/java/com/chinasoft/ohos/slice/AttrSlice.java
index fbe7302..a0f945b 100644
--- a/entry/src/main/java/com/chinasoft/ohos/slice/AttrSlice.java
+++ b/entry/src/main/java/com/chinasoft/ohos/slice/AttrSlice.java
@@ -1,17 +1,16 @@
/*
- * Copyright (C) 2021 The Chinese Software International Co., Ltd.
+ * 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.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
package com.chinasoft.ohos.slice;
diff --git a/entry/src/main/java/com/chinasoft/ohos/slice/BaseFuncSlice.java b/entry/src/main/java/com/chinasoft/ohos/slice/BaseFuncSlice.java
index f10a4e5..8b17bc2 100644
--- a/entry/src/main/java/com/chinasoft/ohos/slice/BaseFuncSlice.java
+++ b/entry/src/main/java/com/chinasoft/ohos/slice/BaseFuncSlice.java
@@ -1,22 +1,23 @@
/*
- * Copyright (C) 2021 The Chinese Software International Co., Ltd.
+ * 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.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
package com.chinasoft.ohos.slice;
import com.chinasoft.ohos.ResourceTable;
import com.chinasoft.ohos.base.BaseAbilitySlice;
+import com.chinasoft.ohos.bean.WeekChooseBean;
+import com.chinasoft.ohos.dialog.ChooseWeekDialog;
import com.chinasoft.ohos.dialog.ToastViewDialog;
import com.chinasoft.ohos.model.MySubject;
import com.chinasoft.ohos.model.SubjectRepertory;
@@ -33,9 +34,11 @@ import ohos.agp.components.Component;
import ohos.agp.components.DirectionalLayout;
import ohos.agp.components.Text;
import ohos.agp.utils.Color;
+import ohos.multimodalinput.event.KeyEvent;
import ohos.utils.IntentConstants;
import java.security.SecureRandom;
+import java.util.ArrayList;
import java.util.List;
/**
@@ -52,12 +55,14 @@ public class BaseFuncSlice extends BaseAbilitySlice implements Component.Clicked
DirectionalLayout layout;
Text titleTextView;
List mySubjects;
+ Component mBgComponent;
/**
* 记录切换的周次,不一定是当前周
*/
int target = -1;
+
@Override
public void onStart(Intent intent) {
super.onStart(intent);
@@ -71,6 +76,8 @@ public class BaseFuncSlice extends BaseAbilitySlice implements Component.Clicked
titleTextView = (Text) findComponentById(ResourceTable.Id_id_title);
layout = (DirectionalLayout) findComponentById(ResourceTable.Id_id_layout);
MaterialSpinner spinner = (MaterialSpinner) findComponentById(ResourceTable.Id_id_more);
+ mBgComponent = findComponentById(ResourceTable.Id_bg_component);
+
mySubjects = SubjectRepertory.loadDefaultSubjects2();
mySubjects.addAll(SubjectRepertory.loadDefaultSubjects());
@@ -92,7 +99,6 @@ public class BaseFuncSlice extends BaseAbilitySlice implements Component.Clicked
spinner.setShowFalse();
}
});
-
initTimetableView();
}
@@ -187,33 +193,42 @@ public class BaseFuncSlice extends BaseAbilitySlice implements Component.Clicked
* 对话框修改当前周次
*/
protected void onWeekLeftLayoutClicked() {
- final String items[] = new String[20];
+ mBgComponent.setVisibility(Component.VISIBLE);
+ final ArrayList items = new ArrayList<>();
int itemCount = mWeekView.itemCount();
for (int i = 0; i < itemCount; i++) {
- items[i] = "第" + (i + 1) + "周";
+ WeekChooseBean bean = new WeekChooseBean();
+ bean.setWeek("第" + (i + 1) + "周");
+ if (i == 0) {
+ bean.setSelect(true);
+ }else {
+ bean.setSelect(false);
+ }
+ items.add(bean);
}
target = -1;
-// AlertDialog.Builder builder = new AlertDialog.Builder(this);
-// builder.setTitle("设置当前周");
-// builder.setSingleChoiceItems(items, mTimetableView.curWeek() - 1,
-// new DialogInterface.OnClickListener() {
-// @Override
-// public void onClick(DialogInterface dialogInterface, int i) {
-// target = i;
-// }
-// });
-// builder.setPositiveButton("设置为当前周", new DialogInterface.OnClickListener() {
-// @Override
-// public void onClick(DialogInterface dialog, int which) {
-// if (target != -1) {
-// mWeekView.curWeek(target + 1).updateView();
-// mTimetableView.changeWeekForce(target + 1);
-// }
-// }
-// });
-// builder.setNegativeButton("取消", null);
-// builder.create().show();
+ ChooseWeekDialog chooseWeekDialog = new ChooseWeekDialog(this,mTimetableView.curWeek() - 1);
+ chooseWeekDialog.setTitle("设置当前周");
+ chooseWeekDialog.setData(items);
+ chooseWeekDialog.setmConfimClickListen(new ChooseWeekDialog.ConfimClickListen() {
+ @Override
+ public void onConfimClick(int index) {
+ target = index;
+ if (target != -1) {
+ mWeekView.curWeek(target + 1).updateView();
+ mTimetableView.changeWeekForce(target + 1);
+ mBgComponent.setVisibility(Component.HIDE);
+ }
+ }
+ });
+ chooseWeekDialog.setCancleButton(new ChooseWeekDialog.CancleClickListen() {
+ @Override
+ public void onCancleClick() {
+ mBgComponent.setVisibility(Component.HIDE);
+ }
+ });
+ chooseWeekDialog.show();
}
/**
@@ -393,6 +408,7 @@ public class BaseFuncSlice extends BaseAbilitySlice implements Component.Clicked
* 显示WeekView
*/
protected void showWeekView() {
+ mTimetableView.setShowWeekView(true);
mWeekView.isShow(true);
}
@@ -400,6 +416,7 @@ public class BaseFuncSlice extends BaseAbilitySlice implements Component.Clicked
* 隐藏WeekView
*/
protected void hideWeekView() {
+ mTimetableView.setShowWeekView(false);
mWeekView.isShow(false);
}
diff --git a/entry/src/main/java/com/chinasoft/ohos/slice/ColorPoolSlice.java b/entry/src/main/java/com/chinasoft/ohos/slice/ColorPoolSlice.java
index 985a947..d31c7f3 100644
--- a/entry/src/main/java/com/chinasoft/ohos/slice/ColorPoolSlice.java
+++ b/entry/src/main/java/com/chinasoft/ohos/slice/ColorPoolSlice.java
@@ -1,17 +1,16 @@
/*
- * Copyright (C) 2021 The Chinese Software International Co., Ltd.
+ * 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.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
package com.chinasoft.ohos.slice;
@@ -95,28 +94,6 @@ public class ColorPoolSlice extends BaseAbilitySlice {
private static final String[] SPIN_MUNE = {"指定三种颜色", "默认颜色池", "扩充颜色池", "指定课程颜色"};
- /**
- * 显示弹出菜单
- */
- public void showPopmenu() {
- MaterialSpinner spinner = (MaterialSpinner) findComponentById(ResourceTable.Id_id_more);
- spinner.setOnItemSelectedListener(new MaterialSpinner.OnItemSelectedListener() {
- @Override
- public void onItemSelected(MaterialSpinner view, int position, long id, String item) {
- selectLayout(position);
- spinner.setShowFalse();
- }
- });
- spinner.setItems(SPIN_MUNE);
- spinner.setOnNothingSelectedListener(new MaterialSpinner.OnNothingSelectedListener() {
-
- @Override
- public void onNothingSelected(MaterialSpinner spinner) {
- spinner.setShowFalse();
- }
- });
- }
-
private void selectLayout(int position) {
switch (position) {
case 0:
diff --git a/entry/src/main/java/com/chinasoft/ohos/slice/CustomWidthSlice.java b/entry/src/main/java/com/chinasoft/ohos/slice/CustomWidthSlice.java
index 6c97786..38f94ce 100644
--- a/entry/src/main/java/com/chinasoft/ohos/slice/CustomWidthSlice.java
+++ b/entry/src/main/java/com/chinasoft/ohos/slice/CustomWidthSlice.java
@@ -1,17 +1,16 @@
/*
- * Copyright (C) 2021 The Chinese Software International Co., Ltd.
+ * 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.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
package com.chinasoft.ohos.slice;
diff --git a/entry/src/main/java/com/chinasoft/ohos/slice/DateDelaySlice.java b/entry/src/main/java/com/chinasoft/ohos/slice/DateDelaySlice.java
index c6d418b..06ea5ae 100644
--- a/entry/src/main/java/com/chinasoft/ohos/slice/DateDelaySlice.java
+++ b/entry/src/main/java/com/chinasoft/ohos/slice/DateDelaySlice.java
@@ -1,17 +1,16 @@
/*
- * Copyright (C) 2021 The Chinese Software International Co., Ltd.
+ * 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.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
package com.chinasoft.ohos.slice;
@@ -20,6 +19,7 @@ import com.chinasoft.ohos.adapter.OnDateDelayAdapter;
import com.chinasoft.ohos.base.BaseAbilitySlice;
import com.chinasoft.ohos.model.MySubject;
import com.chinasoft.ohos.model.SubjectRepertory;
+import com.chinasoft.ohos.spinner.MaterialSpinner;
import com.zhuangfei.timetable.TimetableView;
import com.zhuangfei.timetable.listener.ISchedule;
import ohos.aafwk.ability.AbilitySlice;
@@ -50,7 +50,8 @@ public class DateDelaySlice extends BaseAbilitySlice {
mySubjects = SubjectRepertory.loadDefaultSubjects();
titleTextView = (Text) findComponentById(ResourceTable.Id_id_title);
mTimetableView = (TimetableView) findComponentById(ResourceTable.Id_id_timetableView);
-
+ MaterialSpinner spinner = (MaterialSpinner) findComponentById(ResourceTable.Id_id_more);
+ spinner.setShowFalse(true);
initTimetableView();
data();
}
diff --git a/entry/src/main/java/com/chinasoft/ohos/slice/DateSlice.java b/entry/src/main/java/com/chinasoft/ohos/slice/DateSlice.java
index 20153e4..07c36ba 100644
--- a/entry/src/main/java/com/chinasoft/ohos/slice/DateSlice.java
+++ b/entry/src/main/java/com/chinasoft/ohos/slice/DateSlice.java
@@ -1,17 +1,16 @@
/*
- * Copyright (C) 2021 The Chinese Software International Co., Ltd.
+ * 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.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
package com.chinasoft.ohos.slice;
diff --git a/entry/src/main/java/com/chinasoft/ohos/slice/ElasticSlice.java b/entry/src/main/java/com/chinasoft/ohos/slice/ElasticSlice.java
index d0f38cd..e2f59ef 100644
--- a/entry/src/main/java/com/chinasoft/ohos/slice/ElasticSlice.java
+++ b/entry/src/main/java/com/chinasoft/ohos/slice/ElasticSlice.java
@@ -1,17 +1,16 @@
/*
- * Copyright (C) 2021 The Chinese Software International Co., Ltd.
+ * 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.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
package com.chinasoft.ohos.slice;
diff --git a/entry/src/main/java/com/chinasoft/ohos/slice/ExtrasSlice.java b/entry/src/main/java/com/chinasoft/ohos/slice/ExtrasSlice.java
index 7f0a3c2..9583544 100644
--- a/entry/src/main/java/com/chinasoft/ohos/slice/ExtrasSlice.java
+++ b/entry/src/main/java/com/chinasoft/ohos/slice/ExtrasSlice.java
@@ -1,17 +1,16 @@
/*
- * Copyright (C) 2021 The Chinese Software International Co., Ltd.
+ * 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.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
package com.chinasoft.ohos.slice;
@@ -20,6 +19,7 @@ import com.chinasoft.ohos.base.BaseAbilitySlice;
import com.chinasoft.ohos.dialog.ToastViewDialog;
import com.chinasoft.ohos.model.MySubject;
import com.chinasoft.ohos.model.SubjectRepertory;
+import com.chinasoft.ohos.spinner.MaterialSpinner;
import com.zhuangfei.timetable.TimetableView;
import com.zhuangfei.timetable.listener.ISchedule;
import com.zhuangfei.timetable.model.Schedule;
@@ -42,12 +42,17 @@ public class ExtrasSlice extends BaseAbilitySlice {
public void onStart(Intent intent) {
super.onStart(intent);
super.setUIContent(ResourceTable.Layout_ability_extras);
+
mySubjects = SubjectRepertory.loadDefaultSubjects();
+
initViews();
}
private void initViews() {
mTimetableView = (TimetableView) findComponentById(ResourceTable.Id_id_timetableView);
+ MaterialSpinner spinner = (MaterialSpinner) findComponentById(ResourceTable.Id_id_more);
+
+ spinner.setShowFalse(true);
mTimetableView.source(mySubjects)
.curWeek(1)
diff --git a/entry/src/main/java/com/chinasoft/ohos/slice/FlaglayoutSlice.java b/entry/src/main/java/com/chinasoft/ohos/slice/FlaglayoutSlice.java
index a55a70f..a53efe9 100644
--- a/entry/src/main/java/com/chinasoft/ohos/slice/FlaglayoutSlice.java
+++ b/entry/src/main/java/com/chinasoft/ohos/slice/FlaglayoutSlice.java
@@ -1,17 +1,16 @@
/*
- * Copyright (C) 2021 The Chinese Software International Co., Ltd.
+ * 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.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
package com.chinasoft.ohos.slice;
@@ -48,7 +47,7 @@ public class FlaglayoutSlice extends BaseAbilitySlice {
showPopmenu();
}
- private static final String[] SPIN_MUNE = {"点击空白格子试试","修改旗标布局背景","重置旗标布局背景","取消旗标布局","恢复旗标布局"};
+ private static final String[] SPIN_MUNE = {"点击空白格子试试~","修改旗标布局背景","重置旗标布局背景","取消旗标布局","恢复旗标布局"};
public void showPopmenu() {
MaterialSpinner spinner = (MaterialSpinner) findComponentById(ResourceTable.Id_id_more);
diff --git a/entry/src/main/java/com/chinasoft/ohos/slice/ItemStyleSlice.java b/entry/src/main/java/com/chinasoft/ohos/slice/ItemStyleSlice.java
index e13b57c..7cffddd 100644
--- a/entry/src/main/java/com/chinasoft/ohos/slice/ItemStyleSlice.java
+++ b/entry/src/main/java/com/chinasoft/ohos/slice/ItemStyleSlice.java
@@ -1,17 +1,16 @@
/*
- * Copyright (C) 2021 The Chinese Software International Co., Ltd.
+ * 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.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
package com.chinasoft.ohos.slice;
@@ -147,7 +146,7 @@ public class ItemStyleSlice extends BaseAbilitySlice {
setCorner(0, 10, 0, 0);
break;
case 7:
- setNonThisWeekBgcolor(new RgbColor(255, 255, 0));
+ setNonThisWeekBgcolor(new RgbColor(255,255,0));
break;
case 8:
modifyOverlayStyle();
diff --git a/entry/src/main/java/com/chinasoft/ohos/slice/LocalConfigSlice.java b/entry/src/main/java/com/chinasoft/ohos/slice/LocalConfigSlice.java
index aae76cd..0480988 100644
--- a/entry/src/main/java/com/chinasoft/ohos/slice/LocalConfigSlice.java
+++ b/entry/src/main/java/com/chinasoft/ohos/slice/LocalConfigSlice.java
@@ -1,17 +1,16 @@
/*
- * Copyright (C) 2021 The Chinese Software International Co., Ltd.
+ * 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.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
package com.chinasoft.ohos.slice;
@@ -25,10 +24,9 @@ import com.chinasoft.ohos.model.SubjectRepertory;
import com.chinasoft.ohos.spinner.MaterialSpinner;
import com.zhuangfei.timetable.TimetableView;
import com.zhuangfei.timetable.model.ScheduleConfig;
-import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
+import ohos.agp.components.Component;
import ohos.agp.components.Text;
-import ohos.agp.window.dialog.CommonDialog;
import java.util.List;
import java.util.Set;
@@ -43,6 +41,8 @@ public class LocalConfigSlice extends BaseAbilitySlice {
TimetableView timetableView;
MaterialSpinner moreButton;
Text titleTextView;
+ private Component mBgComponent;
+
List mySubjects;
int target = -1;
boolean initFinish = false;
@@ -52,6 +52,7 @@ public class LocalConfigSlice extends BaseAbilitySlice {
private static final String[] SPIN_MUNE = {"加载本地配置", "清除本地配置", "导出配置至文本", "加载配置文本"};
+
@Override
public void onStart(Intent intent) {
super.onStart(intent);
@@ -63,6 +64,7 @@ public class LocalConfigSlice extends BaseAbilitySlice {
timetableView = (TimetableView) findComponentById(ResourceTable.Id_id_timetableView);
moreButton = (MaterialSpinner) findComponentById(ResourceTable.Id_id_more);
titleTextView = (Text) findComponentById(ResourceTable.Id_id_title);
+ mBgComponent = findComponentById(ResourceTable.Id_bg_component);
mySubjects = SubjectRepertory.loadDefaultSubjects2();
mySubjects.addAll(SubjectRepertory.loadDefaultSubjects());
@@ -162,7 +164,9 @@ public class LocalConfigSlice extends BaseAbilitySlice {
for (String s : set){
content += s + "\n";
}
- DialogUtil.show(this, "配置导出", content);
+ DialogUtil.show(this, "配置导出", content,mBgComponent);
+
+
}
/**
@@ -170,7 +174,7 @@ public class LocalConfigSlice extends BaseAbilitySlice {
*/
private void loadLocalConfigSet() {
if (configSet == null) {
- DialogUtil.show(this, "配置导出", "还没有导出,先导出再来试试吧");
+ DialogUtil.show(this, "配置导入", "还没有导出,先导出再来试试吧", mBgComponent);
} else {
mScheduleConfig.load(configSet);
ToastViewDialog.toast(this, "配置已生效");
diff --git a/entry/src/main/java/com/chinasoft/ohos/slice/MainAbilitySlice.java b/entry/src/main/java/com/chinasoft/ohos/slice/MainAbilitySlice.java
index 1d50a9f..b767d6f 100644
--- a/entry/src/main/java/com/chinasoft/ohos/slice/MainAbilitySlice.java
+++ b/entry/src/main/java/com/chinasoft/ohos/slice/MainAbilitySlice.java
@@ -1,17 +1,16 @@
/*
- * Copyright (C) 2021 The Chinese Software International Co., Ltd.
+ * 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.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
package com.chinasoft.ohos.slice;
diff --git a/entry/src/main/java/com/chinasoft/ohos/slice/NonViewSlice.java b/entry/src/main/java/com/chinasoft/ohos/slice/NonViewSlice.java
index 5a3be4b..9857fef 100644
--- a/entry/src/main/java/com/chinasoft/ohos/slice/NonViewSlice.java
+++ b/entry/src/main/java/com/chinasoft/ohos/slice/NonViewSlice.java
@@ -1,17 +1,16 @@
/*
- * Copyright (C) 2021 The Chinese Software International Co., Ltd.
+ * 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.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
package com.chinasoft.ohos.slice;
diff --git a/entry/src/main/java/com/chinasoft/ohos/slice/SimpleSlice.java b/entry/src/main/java/com/chinasoft/ohos/slice/SimpleSlice.java
index 2066ab0..e38e018 100644
--- a/entry/src/main/java/com/chinasoft/ohos/slice/SimpleSlice.java
+++ b/entry/src/main/java/com/chinasoft/ohos/slice/SimpleSlice.java
@@ -1,32 +1,34 @@
/*
- * Copyright (C) 2021 The Chinese Software International Co., Ltd.
+ * 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.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
package com.chinasoft.ohos.slice;
import com.chinasoft.ohos.ResourceTable;
import com.chinasoft.ohos.base.BaseAbilitySlice;
+import com.chinasoft.ohos.bean.WeekChooseBean;
+import com.chinasoft.ohos.dialog.ChooseWeekDialog;
+import com.chinasoft.ohos.dialog.TipsDialogUtil;
import com.chinasoft.ohos.dialog.ToastViewDialog;
import com.chinasoft.ohos.model.MySubject;
import com.chinasoft.ohos.model.SubjectRepertory;
+import com.chinasoft.ohos.spinner.MaterialSpinner;
import com.zhuangfei.timetable.TimetableView;
import com.zhuangfei.timetable.listener.ISchedule;
import com.zhuangfei.timetable.listener.IWeekView;
import com.zhuangfei.timetable.listener.OnItemBuildAdapter;
import com.zhuangfei.timetable.model.Schedule;
import com.zhuangfei.timetable.view.WeekView;
-import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.agp.components.*;
import ohos.agp.components.element.ShapeElement;
@@ -62,11 +64,16 @@ public class SimpleSlice extends BaseAbilitySlice implements Component.ClickedLi
DirectionalLayout layout;
Text titleTextView;
List mySubjects;
+ private Component mBgComponent;
+
/**
* 记录切换的周次,不一定是当前周
*/
+
int target = -1;
+ private TipsDialogUtil tipsDialogUtil;
+
@Override
public void onStart(Intent intent) {
@@ -78,9 +85,14 @@ public class SimpleSlice extends BaseAbilitySlice implements Component.ClickedLi
private void initViews() {
titleTextView = (Text) findComponentById(ResourceTable.Id_id_title);
layout = (DirectionalLayout) findComponentById(ResourceTable.Id_id_layout);
+ MaterialSpinner spinner = (MaterialSpinner) findComponentById(ResourceTable.Id_id_more);
+ mBgComponent = findComponentById(ResourceTable.Id_bg_component);
+
layout.setClickedListener(this);
- initTimetableView();
+ spinner.setShowFalse(true);
+
+ initTimetableView();
requestData();
}
@@ -111,7 +123,10 @@ public class SimpleSlice extends BaseAbilitySlice implements Component.ClickedLi
SimpleSlice.this.getUITaskDispatcher().asyncDispatch(() -> {
mWeekView.source(mySubjects).showView();
mTimetableView.source(mySubjects).showView();
+ tipsDialogUtil.dismiss();
+ mBgComponent.setVisibility(Component.HIDE);
});
+
}
};
@@ -123,6 +138,12 @@ public class SimpleSlice extends BaseAbilitySlice implements Component.ClickedLi
@Override
public void run() {
try {
+ SimpleSlice.this.getUITaskDispatcher().asyncDispatch(() -> {
+ mBgComponent.setVisibility(Component.VISIBLE);
+ tipsDialogUtil = new TipsDialogUtil(SimpleSlice.this);
+ tipsDialogUtil.show(SimpleSlice.this, "Tips", "模拟请求网络中..");
+ });
+
Thread.sleep(2000);
} catch (InterruptedException e) {
String errorString = e.toString();
@@ -257,12 +278,41 @@ public class SimpleSlice extends BaseAbilitySlice implements Component.ClickedLi
* 对话框修改当前周次
*/
protected void onWeekLeftLayoutClicked() {
- final String items[] = new String[20];
+ mBgComponent.setVisibility(Component.VISIBLE);
+ final ArrayList items = new ArrayList();
int itemCount = mWeekView.itemCount();
for (int i = 0; i < itemCount; i++) {
- items[i] = "第" + (i + 1) + "周";
+ WeekChooseBean bean = new WeekChooseBean();
+ bean.setWeek("第" + (i + 1) + "周");
+ if (i == 0) {
+ bean.setSelect(true);
+ }else {
+ bean.setSelect(false);
+ }
+ items.add(bean);
}
- target = -1;
+
+ ChooseWeekDialog chooseWeekDialog = new ChooseWeekDialog(this,mTimetableView.curWeek() - 1);
+ chooseWeekDialog.setTitle("设置当前周");
+ chooseWeekDialog.setData(items);
+ chooseWeekDialog.setmConfimClickListen(new ChooseWeekDialog.ConfimClickListen() {
+ @Override
+ public void onConfimClick(int index) {
+ target = index;
+ if (target != -1) {
+ mWeekView.curWeek(target + 1).updateView();
+ mTimetableView.changeWeekForce(target + 1);
+ mBgComponent.setVisibility(Component.HIDE);
+ }
+ }
+ });
+ chooseWeekDialog.setCancleButton(new ChooseWeekDialog.CancleClickListen() {
+ @Override
+ public void onCancleClick() {
+ mBgComponent.setVisibility(Component.HIDE);
+ }
+ });
+ chooseWeekDialog.show();
}
/**
@@ -283,7 +333,8 @@ public class SimpleSlice extends BaseAbilitySlice implements Component.ClickedLi
*/
public void hideWeekView() {
mWeekView.isShow(false);
- titleTextView.setTextColor(Color.BLUE);
+ mTimetableView.setShowWeekView(false);
+ titleTextView.setTextColor(new Color(Color.rgb(19,176,241)));
int cur = mTimetableView.curWeek();
mTimetableView.onDateBuildListener()
.onUpdateDate(cur, cur);
@@ -292,6 +343,7 @@ public class SimpleSlice extends BaseAbilitySlice implements Component.ClickedLi
public void showWeekView() {
mWeekView.isShow(true);
+ mTimetableView.setShowWeekView(true);
titleTextView.setTextColor(Color.RED);
}
diff --git a/entry/src/main/java/com/chinasoft/ohos/slice/SlideSlice.java b/entry/src/main/java/com/chinasoft/ohos/slice/SlideSlice.java
index a4f5a6a..18dec90 100644
--- a/entry/src/main/java/com/chinasoft/ohos/slice/SlideSlice.java
+++ b/entry/src/main/java/com/chinasoft/ohos/slice/SlideSlice.java
@@ -1,17 +1,16 @@
/*
- * Copyright (C) 2021 The Chinese Software International Co., Ltd.
+ * 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.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
package com.chinasoft.ohos.slice;
diff --git a/entry/src/main/java/com/chinasoft/ohos/spinner/MaterialSpinner.java b/entry/src/main/java/com/chinasoft/ohos/spinner/MaterialSpinner.java
index 8a6d7e2..24f058d 100644
--- a/entry/src/main/java/com/chinasoft/ohos/spinner/MaterialSpinner.java
+++ b/entry/src/main/java/com/chinasoft/ohos/spinner/MaterialSpinner.java
@@ -16,19 +16,18 @@
*/
/*
- * Copyright (C) 2021 The Chinese Software International Co., Ltd.
+ * 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.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
package com.chinasoft.ohos.spinner;
@@ -163,7 +162,7 @@ public class MaterialSpinner extends Text implements Component.TouchEventListene
hideArrow = com.chinasoft.ohos.spinner.TypedAttrUtils.getBoolean(attrs, "ms_hide_arrow", false);
hintText = com.chinasoft.ohos.spinner.TypedAttrUtils.getString(attrs, "ms_hint", "");
- popupWindowMaxHeight = com.chinasoft.ohos.spinner.TypedAttrUtils.getDimensionPixelSize(attrs, "ms_dropdown_max_height", 1080);
+ popupWindowMaxHeight = com.chinasoft.ohos.spinner.TypedAttrUtils.getDimensionPixelSize(attrs, "ms_dropdown_max_height", 1680);
popupWindowHeight = com.chinasoft.ohos.spinner.TypedAttrUtils.getLayoutDimension(attrs, "ms_dropdown_height",
ComponentContainer.LayoutConfig.MATCH_CONTENT);
paddingTop = com.chinasoft.ohos.spinner.TypedAttrUtils.getDimensionPixelSize(attrs, "ms_padding_top", defaultPaddingTop);
@@ -221,23 +220,19 @@ public class MaterialSpinner extends Text implements Component.TouchEventListene
}
private void initPopupWindow(Context context) {
-
- listView = new ListContainer(context);
- ComponentContainer.LayoutConfig layoutConfig =
- new ComponentContainer.LayoutConfig(ComponentContainer.LayoutConfig.MATCH_PARENT, ComponentContainer.LayoutConfig.MATCH_PARENT);
+ ComponentContainer customToastLayout = (ComponentContainer) LayoutScatter.getInstance(context).parse(ResourceTable.Layout_list_spinner, null, false);
+ listView = (ListContainer) customToastLayout.findComponentById(ResourceTable.Id_lv_spinner);
+ DirectionalLayout.LayoutConfig layoutConfig =
+ new DirectionalLayout.LayoutConfig(ComponentContainer.LayoutConfig.MATCH_PARENT, ComponentContainer.LayoutConfig.MATCH_CONTENT);
listView.setLayoutConfig(layoutConfig);
listView.setId(getId());
listView.setLayoutManager(new DirectionalLayoutManager());
listView.setScrollbarColor(Color.DKGRAY);
- listView.setScrollbarThickness(20);
+ listView.setScrollbarThickness(0);
listView.setScrollbarFadingEnabled(true);
listView.enableScrollBar(AXIS_Y, true);
listView.setScrollbarRoundRect(true);
listView.setScrollbarRadius(10);
- ShapeElement background = new ShapeElement(this.getContext(), ResourceTable.Graphic_ms__drawable);
- background.setCornerRadius(20);
- background.setStroke(3, RgbColor.fromArgbInt(Color.getIntColor("#9496A3")));
- listView.setBackground(background);
listView.setItemProvider(mAdapter);
listView.setItemClickedListener(new ListContainer.ItemClickedListener() {
@@ -256,7 +251,7 @@ public class MaterialSpinner extends Text implements Component.TouchEventListene
});
popupWindow = new PopupDialog(context, null);
- popupWindow.setCustomComponent(listView);
+ popupWindow.setCustomComponent(customToastLayout);
HiLog.info(LABEL, "backgroundColor = " + (backgroundColor != Color.WHITE.getValue()));
if (backgroundColor != Color.WHITE.getValue()) { // default color is white
ShapeElement element = new ShapeElement();
@@ -320,6 +315,10 @@ public class MaterialSpinner extends Text implements Component.TouchEventListene
isShow = false;
}
+ public void setShowFalse(Boolean isShows) {
+ isShow = isShows;
+ }
+
@Override
public void setTextSize(int size) {
HiLog.info(LABEL, "setTextSize adapter = " + adapter + ", textSize = " + textSize);
@@ -452,7 +451,8 @@ public class MaterialSpinner extends Text implements Component.TouchEventListene
setText("");
}
if (shouldResetPopupHeight) {
- popupWindow.setSize(getWidth(), calculatePopupWindowHeight());
+ popupWindow.setSize(getWidth(), adapterInternal.getCount() * ScreenUtils.pxToFp(mContext,36) + 10);
+ listView.setComponentSize(getWidth(), adapterInternal.getCount() * ScreenUtils.pxToFp(mContext,36) + 10);
}
}
@@ -482,10 +482,13 @@ public class MaterialSpinner extends Text implements Component.TouchEventListene
}
nothingSelected = true;
initPopupWindow(mContext);
- popupWindow.setSize(ScreenUtils.getDisplayWidth(mContext) / 5 * 2, calculatePopupWindowHeight());
+
+ popupWindow.setSize(ScreenUtils.getDisplayWidth(mContext) / 5 * 2, adapter.getCount() * ScreenUtils.pxToFp(mContext,36) + 10);
+ listView.setComponentSize(ScreenUtils.getDisplayWidth(mContext) / 5 * 2, adapter.getCount() * ScreenUtils.pxToFp(mContext,36) + 10);
+ // popupWindow.setSize(ScreenUtils.getDisplayWidth(mContext) / 5 * 2, calculatePopupWindowHeight());
int[] locationOnScreen = this.getLocationOnScreen();
HiLog.info(LABEL, "locationOnScreen[1] = " + locationOnScreen[1] + ", " + spinnerWidth + ",locationOnScreen[1]" + locationOnScreen[1]);
- popupWindow.showOnCertainPosition(LayoutAlignment.LEFT | LayoutAlignment.TOP, locationOnScreen[0] + 60, locationOnScreen[1] + this.getComponentSize().getSizeYToInt());
+ popupWindow.showOnCertainPosition(LayoutAlignment.LEFT | LayoutAlignment.TOP, locationOnScreen[0] + 60, locationOnScreen[1] + this.getComponentSize().getSizeYToInt() + 10);
isShow = true;
}
}
diff --git a/entry/src/main/java/com/chinasoft/ohos/spinner/MaterialSpinnerAdapter.java b/entry/src/main/java/com/chinasoft/ohos/spinner/MaterialSpinnerAdapter.java
index 59522d1..bd675d2 100644
--- a/entry/src/main/java/com/chinasoft/ohos/spinner/MaterialSpinnerAdapter.java
+++ b/entry/src/main/java/com/chinasoft/ohos/spinner/MaterialSpinnerAdapter.java
@@ -16,19 +16,18 @@
*/
/*
- * Copyright (C) 2021 The Chinese Software International Co., Ltd.
+ * 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.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
package com.chinasoft.ohos.spinner;
diff --git a/entry/src/main/java/com/chinasoft/ohos/spinner/MaterialSpinnerBaseAdapter.java b/entry/src/main/java/com/chinasoft/ohos/spinner/MaterialSpinnerBaseAdapter.java
index 837c8d5..6691f9f 100644
--- a/entry/src/main/java/com/chinasoft/ohos/spinner/MaterialSpinnerBaseAdapter.java
+++ b/entry/src/main/java/com/chinasoft/ohos/spinner/MaterialSpinnerBaseAdapter.java
@@ -16,19 +16,18 @@
*/
/*
- * Copyright (C) 2021 The Chinese Software International Co., Ltd.
+ * 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.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
package com.chinasoft.ohos.spinner;
diff --git a/entry/src/main/java/com/chinasoft/ohos/spinner/TypedAttrUtils.java b/entry/src/main/java/com/chinasoft/ohos/spinner/TypedAttrUtils.java
index b5f8ba9..c5287e4 100644
--- a/entry/src/main/java/com/chinasoft/ohos/spinner/TypedAttrUtils.java
+++ b/entry/src/main/java/com/chinasoft/ohos/spinner/TypedAttrUtils.java
@@ -16,19 +16,18 @@
*/
/*
- * Copyright (C) 2021 The Chinese Software International Co., Ltd.
+ * 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.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
package com.chinasoft.ohos.spinner;
@@ -46,7 +45,7 @@ import java.util.NoSuchElementException;
*
* @since 2021-03-29
*/
-final class TypedAttrUtils {
+public class TypedAttrUtils {
static final HiLogLabel LOG_LABEL = new HiLogLabel(HiLog.LOG_APP, 0x00201, "TypedAttrUtils");
public static int getIntColor(AttrSet attrs, String attrName, int defValue) {
@@ -85,6 +84,24 @@ final class TypedAttrUtils {
}
}
+ public static float getFloat(AttrSet attrs, String attrName, float defValue) {
+ Attr attr = attrNoSuchElement(attrs, attrName);
+ if (attr == null) {
+ return defValue;
+ } else {
+ return attr.getFloatValue();
+ }
+ }
+
+ public static int getInteger(AttrSet attrs, String attrName, int defValue) {
+ Attr attr = attrNoSuchElement(attrs, attrName);
+ if (attr == null) {
+ return defValue;
+ } else {
+ return attr.getIntegerValue();
+ }
+ }
+
public static int getDimensionPixelSize(AttrSet attrs, String attrName, int defValue) {
Attr attr = attrNoSuchElement(attrs, attrName);
if (attr == null) {
diff --git a/entry/src/main/java/com/chinasoft/ohos/spinner/Utils.java b/entry/src/main/java/com/chinasoft/ohos/spinner/Utils.java
index d5df94a..31ee746 100644
--- a/entry/src/main/java/com/chinasoft/ohos/spinner/Utils.java
+++ b/entry/src/main/java/com/chinasoft/ohos/spinner/Utils.java
@@ -16,19 +16,18 @@
*/
/*
- * Copyright (C) 2021 The Chinese Software International Co., Ltd.
+ * 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.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
package com.chinasoft.ohos.spinner;
diff --git a/entry/src/main/resources/base/element/color.json b/entry/src/main/resources/base/element/color.json
index 73ff154..c28e2ce 100644
--- a/entry/src/main/resources/base/element/color.json
+++ b/entry/src/main/resources/base/element/color.json
@@ -115,7 +115,7 @@
"value":"#FF7A59"
},{
"name": "colorPrimary",
- "value": "#E6000000"
+ "value": "#dc7e2c"
},
{
"name": "colorSecondary",
diff --git a/entry/src/main/resources/base/graphic/background_shape.xml b/entry/src/main/resources/base/graphic/background_shape.xml
index 9aef3ae..ef24b47 100644
--- a/entry/src/main/resources/base/graphic/background_shape.xml
+++ b/entry/src/main/resources/base/graphic/background_shape.xml
@@ -1,5 +1,6 @@
-
+
\ No newline at end of file
diff --git a/entry/src/main/resources/base/graphic/choose_background.xml b/entry/src/main/resources/base/graphic/choose_background.xml
new file mode 100644
index 0000000..559387b
--- /dev/null
+++ b/entry/src/main/resources/base/graphic/choose_background.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/entry/src/main/resources/base/graphic/toast_background_shape.xml b/entry/src/main/resources/base/graphic/toast_background_shape.xml
index b9b535e..39c4272 100644
--- a/entry/src/main/resources/base/graphic/toast_background_shape.xml
+++ b/entry/src/main/resources/base/graphic/toast_background_shape.xml
@@ -4,5 +4,5 @@
+ ohos:color="#BBF0F0F0"/>
\ No newline at end of file
diff --git a/entry/src/main/resources/base/layout/ability_base_func.xml b/entry/src/main/resources/base/layout/ability_base_func.xml
index e2d4ba3..9642ffc 100644
--- a/entry/src/main/resources/base/layout/ability_base_func.xml
+++ b/entry/src/main/resources/base/layout/ability_base_func.xml
@@ -1,24 +1,36 @@
-
+ ohos:height="match_parent">
-
-
-
+ ohos:orientation="vertical">
-
+
+
+
+
-
+
+
+
+
diff --git a/entry/src/main/resources/base/layout/ability_local_config.xml b/entry/src/main/resources/base/layout/ability_local_config.xml
index 2c4619f..f665f6d 100644
--- a/entry/src/main/resources/base/layout/ability_local_config.xml
+++ b/entry/src/main/resources/base/layout/ability_local_config.xml
@@ -1,21 +1,32 @@
-
-
-
-
-
+ ohos:width="match_parent"
+ ohos:orientation="vertical">
+
+
-
+
+
+
+
+
+
diff --git a/entry/src/main/resources/base/layout/ability_main.xml b/entry/src/main/resources/base/layout/ability_main.xml
index 6f2a62e..6b6b4b3 100644
--- a/entry/src/main/resources/base/layout/ability_main.xml
+++ b/entry/src/main/resources/base/layout/ability_main.xml
@@ -12,143 +12,172 @@
+ ohos:bottom_margin="10vp"/>
+ ohos:bottom_margin="10vp"/>
+ ohos:bottom_margin="10vp"/>
+ ohos:bottom_margin="10vp"/>
+ ohos:bottom_margin="10vp"/>
+ ohos:bottom_margin="10vp"/>
+ ohos:bottom_margin="10vp"/>
+ ohos:bottom_margin="10vp"/>
+ ohos:bottom_margin="10vp"/>
+ ohos:bottom_margin="10vp"/>
+ ohos:bottom_margin="10vp"/>
+ ohos:bottom_margin="10vp"/>
+ ohos:bottom_margin="10vp"/>
+ ohos:bottom_margin="10vp"/>
diff --git a/entry/src/main/resources/base/layout/ability_slide.xml b/entry/src/main/resources/base/layout/ability_slide.xml
index dbd2032..42afa67 100644
--- a/entry/src/main/resources/base/layout/ability_slide.xml
+++ b/entry/src/main/resources/base/layout/ability_slide.xml
@@ -7,8 +7,7 @@
+ ohos:height="50vp"/>
+ ohos:orientation="vertical"
+ >
+ ohos:orientation="vertical">
+ ohos:height="match_content"
+ ohos:width="match_parent"
+ ohos:long_click_enabled="false"/>
-
+ ohos:bottom_margin="60vp"
+ ohos:top_margin="10vp"
+ ohos:orientation="horizontal">
+
+
+
+
+
+
diff --git a/entry/src/main/resources/base/layout/dialog_layout.xml b/entry/src/main/resources/base/layout/dialog_layout.xml
index a3f3a1d..14506ad 100644
--- a/entry/src/main/resources/base/layout/dialog_layout.xml
+++ b/entry/src/main/resources/base/layout/dialog_layout.xml
@@ -3,16 +3,13 @@
xmlns:ohos="http://schemas.huawei.com/res/ohos"
ohos:height="match_parent"
ohos:width="match_parent"
- ohos:alignment="center"
ohos:orientation="vertical">
+ ohos:orientation="vertical">
+
+ ohos:text_size="40px"/>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/entry/src/main/resources/base/layout/item_nonview.xml b/entry/src/main/resources/base/layout/item_nonview.xml
index f72a793..c587cee 100644
--- a/entry/src/main/resources/base/layout/item_nonview.xml
+++ b/entry/src/main/resources/base/layout/item_nonview.xml
@@ -1,9 +1,8 @@
+ ohos:height="50fp"
+ ohos:width="match_parent">
-
+ ohos:align_parent_bottom="true"
+ ohos:background_element="$color:colorListDivider"/>
diff --git a/entry/src/main/resources/base/layout/list_spinner.xml b/entry/src/main/resources/base/layout/list_spinner.xml
new file mode 100644
index 0000000..0633565
--- /dev/null
+++ b/entry/src/main/resources/base/layout/list_spinner.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
diff --git a/entry/src/main/resources/base/layout/tips_dialog_layout.xml b/entry/src/main/resources/base/layout/tips_dialog_layout.xml
new file mode 100644
index 0000000..7ded6f1
--- /dev/null
+++ b/entry/src/main/resources/base/layout/tips_dialog_layout.xml
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/entry/src/main/resources/base/layout/toast_dialog_layout.xml b/entry/src/main/resources/base/layout/toast_dialog_layout.xml
index fc2a70a..e993ddc 100644
--- a/entry/src/main/resources/base/layout/toast_dialog_layout.xml
+++ b/entry/src/main/resources/base/layout/toast_dialog_layout.xml
@@ -2,7 +2,7 @@
\ No newline at end of file
diff --git a/entry/src/main/resources/base/media/radio_button_off.png b/entry/src/main/resources/base/media/radio_button_off.png
new file mode 100644
index 0000000000000000000000000000000000000000..30f340b78b84a8a3d7400dec420d12526890ed59
GIT binary patch
literal 1009
zcmV5syTQ3>lvgaMl-TE9K5J)8ytPYr?lPaQzL1q4o@l3idB&+!u044zAfpI_&PluiYr-7@$b>OF`zLR(!0Qvz-fN4Mn
zCo8gr-U6q9UBKgPad(Mw0%#jKz8KJZ9_e!gVK<=nl2f?=EQp*}?N=hH6{t1rE48q4
z0N4Vo^f2Tb@TK69YMX+ml}BC&fcYNsjYLZYum@O}VZe9b8gLFc0ld$UZx2i?c(Q<8
zjt1GHIFth5HZU}$)MvmBN2hJsv;$@U%Yfb~Wj)XM->OOl2F!9P
zEC-owz;a8znw>J^1Q!5`>TUu_L5^bd(K$HgljUJxc7lR}r4d;XqYHrbz`BG2G|;Jl
z-#*snAln4E0E|hx$`*PB(a3f)g)OtacWL-dI0Z_kJ
z|2LDu-_^cW<}AP2GVo~}utuwC0Gb0YfKGDK0!%ytZhapmovrYqng(G#7tA8{e(t;qyb2pVziPI%}>Qzn6sW*fm&@#qZ~z#
z3evm)XkV_cp>Z6Tp0g9BW`8zXNfzcKC_Q}u3n32WYZuU{ImZxw1PrJV01tuwhOLKyxvl`t0Fw;iTTuX13k(zx4L1zc>@c|wz#w27
z1A^}Y!4HDLPlLe+Lcxc^8Y_cd3<*H+%i-WRM1tQEQ#S~DQ&a$g-xe2yT0R(&?K&K>
zrmS-TDF%NuCI~?vj>gR==;QGiLeLi^VhBNBk%=J$eMu^Y5cD;<7(&n&C1VIdUzLp^
z1btaLhES>N^13Roo8nb4JZ`zQor~nvvpiD(rYgfsBr#ai&bN-!w
ze$_<(;%)CaV{jn10iX>GY={PgCoH!%k`{#2JHT`7I)KhG7Ajs6W5-aAcde|{UQ46k
zp-SoWnHF8i1Ql0o0}sz~WigG6Q~-F6%?4r90KU6S0?)Dc1Gq3u2?8FYJZ@gSSsu>9@F0(uw%IGVfqNOaLc{-n<;p}S
zP$B@lQTrY+LW7PnzTnC$m%{KM&nd^=r3Hbo-5Qg(#ML7<0N$v*4UF4E88aTRs`7@o
zLbIUr%J%&rTp!AdaECP}H^-3^3jlS_L-6h}h761qU0I1EENhy&V^;_m4dv_8WpVO^
zSOC-=`_v@*>lEBLMAN9q7Rj2De(SygO1c$NsVpY&D(T5j>^^uw}I?e-tIlbL?*dxT}|r
zuQS~uBLJ{}4q!uosaz)V7epmF#sC#%P2hc;Skp(-mD
zD!7w9fn3pO0jN9n!vt&$7-8H_iq9
zMJ51VCE)ZfB$;n2RBQKXzy91&cOXHuPm0qF3vr?8h@2{yZe*ez3mG%;TG5qf#0EfB
zZyUK*&+)^}!LyCq-;|jpHC00&6%dsh&|vdl!R7f@?!2&SbLbAJZ?V^sz}_wt8E+J;
z@~y@oHZGWeCE
zTRT@LxSihm)L2U6=Xo~-=S^vI-6_3HpmVxEAa5#GYY)W&z$*`b8^pH;{OHA^E8nX#
z(A#XUL=LJLvh+_2tE_GEkTw=M_MZqizw15IT~>ASTQLE!9|z$J0RWyYx-zs7qUfeZ
z?GH2Kw@Yt5K!lGJ#^mz`01gn)?Iw($SXFuXDF6ZpgvNlrcY%7p2f?(*pjWo{YVZ14
z1qa4Ht18zm=`pBFgqqFSGfj;R{gpH;>)U*cSMhdZWpLogq7oss*mG=k;puK?Gk?XZ
z)_$msz9&H{?3GJbgXjkV9gkS9JS$9Z?Onigh93lYQ}A*PwcMW*Yps$sm@qUoM~qM<^p
z-2v_C4uAHa!2yR@1(CT@nATO&03d*?qe^3%f=DAL2HvilGBKCLM(y2TTpCdL|EnZM
zc)}W!YCI?OS=yp#dCkR4{?4@3Ayow;7Mr3^8cW*|&ayS8>lA0!8f&|Op*e~Z
z&>5bOX2uS2md(*lEYJ=^Mb+uj9D7k~A{sBTho>TYg9{Zg4Mh=9DY$YhO7Se-n~hI4
zG?fT|&Q8z{N2!i64dM1UP17_$v`1uSa7S1txWg~;uvB6IIw17#kkqjNWEhs}(6q?P)Le|G4xC@|)Xp1FdF
zMhI9J?DO>imT)L4xPDOpwB5lpJQebJGaZ#pFbtLIE)X|R_4TmyLXi4)Tt2u{I-@n8
z$K3dQ+_@m#hEtPcPXheYll~7AK?~Z$&c0ahgVjX&`e3_VXR&H$1DFt?i6P-nq#d@7
z();
reset();
}
diff --git a/timetable/src/main/java/com/zhuangfei/timetable/operater/SimpleOperater.java b/timetable/src/main/java/com/zhuangfei/timetable/operater/SimpleOperater.java
index b0d94cf..a0de580 100644
--- a/timetable/src/main/java/com/zhuangfei/timetable/operater/SimpleOperater.java
+++ b/timetable/src/main/java/com/zhuangfei/timetable/operater/SimpleOperater.java
@@ -23,6 +23,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import static ohos.agp.components.Component.AXIS_Y;
+
/**
* 课表业务操作者,TimetableView中只涉及属性的设置,方法的具体实现在这里.
* 常用的方法也就四个,如下
@@ -79,6 +81,10 @@ public class SimpleOperater extends AbsOperater {
* 初始月份长度
*/
protected final static int MONTH_WIDTH = 80;
+ /**
+ * 布局滑动高度
+ */
+ private float scrollY;
@Override
public void init(Context context, AttrSet attrs, TimetableView view) {
@@ -92,6 +98,7 @@ public class SimpleOperater extends AbsOperater {
mView.monthWidthDp(MONTH_WIDTH);
initAttr(attrs);
scheduleConfig = new ScheduleConfig(context);
+
}
/**
@@ -373,7 +380,12 @@ public class SimpleOperater extends AbsOperater {
/**
* 判断点击的是第几节课,1:第1节
*/
- final int start = (int) Math.ceil(y / (mView.itemHeight() + mView.marTop()));
+ final int start;
+ if (mView.isShowWeekView()) {
+ start = (int) Math.ceil((y + scrollY) / (mView.itemHeight() + mView.marTop()));
+ } else {
+ start = (int) Math.ceil(y / (mView.itemHeight() + mView.marTop()));
+ }
if (!checkPosition(day, start)) {
mView.onSpaceItemClickListener().onSpaceItemClick(day, start);
}
@@ -442,6 +454,7 @@ public class SimpleOperater extends AbsOperater {
if (x2 == x && y2 == y) {
onPanelClicked(arg0, point.getY());
}
+
break;
default:
break;
diff --git a/timetable/src/main/java/com/zhuangfei/timetable/utils/ScreenUtils.java b/timetable/src/main/java/com/zhuangfei/timetable/utils/ScreenUtils.java
index b696605..c8fee5b 100644
--- a/timetable/src/main/java/com/zhuangfei/timetable/utils/ScreenUtils.java
+++ b/timetable/src/main/java/com/zhuangfei/timetable/utils/ScreenUtils.java
@@ -1,17 +1,16 @@
/*
- * Copyright (C) 2021 The Chinese Software International Co., Ltd.
+ * 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.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
package com.zhuangfei.timetable.utils;
diff --git a/timetable/src/main/java/com/zhuangfei/timetable/view/WeekView.java b/timetable/src/main/java/com/zhuangfei/timetable/view/WeekView.java
index b9755b3..b1b7125 100644
--- a/timetable/src/main/java/com/zhuangfei/timetable/view/WeekView.java
+++ b/timetable/src/main/java/com/zhuangfei/timetable/view/WeekView.java
@@ -295,7 +295,9 @@ public class WeekView extends DirectionalLayout implements WeekViewEnable 0 && curWeek <= layouts.size()) {
ShapeElement element = new ShapeElement();
diff --git a/timetable/src/main/resources/base/layout/item_dateview.xml b/timetable/src/main/resources/base/layout/item_dateview.xml
index 4bce250..fb43bfa 100644
--- a/timetable/src/main/resources/base/layout/item_dateview.xml
+++ b/timetable/src/main/resources/base/layout/item_dateview.xml
@@ -17,6 +17,7 @@
\ No newline at end of file
diff --git a/timetable/src/main/resources/base/layout/item_dateview_first.xml b/timetable/src/main/resources/base/layout/item_dateview_first.xml
index 2eaf7a0..1376de4 100644
--- a/timetable/src/main/resources/base/layout/item_dateview_first.xml
+++ b/timetable/src/main/resources/base/layout/item_dateview_first.xml
@@ -4,6 +4,7 @@
ohos:id="$+id:id_week_month"
ohos:width="match_content"
ohos:height="50vp"
+ ohos:left_padding="5vp"
ohos:text_alignment="vertical_center|horizontal_center"
ohos:text_size="12fp"
ohos:multiple_lines="true"
diff --git a/timetable/src/main/resources/base/layout/item_weekview.xml b/timetable/src/main/resources/base/layout/item_weekview.xml
index 3c3c99f..d19fc16 100644
--- a/timetable/src/main/resources/base/layout/item_weekview.xml
+++ b/timetable/src/main/resources/base/layout/item_weekview.xml
@@ -25,6 +25,7 @@
@@ -34,6 +35,7 @@
ohos:width="35vp"
ohos:top_margin="2vp"
app:gray_color="#cfdbdb"
+ ohos:text_color="#8a000000"
app:light_color="#3fcab8"
app:radius="8"/>
@@ -41,6 +43,7 @@
ohos:id="$+id:id_weektext_bottom"
ohos:height="match_content"
ohos:width="match_content"
+ ohos:text_color="#8a000000"
ohos:text_size="10fp"/>
diff --git a/timetable/src/main/resources/base/layout/view_weekview.xml b/timetable/src/main/resources/base/layout/view_weekview.xml
index ef55e0e..1205632 100644
--- a/timetable/src/main/resources/base/layout/view_weekview.xml
+++ b/timetable/src/main/resources/base/layout/view_weekview.xml
@@ -10,7 +10,7 @@
@@ -19,6 +19,7 @@
ohos:width="match_content"
ohos:height="match_content"
ohos:text_alignment="center"
+ ohos:text_color="#8a000000"
ohos:text_size="13vp"
ohos:max_text_lines="2"
ohos:multiple_lines="true"/>
--
Gitee