Eliminate some warnings
This commit is contained in:
@@ -7,6 +7,9 @@
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_app.h"
|
||||
|
||||
#if LV_APP_ENABLE != 0
|
||||
#include "lv_app_sup.h"
|
||||
#include "lvgl/lv_misc/anim.h"
|
||||
|
||||
/*********************
|
||||
@@ -30,7 +33,7 @@ static lv_action_res_t lv_app_sc_rel_action(lv_obj_t * sc, lv_dispi_t * dispi);
|
||||
static lv_action_res_t lv_app_sc_pr_action(lv_obj_t * sc, lv_dispi_t * dispi);
|
||||
static lv_action_res_t lv_app_win_close_action(lv_obj_t * close_btn, lv_dispi_t * dispi);
|
||||
static lv_action_res_t lv_app_win_minim_action(lv_obj_t * close_btn, lv_dispi_t * dispi);
|
||||
#if LV_APP_ANIM_LEVEL == 2 && LV_APP_ANIM_WIN != 0
|
||||
#if LV_APP_ANIM_LEVEL != 0 && LV_APP_ANIM_WIN != 0
|
||||
static void lv_app_win_close_anim_cb(lv_obj_t * app_win);
|
||||
static void lv_app_win_minim_anim_cb(lv_obj_t * app_win);
|
||||
#endif
|
||||
@@ -47,6 +50,7 @@ static lv_obj_t * app_scr;
|
||||
static lv_obj_t * menuh; /*Holder of timg_bubbleshe menu on the top*/
|
||||
static lv_obj_t * app_btn; /*The "Apps" button on the menu*/
|
||||
static lv_obj_t * sys_apph; /*Holder of the system app. buttons*/
|
||||
static lv_obj_t * clock; /*Clock on the menu bar (right top)*/
|
||||
static lv_obj_t * app_list;
|
||||
static lv_obj_t * sc_page;
|
||||
|
||||
@@ -125,9 +129,18 @@ void lv_app_init(void)
|
||||
lv_btn_set_rel_action(app_btn, lv_app_menu_rel_action);
|
||||
lv_obj_t * app_label = lv_label_create(app_btn, NULL);
|
||||
lv_obj_set_style(app_label, &app_style.menu_btn_label_style);
|
||||
lv_obj_set_pos(app_btn, 0, 0);
|
||||
lv_label_set_text(app_label, "Apps");
|
||||
lv_obj_set_pos(app_btn, 0, 0);
|
||||
|
||||
sys_apph = lv_rect_create(menuh, NULL);
|
||||
lv_rect_set_layout(sys_apph, LV_RECT_LAYOUT_ROW_M);
|
||||
lv_rect_set_fit(sys_apph, true, false);
|
||||
lv_obj_set_height(sys_apph, app_style.menu_h);
|
||||
lv_obj_set_style(sys_apph, lv_rects_get(LV_RECTS_TRANSP, NULL));
|
||||
clock = lv_label_create(sys_apph, NULL);
|
||||
lv_obj_set_style(clock, &app_style.menu_btn_label_style);
|
||||
lv_label_set_text(clock, "20:17");
|
||||
lv_obj_align(sys_apph, NULL, LV_ALIGN_IN_RIGHT_MID, 0, 0);
|
||||
lv_app_refr_style();
|
||||
|
||||
|
||||
@@ -177,13 +190,16 @@ void lv_app_close(lv_app_inst_t * app)
|
||||
}
|
||||
|
||||
/**
|
||||
* Publish an event.
|
||||
* @param app pointer to an application which publishes the event
|
||||
* @param event an event from 'lv_app_event_t' enum
|
||||
* Send data to other applications
|
||||
* @param app_send pointer to the application which is sending the message
|
||||
* @param type type of data from 'lv_app_com_type_t' enum
|
||||
* @param data pointer to the sent data
|
||||
* @param len length of 'data' in bytes
|
||||
* @return number application which were received the message
|
||||
*/
|
||||
void lv_app_event_send(lv_app_inst_t * app, lv_app_event_t event)
|
||||
uint16_t lv_app_com_send(lv_app_inst_t * app_send, lv_app_com_type_t type , void * data, uint32_t len)
|
||||
{
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -211,7 +227,7 @@ lv_obj_t * lv_app_sc_open(lv_app_inst_t * app)
|
||||
|
||||
app->sc_title = lv_label_create(app->sc, NULL);
|
||||
lv_obj_set_style(app->sc_title, &app_style.sc_title_style);
|
||||
lv_label_set_long_mode(app->sc_title, LV_LABEL_LONG_SCROLL);
|
||||
//lv_label_set_long_mode(app->sc_title, LV_LABEL_LONG_SCROLL);
|
||||
lv_label_set_text(app->sc_title, app->name);
|
||||
lv_obj_align_us(app->sc_title, NULL, LV_ALIGN_IN_TOP_MID, 0, app_style.sc_title_margin);
|
||||
|
||||
@@ -264,6 +280,9 @@ lv_obj_t * lv_app_win_open(lv_app_inst_t * app)
|
||||
lv_win_add_ctrl_btn(app->win, "U:/icon_down", lv_app_win_minim_action);
|
||||
lv_win_add_ctrl_btn(app->win, "U:/icon_close", lv_app_win_close_action);
|
||||
|
||||
app->win_data = dm_alloc(app->dsc->win_data_size);
|
||||
app->dsc->win_open(app, app->win);
|
||||
|
||||
return app->win;
|
||||
}
|
||||
|
||||
@@ -330,6 +349,29 @@ const lv_app_dsc_t * lv_app_get_dsc(const char * name)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the list of the running applications. (Get he next element)
|
||||
* @param prev the previous application (at the first call give NULL to get the first application)
|
||||
* @param dsc pointer to an application descriptor to filer the applications (NULL to do not filter)
|
||||
* @return pointer to the next running application or NULL if no more
|
||||
*/
|
||||
lv_app_inst_t * lv_app_get_next_app(lv_app_inst_t * prev, lv_app_dsc_t * dsc)
|
||||
{
|
||||
lv_app_inst_t * next;
|
||||
|
||||
while(1) {
|
||||
if(prev == NULL) next = ll_get_head(&app_inst_ll);
|
||||
else next = ll_get_next(&app_inst_ll, prev);
|
||||
if(next == NULL) break;
|
||||
|
||||
if(next->dsc == dsc || dsc == NULL) return next;
|
||||
|
||||
};
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
lv_app_style_t * lv_app_get_style(void)
|
||||
{
|
||||
return &app_style;
|
||||
@@ -349,6 +391,7 @@ static lv_action_res_t lv_app_menu_rel_action(lv_obj_t * app_btn, lv_dispi_t * d
|
||||
/*Create the app. list*/
|
||||
else {
|
||||
app_list = lv_list_create(lv_scr_act(), NULL);
|
||||
lv_obj_set_hidden(app_list, true);
|
||||
lv_obj_set_style(app_list, &app_style.app_list_style);
|
||||
lv_obj_set_opa(app_list, app_style.menu_opa);
|
||||
lv_obj_set_size(app_list, app_style.app_list_w, app_style.app_list_h);
|
||||
@@ -386,6 +429,7 @@ static lv_action_res_t lv_app_menu_rel_action(lv_obj_t * app_btn, lv_dispi_t * d
|
||||
lv_obj_set_opa(elem, app_style.menu_btn_opa);
|
||||
|
||||
}
|
||||
lv_obj_set_hidden(app_list, false);
|
||||
}
|
||||
return LV_ACTION_RES_OK;
|
||||
}
|
||||
@@ -394,6 +438,10 @@ static lv_action_res_t lv_app_menu_elem_rel_action(lv_obj_t * app_elem_btn, lv_d
|
||||
{
|
||||
lv_app_dsc_t * dsc = lv_obj_get_free_p(app_elem_btn);
|
||||
|
||||
/*Close the app list*/
|
||||
lv_obj_del(app_list);
|
||||
app_list = NULL;
|
||||
|
||||
lv_app_inst_t * app = lv_app_run(dsc, "");
|
||||
lv_app_sc_open(app);
|
||||
|
||||
@@ -401,9 +449,6 @@ static lv_action_res_t lv_app_menu_elem_rel_action(lv_obj_t * app_elem_btn, lv_d
|
||||
lv_obj_anim(app->sc, LV_ANIM_FADE | ANIM_IN, LV_APP_ANIM_SC, 0, NULL);
|
||||
#endif
|
||||
|
||||
/*Close the app list*/
|
||||
lv_obj_del(app_list);
|
||||
app_list = NULL;
|
||||
|
||||
return LV_ACTION_RES_INV;
|
||||
}
|
||||
@@ -447,8 +492,6 @@ static lv_action_res_t lv_app_sc_rel_action(lv_obj_t * sc, lv_dispi_t * dispi)
|
||||
lv_app_inst_t * app = lv_obj_get_free_p(sc);
|
||||
lv_app_win_open(app);
|
||||
|
||||
app->dsc->win_open(app, app->win);
|
||||
|
||||
/*Make an animation on window open*/
|
||||
#if LV_APP_ANIM_WIN != 0 && LV_APP_ANIM_LEVEL != 0
|
||||
|
||||
@@ -521,7 +564,7 @@ static lv_action_res_t lv_app_win_close_action(lv_obj_t * close_btn, lv_dispi_t
|
||||
lv_obj_t * win = lv_win_get_from_ctrl_btn(close_btn);
|
||||
lv_app_inst_t * app = lv_obj_get_free_p(win);
|
||||
|
||||
lv_app_kb_close();
|
||||
lv_app_kb_close(false);
|
||||
|
||||
#if LV_APP_ANIM_WIN != 0 && LV_APP_ANIM_LEVEL != 0
|
||||
#if LV_APP_ANIM_LEVEL == 1
|
||||
@@ -545,7 +588,7 @@ static lv_action_res_t lv_app_win_minim_action(lv_obj_t * close_btn, lv_dispi_t
|
||||
lv_obj_t * win = lv_win_get_from_ctrl_btn(close_btn);
|
||||
lv_app_inst_t * app = lv_obj_get_free_p(win);
|
||||
|
||||
lv_app_kb_close();
|
||||
lv_app_kb_close(false);
|
||||
|
||||
/*Make an animation on window open*/
|
||||
#if LV_APP_ANIM_WIN != 0 && LV_APP_ANIM_LEVEL != 0
|
||||
@@ -607,6 +650,7 @@ static lv_action_res_t lv_app_win_minim_action(lv_obj_t * close_btn, lv_dispi_t
|
||||
return LV_ACTION_RES_OK;
|
||||
}
|
||||
|
||||
#if LV_APP_ANIM_LEVEL != 0 && LV_APP_ANIM_WIN != 0
|
||||
static void lv_app_win_close_anim_cb(lv_obj_t * app_win)
|
||||
{
|
||||
lv_app_inst_t * app = lv_obj_get_free_p(app_win);
|
||||
@@ -618,6 +662,7 @@ static void lv_app_win_minim_anim_cb(lv_obj_t * app_win)
|
||||
lv_app_inst_t * app = lv_obj_get_free_p(app_win);
|
||||
lv_app_win_close(app);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void lv_app_init_icons(void)
|
||||
{
|
||||
@@ -656,11 +701,6 @@ static void lv_app_init_style(void)
|
||||
app_style.app_list_h = (2 * LV_VER_RES) / 3;
|
||||
app_style.sc_title_margin = 2 * LV_DOWNSCALE;
|
||||
|
||||
/*Fonts*/
|
||||
app_style.font_small = FONT_DEJAVU_20;
|
||||
app_style.font_medium = FONT_DEJAVU_30;
|
||||
app_style.font_large = FONT_DEJAVU_40;
|
||||
|
||||
/*Opacity*/
|
||||
app_style.menu_opa = OPA_80;
|
||||
app_style.menu_btn_opa = OPA_50;
|
||||
@@ -688,7 +728,7 @@ static void lv_app_init_style(void)
|
||||
app_style.menu_btn_style.gcolor[LV_BTN_STATE_PR] = COLOR_GRAY;
|
||||
|
||||
lv_labels_get(LV_LABELS_BTN,&app_style.menu_btn_label_style);
|
||||
app_style.menu_btn_label_style.font = app_style.font_large;
|
||||
app_style.menu_btn_label_style.font = LV_APP_FONT_LARGE;
|
||||
app_style.menu_btn_label_style.objs.color = COLOR_MAKE(0xd0, 0xe0, 0xf0);
|
||||
|
||||
lv_imgs_get(LV_IMGS_DEF,&app_style.menu_btn_img_style);
|
||||
@@ -736,7 +776,7 @@ static void lv_app_init_style(void)
|
||||
app_style.sc_style.rects.bwidth = 1 * LV_DOWNSCALE;
|
||||
|
||||
lv_labels_get(LV_LABELS_DEF,&app_style.sc_title_style);
|
||||
app_style.sc_title_style.font = app_style.font_small;
|
||||
app_style.sc_title_style.font = LV_APP_FONT_SMALL;
|
||||
app_style.sc_title_style.objs.color = COLOR_MAKE(0x20, 0x30, 0x40);
|
||||
app_style.sc_title_style.mid = 1;
|
||||
|
||||
@@ -758,4 +798,6 @@ static void lv_app_init_style(void)
|
||||
app_style.win_style.content.scrable_rects.objs.transp = 1;
|
||||
}
|
||||
|
||||
#endif /*LV_APP_ENABLE != 0*/
|
||||
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
*********************/
|
||||
#include "lvgl/lvgl.h"
|
||||
|
||||
#if LV_APP_ENABLE != 0
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
@@ -32,13 +34,12 @@ typedef enum
|
||||
|
||||
typedef enum
|
||||
{
|
||||
LV_APP_EVENT_OPEN,
|
||||
LV_APP_EVENT_CLOSE,
|
||||
LV_APP_EVENT_SC_OPENED,
|
||||
LV_APP_EVENT_SC_CLOSED,
|
||||
LV_APP_EVENT_WIN_OPENED,
|
||||
LV_APP_EVENT_WIN_CLOSED,
|
||||
}lv_app_event_t;
|
||||
LV_APP_COM_TYPE_STR, /*String data to process*/
|
||||
LV_APP_COM_TYPE_BIN, /*Binary data as 'int32_t' array*/
|
||||
LV_APP_COM_TYPE_SYS, /*System level event*/
|
||||
LV_APP_COM_TYPE_LOG, /*String about an event to log*/
|
||||
LV_APP_COM_TYPE_NOTE, /*String to display to the user as a notification*/
|
||||
}lv_app_com_type_t;
|
||||
|
||||
struct __LV_APP_DSC_T;
|
||||
|
||||
@@ -60,7 +61,7 @@ typedef struct __LV_APP_DSC_T
|
||||
lv_app_mode_t mode;
|
||||
void (*app_run)(lv_app_inst_t *, const char *);
|
||||
void (*app_close) (lv_app_inst_t *);
|
||||
void (*event_read) (lv_app_inst_t *, lv_app_event_t);
|
||||
void (*com_rec) (lv_app_inst_t *, lv_app_inst_t *, lv_app_com_type_t, void *, uint32_t);
|
||||
void (*sc_open) (lv_app_inst_t *, lv_obj_t *);
|
||||
void (*sc_close) (lv_app_inst_t *);
|
||||
void (*win_open) (lv_app_inst_t *, lv_obj_t *);
|
||||
@@ -89,10 +90,6 @@ typedef struct {
|
||||
cord_t app_list_w;
|
||||
cord_t app_list_h;
|
||||
cord_t sc_title_margin;
|
||||
|
||||
font_types_t font_small;
|
||||
font_types_t font_medium;
|
||||
font_types_t font_large;
|
||||
}lv_app_style_t;
|
||||
|
||||
|
||||
@@ -102,7 +99,7 @@ typedef struct {
|
||||
void lv_app_init(void);
|
||||
lv_app_inst_t * lv_app_run(const lv_app_dsc_t * app_dsc, const char * cstr);
|
||||
void lv_app_close(lv_app_inst_t * app);
|
||||
void lv_app_event_send(lv_app_inst_t * app, lv_app_event_t event);
|
||||
uint16_t lv_app_com_send(lv_app_inst_t * app_send, lv_app_com_type_t type , void * data, uint32_t len);
|
||||
lv_obj_t * lv_app_sc_open(lv_app_inst_t * app);
|
||||
void lv_app_sc_close(lv_app_inst_t * app);
|
||||
lv_obj_t * lv_app_win_open(lv_app_inst_t * app);
|
||||
@@ -114,10 +111,14 @@ lv_app_style_t * lv_app_get_style(void);
|
||||
void lv_app_rename(lv_app_inst_t * app, const char * name);
|
||||
void lv_app_refr_style(void);
|
||||
|
||||
lv_app_inst_t * lv_app_get_next_app(lv_app_inst_t * prev, lv_app_dsc_t * dsc);
|
||||
|
||||
const lv_app_dsc_t * lv_app_example_init(void);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif
|
||||
#endif /*LV_APP_ENABLE != 0*/
|
||||
|
||||
#endif /*LV_APP_H*/
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include <lvgl/lv_app/lv_app_sup.h>
|
||||
#include "lv_app_sup.h"
|
||||
#if LV_APP_ENABLE != 0
|
||||
|
||||
#include "../lv_objx/lv_btnm.h"
|
||||
#include "../lv_objx/lv_ta.h"
|
||||
|
||||
@@ -30,14 +32,14 @@ static lv_obj_t * kb_btnm;
|
||||
static lv_obj_t * kb_win;
|
||||
static lv_obj_t * kb_ta;
|
||||
static const char * kb_map_lc[] = {
|
||||
"\0061#", "\004q", "\004w", "\004e", "\004r", "\004t", "\004y", "\004u", "\004i", "\004o", "\004p", "\010Del", "\n",
|
||||
"\0051#", "\004q", "\004w", "\004e", "\004r", "\004t", "\004y", "\004u", "\004i", "\004o", "\004p", "\007Del", "\n",
|
||||
"\007ABC", "\004a", "\004s", "\004d", "\004f", "\004g", "\004h", "\004j", "\004k", "\004l", "\010Enter", "\n",
|
||||
"*", "-", "z", "x", "c", "v", "b", "n", "m", ".", ",", ";", "\n",
|
||||
"\002Hide", "\002Left", "\006 ", "\002Right", "\002Ok", ""
|
||||
};
|
||||
|
||||
static const char * kb_map_uc[] = {
|
||||
"\0061#", "\004Q", "\004W", "\004E", "\004R", "\004T", "\004Y", "\004U", "\004I", "\004O", "\004P", "\010Del", "\n",
|
||||
"\0051#", "\004Q", "\004W", "\004E", "\004R", "\004T", "\004Y", "\004U", "\004I", "\004O", "\004P", "\007Del", "\n",
|
||||
"\007abc", "\004A", "\004S", "\004D", "\004F", "\004G", "\004H", "\004J", "\004K", "\004L", "\010Enter", "\n",
|
||||
"*", "/", "Z", "X", "C", "V", "B", "N", "M", ".", ",", ";", "\n",
|
||||
"\002Hide", "\002Left", "\006 ", "\002Right", "\002Ok", ""
|
||||
@@ -79,6 +81,7 @@ void lv_app_kb_open(lv_obj_t * ta, lv_app_kb_mode_t mode, void (*close)(lv_obj_t
|
||||
kb_btnms.rects.opad = 4 + LV_DOWNSCALE;
|
||||
kb_btnms.rects.vpad = 3 + LV_DOWNSCALE;
|
||||
kb_btnms.rects.hpad = 3 + LV_DOWNSCALE;
|
||||
kb_btnms.rects.round = 0;
|
||||
kb_inited = true;
|
||||
}
|
||||
|
||||
@@ -94,10 +97,16 @@ void lv_app_kb_open(lv_obj_t * ta, lv_app_kb_mode_t mode, void (*close)(lv_obj_t
|
||||
kb_btnm = lv_btnm_create(lv_scr_act(), NULL);
|
||||
lv_obj_set_size(kb_btnm, LV_HOR_RES, LV_VER_RES / 2);
|
||||
lv_obj_align(kb_btnm, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, 0);
|
||||
lv_obj_set_style(kb_btnm, &kb_btnms);
|
||||
lv_btnm_set_cb(kb_btnm, lv_app_kb_action);
|
||||
if(mode & LV_APP_KB_MODE_TXT) lv_btnm_set_map(kb_btnm, kb_map_lc);
|
||||
else if(mode & LV_APP_KB_MODE_NUM) lv_btnm_set_map(kb_btnm, kb_map_num);
|
||||
if(mode & LV_APP_KB_MODE_TXT) {
|
||||
kb_btnms.labels.font = LV_APP_FONT_MEDIUM;
|
||||
lv_btnm_set_map(kb_btnm, kb_map_lc);
|
||||
}
|
||||
else if(mode & LV_APP_KB_MODE_NUM) {
|
||||
kb_btnms.labels.font = LV_APP_FONT_LARGE;
|
||||
lv_btnm_set_map(kb_btnm, kb_map_num);
|
||||
}
|
||||
lv_obj_set_style(kb_btnm, &kb_btnms);
|
||||
|
||||
kb_win = lv_app_get_win_from_obj(kb_ta);
|
||||
lv_obj_set_height(kb_win, LV_VER_RES / 2);
|
||||
@@ -140,63 +149,74 @@ void lv_app_kb_close(bool ok)
|
||||
kb_ta = NULL;
|
||||
}
|
||||
|
||||
static lv_action_res_t lv_app_kb_action(lv_obj_t * btnm, uint16_t i)
|
||||
{
|
||||
const char ** map = lv_btnm_get_map(btnm);
|
||||
const char * txt = map[i];
|
||||
|
||||
if(txt[0] <= '\011') txt++;
|
||||
|
||||
if(strcmp(txt, "abc") == 0) {
|
||||
lv_btnm_set_map(btnm, kb_map_lc);
|
||||
} else if(strcmp(txt, "ABC") == 0) {
|
||||
lv_btnm_set_map(btnm, kb_map_uc);
|
||||
} else if(strcmp(txt, "1#") == 0) {
|
||||
lv_btnm_set_map(btnm, kb_map_spec);
|
||||
} else if(strcmp(txt, "Enter") == 0) {
|
||||
lv_ta_add_char(kb_ta, '\n');
|
||||
} else if(strcmp(txt, "Left") == 0) {
|
||||
lv_ta_cursor_left(kb_ta);
|
||||
} else if(strcmp(txt, "Right") == 0) {
|
||||
lv_ta_cursor_right(kb_ta);
|
||||
} else if(strcmp(txt, "Del") == 0) {
|
||||
lv_ta_del(kb_ta);
|
||||
} else if(strcmp(txt, "+/-") == 0) {
|
||||
uint16_t cur = lv_ta_get_cursor_pos(kb_ta);
|
||||
const char * ta_txt = lv_ta_get_txt(kb_ta);
|
||||
if(ta_txt[0] == '-') {
|
||||
lv_ta_set_cursor_pos(kb_ta, 1);
|
||||
lv_ta_del(kb_ta);
|
||||
lv_ta_add_char(kb_ta, '+');
|
||||
lv_ta_set_cursor_pos(kb_ta, cur);
|
||||
} else if(ta_txt[0] == '+') {
|
||||
lv_ta_set_cursor_pos(kb_ta, 1);
|
||||
lv_ta_del(kb_ta);
|
||||
lv_ta_add_char(kb_ta, '-');
|
||||
lv_ta_set_cursor_pos(kb_ta, cur);
|
||||
} else {
|
||||
lv_ta_set_cursor_pos(kb_ta, 0);
|
||||
lv_ta_add_char(kb_ta, '-');
|
||||
lv_ta_set_cursor_pos(kb_ta, cur + 1);
|
||||
}
|
||||
} else if(strcmp(txt, "Hide") == 0) {
|
||||
lv_app_kb_close(false);
|
||||
return LV_ACTION_RES_INV;
|
||||
} else if(strcmp(txt, "Ok") == 0) {
|
||||
lv_app_kb_close(true);
|
||||
return LV_ACTION_RES_INV;
|
||||
} else {
|
||||
lv_ta_add_text(kb_ta, txt);
|
||||
}
|
||||
|
||||
#if LV_APP_ANIM_LEVEL != 0
|
||||
lv_page_focus(lv_win_get_content(kb_win), kb_ta, true);
|
||||
#else
|
||||
lv_page_focus(lv_win_get_content(kb_win), kb_ta, false);
|
||||
#endif
|
||||
return LV_ACTION_RES_OK;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Called when a button of 'kb_btnm' is released
|
||||
* @param btnm pointer to 'kb_btnm'
|
||||
* @param i the index of the released button from the current btnm map
|
||||
* @return LV_ACTION_RES_INV if the btnm is deleted else LV_ACTION_RES_OK
|
||||
*/
|
||||
static lv_action_res_t lv_app_kb_action(lv_obj_t * btnm, uint16_t i)
|
||||
{
|
||||
const char ** map = lv_btnm_get_map(btnm);
|
||||
const char * txt = map[i];
|
||||
|
||||
/*Ignore the unit size number of the text*/
|
||||
if(txt[0] <= '\011') txt++;
|
||||
|
||||
/*Do the corresponding action according to the text of the button*/
|
||||
if(strcmp(txt, "abc") == 0) {
|
||||
lv_btnm_set_map(btnm, kb_map_lc);
|
||||
} else if(strcmp(txt, "ABC") == 0) {
|
||||
lv_btnm_set_map(btnm, kb_map_uc);
|
||||
} else if(strcmp(txt, "1#") == 0) {
|
||||
lv_btnm_set_map(btnm, kb_map_spec);
|
||||
} else if(strcmp(txt, "Enter") == 0) {
|
||||
lv_ta_add_char(kb_ta, '\n');
|
||||
} else if(strcmp(txt, "Left") == 0) {
|
||||
lv_ta_cursor_left(kb_ta);
|
||||
} else if(strcmp(txt, "Right") == 0) {
|
||||
lv_ta_cursor_right(kb_ta);
|
||||
} else if(strcmp(txt, "Del") == 0) {
|
||||
lv_ta_del(kb_ta);
|
||||
} else if(strcmp(txt, "+/-") == 0) {
|
||||
uint16_t cur = lv_ta_get_cursor_pos(kb_ta);
|
||||
const char * ta_txt = lv_ta_get_txt(kb_ta);
|
||||
if(ta_txt[0] == '-') {
|
||||
lv_ta_set_cursor_pos(kb_ta, 1);
|
||||
lv_ta_del(kb_ta);
|
||||
lv_ta_add_char(kb_ta, '+');
|
||||
lv_ta_set_cursor_pos(kb_ta, cur);
|
||||
} else if(ta_txt[0] == '+') {
|
||||
lv_ta_set_cursor_pos(kb_ta, 1);
|
||||
lv_ta_del(kb_ta);
|
||||
lv_ta_add_char(kb_ta, '-');
|
||||
lv_ta_set_cursor_pos(kb_ta, cur);
|
||||
} else {
|
||||
lv_ta_set_cursor_pos(kb_ta, 0);
|
||||
lv_ta_add_char(kb_ta, '-');
|
||||
lv_ta_set_cursor_pos(kb_ta, cur + 1);
|
||||
}
|
||||
} else if(strcmp(txt, "Hide") == 0) {
|
||||
lv_app_kb_close(false);
|
||||
return LV_ACTION_RES_INV;
|
||||
} else if(strcmp(txt, "Ok") == 0) {
|
||||
lv_app_kb_close(true);
|
||||
return LV_ACTION_RES_INV;
|
||||
} else {
|
||||
lv_ta_add_text(kb_ta, txt);
|
||||
}
|
||||
|
||||
#if LV_APP_ANIM_LEVEL != 0
|
||||
lv_page_focus(lv_win_get_content(kb_win), kb_ta, true);
|
||||
#else
|
||||
lv_page_focus(lv_win_get_content(kb_win), kb_ta, false);
|
||||
#endif
|
||||
return LV_ACTION_RES_OK;
|
||||
}
|
||||
|
||||
#endif /*LV_APP_ENABLE != 0*/
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_app.h"
|
||||
#if LV_APP_ENABLE != 0
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@@ -33,5 +34,6 @@ void lv_app_kb_close(bool ok);
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
#endif /*LV_APP_ENABLE != 0*/
|
||||
|
||||
#endif /*LV_APP_SUP_H*/
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "img_conf.h"
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_IMG_ADD != 0 || (LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
|
||||
#if USE_IMG_ADD != 0 || LV_APP_USE_INTERNAL_ICONS == 2
|
||||
|
||||
#include <stdint.h>
|
||||
#include "misc/others/color.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "img_conf.h"
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_IMG_BATTERY_EMPTY != 0 || (LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
|
||||
#if USE_IMG_BATTERY_EMPTY != 0 || LV_APP_USE_INTERNAL_ICONS == 2
|
||||
|
||||
#include <stdint.h>
|
||||
#include "misc/others/color.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "img_conf.h"
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_IMG_BATTERY_FULL != 0 || (LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
|
||||
#if USE_IMG_BATTERY_FULL != 0 || LV_APP_USE_INTERNAL_ICONS == 2
|
||||
|
||||
#include <stdint.h>
|
||||
#include "misc/others/color.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "img_conf.h"
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_IMG_BATTERY_HALF != 0 || (LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
|
||||
#if USE_IMG_BATTERY_HALF != 0 || LV_APP_USE_INTERNAL_ICONS == 2
|
||||
|
||||
#include <stdint.h>
|
||||
#include "misc/others/color.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "img_conf.h"
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_IMG_BUBBLE != 0 || (LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
|
||||
#if USE_IMG_BUBBLE != 0 || LV_APP_USE_INTERNAL_ICONS == 2
|
||||
|
||||
#include <stdint.h>
|
||||
#include "misc/others/color.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "img_conf.h"
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_IMG_CALENDAR != 0 || (LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
|
||||
#if USE_IMG_CALENDAR != 0 || LV_APP_USE_INTERNAL_ICONS == 2
|
||||
|
||||
#include <stdint.h>
|
||||
#include "misc/others/color.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "img_conf.h"
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_IMG_CLOCK != 0 || (LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
|
||||
#if USE_IMG_CLOCK != 0 || LV_APP_USE_INTERNAL_ICONS == 2
|
||||
|
||||
#include <stdint.h>
|
||||
#include "misc/others/color.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "img_conf.h"
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_IMG_CLOSE != 0 || (LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
|
||||
#if USE_IMG_CLOSE != 0 || LV_APP_USE_INTERNAL_ICONS == 2
|
||||
|
||||
#include <stdint.h>
|
||||
#include "misc/others/color.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "img_conf.h"
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_IMG_DOWN != 0 || (LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
|
||||
#if USE_IMG_DOWN != 0 || LV_APP_USE_INTERNAL_ICONS == 2
|
||||
|
||||
#include <stdint.h>
|
||||
#include "misc/others/color.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "img_conf.h"
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_IMG_DRIVER != 0 || (LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
|
||||
#if USE_IMG_DRIVER != 0 || LV_APP_USE_INTERNAL_ICONS == 2
|
||||
|
||||
#include <stdint.h>
|
||||
#include "misc/others/color.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "img_conf.h"
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_IMG_EJECT != 0 || (LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
|
||||
#if USE_IMG_EJECT != 0 || LV_APP_USE_INTERNAL_ICONS == 2
|
||||
|
||||
#include <stdint.h>
|
||||
#include "misc/others/color.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "img_conf.h"
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_IMG_FOLDER != 0 || (LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
|
||||
#if USE_IMG_FOLDER != 0 || LV_APP_USE_INTERNAL_ICONS == 2
|
||||
|
||||
#include <stdint.h>
|
||||
#include "misc/others/color.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "img_conf.h"
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_IMG_IMAGE != 0 || (LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
|
||||
#if USE_IMG_IMAGE != 0 || LV_APP_USE_INTERNAL_ICONS == 2
|
||||
|
||||
#include <stdint.h>
|
||||
#include "misc/others/color.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "img_conf.h"
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_IMG_LEFT != 0 || (LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
|
||||
#if USE_IMG_LEFT != 0 || LV_APP_USE_INTERNAL_ICONS == 2
|
||||
|
||||
#include <stdint.h>
|
||||
#include "misc/others/color.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "img_conf.h"
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_IMG_MUSIC != 0 || (LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
|
||||
#if USE_IMG_MUSIC != 0 || LV_APP_USE_INTERNAL_ICONS == 2
|
||||
|
||||
#include <stdint.h>
|
||||
#include "misc/others/color.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "img_conf.h"
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_IMG_OK != 0 || (LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
|
||||
#if USE_IMG_OK != 0 || LV_APP_USE_INTERNAL_ICONS == 2
|
||||
|
||||
#include <stdint.h>
|
||||
#include "misc/others/color.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "img_conf.h"
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_IMG_PLAY != 0 || (LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
|
||||
#if USE_IMG_PLAY != 0 || LV_APP_USE_INTERNAL_ICONS == 2
|
||||
|
||||
#include <stdint.h>
|
||||
#include "misc/others/color.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "img_conf.h"
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_IMG_RIGHT != 0 || (LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
|
||||
#if USE_IMG_RIGHT != 0 || LV_APP_USE_INTERNAL_ICONS == 2
|
||||
|
||||
#include <stdint.h>
|
||||
#include "misc/others/color.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "img_conf.h"
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_IMG_SETTINGS != 0 || (LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
|
||||
#if USE_IMG_SETTINGS != 0 || LV_APP_USE_INTERNAL_ICONS == 2
|
||||
|
||||
#include <stdint.h>
|
||||
#include "misc/others/color.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "img_conf.h"
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_IMG_SHUT_DOWN != 0 || (LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
|
||||
#if USE_IMG_SHUT_DOWN != 0 || LV_APP_USE_INTERNAL_ICONS == 2
|
||||
|
||||
#include <stdint.h>
|
||||
#include "misc/others/color.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "img_conf.h"
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_IMG_STAR != 0 || (LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
|
||||
#if USE_IMG_STAR != 0 || LV_APP_USE_INTERNAL_ICONS == 2
|
||||
|
||||
#include <stdint.h>
|
||||
#include "misc/others/color.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "img_conf.h"
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_IMG_UP != 0 || (LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
|
||||
#if USE_IMG_UP != 0 || LV_APP_USE_INTERNAL_ICONS == 2
|
||||
|
||||
#include <stdint.h>
|
||||
#include "misc/others/color.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "img_conf.h"
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_IMG_USER != 0 || (LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
|
||||
#if USE_IMG_USER != 0 || LV_APP_USE_INTERNAL_ICONS == 2
|
||||
|
||||
#include <stdint.h>
|
||||
#include "misc/others/color.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "img_conf.h"
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_IMG_VIDEO != 0 || (LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
|
||||
#if USE_IMG_VIDEO != 0 || LV_APP_USE_INTERNAL_ICONS == 2
|
||||
|
||||
#include <stdint.h>
|
||||
#include "misc/others/color.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "img_conf.h"
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_IMG_VOLUME != 0 || (LV_APP_USE_INTERNAL_ICONS != 0 && LV_DOWNSCALE == 2)
|
||||
#if USE_IMG_VOLUME != 0 || LV_APP_USE_INTERNAL_ICONS == 2
|
||||
|
||||
#include <stdint.h>
|
||||
#include "misc/others/color.h"
|
||||
|
||||
Reference in New Issue
Block a user