summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--microinteraction/PROTO/circle.pngbin0 -> 5179 bytes
-rw-r--r--microinteraction/PROTO/main.cpp44
-rw-r--r--microinteraction/PROTO/main.h3
-rw-r--r--microinteraction/PROTO/makefile2
-rw-r--r--microinteraction/PROTO/sample1.cpp137
-rw-r--r--microinteraction/PROTO/sample2.cpp115
-rw-r--r--microinteraction/PROTO/sample3.cpp76
-rw-r--r--microinteraction/PROTO/script1.mi51
-rw-r--r--microinteraction/PROTO/script2.mi39
-rw-r--r--microinteraction/PROTO/script3.mi28
-rw-r--r--microinteraction/README.md2
-rwxr-xr-xmicrointeraction/showcase/AjarParchedIzuthrush-small.gifbin0 -> 250844 bytes
-rwxr-xr-xmicrointeraction/showcase/be001dc1e64befa71864227600907889.gifbin0 -> 4707983 bytes
-rwxr-xr-xmicrointeraction/showcase/comp_1.gifbin0 -> 1351463 bytes
14 files changed, 497 insertions, 0 deletions
diff --git a/microinteraction/PROTO/circle.png b/microinteraction/PROTO/circle.png
new file mode 100644
index 0000000..730a777
--- /dev/null
+++ b/microinteraction/PROTO/circle.png
Binary files differ
diff --git a/microinteraction/PROTO/main.cpp b/microinteraction/PROTO/main.cpp
new file mode 100644
index 0000000..ed7744f
--- /dev/null
+++ b/microinteraction/PROTO/main.cpp
@@ -0,0 +1,44 @@
1#define EFL_BETA_API_SUPPORT 1
2
3#include <Efl_Ui.h>
4#include <Elementary.h>
5#include "main.h"
6
7#define WIDTH 360
8#define HEIGHT 360
9
10static void
11win_del_cb(void *data, const Efl_Event *event)
12{
13 elm_exit();
14}
15
16int
17main(int argc, char **argv)
18{
19 elm_init(argc, argv);
20 elm_config_accel_preference_set("gl");
21
22 //Window
23 Eo *win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get());
24 efl_text_set(win, "MicroInteraction");
25 efl_ui_win_autodel_set(win, EINA_TRUE);
26 efl_event_callback_add(win, EFL_UI_WIN_EVENT_DELETE_REQUEST, win_del_cb, 0);
27 efl_gfx_entity_size_set(win, EINA_SIZE2D(WIDTH, HEIGHT));
28 efl_gfx_entity_visible_set(win, true);
29
30 sample1(win);
31
32 //Circle
33 Eo *circle = efl_add(EFL_UI_IMAGE_CLASS, win);
34 efl_file_simple_load(circle, "circle.png", NULL);
35 efl_gfx_entity_visible_set(circle, EINA_TRUE);
36 efl_gfx_entity_size_set(circle, EINA_SIZE2D(WIDTH, HEIGHT));
37 efl_gfx_entity_visible_set(circle, true);
38 efl_gfx_stack_layer_set(circle, EFL_GFX_STACK_LAYER_MAX);
39
40 elm_run();
41 elm_shutdown();
42
43 return 0;
44}
diff --git a/microinteraction/PROTO/main.h b/microinteraction/PROTO/main.h
new file mode 100644
index 0000000..426c35c
--- /dev/null
+++ b/microinteraction/PROTO/main.h
@@ -0,0 +1,3 @@
1void sample1(Eo *parent);
2void sample2(Eo *parent);
3void sample3(Eo *parent);
diff --git a/microinteraction/PROTO/makefile b/microinteraction/PROTO/makefile
new file mode 100644
index 0000000..ca8b0ba
--- /dev/null
+++ b/microinteraction/PROTO/makefile
@@ -0,0 +1,2 @@
1all:
2 gcc -o sample main.cpp -g `pkg-config --cflags --libs elementary`
diff --git a/microinteraction/PROTO/sample1.cpp b/microinteraction/PROTO/sample1.cpp
new file mode 100644
index 0000000..f3b33ae
--- /dev/null
+++ b/microinteraction/PROTO/sample1.cpp
@@ -0,0 +1,137 @@
1#if 1
2/***********************************************************
3 * Button
4 ***********************************************************/
5static void
6button_mi_trigger_cb(void *data, const Efl_Event *event)
7{
8 Eo *button = event->object;
9 efl_part_set(efl_part(button, "upload"), "UPLOAD");
10 efl_font_size_set(efl_part(button, "upload"), 20);
11 efl_font_weight_set(efl_part(button, "upload"), EFL_TEXT_FONT_WEIGHT_BOLD);
12}
13
14static void
15button_gesture_tap_cb(void *data, const Efl_Event *event)
16{
17 Eo *controller = efl_mi_state_controller_get(event->object);
18 //Trigger Button -> Progress Transition
19 efl_mi_controller_trigger_next(controller);
20}
21
22static void
23button_mi_feedback_cb(void *data, const Efl_Event *event)
24{
25 Efl_Mi_Feedback *feedback = event->info;
26 if (feedback->progress< 0.5) return;
27
28 //Upload -> Uploading
29 Eo *button = event->object;
30 efl_part_set(efl_part(button, "upload"), "UPLOADING");
31 efl_font_size_set(efl_part(button, "upload"), 12);
32}
33
34/***********************************************************
35 * Progress
36 ***********************************************************/
37static void
38progress_mi_trigger_cb(void *data, const Efl_Event *event)
39{
40 Eo *progress = event->object;
41 Eo *controller = efl_mi_state_controller_get(progress);
42
43 efl_text_set(efl_part(progress, "progress"), "0%");
44 efl_font_size_set(efl_part(progress, "progress"), 40);
45 efl_font_weight_set(efl_part(progress, "progress"), EFL_TEXT_FONT_WEIGHT_BOLD);
46
47 //Trigger Progress Transition
48 efl_mi_controller_trigger_next(controller);
49}
50
51static void
52progress_mi_feedback_cb(void *data, const Efl_Event *event)
53{
54 Eo *progress = event->object;
55
56 char buf[10];
57 snprintf(buf, sizeof(buf), "%d%", event->progress * 100);
58 efl_text_set(efl_part(progress, "progress"), buf);
59}
60
61static void
62progress_mi_feedback_done_cb(void *data, const Efl_Event *event)
63{
64 //100% DONE!, DO SOMETHING?
65}
66
67/*
68 When tapping, this progress is paused, and resume when tapping again.
69*/
70static void
71progress_gesture_tap_cb(void *data, const Efl_Event *event)
72{
73 Eo *controller = efl_mi_state_controller_get(event->object);
74 //Toggle Freeze/Thaw
75 efl_mi_controller_freeze_set(controller,
76 !efl_mi_controller_freeze_get(controller));
77}
78
79/*
80 When double tapping, this progress is cancelled, it returns to button status.
81 button_mi_trigger_cb() -> button_mi_feedback_cb() with reverse progress will be called.
82*/
83static void
84progress_gesture_double_tap_cb(void *data, const Efl_Event *event)
85{
86 Eo *controller = efl_mi_state_controller_get(event->object);
87 efl_mi_controller_trigger_prev(controller);
88}
89
90
91/*****************************************************************
92 * Entry:
93 * This sample has two states: Button -> Progress
94 * When button is clicked, it transits to upload status.
95 * When uploading is reached to 100%, it finishes.
96 *****************************************************************/
97void
98sample1(Eo *parent)
99{
100 //Controller
101 Eo *controller = efl_add(EFL_MI_CONTROLLER_CLASS, parent);
102 efl_file_simple_load(controller, "sample1.json");
103 efl_mi_controller_repeat_mode_set(controller, EFL_MI_CONTROLLER_REPEAT_NONE); //None, Loop, Toggle
104 efl_gfx_entity_visible_set(controller, EINA_TRUE);
105 efl_content_set(win, controller);
106
107 //State1: Button
108 Eo *button = efl_add(EFL_MI_STATE_CLASS, controller);
109 efl_event_callback_add(button, EFL_EVENT_GESTURE_TAP, button_gesture_tap_cb, NULL);
110 efl_event_callback_add(button, EFL_EVENT_MI_TRIGGER, button_mi_trigger_cb, NULL);
111 efl_event_callback_add(button, EFL_EVENT_MI_FEEDBACK, button_mi_feedback_cb, NULL);
112
113 efl_mi_controller_state_add(controller, button, "button", 0); //The number is priority
114
115 //State2: Progress
116 Eo *progress = efl_add(EFL_MI_STATE_CLASS, controller);
117 efl_event_callback_add(progress, EFL_EVENT_MI_TRIGGER, progress_mi_trigger_cb, NULL);
118 efl_event_callback_add(progress, EFL_EVENT_GESTURE_TAP, progress_gesture_tap_cb, NULL);
119 efl_event_callback_add(progress, EFL_EVENT_GESTURE_DOUBLE_TAP, progress_gesture_double_tap_cb, NULL);
120 efl_event_callback_add(progress, EFL_EVENT_MI_FEEDBACK, progress_mi_feedback_cb, NULL);
121 efl_event_callback_add(progress, EFL_EVENT_MI_FEEDBACK_DONE, progress_mi_feedback_done_cb, NULL);
122
123 efl_mi_controller_state_add(controller, progress, "progress", 1);
124
125 //All setting completed, Activate this controller. (last argument is animation on/off)
126 efl_mi_controller_trigger(controller, "button", EINA_FALSE);
127}
128#else
129void
130sample1(Eo *parent)
131{
132 Eo *controller = efl_add(EFL_MI_CONTROLLER_CLASS, parent);
133 efl_file_simple_load(controller, "script1.mi");
134 efl_gfx_entity_visible_set(controller, EINA_TRUE);
135 efl_content_set(win, controller);
136}
137#endif
diff --git a/microinteraction/PROTO/sample2.cpp b/microinteraction/PROTO/sample2.cpp
new file mode 100644
index 0000000..df214be
--- /dev/null
+++ b/microinteraction/PROTO/sample2.cpp
@@ -0,0 +1,115 @@
1/***********************************************************
2 * Ready
3 ***********************************************************/
4static void
5ready_gesture_tap_cb(void *data, const Efl_Event *event)
6{
7 Eo *controller = efl_mi_state_controller_get(event->object);
8
9 //Trigger Menu
10 efl_mi_controller_trigger_next(controller);
11}
12
13/***********************************************************
14 * Menu
15 ***********************************************************/
16static void
17menu_left_gesture_tap_cb(void *data, const Efl_Event *event)
18{
19 //Trigger Left Active
20 Eo *controller = efl_mi_state_controller_get(event->object);
21 efl_mi_controller_trigger(controller, "lactive", EINA_TRUE);
22}
23
24static void
25menu_right_gesture_tap_cb(void *data, const Efl_Event *event)
26{
27 //Trigger Right Active
28 Eo *controller = efl_mi_state_controller_get(event->object);
29 efl_mi_controller_trigger(controller, "ractive", EINA_TRUE);
30}
31
32static void
33menu_center_gesture_tap_cb(void *data, const Efl_Event *event)
34{
35 //Return previous state
36 Eo *controller = efl_mi_state_controller_get(event->object);
37 efl_mi_controller_trigger_prev(controller);
38}
39
40/***********************************************************
41 * Left Activated
42 ***********************************************************/
43static void
44lactive_feedback_done_cb(void *data, const Efl_Event *event)
45{
46 //Left Activated!, DO SOMETHING?
47}
48
49/***********************************************************
50 * Right Activated
51 ***********************************************************/
52static void
53ractive_feedback_done_cb(void *data, const Efl_Event *event)
54{
55 //Right Activated!, DO SOMETHING?
56}
57
58
59/**************************************************************************************************************
60 * Entry:
61 * This sample has three states: Center Button -> Center Button + 2 Button Siblings -> Each sibling activation
62 **************************************************************************************************************/
63void
64sample2(Eo *parent)
65{
66 //Controller
67 Eo *controller = efl_add(EFL_MI_CONTROLLER_CLASS, parent);
68 efl_file_simple_load(controller, "sample2.json");
69 efl_mi_controller_repeat_mode_set(controller, EFL_MI_CONTROLLER_REPEAT_NONE);
70 efl_gfx_entity_visible_set(controller, EINA_TRUE);
71 efl_content_set(win, controller);
72
73 //State1: Ready
74 {
75 Eo *ready = efl_add(EFL_MI_STATE_CLASS, controller);
76 efl_event_callback_add(ready, EFL_EVENT_GESTURE_TAP, ready_gesture_tap_cb, NULL);
77 efl_mi_controller_state_add(controller, ready, "ready", 0);
78 }
79
80 //State2: Menu
81 {
82 Eo *menu = efl_add(EFL_MI_STATE_CLASS, controller);
83
84 //Rule1: Left
85 Eo *left = efl_add(EFL_MI_RULE_CLASS, menu, efl_mi_rule_name_set(efl_added, "left"));
86 efl_event_callback_add(left, EFL_EVENT_GESTURE_TAP, menu_left_gesture_tap_cb, NULL);
87
88 //Rule2: Right
89 Eo *right = efl_add(EFL_MI_RULE_CLASS, menu, efl_mi_rule_name_set(efl_added, "right"));
90 efl_event_callback_add(right, EFL_EVENT_GESTURE_TAP, menu_right_gesture_tap_cb, NULL);
91
92 //Rule3: Center
93 Eo *center = efl_add(EFL_MI_RULE_CLASS, menu, efl_mi_rule_name_set(efl_added, "center"));
94 efl_event_callback_add(center, EFL_EVENT_GESTURE_TAP, menu_center_gesture_tap_cb, NULL);
95
96 efl_mi_controller_state_add(controller, menu, "menu", 1);
97 }
98
99 //State3: Left Active
100 {
101 Eo *lactive = efl_add(EFL_MI_STATE_CLASS, controller);
102 efl_event_callback_add(lactive, EFL_EVENT_MI_FEEDBACK_DONE, lactive_feedback_done_cb, NULL);
103 efl_mi_controller_state_add(controller, lactive, "lactive", 2);
104 }
105
106 //State4: Right Active
107 {
108 Eo *ractive = efl_add(EFL_MI_STATE_CLASS, controller);
109 efl_event_callback_add(ractive, EFL_EVENT_MI_FEEDBACK_DONE, ractive_feedback_done_cb, NULL);
110 efl_mi_controller_state_add(controller, ractive, "ractive", 2);
111 }
112
113 //All setting completed, Activate this controller.
114 efl_mi_controller_trigger(controller, "ready", EINA_FALSE);
115}
diff --git a/microinteraction/PROTO/sample3.cpp b/microinteraction/PROTO/sample3.cpp
new file mode 100644
index 0000000..adff860
--- /dev/null
+++ b/microinteraction/PROTO/sample3.cpp
@@ -0,0 +1,76 @@
1/***********************************************************
2 * Entry View
3 ***********************************************************/
4static void
5entry_gesture_flick_cb(void *data, const Efl_Event *event)
6{
7 Efl_Canvas_Gesture *gesture = event->info;
8
9 //Flick Up => Detail View
10 double angle = efl_gesture_flick_angle_get(gesture);
11 if ((angle > 350 && angle =< 360) || (angle >= 0 && angle < 10))
12 {
13 Eo *controller = efl_mi_state_controller_get(event->object);
14 efl_mi_state_trigger(controller, "detail-view", EINA_TRUE);
15 }
16 //Flick Down => Entry View
17 else if (angle > 170 && angle < 190)
18 {
19 Eo *controller = efl_mi_state_controller_get(event->object);
20 efl_mi_state_trigger(controller, "list-view", EINA_TRUE);
21 }
22}
23
24/***********************************************************
25 * Detail View
26 ***********************************************************/
27static void
28detail_gesture_flick_cb(void *data, const Efl_Event *event)
29{
30 Efl_Canvas_Gesture *gesture = event->info;
31
32 //Flick Down => Entry View
33 double angle = efl_gesture_flick_angle_get(gesture);
34
35 if (angle > 170 && angle < 190)
36 {
37 Eo *controller = efl_mi_state_controller_get(event->object);
38 efl_mi_state_trigger(controller, "entry-view", EINA_TRUE);
39 }
40}
41
42/*********************************************************************************************
43 * Entry:
44 *********************************************************************************************/
45void
46sample3(Eo *parent)
47{
48 //Controller
49 Eo *controller = efl_add(EFL_MI_CONTROLLER_CLASS, parent);
50 efl_file_simple_load(controller, "sample3.json");
51 efl_gfx_entity_visible_set(controller, EINA_TRUE);
52 efl_content_set(win, controller);
53
54 //State1: List View
55 {
56 Eo *list = efl_add(EFL_MI_STATE_CLASS, controller);
57 efl_mi_controller_state_add(controller, list, "list-view", 0);
58 }
59
60 //State2: Entry View
61 {
62 Eo *entry = efl_add(EFL_MI_STATE_CLASS, controller);
63 efl_mi_controller_state_add(controller, entry, "entry-view", 1);
64 efl_event_callback_add(entry, EFL_EVENT_GESTURE_FLICK, entry_gesture_flick_cb, NULL);
65 }
66
67 //State3: Detail View
68 {
69 Eo *detail = efl_add(EFL_MI_STATE_CLASS, controller);
70 efl_mi_controller_state_add(controller, detail, "detail-view", 2);
71 efl_event_callback_add(button, EFL_EVENT_GESTURE_FLICK, detail_gesture_flick_cb, NULL);
72 }
73
74 //All setting completed, Activate this controller.
75 efl_mi_controller_trigger(controller, "list-view", EINA_FALSE);
76}
diff --git a/microinteraction/PROTO/script1.mi b/microinteraction/PROTO/script1.mi
new file mode 100644
index 0000000..231c436
--- /dev/null
+++ b/microinteraction/PROTO/script1.mi
@@ -0,0 +1,51 @@
1MicroInteraction {
2 Controller.mycontroller {
3 file = "sample1.json";
4 repeat = REPEAT_NONE;
5
6 State.button {
7 Trigger {
8 Text.upload {
9 text = "UPLOAD";
10 size = 20;
11 style = WEIGHT_BOLD;
12 }
13 }
14 Gesture.Tap {
15 Self.Next();
16 }
17 Feedback {
18 if (Feedback.Progress < 0.5) {
19 Text.upload {
20 text: "UPLOADING";
21 size: 12;
22 }
23 }
24 }
25 }
26 State.progress {
27 Trigger {
28 Text.progress {
29 text = "0%";
30 size = 40;
31 style = WEIGHT_BOLD;
32 }
33 Self.Next();
34 }
35 Feedback {
36 Text.progress {
37 text = Feedback.Progress + "%";
38 }
39 }
40 Feedback.Done {
41 //DO SOMETHING
42 }
43 Gesture.Tap {
44 Self.Freeze = !Self.Freeze;
45 }
46 Gesture.DoubleTap {
47 Self.Prev();
48 }
49 }
50 }
51}
diff --git a/microinteraction/PROTO/script2.mi b/microinteraction/PROTO/script2.mi
new file mode 100644
index 0000000..2e96766
--- /dev/null
+++ b/microinteraction/PROTO/script2.mi
@@ -0,0 +1,39 @@
1MicroInteraction {
2 Controller.mycontroller {
3 file = "sample2.json";
4 repeat = REPEAT_NONE;
5
6 State.ready {
7 Gesture.Tap {
8 Self.Next();
9 }
10 }
11 State.menu {
12 Rule.left {
13 Gesture.Tap {
14 Self.trigger("lactive", true);
15 }
16 }
17 Rule.right {
18 Gesture.Tap {
19 Self.trigger("ractive", true);
20 }
21 }
22 Rule.center {
23 Gesture.Tap {
24 Self.Prev();
25 }
26 }
27 }
28 State.lactive {
29 Feedback.Done {
30 //DO SOMETHING
31 }
32 }
33 State.ractive {
34 Feedback.Done {
35 //DO SOMETHING
36 }
37 }
38 }
39}
diff --git a/microinteraction/PROTO/script3.mi b/microinteraction/PROTO/script3.mi
new file mode 100644
index 0000000..9e65200
--- /dev/null
+++ b/microinteraction/PROTO/script3.mi
@@ -0,0 +1,28 @@
1MicroInteraction {
2 Controller.mycontroller {
3 file = "sample3.json";
4 repeat = REPEAT_NONE;
5
6 State.list-view {
7 Gesture.Tap {
8 Self.Next();
9 }
10 }
11
12 State.entry-view {
13 Gesture.Flick {
14 if (350 > Gesture.Flick.Angle >) {
15 Self.Trigger("entry-view, true);
16 }
17 }
18 }
19
20 State.detail-view {
21 Gesture.Flick {
22 if (190 > Gesture.Flick.Angle > 170) {
23 Self.Trigger("entry-view, true);
24 }
25 }
26 }
27 }
28}
diff --git a/microinteraction/README.md b/microinteraction/README.md
new file mode 100644
index 0000000..0ae812a
--- /dev/null
+++ b/microinteraction/README.md
@@ -0,0 +1,2 @@
1# microinteraction
2microinteraction
diff --git a/microinteraction/showcase/AjarParchedIzuthrush-small.gif b/microinteraction/showcase/AjarParchedIzuthrush-small.gif
new file mode 100755
index 0000000..bfaba70
--- /dev/null
+++ b/microinteraction/showcase/AjarParchedIzuthrush-small.gif
Binary files differ
diff --git a/microinteraction/showcase/be001dc1e64befa71864227600907889.gif b/microinteraction/showcase/be001dc1e64befa71864227600907889.gif
new file mode 100755
index 0000000..5b2b451
--- /dev/null
+++ b/microinteraction/showcase/be001dc1e64befa71864227600907889.gif
Binary files differ
diff --git a/microinteraction/showcase/comp_1.gif b/microinteraction/showcase/comp_1.gif
new file mode 100755
index 0000000..b7c7e92
--- /dev/null
+++ b/microinteraction/showcase/comp_1.gif
Binary files differ