SlideShare una empresa de Scribd logo
1 de 54
Descargar para leer sin conexión
DeveloperWorkshop
Tizen NativeApplication
Development with C/C++
Gilang Mentari Hamidy
SamsungResearch and Development Institute Indonesia(SRIN)
gilang.hamidy@gmail.com • g.hamidy@samsung.com •http://labs.heliosky.com
OneDrive Link: http://bit.ly/TizenNativeWorkshop
DeveloperWorkshop
Hallo! Ich heiβeGilang
Page 2
• I am engineer at Samsung Research Institute Indonesia
(SRIN)
• I have been involved in Tizen Projects in SRIN since
December2015, our firstTizen project
• Graduatedfrom Universitas Indonesia
• 4years experience asConsultant inAccenture Indonesia,
then suddenlychange my direction to Software Engineer
• Favoriteprogramming language: C# and C++!
DeveloperWorkshop
The Menu
 Intro
 WhyNative?
 TizenSDK
 TizenNative API
 Hello Native
 StartNew Project
 Native AppStructure
 CCrashCourse
 Runningthe App
 Debuggingthe App
 EFL Libraries
 Whatisit?
 Available Widgets
 WidgetsinYourApp
 Interactive Widget
 AdvancedWidget
 App Layouting
 WhatisEDJE
 Structure ofEDCfile
 Theme inNative App
 CustomizingGenlist
 TizenUI Builder
 Coding in C++
 WhyC++?
 SRINC++ Framework
 Some Examples
 Useful Libraries
 Sample Project
Page 3
 Intro
 HelloNative
 EFLLibraries
 AppLayouting
 Codingin C++
 UsefulLibraries
 SampleProject
All questions, direct at http://bit.ly/TanyaNative, I will discuss questions in
front 
DeveloperWorkshop
Utilize the full power ofTizen device
withTizen Native Framework
• Nativeapplication can
utilize the full power of
devicecapabilities
• Nativeapplication does
not sufferwith resource-
heavyweb rendering
• Unlike web application,
debuggingin native app is
aidedby the IDE
• Harderto learn compared
to web app framework
• Obscureerror and harder
to identify crashing bug
• Harderto develop cool
userinterface (hard but
possible)
Pros Cons
 Intro
 WhyNative?
 TizenSDK
 TizenNativeAPI
 HelloNative
 EFLLibraries
 AppLayouting
 Codingin C++
 UsefulLibraries
 SampleProject
Page 4
DeveloperWorkshop
Install Native SDK for Tizen
• Defaultinstallation
doesnot include
NativeSDK. Install it
usingUpdate Manager
• TizenNative SDK
providesC/C++
compilers (GCC/LLVM)
and its required
libraries.No additional
hassle required
 Intro
 WhyNative?
 TizenSDK
 TizenNativeAPI
 HelloNative
 EFLLibraries
 AppLayouting
 Codingin C++
 UsefulLibraries
 SampleProject
Page 5
DeveloperWorkshop Tools provided to develop native application for
Tizen: Integrated Development Environment
• CodeusingTizen IDE
(a.k.a.Eclipse)
• TizenIDE provides
debuggerinternally,
youcan perform step-
by-stepinteractive
debugging
 Intro
 WhyNative?
 TizenSDK
 TizenNativeAPI
 HelloNative
 EFLLibraries
 AppLayouting
 Codingin C++
 UsefulLibraries
 SampleProject
Page 6
DeveloperWorkshop Tools provided to develop native application for
Tizen: Log and CrashViewer
• Integrated in the IDE
• Logging similar to
Android’slogcat
• Crashviewer to display
StackTrace if the
application is crashed
 Intro
 WhyNative?
 TizenSDK
 TizenNativeAPI
 HelloNative
 EFLLibraries
 AppLayouting
 Codingin C++
 UsefulLibraries
 SampleProject
Page 7
DeveloperWorkshop Tools provided to develop native application for
Tizen: Enventor, a layout builder
• BuildUI layout for EFL
• AlmostWYSIWYG
editor.What you code
there will be similar
with what you will see
onthe device
• Willbe explained
furtherlater
 Intro
 WhyNative?
 TizenSDK
 TizenNativeAPI
 HelloNative
 EFLLibraries
 AppLayouting
 Codingin C++
 UsefulLibraries
 SampleProject
Page 8
DeveloperWorkshop Tools provided to develop native application for
Tizen:Tizen UI Builder
• Another way to
developUI for native
application
• WYSIWYGtools which
is very similar with
Android’slayout
builder
• Simplifyapplication
development
 Intro
 WhyNative?
 TizenSDK
 TizenNativeAPI
 HelloNative
 EFLLibraries
 AppLayouting
 Codingin C++
 UsefulLibraries
 SampleProject
Page 9
DeveloperWorkshop
Tizen NativeAPI
• A big set of API available
toaccess Tizen device
capability from Native
application
• From UI, networking,
telephony, system, and
user data
• It is possible to use
external libraries in your
application
• Access at
http://bit.ly/TizenNative
 Intro
 WhyNative?
 TizenSDK
 TizenNativeAPI
 HelloNative
 EFLLibraries
 AppLayouting
 Codingin C++
 UsefulLibraries
 SampleProject
Page 10
DeveloperWorkshop
Start your new native project
• File  New  Tizen Native Project
(Or you can choose Project and look
forTizen Native Project on the
dialog box)
• Various native project templates
available. To build native application
from scratch, choose Basic UI
• Give your project and package a
meaningful name, then click Finish
 Intro
 HelloNative
 StartNew Project
 NativeApp Structure
 CCrash Course
 Running theApp
 Debugging theApp
 EFL Libraries
 AppLayouting
 Codingin C++
 UsefulLibraries
 SampleProject
Page 11
DeveloperWorkshop
Whatare those project templates
available?
• BasicDALi
Nativeapplication using Dynamic
Application Library tocreate native
application with fancy graphical
interface
• BasicUI
Nativeapplication using
Enlightenment FrameworkLibrary
(EFL), default widget toolkit forTizen
• BasicUIwith EDC
SamewithBasicUI templatebut with
EDClayout example
• Downloadable Font
Todeploy your own custom font
• InputMethod Editor
Createyour own on-screen keyboard
• Service
Application which runs in the
backgroundanddoesn’t haveGUI
• Shared/StaticLibrary
Createcommon code library that can
beshared among projects
• UIBuilder
Develop nativeapplication using UI
builder lookalike withAndroid layout
builder
• Widget
Createyour own widget
 Intro
 HelloNative
 StartNew Project
 NativeApp Structure
 CCrash Course
 Running theApp
 Debugging theApp
 EFLLibraries
 AppLayouting
 Codingin C++
 UsefulLibraries
 SampleProject
Page 12
DeveloperWorkshop
NativeTizen app project has similar
structure with LinuxC/C++ app project
• Includes
List of header files included automatically by
thebuilder
• inc
Yourown header files
• res
Resourcefiles tobe included in the
application installation package
• shared
Shared resource files that can be accessed
by otherapplication package
• src
Thesourcecode file
• lib
Library files if you have additional external
libraries
 Intro
 HelloNative
 Start New Project
 NativeAppStructure
 CCrash Course
 Running theApp
 Debugging theApp
 EFLLibraries
 AppLayouting
 Codingin C++
 UsefulLibraries
 SampleProject
Page 13
DeveloperWorkshop
NativeTizen app project has similar
structure with LinuxC/C++ app project
• Includes
List of header files included automatically by
thebuilder
• inc
Yourown header files
• res
Resourcefiles tobe included in the
application installation package
• shared
Shared resource files that can be accessed
by otherapplication package
• src
Thesourcecode file
• lib
Library files if you have additional external
libraries
 Intro
 HelloNative
 Start New Project
 NativeAppStructure
 CCrash Course
 Running theApp
 Debugging theApp
 EFLLibraries
 AppLayouting
 Codingin C++
 UsefulLibraries
 SampleProject
Page 14
DeveloperWorkshop
Nativeapplicationhas to always have
mainfunction
• main function is the entry point of your program
• InTizen application, main function always have to
initialize callbackfunctions to internal application events
suchas create, pause, terminate, and device events such
as battery low, etc.
• To saveyour time, just use the provided template. If you
touchit, do at your own risk
 Intro
 HelloNative
 Start New Project
 NativeAppStructure
 CCrash Course
 Running theApp
 Debugging theApp
 EFLLibraries
 AppLayouting
 Codingin C++
 UsefulLibraries
 SampleProject
Page 15
DeveloperWorkshop
Nativeapplicationhas to always have
mainfunction Intro
 HelloNative
 Start New Project
 NativeAppStructure
 CCrash Course
 Running theApp
 Debugging theApp
 EFLLibraries
 AppLayouting
 Codingin C++
 UsefulLibraries
 SampleProject
Page 16
int main(int argc, char *argv[])
{
appdata_s ad = {0,};
int ret = 0;
ui_app_lifecycle_callback_s event_callback = {0,};
app_event_handler_h handlers[5] = {NULL, };
event_callback.create = app_create;
event_callback.terminate = app_terminate;
event_callback.pause = app_pause;
event_callback.resume = app_resume;
event_callback.app_control = app_control;
ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, ui_app_low_battery, &ad);
ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, ui_app_low_memory, &ad);
ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED,
ui_app_orient_changed, &ad);
ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, ui_app_lang_changed,
&ad);
ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED,
ui_app_region_changed, &ad);
ret = ui_app_main(argc, argv, &event_callback, &ad);
if (ret != APP_ERROR_NONE) {
dlog_print(DLOG_ERROR, LOG_TAG, "app_main() is failed. err = %d", ret);
}
return ret;
}
DeveloperWorkshop
Purpose ofApplicationEventCallbacks
Page 17
• Perform actions before themain
event loop starts, such as creating
thewindow andfirstUI of your
application
• At this point, (almost) allTizenAPI
functions can becalled safely
• When theapplication becomes
invisible, such as switching to other
application or clicking thehome
button
Create Pause
 Intro
 HelloNative
 Start New Project
 NativeAppStructure
 CCrash Course
 Running theApp
 Debugging theApp
 EFLLibraries
 AppLayouting
 Codingin C++
 UsefulLibraries
 SampleProject
• When theapplication becomes
visible, or waking up after being
paused
• Reallocate resource if theresource is
released by Pauseevent
• When theapplication is going to be
terminated.
• Releaseshared resource so other
application can utilize the resource
again
Resume Terminate
DeveloperWorkshop
The lifetime ofTizen Native
Application
Page 18
 Intro
 HelloNative
 Start New Project
 NativeAppStructure
 CCrash Course
 Running theApp
 Debugging theApp
 EFLLibraries
 AppLayouting
 Codingin C++
 UsefulLibraries
 SampleProject
DeveloperWorkshop
Tizen Manifest as the metadata for
nativeapplication
• Act similar with Android
manifest
• Defines the identity of
application (ID, name, version,
icon)
• Define application privileges to
access system features or data
(see the list at
http://bit.ly/TizenPrivilege)
• Define required software or
hardware features (camera,
GPS, etc)
• Other advanced functionality
such as Application Control,
sharing, etc.
 Intro
 HelloNative
 Start New Project
 NativeAppStructure
 CCrash Course
 Running theApp
 Debugging theApp
 EFLLibraries
 AppLayouting
 Codingin C++
 UsefulLibraries
 SampleProject
Page 19
DeveloperWorkshop
C ProgrammingLanguageCrash
Course
• C is the grandfather of
manypopular languages
like Java,Objective-C,C#,
etc
• Justthink of you coding in
limited version of Java
• Noclass and method,
onlystructures and
functions
• Manual memory
management!
• Good references:
– http://www.learn-c.org/
– https://en.wikipedia.org/
wiki/C_syntax
– http://en.cppreference.c
om/w/c/language/switch
Page 20
 Intro
 HelloNative
 Start New Project
 NativeApp Structure
 CCrash Course
 Running theApp
 Debugging theApp
 EFLLibraries
 AppLayouting
 Codingin C++
 UsefulLibraries
 SampleProject
DeveloperWorkshop
Runningthe applicationfor the first
time
1. Start theemulator/connect thedevice
first
2. Click arrow button next to Smart
Launch on thetoolbar (Play button in
bluecircle)
3. Select NewLaunchConfiguration
4. Select theproject you want torun and
click OK
Afteryou follow this methodfor thefirst
time, thechoice for your application will
appearin Run/Debug icon in the toolbar
(buttonA andBin theimage).You can run
viathosebuttons thenext timeyou want
torun/debug
If you haven’t set security profile, it will ask
forit before deploying the app
Page 21
 Intro
 HelloNative
 Start New Project
 NativeApp Structure
 CCrash Course
 RunningtheApp
 Debugging theApp
 EFLLibraries
 AppLayouting
 Codingin C++
 UsefulLibraries
 SampleProject
2
3
4
A B
DeveloperWorkshop
Runningthe applicationfor the first
time
Page 22
 Intro
 HelloNative
 Start New Project
 NativeApp Structure
 CCrash Course
 RunningtheApp
 Debugging theApp
 EFLLibraries
 AppLayouting
 Codingin C++
 UsefulLibraries
 SampleProject
• Voila!Your application is
runningon the emulator
DeveloperWorkshop
Debugging the application
1. Click arrow button next to Debugicon
on thetoolbar (A bettle icon)
2. Select thedesired application to
debug
3. When popup appears, click Yes
AfterclickingYes, theIDE willswitch into
Debug perspective
Page 23
 Intro
 HelloNative
 Start New Project
 NativeApp Structure
 CCrash Course
 Running theApp
 DebuggingtheApp
 EFLLibraries
 AppLayouting
 Codingin C++
 UsefulLibraries
 SampleProject
1
2
3
DeveloperWorkshop
Debug Perspective ofTizen IDE
Page 24
 Intro
 HelloNative
 Start New Project
 NativeApp Structure
 CCrash Course
 Running theApp
 DebuggingtheApp
 EFLLibraries
 AppLayouting
 Codingin C++
 UsefulLibraries
 SampleProject
CurrentStack Frame VariableWatch
Code/CurrentInstruction
Console,Logs, etc
DeveloperWorkshop
Walkingstep-by-step of your program
codes
• Breakpoint is usefulto
maketheexecution of your
program pauses at certain
point
• Just doubleclick on theleft
area of source code editor
(seered squareon image
beside) untila blue dot
appears
• Tocontrolprogram
execution, usethetoolbar
Page 25
 Intro
 HelloNative
 Start New Project
 NativeApp Structure
 CCrash Course
 Running theApp
 DebuggingtheApp
 EFLLibraries
 AppLayouting
 Codingin C++
 UsefulLibraries
 SampleProject
Skip all
breakpoints
Resume
execution
Pause Terminate
App
Step into inside
function
Step overto next
statement
Step out from
current function
DeveloperWorkshop
EnlightenmentFramework Libraries is
the core ofTizen NativeApplication
• Tizen profide EFL as thecore
components fordeveloping native
application
• EFL provides widerangeof libraries
usefultodevelop application, from
utilities toUI widgets
• UI libraries in EFL is called
Elementary
Page 26
 Intro
 HelloNative
 EFL Libraries
 Whatis it?
 AvailableWidgets
 Widgets inYourApp
 InteractiveWidget
 AdvancedWidget
 AppLayouting
 Codingin C++
 UsefulLibraries
 SampleProject
DeveloperWorkshop
EFL provides manywidgets which can
be composed to build UI
• Button, label, entry, grid, list, popup,
calendar, etc
• Access thelist on
http://bit.ly/TizenWidget
• CreateSampleProjects UI
Components toaccess thesampleof
widgets
• Run thesampletoview it in action
using emulatorordevice
Page 27
 Intro
 HelloNative
 EFLLibraries
 What is it?
 AvailableWidgets
 Widgets inYourApp
 InteractiveWidget
 AdvancedWidget
 AppLayouting
 Codingin C++
 UsefulLibraries
 SampleProject
DeveloperWorkshop
Applicationis composed by multiple
widgets
• Let’s goback toour first BasicUI application
• Checkfunction create_base_guiwhich
creates theapplication widgets.That
function is called by app_create function
during thecreation of the application
• Theapplication creates a window, then a
conformant, andalabel
• Window andconformant is a required
widget fortheapplication torun
• You can start addingwidget to conformant.
But conformant can only hold one widget
at atime. Soyou will need acontainer
widget (willbeexplained later)
Page 28
 Intro
 HelloNative
 EFLLibraries
 What is it?
 AvailableWidgets
 WidgetsinYourApp
 InteractiveWidget
 AdvancedWidget
 AppLayouting
 Codingin C++
 UsefulLibraries
 SampleProject
Window
Conformant
Label
DeveloperWorkshop
Containerwidget to hold more than
one widget
• Tizen has 3 basic container widgets: Box,
Grid,Table
• Thesimplest touseis Box, which acts
similarwithAndroid’s Linear Layout
• CreateBox by calling elm_box_add the
storethepointer returned tolocal variable
• Createwidgets you want toadd tobox by
calling therespective add function (such as
elm_label_add, elm_entry_add, etc) and
supplythepointertobox widget you stored
earlier as the parameter
• Callelm_box_pack_end to“pack” the
widget intothebox.Various pack order
available (start, end, after, before)
Page 29
 Intro
 HelloNative
 EFLLibraries
 What is it?
 AvailableWidgets
 WidgetsinYourApp
 InteractiveWidget
 AdvancedWidget
 AppLayouting
 Codingin C++
 UsefulLibraries
 SampleProject
Window
Conformant
Box
Label
Button
Calendar
DeveloperWorkshop
Usingcontainer widget to represent a
single view for navigation
• InTizen nativeapplication, to makea
navigableuser interface, we use naviframe
widget
• Naviframecan display one container at a
timebut can have a view stackwhich can
holdalmost limitless numberof container
• Thevisiblecontainer is the container on top
of thenaviframe stack.We perform
navigation by pushing container widget to
thenaviframe
Page 30
 Intro
 HelloNative
 EFLLibraries
 What is it?
 AvailableWidgets
 WidgetsinYourApp
 InteractiveWidget
 AdvancedWidget
 AppLayouting
 Codingin C++
 UsefulLibraries
 SampleProject
Window
Conformant
Naviframe
Box
Label
Button
Calendar
DeveloperWorkshop
Which functions to call?
• BecauseEFL is aflat-C library, calling functions on objects is different with what we
doin Java
• Javahas methods which is attached toan object instance
• In EFL, you haveloadof functions which accept Evas_Object pointer, andyou have
tocall correct function for an instanceof a type. Soyou have toexactly remember
what is insideyour Evas_Object pointer
• Thegood(orbad) news is when supplying incorrect Evas_Object pointertoa
function that accept different Evas_Object type, EFL willkeep silent andthe
program does not crash. It just won’t dowhat you might expect
• This is thenatureof EFLAPI whichis makes content inside Evas_Object pointer
semantically transparent tothedeveloper. This is tosupport theprocedural flat-C
library which is naturally type-unsafe
Page 31
 Intro
 HelloNative
 EFLLibraries
 What is it?
 AvailableWidgets
 WidgetsinYourApp
 InteractiveWidget
 AdvancedWidget
 AppLayouting
 Codingin C++
 UsefulLibraries
 SampleProject
DeveloperWorkshop
Picking functions to call
• Access thedocumentation at http://bit.ly/TizenNative
• EFL functions convention forElementaryAPI:
elm_[WIDGET TYPE]_[METHOD NAME]
• Begin by determining what widget you want tocreate, for instance, a
button. Sothefunction you needtocall is elm_button_add.Alladdfunction
is aconstructorof awidget. Storethe return value (Evas_Object pointer)
forreferencing tothat widget
• Supposedthat you want tochangethetext of thebutton. But you willnot
findelm_button_text_set orsimilaron thedocumentation
• Although EFL is flat-CAPI tosupport procedural, theback-end of itsAPI is
actually an object-orientedAPI.Wecan call thefunction of its parent type
• Theroot of the typeis widget (called as object in the code), so you can call
many elm_object functions on button, oneof it is elm_object_text_set.
Supply theEvas_Object pointertothefunction andit willwork as you
might expect
Page 32
 Intro
 HelloNative
 EFLLibraries
 What is it?
 AvailableWidgets
 WidgetsinYourApp
 InteractiveWidget
 AdvancedWidget
 AppLayouting
 Codingin C++
 UsefulLibraries
 SampleProject
DeveloperWorkshop
Don’t forget these things!
• Widgets are always in hidden state when created
Always callevas_object_show foreach widget you created
• Widgets are always in zerosize when created
Tolet EFL automatically sizeyour widgets tofill available containers, always call:
evas_object_size_hint_weight_set(widget, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(widget, EVAS_HINT_FILL, EVAS_HINT_FILL);
• Supply the parentcontainerwhencreatingyour widget
If you want toaddlabel toa box, call elm_label_add andsupply Evas_Object
pointertothebox.This is toensure EFL allocates memory block in correct order. So
when parent widget is removed, EFL also deallocate thechild widget
• Always store the Evas_Object pointerreturned by add function
Oryou cannot access your widget in easy way
• Do not freethe Evas_Object pointer
This willmess up yourapplication. EFL automatically manages thememory
allocation of its widgets. Donot outsmart thelibrary, only takecare of your own
allocated memory
Page 33
 Intro
 HelloNative
 EFLLibraries
 What is it?
 AvailableWidgets
 WidgetsinYourApp
 InteractiveWidget
 AdvancedWidget
 AppLayouting
 Codingin C++
 UsefulLibraries
 SampleProject
DeveloperWorkshop
Making the widget interactive
• Thewidget can receive event from user, such as click, hover, etc.
• EFL libraries is event-driven library. We can attach an event handler to listen to
specificevent andact accordingly as wedesired
• Severalimportant types of Events on EFL library:
– SmartEvent
Event of a “smart” widget.Basicallyahigh-levelevent such as clicked,pressed,unpressed,
etc
– EvasEvent
Amore lower levelevent of aUI object such as mouseup, mousemove, keydown, show,
hide,resize,etc
– Edje Event
Event which are triggeredfrom EDJEstylesheet program.WillbediscussedinApp Layouting
section
Page 34
 Intro
 HelloNative
 EFLLibraries
 What is it?
 AvailableWidgets
 Widgets inYourApp
 InteractiveWidget
 AdvancedWidget
 AppLayouting
 Codingin C++
 UsefulLibraries
 SampleProject
DeveloperWorkshop
Creating callback functionto be called
on an event
• Callback function usually will receive pointer totriggering widget, an event data,
anduserstatesuppliedwhen registering for an event
• Createa function tobe called by EFL when specificfunction occurs.The function has
tohaveparameters as follow
– SmartEvent
smart_event_callback_name(void* data, Evas_Object* obj, void* event_info)
– EvasEvent
evas_event_callback_name(void* data, Evas* evas, Evas_Object* obj, void* event_info)
– Edje Event
edje_event_callback_name(void* data, Evas_Object* obj, const char* emission, const
char* source)
• Datapointercan be usedtostoreuser datatobe accessed by callback function
• BecauseC does not have ‘this’ tostoreinstance data, you haveto supply it using
datapointer
Page 35
 Intro
 HelloNative
 EFLLibraries
 What is it?
 AvailableWidgets
 Widgets inYourApp
 InteractiveWidget
 AdvancedWidget
 AppLayouting
 Codingin C++
 UsefulLibraries
 SampleProject
DeveloperWorkshop
How to store user data
• Tostoreuserdata, wehave tostore it in struct datatype.
• It is recommendedtostore Evas_Object pointer, as well as business logic variables in
struct
• Try tonot storethestruct forstoring view datain global variable. Allocate the struct
dynamically when creating theview. This is toensure the view can be instantiated
morethan once
• Perform deinitialization using the callback event for EVAS_OBJECT_DEL of the
containerwidget, sothe data struct will be deallocated when thecontainer widget is
destroyed
• You can also attachpointer tothe struct toa widget object bycalling
evas_object_data_set
Page 36
 Intro
 HelloNative
 EFLLibraries
 What is it?
 AvailableWidgets
 Widgets inYourApp
 InteractiveWidget
 AdvancedWidget
 AppLayouting
 Codingin C++
 UsefulLibraries
 SampleProject
DeveloperWorkshop
AdvancedWidget:Creating widget by
composingother widgets
• SomeUserInterface elements might
not available out-of-the-box from EFL
libraries, sowe have tocompose
multiplewidgets toachieve theUI we
expect
• Forexample: drop down widget has to
becomposedof context popup widget
andbutton widget
• If yourUI element does not available,
createa function toconstruct yourUI
elements andreuse it across the
program
• SeeUIComponents sampleproject to
seesomewidget composition
examplePage 37
 Intro
 HelloNative
 EFLLibraries
 What is it?
 AvailableWidgets
 Widgets inYourApp
 InteractiveWidget
 AdvancedWidget
 AppLayouting
 Codingin C++
 UsefulLibraries
 SampleProject
DeveloperWorkshop
AdvancedWidget:Customizing
contentof list using widgets
• EFL provides acustomizablelist
widget (genericlist/genlist) which can
beusefulcreating types of list
• Genlist can provide item class which
can have acallback function toget a
widget forspecific part of the list
• Wecan even customizethe item
layout using EDCfile(will be explained
furtherlater)
Page 38
 Intro
 HelloNative
 EFLLibraries
 What is it?
 AvailableWidgets
 Widgets inYourApp
 InteractiveWidget
 AdvancedWidget
 AppLayouting
 Codingin C++
 UsefulLibraries
 SampleProject
DeveloperWorkshop
TPK Package
Layouting the app using EDJE
• EFL provideastylesheet-like
mechanism todefine layout, called
EDJE
• EDJE consist of EDCsourcefile, which
willbe compiled intoEDJ file tobe
loadedinto runtime
• EDCfileis adoptedfrom LUA
programming language. Basically it is
adeclarative script defining layout
position andsize
• You maysayit is theCSS for native
app
Page 39
 Intro
 HelloNative
 EFLLibraries
 AppLayouting
 Whatis EDJE
 Structureof EDC file
 Themein NativeApp
 Customizing Genlist
 TizenUI Builder
 Codingin C++
 UsefulLibraries
 SampleProject
EDCstylefile
(.edc)
C codefile(.c/.cpp)
EDJfile(.edj)
Executable
edje_cccompiler
GCC/LLVM
compiler
Compile
Package
Load
DeveloperWorkshop
Writing EDC file using Enventor
• Tizen SDK provides Enventorwhich is
an (almost)WYSIWYG editorforEDC
file
• Thelayout wecreate in Enventorwill
beexactly similar when loaded to the
real application. minor tweaksuch as
scaling tomakeeverything looks right
• EDJE can alsohave aprogram script
that can be usedfor animation or
changing stateof thestyle
• Thereare additional powerfultools to
debug yourEDCscript: edje_player. It
can “run” theEDJ file and see what it
behaves without running theentire
application. Findit on your Tizen SDK
folder
Page 40
 Intro
 HelloNative
 EFLLibraries
 AppLayouting
 Whatis EDJE
 Structureof EDC file
 Themein NativeApp
 Customizing Genlist
 TizenUI Builder
 Codingin C++
 UsefulLibraries
 SampleProject
DeveloperWorkshop
EDC file basic structures
• EDCfiles is a declarative file with tree
structure, just likeXML, but withC-like
syntax (with braces). Each elements
has attributes that defines thedetail
of theelements.
• Theroot of EDCfile is collections
• Todefinea style, we declare group
insidethecollection. We have togive
it name.
• A group can have multipleparts.
Parts arethe building blocks of your
layout.You can compose(almost)
unlimitednumberof part for each
group.
Page 41
 Intro
 HelloNative
 EFLLibraries
 AppLayouting
 What is EDJE
 Structureof EDC file
 Themein NativeApp
 Customizing Genlist
 TizenUI Builder
 Codingin C++
 UsefulLibraries
 SampleProject
collections {
base_scale: 1.0;
group { name: "main";
parts {
part {
name: "bg";
type: RECT;
scale: 1;
description {
state: "default" 0.0;
color: 30 31 34 255;
rel1.relative: 0.0 0.0;
rel2.relative: 1.0 1.0;
}
}
}
}
}
DeveloperWorkshop
Part types available on EDC file
• Basically EDCfiles only provide
primitivegraphical types. Below are
someimportant types
– RECT
A primitive rectangle
– TEXT/TEXTBLOCK
A text.DifferencesonlyTextblockcan
be multilineandbe set
programmatically
– IMAGE
Animage
– SWALLOW
Anareawhichcancontainsany
Elementarywidget.The importanttype
ofpart
• Seehttp://bit.ly/EFLEDC fordetails
on structureof EDCfile
• Each typecan have their own
attributes which can be set. Set the
attributes on description
declaration
• Most common attributes are:
– Color
Colordefined in R GB A one-byte
values in decimal,separated byspace
– Rel1/Rel2
Positioning ofthepart relativeto
otherpart element.Willbe explained
later
– Min/Max
Minimum/maximum sizeof thepart
Page 42
 Intro
 HelloNative
 EFLLibraries
 AppLayouting
 What is EDJE
 Structureof EDC file
 Themein NativeApp
 Customizing Genlist
 TizenUI Builder
 Codingin C++
 UsefulLibraries
 SampleProject
DeveloperWorkshop
Positioning object part in EDC file
• Part in EDCcan be positioned
relatively from other part. This is the
default mechanism in EDC
• Rel1/Rel2 attributes definethe other
part nameas the anchor point to
computetheposition of thepart
• Rel1 is thetop-left position, Rel2 is
thebottom-right position.Thepart
willthen be stretched between those
twopoints
• Therelative point is taken from the
position of anchored part.The point
is calculated as percentage between
0.0 to1.0 ofX&Yaxis of theanchored
part
Page 43
 Intro
 HelloNative
 EFLLibraries
 AppLayouting
 What is EDJE
 Structureof EDC file
 Themein NativeApp
 Customizing Genlist
 TizenUI Builder
 Codingin C++
 UsefulLibraries
 SampleProject
Thispart
Rel1
Anchor
Rel2
Anchor
Relative: 1.0 1.0
Relative: 0.0 0.0
DeveloperWorkshop
Relative position of a part
• Thediagram in left can describe how
relative positioning works in EDC
• You can usefractional amount as
relative. If you use0.5 0.5, then the
relative position will be theexact
centerpoint of thepart
• You can also not supply anypart
nameforrelative anchor. TheEDC
willusethe root canvas area as
anchorpart
• Seehttp://bit.ly/TizenPartPosition for
details on positioning part on EDC
file
Page 44
 Intro
 HelloNative
 EFLLibraries
 AppLayouting
 What is EDJE
 Structureof EDC file
 Themein NativeApp
 Customizing Genlist
 TizenUI Builder
 Codingin C++
 UsefulLibraries
 SampleProject
Rel
0.0 0.0
0.0 1.0 1.0 1.0
1.0 0.0
y
x
DeveloperWorkshop
Using EDJE in your application
• ToutilizeEDJE in your application,
you havetouselayout widget
• Callelm_layout_file_set toset
EDJ file tothelayout widget
• If you haveSwallow orText part in
yourEDJE layout, you can set it by
using
elm_layout_part_content_set
andelm_layout_part_text_set to
supply thewidget/text tothe
specifiedpart
Page 45
 Intro
 HelloNative
 EFLLibraries
 AppLayouting
 What is EDJE
 Structureof EDC file
 Themein NativeApp
 Customizing Genlist
 TizenUI Builder
 Codingin C++
 UsefulLibraries
 SampleProject
DeveloperWorkshop
OverridingTizen theme with your own
EDC file
• It is possibletooverride Tizen default
widget styleanduseyour own
implementation
• Don’t start from zero. Obtain the
original sourceof Tizen widget EDC
file. Pulldirectly fromTizen source
http://review.tizen.org/git
• Copy theEDCsourceyou want to
style, andput it on EDCfile on your
project. It might cannot becompiled
forthefirst time. Fix one byone the
error. Usually it is missing include
definition or missing file.
Page 46
 Intro
 HelloNative
 EFLLibraries
 AppLayouting
 What is EDJE
 Structureof EDC file
 Themein NativeApp
 Customizing Genlist
 TizenUI Builder
 Codingin C++
 UsefulLibraries
 SampleProject
DeveloperWorkshop
Use the widget override you created in
your application
• Twoway of embedding themetoyour application:
– Overlay
Replaceentirelythedefault themewith our implementation.Ensure thegroup name is
exactlysimilarwith theconvention of Elementarywidget
– Extensions
Extendthethemewhich addnew group name to thecollection.Does not replaceany
default group
Page 47
 Intro
 HelloNative
 EFLLibraries
 AppLayouting
 What is EDJE
 Structureof EDC file
 Themein NativeApp
 Customizing Genlist
 TizenUI Builder
 Codingin C++
 UsefulLibraries
 SampleProject
defaultTheme = elm_theme_new();
elm_theme_ref_set(defaultTheme, elm_theme_default_get());
elm_theme_overlay_add(defaultTheme, “/res/edc/naviframe.edc”);
elm_object_theme_set(rootFrame, defaultTheme);
DeveloperWorkshop
CustomizingGenlist style default style
• Thedefault styleis boring
• By extending default theme, wecan
defineour own genlist style. It is very
usefultocreate yourown item style
forgenlist
• Follow theprocedure of copying the
original sourcefrom Tizen source,
then start modifying yours
Page 48
 Intro
 HelloNative
 EFLLibraries
 AppLayouting
 What is EDJE
 Structureof EDC file
 Themein NativeApp
 CustomizingGenlist
 TizenUI Builder
 Codingin C++
 UsefulLibraries
 SampleProject
DeveloperWorkshop
TizenUI Builder, simpler way to
developUI
• Ratherthan coding yourself, you can
let theIDE generates the code for you
• Tizen IDE providesWYSIWYG editor
forbuilding nativeapp, similar with
Androidlayout editor
• But you havetodecide in the
beginning: want tocode yourself, or
utilizeUI builder.You cannot change
yourmindafter that
• Start new project andselect UI
Builder fromTemplate
Page 49
 Intro
 HelloNative
 EFLLibraries
 AppLayouting
 What is EDJE
 Structureof EDC file
 Themein NativeApp
 Customizing Genlist
 TizenUI Builder
 Codingin C++
 UsefulLibraries
 SampleProject
DeveloperWorkshop
Ifyou thinkC is too clumsy, code in
C++!
• C is procedural, C++ is object-
oriented
• C++ has classes, C only have
struct
• C++ has standard library that is
very stable and easy to use,
while C does not. In Tizen you
are equipped with some utilities,
like EFL Eina, but once again, it
is procedural
• C++ is typesafe. In C you deal
with casting everytime, might
lead to bug
• Tizen API is flat-C libraries, not
readily to be implemented in
C++ out of the box
• C++ is a massive language, quite
differ with Java/Objective-C, add
more learning curve
• Additional code size and
complexity created by the
compiler, as well as memory
footprint (but still far-far less
than web-based app)
Pros Cons
 Intro
 HelloNative
 EFLLibraries
 AppLayouting
 Codingin C++
 WhyC++?
 SRINC++ Framework
 SomeExamples
 UsefulLibraries
 SampleProject
Page 50
DeveloperWorkshop
SRINC++ Framework Libraries: Our
library to codeTizen NativeApp inC++
• Ourresearch product for Tizen
development
• Havebeen implemented in all our
Tizen projects in SRIN(Yes, weall
codeour projects in nativeC++)
• Was born becausewe fed up of
coding in procedural during our first
two-weeks of developing native
Tizen app
• The library is built as Shared
Library
• Your project can compile and
link against the library
• Define application pattern using
popular MVC pattern. This helps
in organizing app and help
migrating from popular platform
such as Android or iOS
• Simplify boilerplate codes that
resulted from using flat-C API of
Tizen API
 Intro
 HelloNative
 EFLLibraries
 AppLayouting
 Codingin C++
 WhyC++?
 SRINC++ Framework
 SomeExamples
 UsefulLibraries
 SampleProject
Page 51
DeveloperWorkshop
Example:HelioskyApp, aWordpress
blog client inTizen
• My blog: http://heliosky.com using
Wordpress.UsingWP REST 2.0 asAPI
toconnect tomy blog
• Just run andseeit in action 
 Intro
 HelloNative
 EFLLibraries
 AppLayouting
 Codingin C++
 WhyC++?
 SRINC++ Framework
 SomeExamples
 UsefulLibraries
 SampleProject
Page 52
DeveloperWorkshop
Useful libraries that can enhance your
Tizen native development
• Weadmit,Tizen NativeAPI sometimes is hard touse. Sohere’s someof libraries
that weusein our projects
• RapidJSON (http://rapidjson.org)
C++ way toparseJSON.Way simplerand straightforwardthan usingGlib provided
byTizen
• QuinceLib (http://quince-lib.org)
ORM forSQLiteinTizen.Very simpleway rather than writing your own SQL query
andfetching data from memory
• Allthoselibraries is embedded in ourSRINC++ FrameworkLibraries. Wewill share
it soon 
• Registeryoure-mail onGitLab, and also register to http://bit.ly/SRINCPPLIB and
when weare ready to publish, wewill notify you!
 Intro
 HelloNative
 EFLLibraries
 AppLayouting
 Codingin C++
 UsefulLibraries
 SampleProject
Page 53
DeveloperWorkshop
SomeSneak Peek…
Page 54
 Intro
 HelloNative
 EFLLibraries
 AppLayouting
 Codingin C++
 UsefulLibraries
 SampleProject

Más contenido relacionado

La actualidad más candente

Mobile test automation with Selenium, Selendroid and ios-driver
Mobile test automation with Selenium, Selendroid and ios-driverMobile test automation with Selenium, Selendroid and ios-driver
Mobile test automation with Selenium, Selendroid and ios-driver
Michael Palotas
 

La actualidad más candente (20)

Ionic App Platform Overview
Ionic App Platform Overview Ionic App Platform Overview
Ionic App Platform Overview
 
Ionic in 30
Ionic in 30Ionic in 30
Ionic in 30
 
Cordova + Ionic + MobileFirst
Cordova + Ionic + MobileFirstCordova + Ionic + MobileFirst
Cordova + Ionic + MobileFirst
 
Capacitor 2.0 Launch
Capacitor 2.0 LaunchCapacitor 2.0 Launch
Capacitor 2.0 Launch
 
Ionic framework
Ionic frameworkIonic framework
Ionic framework
 
Building capacitor apps in appflow webinar
Building capacitor apps in appflow webinarBuilding capacitor apps in appflow webinar
Building capacitor apps in appflow webinar
 
Hybrid App Development, Redefined
Hybrid App Development, RedefinedHybrid App Development, Redefined
Hybrid App Development, Redefined
 
Top Cordova Challenges and How to Tackle Them
Top Cordova Challenges and How to Tackle ThemTop Cordova Challenges and How to Tackle Them
Top Cordova Challenges and How to Tackle Them
 
iPlayground: CarPlay and MFI Hearing Aids
iPlayground: CarPlay and MFI Hearing AidsiPlayground: CarPlay and MFI Hearing Aids
iPlayground: CarPlay and MFI Hearing Aids
 
Ionic Native: Native-powered apps, without the hassle
Ionic Native: Native-powered apps, without the hassleIonic Native: Native-powered apps, without the hassle
Ionic Native: Native-powered apps, without the hassle
 
When Android Apps Go Evil
When Android Apps Go EvilWhen Android Apps Go Evil
When Android Apps Go Evil
 
Capacitor 1.0 launch
Capacitor 1.0 launchCapacitor 1.0 launch
Capacitor 1.0 launch
 
Scaling Mobile Development
Scaling Mobile DevelopmentScaling Mobile Development
Scaling Mobile Development
 
The Power, and Pain, of Cordova Plugins
The Power, and Pain, of Cordova PluginsThe Power, and Pain, of Cordova Plugins
The Power, and Pain, of Cordova Plugins
 
Reimagining Cordova: Building Cross-Platform Web Apps with Capacitor
Reimagining Cordova: Building Cross-Platform Web Apps with CapacitorReimagining Cordova: Building Cross-Platform Web Apps with Capacitor
Reimagining Cordova: Building Cross-Platform Web Apps with Capacitor
 
Universal Windows Platform
Universal Windows PlatformUniversal Windows Platform
Universal Windows Platform
 
Introduction to PhoneGap
Introduction to PhoneGapIntroduction to PhoneGap
Introduction to PhoneGap
 
[Srijan Wednesday Webinars] Building a High Performance QA Team
[Srijan Wednesday Webinars] Building a High Performance QA Team[Srijan Wednesday Webinars] Building a High Performance QA Team
[Srijan Wednesday Webinars] Building a High Performance QA Team
 
Mobile test automation with Selenium, Selendroid and ios-driver
Mobile test automation with Selenium, Selendroid and ios-driverMobile test automation with Selenium, Selendroid and ios-driver
Mobile test automation with Selenium, Selendroid and ios-driver
 
Hybrid Mobile Applications
Hybrid Mobile ApplicationsHybrid Mobile Applications
Hybrid Mobile Applications
 

Destacado

Dr CK Kim, City of Seoul - U-TOPIS & Seoul PTA
Dr CK Kim, City of Seoul - U-TOPIS & Seoul PTADr CK Kim, City of Seoul - U-TOPIS & Seoul PTA
Dr CK Kim, City of Seoul - U-TOPIS & Seoul PTA
Shane Mitchell
 
Presentation for Aswad (Final Draft).pptx
Presentation for Aswad (Final Draft).pptxPresentation for Aswad (Final Draft).pptx
Presentation for Aswad (Final Draft).pptx
Sher Shah
 

Destacado (15)

Gear Fit2 Watchface Design Guide
Gear Fit2 Watchface Design GuideGear Fit2 Watchface Design Guide
Gear Fit2 Watchface Design Guide
 
OpenMobile ACL bringing Android apps to TIZEN
OpenMobile ACL bringing Android apps to TIZENOpenMobile ACL bringing Android apps to TIZEN
OpenMobile ACL bringing Android apps to TIZEN
 
Introduction to Watch Face Development with Tizen Studio
Introduction to Watch Face Development with Tizen StudioIntroduction to Watch Face Development with Tizen Studio
Introduction to Watch Face Development with Tizen Studio
 
Xotelia - Why should you implement a dynamic pricing strategy on your vacatio...
Xotelia - Why should you implement a dynamic pricing strategy on your vacatio...Xotelia - Why should you implement a dynamic pricing strategy on your vacatio...
Xotelia - Why should you implement a dynamic pricing strategy on your vacatio...
 
Seoul topis
Seoul topisSeoul topis
Seoul topis
 
LieDM asociacija - 2013 on
LieDM asociacija - 2013 onLieDM asociacija - 2013 on
LieDM asociacija - 2013 on
 
World Economic Forum on East Asia 2006
World Economic Forum on East Asia 2006World Economic Forum on East Asia 2006
World Economic Forum on East Asia 2006
 
ROARERS
ROARERSROARERS
ROARERS
 
计算机应用基础课件(一)
计算机应用基础课件(一)计算机应用基础课件(一)
计算机应用基础课件(一)
 
$1000 BEFORE JAN. 1? LOOK AT INDIA
$1000 BEFORE JAN. 1? LOOK AT INDIA$1000 BEFORE JAN. 1? LOOK AT INDIA
$1000 BEFORE JAN. 1? LOOK AT INDIA
 
Rajesh portfolio
Rajesh portfolioRajesh portfolio
Rajesh portfolio
 
Dr CK Kim, City of Seoul - U-TOPIS & Seoul PTA
Dr CK Kim, City of Seoul - U-TOPIS & Seoul PTADr CK Kim, City of Seoul - U-TOPIS & Seoul PTA
Dr CK Kim, City of Seoul - U-TOPIS & Seoul PTA
 
Snick English
Snick EnglishSnick English
Snick English
 
Careers in copywriting part 2
Careers in copywriting part 2Careers in copywriting part 2
Careers in copywriting part 2
 
Presentation for Aswad (Final Draft).pptx
Presentation for Aswad (Final Draft).pptxPresentation for Aswad (Final Draft).pptx
Presentation for Aswad (Final Draft).pptx
 

Similar a Samsung Indonesia: Tizen Native App

GoogleDSC_ GHRCE_ flutter_firebase.pptx
GoogleDSC_ GHRCE_  flutter_firebase.pptxGoogleDSC_ GHRCE_  flutter_firebase.pptx
GoogleDSC_ GHRCE_ flutter_firebase.pptx
GoogleDeveloperStude22
 

Similar a Samsung Indonesia: Tizen Native App (20)

Ignite your app development with Angular, NativeScript and Firebase
Ignite your app development with Angular, NativeScript and FirebaseIgnite your app development with Angular, NativeScript and Firebase
Ignite your app development with Angular, NativeScript and Firebase
 
C# everywhere
C# everywhereC# everywhere
C# everywhere
 
Typescript kata The TDD style 2 edition
Typescript kata The TDD style 2 editionTypescript kata The TDD style 2 edition
Typescript kata The TDD style 2 edition
 
Appcelerator Titanium Intro (2014)
Appcelerator Titanium Intro (2014)Appcelerator Titanium Intro (2014)
Appcelerator Titanium Intro (2014)
 
Dominik Veselý - Vše co jste kdy chtěli vědět o CI a báli jste se zeptat
Dominik Veselý - Vše co jste kdy chtěli vědět o CI a báli jste se zeptatDominik Veselý - Vše co jste kdy chtěli vědět o CI a báli jste se zeptat
Dominik Veselý - Vše co jste kdy chtěli vědět o CI a báli jste se zeptat
 
Jetpack Compose - Android’s modern toolkit for building native UI
Jetpack Compose - Android’s modern toolkit for building native UIJetpack Compose - Android’s modern toolkit for building native UI
Jetpack Compose - Android’s modern toolkit for building native UI
 
GoogleDSC_ GHRCE_ flutter_firebase.pptx
GoogleDSC_ GHRCE_  flutter_firebase.pptxGoogleDSC_ GHRCE_  flutter_firebase.pptx
GoogleDSC_ GHRCE_ flutter_firebase.pptx
 
Introduction to Indigo.Design App Builder
Introduction to Indigo.Design App BuilderIntroduction to Indigo.Design App Builder
Introduction to Indigo.Design App Builder
 
Visual BAsic Softwares intended for ICT students
Visual BAsic Softwares intended for ICT studentsVisual BAsic Softwares intended for ICT students
Visual BAsic Softwares intended for ICT students
 
Day 8 sketchware
Day 8  sketchwareDay 8  sketchware
Day 8 sketchware
 
Titanium #MDS13
Titanium #MDS13Titanium #MDS13
Titanium #MDS13
 
Prototyping Office AddIns using ScriptLab
Prototyping Office AddIns using ScriptLabPrototyping Office AddIns using ScriptLab
Prototyping Office AddIns using ScriptLab
 
iOS Development Survival Guide for the .NET Guy
iOS Development Survival Guide for the .NET GuyiOS Development Survival Guide for the .NET Guy
iOS Development Survival Guide for the .NET Guy
 
Next-gen IDE v2 - OpenSlava 2013-10-11
Next-gen IDE v2 - OpenSlava 2013-10-11Next-gen IDE v2 - OpenSlava 2013-10-11
Next-gen IDE v2 - OpenSlava 2013-10-11
 
Introduction to hybrid application development
Introduction to hybrid application developmentIntroduction to hybrid application development
Introduction to hybrid application development
 
Lecture 1 Introduction to React Native.pptx
Lecture 1 Introduction to React Native.pptxLecture 1 Introduction to React Native.pptx
Lecture 1 Introduction to React Native.pptx
 
Understanding Codenvy - for Containerized Developer Workspaces
Understanding Codenvy - for Containerized Developer WorkspacesUnderstanding Codenvy - for Containerized Developer Workspaces
Understanding Codenvy - for Containerized Developer Workspaces
 
AnselFaillaceResume
AnselFaillaceResumeAnselFaillaceResume
AnselFaillaceResume
 
.Net Technologies Lesson 1.pptx
.Net Technologies Lesson 1.pptx.Net Technologies Lesson 1.pptx
.Net Technologies Lesson 1.pptx
 
01. Introduction to Programming
01. Introduction to Programming01. Introduction to Programming
01. Introduction to Programming
 

Más de Ryo Jin

Más de Ryo Jin (20)

Why is EFL used on Tizen?
Why is EFL used on Tizen?Why is EFL used on Tizen?
Why is EFL used on Tizen?
 
Samsung Z4 User Manual
Samsung Z4 User ManualSamsung Z4 User Manual
Samsung Z4 User Manual
 
Samsung ARTIK 050 (ARTIK ZERO) Modules Data Sheet
Samsung ARTIK 050 (ARTIK ZERO) Modules Data SheetSamsung ARTIK 050 (ARTIK ZERO) Modules Data Sheet
Samsung ARTIK 050 (ARTIK ZERO) Modules Data Sheet
 
Tizen 3.0's Window System Integration Layer of OpenGLES/EGL & Vulkan Driver
Tizen 3.0's Window System Integration Layer of OpenGLES/EGL & Vulkan DriverTizen 3.0's Window System Integration Layer of OpenGLES/EGL & Vulkan Driver
Tizen 3.0's Window System Integration Layer of OpenGLES/EGL & Vulkan Driver
 
Panduan Penggunaan Perangkat Wearable Tizen
Panduan Penggunaan Perangkat Wearable TizenPanduan Penggunaan Perangkat Wearable Tizen
Panduan Penggunaan Perangkat Wearable Tizen
 
Cara Menggunakan Smartphone Tizen
Cara Menggunakan Smartphone TizenCara Menggunakan Smartphone Tizen
Cara Menggunakan Smartphone Tizen
 
Samsung Indonesia: Tizen Store
Samsung Indonesia: Tizen StoreSamsung Indonesia: Tizen Store
Samsung Indonesia: Tizen Store
 
Samsung Indonesia: Tizen Platform Overview and IoT
Samsung Indonesia: Tizen Platform Overview and IoTSamsung Indonesia: Tizen Platform Overview and IoT
Samsung Indonesia: Tizen Platform Overview and IoT
 
Russian Tizen Project
Russian Tizen ProjectRussian Tizen Project
Russian Tizen Project
 
Samsung SM-R360 Tizen User Manual
Samsung SM-R360 Tizen User ManualSamsung SM-R360 Tizen User Manual
Samsung SM-R360 Tizen User Manual
 
Tizen Micro Profile for IoT device
Tizen Micro Profile for IoT deviceTizen Micro Profile for IoT device
Tizen Micro Profile for IoT device
 
Panduan Dasar Pemrograman Tizen
Panduan Dasar Pemrograman TizenPanduan Dasar Pemrograman Tizen
Panduan Dasar Pemrograman Tizen
 
The Story of Enlightenment, EFL, Tizen and Wayland
The Story of Enlightenment, EFL, Tizen and WaylandThe Story of Enlightenment, EFL, Tizen and Wayland
The Story of Enlightenment, EFL, Tizen and Wayland
 
Tizen PASS
Tizen PASSTizen PASS
Tizen PASS
 
Tizen PASS
Tizen PASSTizen PASS
Tizen PASS
 
Samsung Gear UI Design Guidelines
Samsung Gear UI Design GuidelinesSamsung Gear UI Design Guidelines
Samsung Gear UI Design Guidelines
 
Attack surface analysis of Tizen devices
Attack surface analysis of Tizen devicesAttack surface analysis of Tizen devices
Attack surface analysis of Tizen devices
 
Samsung DeepSort
Samsung DeepSortSamsung DeepSort
Samsung DeepSort
 
Samsung Gear Circle SM-R130 User Manual
Samsung Gear Circle SM-R130 User ManualSamsung Gear Circle SM-R130 User Manual
Samsung Gear Circle SM-R130 User Manual
 
Samsung Gear S SM-R750 User Manual
Samsung Gear S SM-R750 User ManualSamsung Gear S SM-R750 User Manual
Samsung Gear S SM-R750 User Manual
 

Último

AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 

Último (20)

Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban
 
Generic or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisions
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 

Samsung Indonesia: Tizen Native App

  • 1. DeveloperWorkshop Tizen NativeApplication Development with C/C++ Gilang Mentari Hamidy SamsungResearch and Development Institute Indonesia(SRIN) gilang.hamidy@gmail.com • g.hamidy@samsung.com •http://labs.heliosky.com OneDrive Link: http://bit.ly/TizenNativeWorkshop
  • 2. DeveloperWorkshop Hallo! Ich heiβeGilang Page 2 • I am engineer at Samsung Research Institute Indonesia (SRIN) • I have been involved in Tizen Projects in SRIN since December2015, our firstTizen project • Graduatedfrom Universitas Indonesia • 4years experience asConsultant inAccenture Indonesia, then suddenlychange my direction to Software Engineer • Favoriteprogramming language: C# and C++!
  • 3. DeveloperWorkshop The Menu  Intro  WhyNative?  TizenSDK  TizenNative API  Hello Native  StartNew Project  Native AppStructure  CCrashCourse  Runningthe App  Debuggingthe App  EFL Libraries  Whatisit?  Available Widgets  WidgetsinYourApp  Interactive Widget  AdvancedWidget  App Layouting  WhatisEDJE  Structure ofEDCfile  Theme inNative App  CustomizingGenlist  TizenUI Builder  Coding in C++  WhyC++?  SRINC++ Framework  Some Examples  Useful Libraries  Sample Project Page 3  Intro  HelloNative  EFLLibraries  AppLayouting  Codingin C++  UsefulLibraries  SampleProject All questions, direct at http://bit.ly/TanyaNative, I will discuss questions in front 
  • 4. DeveloperWorkshop Utilize the full power ofTizen device withTizen Native Framework • Nativeapplication can utilize the full power of devicecapabilities • Nativeapplication does not sufferwith resource- heavyweb rendering • Unlike web application, debuggingin native app is aidedby the IDE • Harderto learn compared to web app framework • Obscureerror and harder to identify crashing bug • Harderto develop cool userinterface (hard but possible) Pros Cons  Intro  WhyNative?  TizenSDK  TizenNativeAPI  HelloNative  EFLLibraries  AppLayouting  Codingin C++  UsefulLibraries  SampleProject Page 4
  • 5. DeveloperWorkshop Install Native SDK for Tizen • Defaultinstallation doesnot include NativeSDK. Install it usingUpdate Manager • TizenNative SDK providesC/C++ compilers (GCC/LLVM) and its required libraries.No additional hassle required  Intro  WhyNative?  TizenSDK  TizenNativeAPI  HelloNative  EFLLibraries  AppLayouting  Codingin C++  UsefulLibraries  SampleProject Page 5
  • 6. DeveloperWorkshop Tools provided to develop native application for Tizen: Integrated Development Environment • CodeusingTizen IDE (a.k.a.Eclipse) • TizenIDE provides debuggerinternally, youcan perform step- by-stepinteractive debugging  Intro  WhyNative?  TizenSDK  TizenNativeAPI  HelloNative  EFLLibraries  AppLayouting  Codingin C++  UsefulLibraries  SampleProject Page 6
  • 7. DeveloperWorkshop Tools provided to develop native application for Tizen: Log and CrashViewer • Integrated in the IDE • Logging similar to Android’slogcat • Crashviewer to display StackTrace if the application is crashed  Intro  WhyNative?  TizenSDK  TizenNativeAPI  HelloNative  EFLLibraries  AppLayouting  Codingin C++  UsefulLibraries  SampleProject Page 7
  • 8. DeveloperWorkshop Tools provided to develop native application for Tizen: Enventor, a layout builder • BuildUI layout for EFL • AlmostWYSIWYG editor.What you code there will be similar with what you will see onthe device • Willbe explained furtherlater  Intro  WhyNative?  TizenSDK  TizenNativeAPI  HelloNative  EFLLibraries  AppLayouting  Codingin C++  UsefulLibraries  SampleProject Page 8
  • 9. DeveloperWorkshop Tools provided to develop native application for Tizen:Tizen UI Builder • Another way to developUI for native application • WYSIWYGtools which is very similar with Android’slayout builder • Simplifyapplication development  Intro  WhyNative?  TizenSDK  TizenNativeAPI  HelloNative  EFLLibraries  AppLayouting  Codingin C++  UsefulLibraries  SampleProject Page 9
  • 10. DeveloperWorkshop Tizen NativeAPI • A big set of API available toaccess Tizen device capability from Native application • From UI, networking, telephony, system, and user data • It is possible to use external libraries in your application • Access at http://bit.ly/TizenNative  Intro  WhyNative?  TizenSDK  TizenNativeAPI  HelloNative  EFLLibraries  AppLayouting  Codingin C++  UsefulLibraries  SampleProject Page 10
  • 11. DeveloperWorkshop Start your new native project • File  New  Tizen Native Project (Or you can choose Project and look forTizen Native Project on the dialog box) • Various native project templates available. To build native application from scratch, choose Basic UI • Give your project and package a meaningful name, then click Finish  Intro  HelloNative  StartNew Project  NativeApp Structure  CCrash Course  Running theApp  Debugging theApp  EFL Libraries  AppLayouting  Codingin C++  UsefulLibraries  SampleProject Page 11
  • 12. DeveloperWorkshop Whatare those project templates available? • BasicDALi Nativeapplication using Dynamic Application Library tocreate native application with fancy graphical interface • BasicUI Nativeapplication using Enlightenment FrameworkLibrary (EFL), default widget toolkit forTizen • BasicUIwith EDC SamewithBasicUI templatebut with EDClayout example • Downloadable Font Todeploy your own custom font • InputMethod Editor Createyour own on-screen keyboard • Service Application which runs in the backgroundanddoesn’t haveGUI • Shared/StaticLibrary Createcommon code library that can beshared among projects • UIBuilder Develop nativeapplication using UI builder lookalike withAndroid layout builder • Widget Createyour own widget  Intro  HelloNative  StartNew Project  NativeApp Structure  CCrash Course  Running theApp  Debugging theApp  EFLLibraries  AppLayouting  Codingin C++  UsefulLibraries  SampleProject Page 12
  • 13. DeveloperWorkshop NativeTizen app project has similar structure with LinuxC/C++ app project • Includes List of header files included automatically by thebuilder • inc Yourown header files • res Resourcefiles tobe included in the application installation package • shared Shared resource files that can be accessed by otherapplication package • src Thesourcecode file • lib Library files if you have additional external libraries  Intro  HelloNative  Start New Project  NativeAppStructure  CCrash Course  Running theApp  Debugging theApp  EFLLibraries  AppLayouting  Codingin C++  UsefulLibraries  SampleProject Page 13
  • 14. DeveloperWorkshop NativeTizen app project has similar structure with LinuxC/C++ app project • Includes List of header files included automatically by thebuilder • inc Yourown header files • res Resourcefiles tobe included in the application installation package • shared Shared resource files that can be accessed by otherapplication package • src Thesourcecode file • lib Library files if you have additional external libraries  Intro  HelloNative  Start New Project  NativeAppStructure  CCrash Course  Running theApp  Debugging theApp  EFLLibraries  AppLayouting  Codingin C++  UsefulLibraries  SampleProject Page 14
  • 15. DeveloperWorkshop Nativeapplicationhas to always have mainfunction • main function is the entry point of your program • InTizen application, main function always have to initialize callbackfunctions to internal application events suchas create, pause, terminate, and device events such as battery low, etc. • To saveyour time, just use the provided template. If you touchit, do at your own risk  Intro  HelloNative  Start New Project  NativeAppStructure  CCrash Course  Running theApp  Debugging theApp  EFLLibraries  AppLayouting  Codingin C++  UsefulLibraries  SampleProject Page 15
  • 16. DeveloperWorkshop Nativeapplicationhas to always have mainfunction Intro  HelloNative  Start New Project  NativeAppStructure  CCrash Course  Running theApp  Debugging theApp  EFLLibraries  AppLayouting  Codingin C++  UsefulLibraries  SampleProject Page 16 int main(int argc, char *argv[]) { appdata_s ad = {0,}; int ret = 0; ui_app_lifecycle_callback_s event_callback = {0,}; app_event_handler_h handlers[5] = {NULL, }; event_callback.create = app_create; event_callback.terminate = app_terminate; event_callback.pause = app_pause; event_callback.resume = app_resume; event_callback.app_control = app_control; ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, ui_app_low_battery, &ad); ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, ui_app_low_memory, &ad); ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, ui_app_orient_changed, &ad); ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, ui_app_lang_changed, &ad); ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, ui_app_region_changed, &ad); ret = ui_app_main(argc, argv, &event_callback, &ad); if (ret != APP_ERROR_NONE) { dlog_print(DLOG_ERROR, LOG_TAG, "app_main() is failed. err = %d", ret); } return ret; }
  • 17. DeveloperWorkshop Purpose ofApplicationEventCallbacks Page 17 • Perform actions before themain event loop starts, such as creating thewindow andfirstUI of your application • At this point, (almost) allTizenAPI functions can becalled safely • When theapplication becomes invisible, such as switching to other application or clicking thehome button Create Pause  Intro  HelloNative  Start New Project  NativeAppStructure  CCrash Course  Running theApp  Debugging theApp  EFLLibraries  AppLayouting  Codingin C++  UsefulLibraries  SampleProject • When theapplication becomes visible, or waking up after being paused • Reallocate resource if theresource is released by Pauseevent • When theapplication is going to be terminated. • Releaseshared resource so other application can utilize the resource again Resume Terminate
  • 18. DeveloperWorkshop The lifetime ofTizen Native Application Page 18  Intro  HelloNative  Start New Project  NativeAppStructure  CCrash Course  Running theApp  Debugging theApp  EFLLibraries  AppLayouting  Codingin C++  UsefulLibraries  SampleProject
  • 19. DeveloperWorkshop Tizen Manifest as the metadata for nativeapplication • Act similar with Android manifest • Defines the identity of application (ID, name, version, icon) • Define application privileges to access system features or data (see the list at http://bit.ly/TizenPrivilege) • Define required software or hardware features (camera, GPS, etc) • Other advanced functionality such as Application Control, sharing, etc.  Intro  HelloNative  Start New Project  NativeAppStructure  CCrash Course  Running theApp  Debugging theApp  EFLLibraries  AppLayouting  Codingin C++  UsefulLibraries  SampleProject Page 19
  • 20. DeveloperWorkshop C ProgrammingLanguageCrash Course • C is the grandfather of manypopular languages like Java,Objective-C,C#, etc • Justthink of you coding in limited version of Java • Noclass and method, onlystructures and functions • Manual memory management! • Good references: – http://www.learn-c.org/ – https://en.wikipedia.org/ wiki/C_syntax – http://en.cppreference.c om/w/c/language/switch Page 20  Intro  HelloNative  Start New Project  NativeApp Structure  CCrash Course  Running theApp  Debugging theApp  EFLLibraries  AppLayouting  Codingin C++  UsefulLibraries  SampleProject
  • 21. DeveloperWorkshop Runningthe applicationfor the first time 1. Start theemulator/connect thedevice first 2. Click arrow button next to Smart Launch on thetoolbar (Play button in bluecircle) 3. Select NewLaunchConfiguration 4. Select theproject you want torun and click OK Afteryou follow this methodfor thefirst time, thechoice for your application will appearin Run/Debug icon in the toolbar (buttonA andBin theimage).You can run viathosebuttons thenext timeyou want torun/debug If you haven’t set security profile, it will ask forit before deploying the app Page 21  Intro  HelloNative  Start New Project  NativeApp Structure  CCrash Course  RunningtheApp  Debugging theApp  EFLLibraries  AppLayouting  Codingin C++  UsefulLibraries  SampleProject 2 3 4 A B
  • 22. DeveloperWorkshop Runningthe applicationfor the first time Page 22  Intro  HelloNative  Start New Project  NativeApp Structure  CCrash Course  RunningtheApp  Debugging theApp  EFLLibraries  AppLayouting  Codingin C++  UsefulLibraries  SampleProject • Voila!Your application is runningon the emulator
  • 23. DeveloperWorkshop Debugging the application 1. Click arrow button next to Debugicon on thetoolbar (A bettle icon) 2. Select thedesired application to debug 3. When popup appears, click Yes AfterclickingYes, theIDE willswitch into Debug perspective Page 23  Intro  HelloNative  Start New Project  NativeApp Structure  CCrash Course  Running theApp  DebuggingtheApp  EFLLibraries  AppLayouting  Codingin C++  UsefulLibraries  SampleProject 1 2 3
  • 24. DeveloperWorkshop Debug Perspective ofTizen IDE Page 24  Intro  HelloNative  Start New Project  NativeApp Structure  CCrash Course  Running theApp  DebuggingtheApp  EFLLibraries  AppLayouting  Codingin C++  UsefulLibraries  SampleProject CurrentStack Frame VariableWatch Code/CurrentInstruction Console,Logs, etc
  • 25. DeveloperWorkshop Walkingstep-by-step of your program codes • Breakpoint is usefulto maketheexecution of your program pauses at certain point • Just doubleclick on theleft area of source code editor (seered squareon image beside) untila blue dot appears • Tocontrolprogram execution, usethetoolbar Page 25  Intro  HelloNative  Start New Project  NativeApp Structure  CCrash Course  Running theApp  DebuggingtheApp  EFLLibraries  AppLayouting  Codingin C++  UsefulLibraries  SampleProject Skip all breakpoints Resume execution Pause Terminate App Step into inside function Step overto next statement Step out from current function
  • 26. DeveloperWorkshop EnlightenmentFramework Libraries is the core ofTizen NativeApplication • Tizen profide EFL as thecore components fordeveloping native application • EFL provides widerangeof libraries usefultodevelop application, from utilities toUI widgets • UI libraries in EFL is called Elementary Page 26  Intro  HelloNative  EFL Libraries  Whatis it?  AvailableWidgets  Widgets inYourApp  InteractiveWidget  AdvancedWidget  AppLayouting  Codingin C++  UsefulLibraries  SampleProject
  • 27. DeveloperWorkshop EFL provides manywidgets which can be composed to build UI • Button, label, entry, grid, list, popup, calendar, etc • Access thelist on http://bit.ly/TizenWidget • CreateSampleProjects UI Components toaccess thesampleof widgets • Run thesampletoview it in action using emulatorordevice Page 27  Intro  HelloNative  EFLLibraries  What is it?  AvailableWidgets  Widgets inYourApp  InteractiveWidget  AdvancedWidget  AppLayouting  Codingin C++  UsefulLibraries  SampleProject
  • 28. DeveloperWorkshop Applicationis composed by multiple widgets • Let’s goback toour first BasicUI application • Checkfunction create_base_guiwhich creates theapplication widgets.That function is called by app_create function during thecreation of the application • Theapplication creates a window, then a conformant, andalabel • Window andconformant is a required widget fortheapplication torun • You can start addingwidget to conformant. But conformant can only hold one widget at atime. Soyou will need acontainer widget (willbeexplained later) Page 28  Intro  HelloNative  EFLLibraries  What is it?  AvailableWidgets  WidgetsinYourApp  InteractiveWidget  AdvancedWidget  AppLayouting  Codingin C++  UsefulLibraries  SampleProject Window Conformant Label
  • 29. DeveloperWorkshop Containerwidget to hold more than one widget • Tizen has 3 basic container widgets: Box, Grid,Table • Thesimplest touseis Box, which acts similarwithAndroid’s Linear Layout • CreateBox by calling elm_box_add the storethepointer returned tolocal variable • Createwidgets you want toadd tobox by calling therespective add function (such as elm_label_add, elm_entry_add, etc) and supplythepointertobox widget you stored earlier as the parameter • Callelm_box_pack_end to“pack” the widget intothebox.Various pack order available (start, end, after, before) Page 29  Intro  HelloNative  EFLLibraries  What is it?  AvailableWidgets  WidgetsinYourApp  InteractiveWidget  AdvancedWidget  AppLayouting  Codingin C++  UsefulLibraries  SampleProject Window Conformant Box Label Button Calendar
  • 30. DeveloperWorkshop Usingcontainer widget to represent a single view for navigation • InTizen nativeapplication, to makea navigableuser interface, we use naviframe widget • Naviframecan display one container at a timebut can have a view stackwhich can holdalmost limitless numberof container • Thevisiblecontainer is the container on top of thenaviframe stack.We perform navigation by pushing container widget to thenaviframe Page 30  Intro  HelloNative  EFLLibraries  What is it?  AvailableWidgets  WidgetsinYourApp  InteractiveWidget  AdvancedWidget  AppLayouting  Codingin C++  UsefulLibraries  SampleProject Window Conformant Naviframe Box Label Button Calendar
  • 31. DeveloperWorkshop Which functions to call? • BecauseEFL is aflat-C library, calling functions on objects is different with what we doin Java • Javahas methods which is attached toan object instance • In EFL, you haveloadof functions which accept Evas_Object pointer, andyou have tocall correct function for an instanceof a type. Soyou have toexactly remember what is insideyour Evas_Object pointer • Thegood(orbad) news is when supplying incorrect Evas_Object pointertoa function that accept different Evas_Object type, EFL willkeep silent andthe program does not crash. It just won’t dowhat you might expect • This is thenatureof EFLAPI whichis makes content inside Evas_Object pointer semantically transparent tothedeveloper. This is tosupport theprocedural flat-C library which is naturally type-unsafe Page 31  Intro  HelloNative  EFLLibraries  What is it?  AvailableWidgets  WidgetsinYourApp  InteractiveWidget  AdvancedWidget  AppLayouting  Codingin C++  UsefulLibraries  SampleProject
  • 32. DeveloperWorkshop Picking functions to call • Access thedocumentation at http://bit.ly/TizenNative • EFL functions convention forElementaryAPI: elm_[WIDGET TYPE]_[METHOD NAME] • Begin by determining what widget you want tocreate, for instance, a button. Sothefunction you needtocall is elm_button_add.Alladdfunction is aconstructorof awidget. Storethe return value (Evas_Object pointer) forreferencing tothat widget • Supposedthat you want tochangethetext of thebutton. But you willnot findelm_button_text_set orsimilaron thedocumentation • Although EFL is flat-CAPI tosupport procedural, theback-end of itsAPI is actually an object-orientedAPI.Wecan call thefunction of its parent type • Theroot of the typeis widget (called as object in the code), so you can call many elm_object functions on button, oneof it is elm_object_text_set. Supply theEvas_Object pointertothefunction andit willwork as you might expect Page 32  Intro  HelloNative  EFLLibraries  What is it?  AvailableWidgets  WidgetsinYourApp  InteractiveWidget  AdvancedWidget  AppLayouting  Codingin C++  UsefulLibraries  SampleProject
  • 33. DeveloperWorkshop Don’t forget these things! • Widgets are always in hidden state when created Always callevas_object_show foreach widget you created • Widgets are always in zerosize when created Tolet EFL automatically sizeyour widgets tofill available containers, always call: evas_object_size_hint_weight_set(widget, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(widget, EVAS_HINT_FILL, EVAS_HINT_FILL); • Supply the parentcontainerwhencreatingyour widget If you want toaddlabel toa box, call elm_label_add andsupply Evas_Object pointertothebox.This is toensure EFL allocates memory block in correct order. So when parent widget is removed, EFL also deallocate thechild widget • Always store the Evas_Object pointerreturned by add function Oryou cannot access your widget in easy way • Do not freethe Evas_Object pointer This willmess up yourapplication. EFL automatically manages thememory allocation of its widgets. Donot outsmart thelibrary, only takecare of your own allocated memory Page 33  Intro  HelloNative  EFLLibraries  What is it?  AvailableWidgets  WidgetsinYourApp  InteractiveWidget  AdvancedWidget  AppLayouting  Codingin C++  UsefulLibraries  SampleProject
  • 34. DeveloperWorkshop Making the widget interactive • Thewidget can receive event from user, such as click, hover, etc. • EFL libraries is event-driven library. We can attach an event handler to listen to specificevent andact accordingly as wedesired • Severalimportant types of Events on EFL library: – SmartEvent Event of a “smart” widget.Basicallyahigh-levelevent such as clicked,pressed,unpressed, etc – EvasEvent Amore lower levelevent of aUI object such as mouseup, mousemove, keydown, show, hide,resize,etc – Edje Event Event which are triggeredfrom EDJEstylesheet program.WillbediscussedinApp Layouting section Page 34  Intro  HelloNative  EFLLibraries  What is it?  AvailableWidgets  Widgets inYourApp  InteractiveWidget  AdvancedWidget  AppLayouting  Codingin C++  UsefulLibraries  SampleProject
  • 35. DeveloperWorkshop Creating callback functionto be called on an event • Callback function usually will receive pointer totriggering widget, an event data, anduserstatesuppliedwhen registering for an event • Createa function tobe called by EFL when specificfunction occurs.The function has tohaveparameters as follow – SmartEvent smart_event_callback_name(void* data, Evas_Object* obj, void* event_info) – EvasEvent evas_event_callback_name(void* data, Evas* evas, Evas_Object* obj, void* event_info) – Edje Event edje_event_callback_name(void* data, Evas_Object* obj, const char* emission, const char* source) • Datapointercan be usedtostoreuser datatobe accessed by callback function • BecauseC does not have ‘this’ tostoreinstance data, you haveto supply it using datapointer Page 35  Intro  HelloNative  EFLLibraries  What is it?  AvailableWidgets  Widgets inYourApp  InteractiveWidget  AdvancedWidget  AppLayouting  Codingin C++  UsefulLibraries  SampleProject
  • 36. DeveloperWorkshop How to store user data • Tostoreuserdata, wehave tostore it in struct datatype. • It is recommendedtostore Evas_Object pointer, as well as business logic variables in struct • Try tonot storethestruct forstoring view datain global variable. Allocate the struct dynamically when creating theview. This is toensure the view can be instantiated morethan once • Perform deinitialization using the callback event for EVAS_OBJECT_DEL of the containerwidget, sothe data struct will be deallocated when thecontainer widget is destroyed • You can also attachpointer tothe struct toa widget object bycalling evas_object_data_set Page 36  Intro  HelloNative  EFLLibraries  What is it?  AvailableWidgets  Widgets inYourApp  InteractiveWidget  AdvancedWidget  AppLayouting  Codingin C++  UsefulLibraries  SampleProject
  • 37. DeveloperWorkshop AdvancedWidget:Creating widget by composingother widgets • SomeUserInterface elements might not available out-of-the-box from EFL libraries, sowe have tocompose multiplewidgets toachieve theUI we expect • Forexample: drop down widget has to becomposedof context popup widget andbutton widget • If yourUI element does not available, createa function toconstruct yourUI elements andreuse it across the program • SeeUIComponents sampleproject to seesomewidget composition examplePage 37  Intro  HelloNative  EFLLibraries  What is it?  AvailableWidgets  Widgets inYourApp  InteractiveWidget  AdvancedWidget  AppLayouting  Codingin C++  UsefulLibraries  SampleProject
  • 38. DeveloperWorkshop AdvancedWidget:Customizing contentof list using widgets • EFL provides acustomizablelist widget (genericlist/genlist) which can beusefulcreating types of list • Genlist can provide item class which can have acallback function toget a widget forspecific part of the list • Wecan even customizethe item layout using EDCfile(will be explained furtherlater) Page 38  Intro  HelloNative  EFLLibraries  What is it?  AvailableWidgets  Widgets inYourApp  InteractiveWidget  AdvancedWidget  AppLayouting  Codingin C++  UsefulLibraries  SampleProject
  • 39. DeveloperWorkshop TPK Package Layouting the app using EDJE • EFL provideastylesheet-like mechanism todefine layout, called EDJE • EDJE consist of EDCsourcefile, which willbe compiled intoEDJ file tobe loadedinto runtime • EDCfileis adoptedfrom LUA programming language. Basically it is adeclarative script defining layout position andsize • You maysayit is theCSS for native app Page 39  Intro  HelloNative  EFLLibraries  AppLayouting  Whatis EDJE  Structureof EDC file  Themein NativeApp  Customizing Genlist  TizenUI Builder  Codingin C++  UsefulLibraries  SampleProject EDCstylefile (.edc) C codefile(.c/.cpp) EDJfile(.edj) Executable edje_cccompiler GCC/LLVM compiler Compile Package Load
  • 40. DeveloperWorkshop Writing EDC file using Enventor • Tizen SDK provides Enventorwhich is an (almost)WYSIWYG editorforEDC file • Thelayout wecreate in Enventorwill beexactly similar when loaded to the real application. minor tweaksuch as scaling tomakeeverything looks right • EDJE can alsohave aprogram script that can be usedfor animation or changing stateof thestyle • Thereare additional powerfultools to debug yourEDCscript: edje_player. It can “run” theEDJ file and see what it behaves without running theentire application. Findit on your Tizen SDK folder Page 40  Intro  HelloNative  EFLLibraries  AppLayouting  Whatis EDJE  Structureof EDC file  Themein NativeApp  Customizing Genlist  TizenUI Builder  Codingin C++  UsefulLibraries  SampleProject
  • 41. DeveloperWorkshop EDC file basic structures • EDCfiles is a declarative file with tree structure, just likeXML, but withC-like syntax (with braces). Each elements has attributes that defines thedetail of theelements. • Theroot of EDCfile is collections • Todefinea style, we declare group insidethecollection. We have togive it name. • A group can have multipleparts. Parts arethe building blocks of your layout.You can compose(almost) unlimitednumberof part for each group. Page 41  Intro  HelloNative  EFLLibraries  AppLayouting  What is EDJE  Structureof EDC file  Themein NativeApp  Customizing Genlist  TizenUI Builder  Codingin C++  UsefulLibraries  SampleProject collections { base_scale: 1.0; group { name: "main"; parts { part { name: "bg"; type: RECT; scale: 1; description { state: "default" 0.0; color: 30 31 34 255; rel1.relative: 0.0 0.0; rel2.relative: 1.0 1.0; } } } } }
  • 42. DeveloperWorkshop Part types available on EDC file • Basically EDCfiles only provide primitivegraphical types. Below are someimportant types – RECT A primitive rectangle – TEXT/TEXTBLOCK A text.DifferencesonlyTextblockcan be multilineandbe set programmatically – IMAGE Animage – SWALLOW Anareawhichcancontainsany Elementarywidget.The importanttype ofpart • Seehttp://bit.ly/EFLEDC fordetails on structureof EDCfile • Each typecan have their own attributes which can be set. Set the attributes on description declaration • Most common attributes are: – Color Colordefined in R GB A one-byte values in decimal,separated byspace – Rel1/Rel2 Positioning ofthepart relativeto otherpart element.Willbe explained later – Min/Max Minimum/maximum sizeof thepart Page 42  Intro  HelloNative  EFLLibraries  AppLayouting  What is EDJE  Structureof EDC file  Themein NativeApp  Customizing Genlist  TizenUI Builder  Codingin C++  UsefulLibraries  SampleProject
  • 43. DeveloperWorkshop Positioning object part in EDC file • Part in EDCcan be positioned relatively from other part. This is the default mechanism in EDC • Rel1/Rel2 attributes definethe other part nameas the anchor point to computetheposition of thepart • Rel1 is thetop-left position, Rel2 is thebottom-right position.Thepart willthen be stretched between those twopoints • Therelative point is taken from the position of anchored part.The point is calculated as percentage between 0.0 to1.0 ofX&Yaxis of theanchored part Page 43  Intro  HelloNative  EFLLibraries  AppLayouting  What is EDJE  Structureof EDC file  Themein NativeApp  Customizing Genlist  TizenUI Builder  Codingin C++  UsefulLibraries  SampleProject Thispart Rel1 Anchor Rel2 Anchor Relative: 1.0 1.0 Relative: 0.0 0.0
  • 44. DeveloperWorkshop Relative position of a part • Thediagram in left can describe how relative positioning works in EDC • You can usefractional amount as relative. If you use0.5 0.5, then the relative position will be theexact centerpoint of thepart • You can also not supply anypart nameforrelative anchor. TheEDC willusethe root canvas area as anchorpart • Seehttp://bit.ly/TizenPartPosition for details on positioning part on EDC file Page 44  Intro  HelloNative  EFLLibraries  AppLayouting  What is EDJE  Structureof EDC file  Themein NativeApp  Customizing Genlist  TizenUI Builder  Codingin C++  UsefulLibraries  SampleProject Rel 0.0 0.0 0.0 1.0 1.0 1.0 1.0 0.0 y x
  • 45. DeveloperWorkshop Using EDJE in your application • ToutilizeEDJE in your application, you havetouselayout widget • Callelm_layout_file_set toset EDJ file tothelayout widget • If you haveSwallow orText part in yourEDJE layout, you can set it by using elm_layout_part_content_set andelm_layout_part_text_set to supply thewidget/text tothe specifiedpart Page 45  Intro  HelloNative  EFLLibraries  AppLayouting  What is EDJE  Structureof EDC file  Themein NativeApp  Customizing Genlist  TizenUI Builder  Codingin C++  UsefulLibraries  SampleProject
  • 46. DeveloperWorkshop OverridingTizen theme with your own EDC file • It is possibletooverride Tizen default widget styleanduseyour own implementation • Don’t start from zero. Obtain the original sourceof Tizen widget EDC file. Pulldirectly fromTizen source http://review.tizen.org/git • Copy theEDCsourceyou want to style, andput it on EDCfile on your project. It might cannot becompiled forthefirst time. Fix one byone the error. Usually it is missing include definition or missing file. Page 46  Intro  HelloNative  EFLLibraries  AppLayouting  What is EDJE  Structureof EDC file  Themein NativeApp  Customizing Genlist  TizenUI Builder  Codingin C++  UsefulLibraries  SampleProject
  • 47. DeveloperWorkshop Use the widget override you created in your application • Twoway of embedding themetoyour application: – Overlay Replaceentirelythedefault themewith our implementation.Ensure thegroup name is exactlysimilarwith theconvention of Elementarywidget – Extensions Extendthethemewhich addnew group name to thecollection.Does not replaceany default group Page 47  Intro  HelloNative  EFLLibraries  AppLayouting  What is EDJE  Structureof EDC file  Themein NativeApp  Customizing Genlist  TizenUI Builder  Codingin C++  UsefulLibraries  SampleProject defaultTheme = elm_theme_new(); elm_theme_ref_set(defaultTheme, elm_theme_default_get()); elm_theme_overlay_add(defaultTheme, “/res/edc/naviframe.edc”); elm_object_theme_set(rootFrame, defaultTheme);
  • 48. DeveloperWorkshop CustomizingGenlist style default style • Thedefault styleis boring • By extending default theme, wecan defineour own genlist style. It is very usefultocreate yourown item style forgenlist • Follow theprocedure of copying the original sourcefrom Tizen source, then start modifying yours Page 48  Intro  HelloNative  EFLLibraries  AppLayouting  What is EDJE  Structureof EDC file  Themein NativeApp  CustomizingGenlist  TizenUI Builder  Codingin C++  UsefulLibraries  SampleProject
  • 49. DeveloperWorkshop TizenUI Builder, simpler way to developUI • Ratherthan coding yourself, you can let theIDE generates the code for you • Tizen IDE providesWYSIWYG editor forbuilding nativeapp, similar with Androidlayout editor • But you havetodecide in the beginning: want tocode yourself, or utilizeUI builder.You cannot change yourmindafter that • Start new project andselect UI Builder fromTemplate Page 49  Intro  HelloNative  EFLLibraries  AppLayouting  What is EDJE  Structureof EDC file  Themein NativeApp  Customizing Genlist  TizenUI Builder  Codingin C++  UsefulLibraries  SampleProject
  • 50. DeveloperWorkshop Ifyou thinkC is too clumsy, code in C++! • C is procedural, C++ is object- oriented • C++ has classes, C only have struct • C++ has standard library that is very stable and easy to use, while C does not. In Tizen you are equipped with some utilities, like EFL Eina, but once again, it is procedural • C++ is typesafe. In C you deal with casting everytime, might lead to bug • Tizen API is flat-C libraries, not readily to be implemented in C++ out of the box • C++ is a massive language, quite differ with Java/Objective-C, add more learning curve • Additional code size and complexity created by the compiler, as well as memory footprint (but still far-far less than web-based app) Pros Cons  Intro  HelloNative  EFLLibraries  AppLayouting  Codingin C++  WhyC++?  SRINC++ Framework  SomeExamples  UsefulLibraries  SampleProject Page 50
  • 51. DeveloperWorkshop SRINC++ Framework Libraries: Our library to codeTizen NativeApp inC++ • Ourresearch product for Tizen development • Havebeen implemented in all our Tizen projects in SRIN(Yes, weall codeour projects in nativeC++) • Was born becausewe fed up of coding in procedural during our first two-weeks of developing native Tizen app • The library is built as Shared Library • Your project can compile and link against the library • Define application pattern using popular MVC pattern. This helps in organizing app and help migrating from popular platform such as Android or iOS • Simplify boilerplate codes that resulted from using flat-C API of Tizen API  Intro  HelloNative  EFLLibraries  AppLayouting  Codingin C++  WhyC++?  SRINC++ Framework  SomeExamples  UsefulLibraries  SampleProject Page 51
  • 52. DeveloperWorkshop Example:HelioskyApp, aWordpress blog client inTizen • My blog: http://heliosky.com using Wordpress.UsingWP REST 2.0 asAPI toconnect tomy blog • Just run andseeit in action   Intro  HelloNative  EFLLibraries  AppLayouting  Codingin C++  WhyC++?  SRINC++ Framework  SomeExamples  UsefulLibraries  SampleProject Page 52
  • 53. DeveloperWorkshop Useful libraries that can enhance your Tizen native development • Weadmit,Tizen NativeAPI sometimes is hard touse. Sohere’s someof libraries that weusein our projects • RapidJSON (http://rapidjson.org) C++ way toparseJSON.Way simplerand straightforwardthan usingGlib provided byTizen • QuinceLib (http://quince-lib.org) ORM forSQLiteinTizen.Very simpleway rather than writing your own SQL query andfetching data from memory • Allthoselibraries is embedded in ourSRINC++ FrameworkLibraries. Wewill share it soon  • Registeryoure-mail onGitLab, and also register to http://bit.ly/SRINCPPLIB and when weare ready to publish, wewill notify you!  Intro  HelloNative  EFLLibraries  AppLayouting  Codingin C++  UsefulLibraries  SampleProject Page 53
  • 54. DeveloperWorkshop SomeSneak Peek… Page 54  Intro  HelloNative  EFLLibraries  AppLayouting  Codingin C++  UsefulLibraries  SampleProject