Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Graphic Ui
提交
94fdde3a
G
Graphic Ui
项目概览
OpenHarmony
/
Graphic Ui
大约 1 年 前同步成功
通知
13
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Graphic Ui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
94fdde3a
编写于
3月 30, 2021
作者:
N
niulihua
提交者:
Gitee
3月 30, 2021
浏览文件
操作
浏览文件
下载
差异文件
!61 UITimePicker增加设置循环接口
Merge pull request !61 from wangtiantian/MyMaster_timepicker
上级
7f0c5467
497adc06
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
54 addition
and
0 deletion
+54
-0
frameworks/components/ui_picker.cpp
frameworks/components/ui_picker.cpp
+1
-0
frameworks/components/ui_time_picker.cpp
frameworks/components/ui_time_picker.cpp
+28
-0
interfaces/kits/components/ui_time_picker.h
interfaces/kits/components/ui_time_picker.h
+25
-0
未找到文件。
frameworks/components/ui_picker.cpp
浏览文件 @
94fdde3a
...
...
@@ -452,6 +452,7 @@ void UIPicker::SetHeight(int16_t height)
void
UIPicker
::
SetLoopState
(
bool
state
)
{
list_
.
SetLoopState
(
state
);
Refresh
();
}
void
UIPicker
::
SetDirect
(
UITextLanguageDirect
direct
)
...
...
frameworks/components/ui_time_picker.cpp
浏览文件 @
94fdde3a
...
...
@@ -28,6 +28,7 @@ UITimePicker::UITimePicker()
selectedMinute_
{
0
},
selectedSecond_
{
0
},
secVisible_
(
false
),
loopState_
{
false
},
setSelectedTime_
(
nullptr
),
pickerWidth_
(
0
),
itemsHeight_
(
0
),
...
...
@@ -84,12 +85,21 @@ void UITimePicker::InitTimePicker()
InitPicker
(
minutePicker_
,
TIME_START
,
MIN_END
);
xPos_
*=
(
SEC_VISIBLE_COUNT
-
1
);
InitPicker
(
secondPicker_
,
TIME_START
,
SEC_END
);
if
(
secondPicker_
!=
nullptr
)
{
secondPicker_
->
SetLoopState
(
loopState_
[
PICKER_SEC
]);
}
}
else
{
pickerWidth_
=
GetWidth
()
/
SEC_INVISIBLE_COUNT
;
InitPicker
(
hourPicker_
,
TIME_START
,
HOUR_END
);
xPos_
=
pickerWidth_
;
InitPicker
(
minutePicker_
,
TIME_START
,
MIN_END
);
}
if
(
hourPicker_
!=
nullptr
)
{
hourPicker_
->
SetLoopState
(
loopState_
[
PICKER_HOUR
]);
}
if
(
minutePicker_
!=
nullptr
)
{
minutePicker_
->
SetLoopState
(
loopState_
[
PICKER_MIN
]);
}
if
(
setSelectedTime_
==
nullptr
)
{
const
char
*
curTime
=
secVisible_
?
"00:00:00"
:
"00:00"
;
...
...
@@ -288,4 +298,22 @@ void UITimePicker::SetHeight(int16_t height)
UIView
::
SetHeight
(
height
);
RefreshTimePicker
();
}
void
UITimePicker
::
SetLoopState
(
const
uint8_t
pickerType
,
bool
state
)
{
switch
(
pickerType
)
{
case
PICKER_HOUR
:
loopState_
[
PICKER_HOUR
]
=
state
;
break
;
case
PICKER_MIN
:
loopState_
[
PICKER_MIN
]
=
state
;
break
;
case
PICKER_SEC
:
loopState_
[
PICKER_SEC
]
=
state
;
break
;
default:
return
;
}
RefreshTimePicker
();
}
}
interfaces/kits/components/ui_time_picker.h
浏览文件 @
94fdde3a
...
...
@@ -52,6 +52,19 @@ public:
static
constexpr
const
char
*
MIN_LIST_NAME
=
"minute"
;
static
constexpr
const
char
*
SEC_LIST_NAME
=
"second"
;
#endif
/**
* 枚举Picker类型
*/
enum
PickerType
:
uint8_t
{
/* 时 */
PICKER_HOUR
=
0
,
/* 分 */
PICKER_MIN
,
/* 秒 */
PICKER_SEC
,
/* 最大值 */
PICKER_MAX
,
};
/**
* @brief A constructor used to create a <b>UITimePicker</b> instance.
*
...
...
@@ -223,6 +236,17 @@ public:
*/
void
SetHeight
(
int16_t
height
)
override
;
/**
* @brief 设置是否开启循环
*
* @param pickerType Picker类型
* @param state 状态
*
* @since 3.0
* @version 5.0
*/
void
SetLoopState
(
const
uint8_t
pickerType
,
bool
state
);
/**
* @brief Defines the listener used by the time picker. This listener is triggered when an item is selected
* after sliding stops.
...
...
@@ -315,6 +339,7 @@ private:
char
selectedMinute_
[
BUF_SIZE
];
char
selectedSecond_
[
BUF_SIZE
];
bool
secVisible_
;
bool
loopState_
[
PICKER_MAX
];
const
char
*
setSelectedTime_
;
uint16_t
pickerWidth_
;
uint16_t
itemsHeight_
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录