v1.0.3
21
packages/artinchip/lvgl-ui/aic_demo/launcher_demo/SConscript
Normal file
@@ -0,0 +1,21 @@
|
||||
from building import *
|
||||
import os
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
group = []
|
||||
src = []
|
||||
CPPPATH = [cwd]
|
||||
|
||||
src += Glob('./launcher_ui.c')
|
||||
src += Glob('./launcher_screen.c')
|
||||
src += Glob('./camera_screen.c')
|
||||
|
||||
list = os.listdir(cwd)
|
||||
for d in list:
|
||||
path = os.path.join(cwd, d)
|
||||
if os.path.isfile(os.path.join(path, 'SConscript')):
|
||||
group = group + SConscript(os.path.join(d, 'SConscript'))
|
||||
|
||||
group = group + DefineGroup('LVGL-port', src, depend = ['AIC_LVGL_LAUNCHER_DEMO'], CPPPATH = CPPPATH)
|
||||
|
||||
Return('group')
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2023 ArtinChip Technology Co., Ltd.
|
||||
* Authors: Ning Fang <ning.fang@artinchip.com>
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/time.h>
|
||||
#include "lvgl.h"
|
||||
#include "aic_ui.h"
|
||||
#include "launcher_ui.h"
|
||||
#include "camera_screen.h"
|
||||
|
||||
FAKE_IMAGE_DECLARE(bg_dark);
|
||||
|
||||
static void back_event_cb(lv_event_t *e)
|
||||
{
|
||||
lv_event_code_t code = (lv_event_code_t)lv_event_get_code(e);
|
||||
|
||||
if (code == LV_EVENT_CLICKED) {
|
||||
// back to launcher screen
|
||||
lv_scr_load(scr_launcher);
|
||||
}
|
||||
}
|
||||
|
||||
lv_obj_t *camera_screen_init(void)
|
||||
{
|
||||
scr_camera = lv_obj_create(NULL);
|
||||
lv_obj_clear_flag(scr_camera, LV_OBJ_FLAG_SCROLLABLE);
|
||||
|
||||
FAKE_IMAGE_INIT(bg_dark, 480, 272, 0, 0x00000000);
|
||||
|
||||
lv_obj_t *img_bg = lv_img_create(scr_camera);
|
||||
lv_img_set_src(img_bg, FAKE_IMAGE_NAME(bg_dark));
|
||||
lv_obj_set_pos(img_bg, 0, 0);
|
||||
|
||||
static lv_style_t style_pr;
|
||||
lv_style_init(&style_pr);
|
||||
lv_style_set_translate_x(&style_pr, 2);
|
||||
lv_style_set_translate_y(&style_pr, 2);
|
||||
|
||||
lv_obj_t *back_btn = lv_imgbtn_create(scr_camera);
|
||||
lv_imgbtn_set_src(back_btn, LV_IMGBTN_STATE_RELEASED , NULL, LVGL_PATH(Back.png), NULL);
|
||||
lv_imgbtn_set_src(back_btn, LV_IMGBTN_STATE_PRESSED , NULL, LVGL_PATH(Back.png), NULL);
|
||||
lv_obj_set_pos(back_btn, 10, 10);
|
||||
lv_obj_set_size(back_btn, 32, 32);
|
||||
lv_obj_add_style(back_btn, &style_pr, LV_STATE_PRESSED);
|
||||
|
||||
lv_obj_add_event_cb(back_btn, back_event_cb, LV_EVENT_ALL, NULL);
|
||||
|
||||
return scr_camera;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2023 ArtinChip Technology Co., Ltd.
|
||||
* Authors: Ning Fang <ning.fang@artinchip.com>
|
||||
*/
|
||||
|
||||
#ifndef CAMERA_SCREEN_H
|
||||
#define CAMERA_SCREEN_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "lvgl.h"
|
||||
|
||||
lv_obj_t *camera_screen_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif //CAMERA_SCREEN_H
|
||||
@@ -0,0 +1,200 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2023 ArtinChip Technology Co., Ltd.
|
||||
* Authors: Ning Fang <ning.fang@artinchip.com>
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/time.h>
|
||||
#include "lvgl.h"
|
||||
#include "aic_ui.h"
|
||||
#include "launcher_screen.h"
|
||||
#include "launcher_ui.h"
|
||||
|
||||
static void launcher_tapview_event(lv_event_t * e)
|
||||
{
|
||||
lv_obj_t * tapview = lv_event_get_target(e);
|
||||
lv_event_code_t code = lv_event_get_code(e);
|
||||
|
||||
if (code == LV_EVENT_VALUE_CHANGED) {
|
||||
int tab_num;
|
||||
|
||||
tab_num = lv_tabview_get_tab_act(tapview);
|
||||
(void)tab_num;
|
||||
//printf("tab_num:%d\n", tab_num);
|
||||
}
|
||||
}
|
||||
|
||||
static void camera_event_cb(lv_event_t *e)
|
||||
{
|
||||
lv_event_code_t code = (lv_event_code_t)lv_event_get_code(e);
|
||||
|
||||
if (code == LV_EVENT_CLICKED) {
|
||||
// load camera screen
|
||||
lv_scr_load(scr_camera);
|
||||
}
|
||||
}
|
||||
|
||||
lv_obj_t *launcher_screen_init(void)
|
||||
{
|
||||
scr_launcher = lv_obj_create(NULL);
|
||||
lv_obj_clear_flag(scr_launcher, LV_OBJ_FLAG_SCROLLABLE);
|
||||
|
||||
lv_obj_t *img_bg = lv_img_create(scr_launcher);
|
||||
lv_img_set_src(img_bg, LVGL_PATH(bg.jpg));
|
||||
lv_obj_set_pos(img_bg, 0, 0);
|
||||
|
||||
lv_obj_t *tab_sub = lv_tabview_create(scr_launcher, LV_DIR_TOP, 0);
|
||||
lv_obj_set_pos(tab_sub, 0, 0);
|
||||
lv_obj_set_style_bg_opa(tab_sub, LV_OPA_0, 0);
|
||||
|
||||
lv_obj_t *sub_tab0 = lv_tabview_add_tab(tab_sub, "lancher page 0");
|
||||
lv_obj_t *sub_tab1 = lv_tabview_add_tab(tab_sub, "lancher page 1");
|
||||
|
||||
static lv_style_t style_pr;
|
||||
lv_style_init(&style_pr);
|
||||
lv_style_set_translate_x(&style_pr, 2);
|
||||
lv_style_set_translate_y(&style_pr, 2);
|
||||
|
||||
lv_obj_t *sub_image00 = lv_imgbtn_create(sub_tab0);
|
||||
lv_imgbtn_set_src(sub_image00, LV_IMGBTN_STATE_RELEASED , NULL, LVGL_PATH(Camera.png), NULL);
|
||||
lv_imgbtn_set_src(sub_image00, LV_IMGBTN_STATE_PRESSED , NULL, LVGL_PATH(Camera.png), NULL);
|
||||
lv_obj_set_pos(sub_image00, 30, 25);
|
||||
lv_obj_set_size(sub_image00, 64, 64);
|
||||
lv_obj_add_style(sub_image00, &style_pr, LV_STATE_PRESSED);
|
||||
|
||||
lv_obj_t *image00_name = lv_label_create(sub_tab0);
|
||||
lv_obj_set_width(image00_name, LV_SIZE_CONTENT);
|
||||
lv_obj_set_height(image00_name, LV_SIZE_CONTENT);
|
||||
lv_obj_set_pos(image00_name, 30 + 2, 25 + 64 + 2);
|
||||
lv_label_set_text(image00_name, "Camera");
|
||||
lv_obj_set_style_text_color(image00_name, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_opa(image00_name, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
lv_obj_t *sub_image01 = lv_imgbtn_create(sub_tab0);
|
||||
lv_imgbtn_set_src(sub_image01, LV_IMGBTN_STATE_RELEASED , NULL, LVGL_PATH(Activity_Monitor.png), NULL);
|
||||
lv_imgbtn_set_src(sub_image01, LV_IMGBTN_STATE_PRESSED , NULL, LVGL_PATH(Activity_Monitor.png), NULL);
|
||||
lv_obj_set_pos(sub_image01, 30 + 64 + 44, 25);
|
||||
lv_obj_set_size(sub_image01, 64, 64);
|
||||
lv_obj_add_style(sub_image01, &style_pr, LV_STATE_PRESSED);
|
||||
|
||||
lv_obj_t *image01_name = lv_label_create(sub_tab0);
|
||||
lv_obj_set_width(image01_name, LV_SIZE_CONTENT);
|
||||
lv_obj_set_height(image01_name, LV_SIZE_CONTENT);
|
||||
lv_obj_set_pos(image01_name, 30 + 3 + 64 + 44, 25 + 64 + 2);
|
||||
lv_label_set_text(image01_name, "Monitor");
|
||||
lv_obj_set_style_text_color(image01_name, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_opa(image01_name, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
lv_obj_t *sub_image02 = lv_imgbtn_create(sub_tab0);
|
||||
lv_imgbtn_set_src(sub_image02, LV_IMGBTN_STATE_RELEASED , NULL, LVGL_PATH(Downloads.png), NULL);
|
||||
lv_imgbtn_set_src(sub_image02, LV_IMGBTN_STATE_PRESSED , NULL, LVGL_PATH(Downloads.png), NULL);
|
||||
lv_obj_set_pos(sub_image02, 30 + 64 + 44 + 64 + 44, 25);
|
||||
lv_obj_set_size(sub_image02, 64, 64);
|
||||
lv_obj_add_style(sub_image02, &style_pr, LV_STATE_PRESSED);
|
||||
|
||||
lv_obj_t *image02_name = lv_label_create(sub_tab0);
|
||||
lv_obj_set_width(image02_name, LV_SIZE_CONTENT);
|
||||
lv_obj_set_height(image02_name, LV_SIZE_CONTENT);
|
||||
lv_obj_set_pos(image02_name, 30 + 64 + 44 + 64 + 44 - 8, 25 + 64 + 2);
|
||||
lv_label_set_text(image02_name, "Downloads");
|
||||
lv_obj_set_style_text_color(image02_name, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_opa(image02_name, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
lv_obj_t *sub_image03 = lv_imgbtn_create(sub_tab0);
|
||||
lv_imgbtn_set_src(sub_image03, LV_IMGBTN_STATE_RELEASED , NULL, LVGL_PATH(iChat.png), NULL);
|
||||
lv_imgbtn_set_src(sub_image03, LV_IMGBTN_STATE_PRESSED , NULL, LVGL_PATH(iChat.png), NULL);
|
||||
lv_obj_set_pos(sub_image03, 30 + 64 + 44 + 64 + 44 + 64 + 44, 25);
|
||||
lv_obj_set_size(sub_image03, 64, 64);
|
||||
lv_obj_add_style(sub_image03, &style_pr, LV_STATE_PRESSED);
|
||||
|
||||
lv_obj_t *image03_name = lv_label_create(sub_tab0);
|
||||
lv_obj_set_width(image03_name, LV_SIZE_CONTENT);
|
||||
lv_obj_set_height(image03_name, LV_SIZE_CONTENT);
|
||||
lv_obj_set_pos(image03_name, 30 + 15 + 64 + 44 + 64 + 44 + 64 + 44, 25 + 64 + 2);
|
||||
lv_label_set_text(image03_name, "iChat");
|
||||
lv_obj_set_style_text_color(image03_name, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_opa(image03_name, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
lv_obj_t *sub_image04 = lv_imgbtn_create(sub_tab0);
|
||||
lv_imgbtn_set_src(sub_image04, LV_IMGBTN_STATE_RELEASED , NULL, LVGL_PATH(Calculator.png), NULL);
|
||||
lv_imgbtn_set_src(sub_image04, LV_IMGBTN_STATE_PRESSED , NULL, LVGL_PATH(Calculator.png), NULL);
|
||||
lv_obj_set_pos(sub_image04, 30, 40 + 100);
|
||||
lv_obj_set_size(sub_image04, 64, 64);
|
||||
lv_obj_add_style(sub_image04, &style_pr, LV_STATE_PRESSED);
|
||||
|
||||
lv_obj_t *image04_name = lv_label_create(sub_tab0);
|
||||
lv_obj_set_width(image04_name, LV_SIZE_CONTENT);
|
||||
lv_obj_set_height(image04_name, LV_SIZE_CONTENT);
|
||||
lv_obj_set_pos(image04_name, 30 - 5, 40 + 100 + 64 + 2);
|
||||
lv_label_set_text(image04_name, "Calculator");
|
||||
lv_obj_set_style_text_color(image04_name, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_opa(image04_name, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
lv_obj_t *sub_image05 = lv_imgbtn_create(sub_tab0);
|
||||
lv_imgbtn_set_src(sub_image05, LV_IMGBTN_STATE_RELEASED , NULL, LVGL_PATH(Mail.png), NULL);
|
||||
lv_imgbtn_set_src(sub_image05, LV_IMGBTN_STATE_PRESSED , NULL, LVGL_PATH(Mail.png), NULL);
|
||||
lv_obj_set_pos(sub_image05, 30 + 64 + 44, 40 + 100);
|
||||
lv_obj_set_size(sub_image05, 64, 64);
|
||||
lv_obj_add_style(sub_image05, &style_pr, LV_STATE_PRESSED);
|
||||
|
||||
lv_obj_t *image05_name = lv_label_create(sub_tab0);
|
||||
lv_obj_set_width(image05_name, LV_SIZE_CONTENT);
|
||||
lv_obj_set_height(image05_name, LV_SIZE_CONTENT);
|
||||
lv_obj_set_pos(image05_name, 30 + 13 + 64 + 44, 40 + 100 + 64 + 2);
|
||||
lv_label_set_text(image05_name, "Mail");
|
||||
lv_obj_set_style_text_color(image05_name, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_opa(image05_name, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
lv_obj_t *sub_image06 = lv_imgbtn_create(sub_tab0);
|
||||
lv_imgbtn_set_src(sub_image06, LV_IMGBTN_STATE_RELEASED , NULL, LVGL_PATH(Maps.png), NULL);
|
||||
lv_imgbtn_set_src(sub_image06, LV_IMGBTN_STATE_PRESSED , NULL, LVGL_PATH(Maps.png), NULL);
|
||||
lv_obj_set_pos(sub_image06, 30 + 64 + 44 + 64 + 44, 40 + 100);
|
||||
lv_obj_set_size(sub_image06, 64, 64);
|
||||
lv_obj_add_style(sub_image06, &style_pr, LV_STATE_PRESSED);
|
||||
|
||||
lv_obj_t *image06_name = lv_label_create(sub_tab0);
|
||||
lv_obj_set_width(image06_name, LV_SIZE_CONTENT);
|
||||
lv_obj_set_height(image06_name, LV_SIZE_CONTENT);
|
||||
lv_obj_set_pos(image06_name, 30 + 64 + 44 + 64 + 44 + 10, 40 + 100 + 64 + 2);
|
||||
lv_label_set_text(image06_name, "Maps");
|
||||
lv_obj_set_style_text_color(image06_name, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_opa(image06_name, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
lv_obj_t *sub_image07 = lv_imgbtn_create(sub_tab0);
|
||||
lv_imgbtn_set_src(sub_image07, LV_IMGBTN_STATE_RELEASED , NULL, LVGL_PATH(Tools.png), NULL);
|
||||
lv_imgbtn_set_src(sub_image07, LV_IMGBTN_STATE_PRESSED , NULL, LVGL_PATH(Tools.png), NULL);
|
||||
lv_obj_set_pos(sub_image07, 30 + 64 + 44 + 64 + 44 + 64 + 44, 40 + 100);
|
||||
lv_obj_set_size(sub_image07, 64, 64);
|
||||
lv_obj_add_style(sub_image07, &style_pr, LV_STATE_PRESSED);
|
||||
|
||||
lv_obj_t *image07_name = lv_label_create(sub_tab0);
|
||||
lv_obj_set_width(image07_name, LV_SIZE_CONTENT);
|
||||
lv_obj_set_height(image07_name, LV_SIZE_CONTENT);
|
||||
lv_obj_set_pos(image07_name, 30 + 10 + 64 + 44 + 64 + 44 + 64 + 44, 40 + 100 + 64 + 2);
|
||||
lv_label_set_text(image07_name, "Tools");
|
||||
lv_obj_set_style_text_color(image07_name, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_opa(image07_name, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
lv_obj_t *sub_image10 = lv_imgbtn_create(sub_tab1);
|
||||
lv_imgbtn_set_src(sub_image10, LV_IMGBTN_STATE_RELEASED , NULL, LVGL_PATH(Weather.png), NULL);
|
||||
lv_imgbtn_set_src(sub_image10, LV_IMGBTN_STATE_PRESSED , NULL, LVGL_PATH(Weather.png), NULL);
|
||||
lv_obj_set_pos(sub_image10, 30, 25);
|
||||
lv_obj_set_size(sub_image10, 64, 64);
|
||||
lv_obj_add_style(sub_image10, &style_pr, LV_STATE_PRESSED);
|
||||
|
||||
lv_obj_t *image10_name = lv_label_create(sub_tab1);
|
||||
lv_obj_set_width(image10_name, LV_SIZE_CONTENT);
|
||||
lv_obj_set_height(image10_name, LV_SIZE_CONTENT);
|
||||
lv_obj_set_pos(image10_name, 30, 25 + 64 + 5);
|
||||
lv_label_set_text(image10_name, "Weather");
|
||||
lv_obj_set_style_text_color(image10_name, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_opa(image10_name, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
lv_obj_add_event_cb(tab_sub, launcher_tapview_event, LV_EVENT_ALL, NULL);
|
||||
lv_obj_add_event_cb(sub_image00, camera_event_cb, LV_EVENT_ALL, NULL);
|
||||
|
||||
return scr_launcher;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2023 ArtinChip Technology Co., Ltd.
|
||||
* Authors: Ning Fang <ning.fang@artinchip.com>
|
||||
*/
|
||||
|
||||
#ifndef LAUNCHER_SCREEN_H
|
||||
#define LAUNCHER_SCREEN_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "lvgl.h"
|
||||
|
||||
lv_obj_t *launcher_screen_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif //LAUNCHER_SCREEN_H
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2023 ArtinChip Technology Co., Ltd.
|
||||
* Authors: Ning Fang <ning.fang@artinchip.com>
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/time.h>
|
||||
#include "lvgl.h"
|
||||
#include "launcher_ui.h"
|
||||
#include "launcher_screen.h"
|
||||
#include "camera_screen.h"
|
||||
#include "aic_ui.h"
|
||||
|
||||
lv_obj_t *scr_launcher;
|
||||
lv_obj_t *scr_camera;
|
||||
|
||||
void launcher_ui_init()
|
||||
{
|
||||
scr_launcher = launcher_screen_init();
|
||||
scr_camera = camera_screen_init();
|
||||
|
||||
lv_scr_load(scr_launcher);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2023 ArtinChip Technology Co., Ltd.
|
||||
* Authors: Ning Fang <ning.fang@artinchip.com>
|
||||
*/
|
||||
|
||||
#ifndef LAUNCHER_UI_H
|
||||
#define LAUNCHER_UI_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "lvgl.h"
|
||||
#include "aic_ui.h"
|
||||
|
||||
// for screen size 480 x 272
|
||||
void launcher_ui_init();
|
||||
|
||||
extern lv_obj_t *scr_launcher;
|
||||
extern lv_obj_t *scr_camera;
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif //LAUNCHER_UI_H
|
||||
|
After Width: | Height: | Size: 9.8 KiB |
|
After Width: | Height: | Size: 482 B |
|
After Width: | Height: | Size: 7.7 KiB |
|
After Width: | Height: | Size: 6.7 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 6.1 KiB |
|
After Width: | Height: | Size: 7.3 KiB |
|
After Width: | Height: | Size: 9.3 KiB |
|
After Width: | Height: | Size: 7.0 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 4.4 KiB |