Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Graphic Ui
提交
efe76dca
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,发现更多精彩内容 >>
提交
efe76dca
编写于
9月 10, 2021
作者:
O
openharmony_ci
提交者:
Gitee
9月 10, 2021
浏览文件
操作
浏览文件
下载
差异文件
!387 修复ui_time_picker组件在修改样式属性后显示的选中值重置问题
Merge pull request !387 from JayLeeHW/master-temp
上级
62c84084
36736e4a
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
39 addition
and
10 deletion
+39
-10
frameworks/components/ui_time_picker.cpp
frameworks/components/ui_time_picker.cpp
+15
-8
interfaces/kits/components/ui_time_picker.h
interfaces/kits/components/ui_time_picker.h
+0
-1
test/uitest/test_picker/ui_test_ui_picker.cpp
test/uitest/test_picker/ui_test_ui_picker.cpp
+22
-1
test/uitest/test_picker/ui_test_ui_picker.h
test/uitest/test_picker/ui_test_ui_picker.h
+2
-0
未找到文件。
frameworks/components/ui_time_picker.cpp
浏览文件 @
efe76dca
...
...
@@ -29,7 +29,6 @@ UITimePicker::UITimePicker()
selectedSecond_
{
0
},
secVisible_
(
false
),
loopState_
{
false
},
setSelectedTime_
(
nullptr
),
pickerWidth_
(
0
),
itemsHeight_
(
0
),
xPos_
(
0
),
...
...
@@ -104,12 +103,7 @@ void UITimePicker::InitTimePicker()
minutePicker_
->
SetLoopState
(
loopState_
[
PICKER_MIN
]);
}
if
(
setSelectedTime_
==
nullptr
)
{
const
char
*
curTime
=
secVisible_
?
"00:00:00"
:
"00:00"
;
RefreshSelected
(
curTime
);
}
else
{
RefreshSelected
(
setSelectedTime_
);
}
RefreshSelected
(
selectedValue_
);
}
void
UITimePicker
::
DeInitTimePicker
()
...
...
@@ -207,7 +201,20 @@ void UITimePicker::GetValueByIndex(char* value, uint8_t len, uint16_t index, int
bool
UITimePicker
::
SetSelected
(
const
char
*
value
)
{
setSelectedTime_
=
value
;
if
(
strcpy_s
(
selectedValue_
,
SELECTED_VALUE_SIZE
,
value
)
!=
EOK
)
{
return
false
;
}
if
(
secVisible_
)
{
if
(
sscanf_s
(
value
,
"%[^:]%*c%[^:]%*c%[^
\n
]"
,
selectedHour_
,
BUF_SIZE
,
selectedMinute_
,
BUF_SIZE
,
selectedSecond_
,
BUF_SIZE
)
<
3
)
{
// 3: three variables
return
false
;
}
}
else
{
if
(
sscanf_s
(
value
,
"[^:]%*c%[^
\n
]"
,
selectedHour_
,
BUF_SIZE
,
selectedMinute_
,
BUF_SIZE
)
<
2
)
{
// 2: two variables
return
false
;
}
}
return
RefreshSelected
(
value
);
}
...
...
interfaces/kits/components/ui_time_picker.h
浏览文件 @
efe76dca
...
...
@@ -340,7 +340,6 @@ private:
char
selectedSecond_
[
BUF_SIZE
];
bool
secVisible_
;
bool
loopState_
[
PICKER_MAX
];
const
char
*
setSelectedTime_
;
uint16_t
pickerWidth_
;
uint16_t
itemsHeight_
;
int16_t
xPos_
;
...
...
test/uitest/test_picker/ui_test_ui_picker.cpp
浏览文件 @
efe76dca
...
...
@@ -47,6 +47,7 @@ void UITestUIPicker::TearDown()
container_
->
Remove
(
setSelectBtn_
);
container_
->
Remove
(
setLeftToRightBtn_
);
container_
->
Remove
(
setRightToLeftBtn_
);
container_
->
Remove
(
setMarginBtn_
);
container_
->
Remove
(
selectIndex_
);
container_
->
Remove
(
selectTime_
);
container_
->
Remove
(
picker1_
);
...
...
@@ -58,6 +59,7 @@ void UITestUIPicker::TearDown()
setSelectBtn_
=
nullptr
;
setLeftToRightBtn_
=
nullptr
;
setRightToLeftBtn_
=
nullptr
;
setMarginBtn_
=
nullptr
;
selectIndex_
=
nullptr
;
selectTime_
=
nullptr
;
container_
=
nullptr
;
...
...
@@ -148,6 +150,9 @@ void UITestUIPicker::CreatButtons()
if
(
setRightToLeftBtn_
==
nullptr
)
{
setRightToLeftBtn_
=
new
UILabelButton
();
}
if
(
setMarginBtn_
==
nullptr
)
{
setMarginBtn_
=
new
UILabelButton
();
}
}
void
UITestUIPicker
::
UIKit_Picker_Test_Base_002
()
...
...
@@ -184,13 +189,21 @@ void UITestUIPicker::UIKit_Picker_Test_Time_Picker_001()
container_
->
Add
(
label
);
label
->
SetPosition
(
672
,
0
);
// 672: x-coordinate
label
->
SetStyle
(
STYLE_BACKGROUND_OPA
,
OPA_OPAQUE
);
container_
->
Add
(
setMarginBtn_
);
setMarginBtn_
->
SetPosition
(
672
,
30
,
120
,
30
);
// 672: x-coordinate, 30 : y-coordinate, 120 : width, 30 : height
setMarginBtn_
->
SetStyle
(
STYLE_BACKGROUND_OPA
,
OPA_OPAQUE
);
setMarginBtn_
->
SetOnClickListener
(
this
);
setMarginBtn_
->
SetText
(
"增加margin"
);
if
(
picker2_
==
nullptr
)
{
picker2_
=
new
UITimePicker
();
}
picker2_
->
EnableSecond
(
true
);
picker2_
->
SetPosition
(
652
,
label
->
GetY
()
+
g_blank
,
g_ListW
,
g_ListH
);
// 652: x-coordinate
picker2_
->
SetPosition
(
652
,
setMarginBtn_
->
GetY
()
+
40
,
g_ListW
,
g_ListH
);
// 652: x-coordinate, 40: offset
picker2_
->
SetItemHeight
(
50
);
// 50 height
picker2_
->
RegisterSelectedListener
(
this
);
picker2_
->
SetSelected
(
"12:20:30"
);
positionX_
=
picker2_
->
GetWidth
();
positionY_
=
picker2_
->
GetY
();
...
...
@@ -217,6 +230,14 @@ bool UITestUIPicker::OnClick(UIView& view, const ClickEvent& event)
picker1_
->
SetDirect
(
UITextLanguageDirect
::
TEXT_DIRECT_LTR
);
}
else
if
(
&
view
==
setRightToLeftBtn_
)
{
picker1_
->
SetDirect
(
UITextLanguageDirect
::
TEXT_DIRECT_RTL
);
}
else
if
(
&
view
==
setMarginBtn_
)
{
picker2_
->
Invalidate
();
picker2_
->
SetStyle
(
STYLE_MARGIN_LEFT
,
++
margin_
);
picker2_
->
SetStyle
(
STYLE_MARGIN_RIGHT
,
margin_
);
picker2_
->
SetStyle
(
STYLE_MARGIN_TOP
,
margin_
);
picker2_
->
SetStyle
(
STYLE_MARGIN_BOTTOM
,
margin_
);
picker2_
->
SetWidth
(
++
g_ListW
);
picker2_
->
Invalidate
();
}
return
true
;
}
...
...
test/uitest/test_picker/ui_test_ui_picker.h
浏览文件 @
efe76dca
...
...
@@ -49,6 +49,7 @@ private:
UILabelButton
*
setSelectBtn_
=
nullptr
;
UILabelButton
*
setLeftToRightBtn_
=
nullptr
;
UILabelButton
*
setRightToLeftBtn_
=
nullptr
;
UILabelButton
*
setMarginBtn_
=
nullptr
;
UILabel
*
selectIndex_
=
nullptr
;
UILabel
*
selectTime_
=
nullptr
;
UIScrollView
*
container_
=
nullptr
;
...
...
@@ -57,6 +58,7 @@ private:
UITimePicker
*
picker2_
=
nullptr
;
int16_t
lastX_
=
0
;
int16_t
lastY_
=
0
;
int16_t
margin_
=
0
;
};
}
// namespace OHOS
#endif // UI_TEST_UI_PICKER_H
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录