1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

Merge pull request #526 from AloyseTech/single-obj-group

Avoid object defocusing in single group object
This commit is contained in:
Gabor Kiss-Vamosi 2018-11-06 17:01:05 +01:00 committed by GitHub
commit 5088e903cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 3 deletions

View File

@ -109,6 +109,10 @@ void lv_group_add_obj(lv_group_t * group, lv_obj_t * obj)
* In this case automatically activate it*/
if(lv_ll_get_head(&group->obj_ll) == next) {
lv_group_refocus(group);
if(!lv_group_get_editing(group))
{
lv_group_set_editing(group, true);
}
}
}

View File

@ -461,11 +461,15 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
if(focused) focused->signal_func(focused, LV_SIGNAL_GET_EDITABLE, &editable);
if(editable) {
if(i->group->obj_ll.head != i->group->obj_ll.tail)
lv_group_set_editing(i->group, lv_group_get_editing(i->group) ? false : true); /*Toggle edit mode on long press*/
else if(focused)
focused->signal_func(focused, LV_SIGNAL_LONG_PRESS, indev_act);
}
/*If not editable then just send a long press signal*/
else {
if(focused) focused->signal_func(focused, LV_SIGNAL_LONG_PRESS, indev_act);
if(focused)
focused->signal_func(focused, LV_SIGNAL_LONG_PRESS, indev_act);
}
i->proc.long_pr_sent = 1;
}
@ -482,7 +486,8 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
}
/*An object is being edited and the button is releases. Just send enter */
else if(i->group->editing) {
if(!i->proc.long_pr_sent) lv_group_send_data(i->group, LV_GROUP_KEY_ENTER); /*Ignore long pressed enter release because it comes from mode switch*/
if(!i->proc.long_pr_sent || i->group->obj_ll.head == i->group->obj_ll.tail)
lv_group_send_data(i->group, LV_GROUP_KEY_ENTER); /*Ignore long pressed enter release because it comes from mode switch*/
}
/*If the focused object is editable and now in navigate mode then enter edit mode*/
else if(editable && !i->group->editing && !i->proc.long_pr_sent) {