Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
N

codecentmc

ANDROID ON GROOVY

Alexander (Sascha) Klein <aIexander. klein@codecentric. de>
cadecentmc

ALEXANDER (SASCHA) KLEIN

Principal Consultant

codecentric AG
Stuttgart

Groovy,  JavaFX,  UI /  UX
Griffon c...
codecentmc

AN DROID

2003 Android,  Inc. 
2005 Google
Open Source (Apache 2.0)
codecentmc

TOOLS

Android SDK
Gradle
Android Studio
Êåłilël

? wal  : JE-L (larval 7* ianrsgęn. .rr. rggsë 

'Witt ucrtųuàží fxłył/ Âúf r fïïàyiyliírfžłg: 
VAVHÊILIClïøciïflí...
codecentmc

USEFU LL GROOVY
FEATURES
N

codecentmc

GROOVY BEANS

@ToString

class User {
String name
String lastname

}

def user =  new User(name:  "Jack",  ...
Iiniïficlni. aflåiillllCLïllłlłLíl-ïÊïålllålftIlåw/  'ál-glim-OIalfïljhúłłüålãiïïęlllarü,  l
('glllvlålPrïjíłâi
vnnjnil on...
N

codecentmc

MAP COERCION

Java Code

new AsyncTask<Void,  Long,  String>() {
@0verride protected String doInBackground(...
codecentmc

AST TRANSFORMATIONS

Groovy Code

@Immutable final class ToBeImmutable {
String Variable

}
,(V-. 

, Qlčíėjptikçllåpåcii? :tilPlíargzlilíłcitžišàe

; @l`l*L. Ii; :;il-g1ï<ïZłi:  iurlgštžrtýiicžtžtsiír"

 

@If; ;a...
ix
codecentmc

TRAITS

@CompileStatic
@SelfType(Context)
trait GoogleApiProvider {

GoogleApiClient googleApiClient

void ...
codecentmc

GROOVY EXTENSIONS

Java Code

import static android. support. v4.app. Notificationcompat. *;

Intent intent = ...
Jmit: =FN! (IILÊJHJCTAIFJIIBJ glim = {`

 

íšircxiàrłizfâ/  Eicrcïł : c

. J -

-s

Lønrilvłaiitæ elLivAv åitïilnralpi ar...
5

codecentric O'

GROOVY EXTENSIONS

Extension Module

@CompileStatic class ContextGroovyMethods {
static void notify(Con...
C   »< :   >  rt    ,   

 

 

lTl

? olkoílarï
? ET LL-'Jz

: lFWYÃIIEÉIII"r'åI= IIIIIF'CK= L`hAW| HÊ'^`»~ 'IMF
om).  um...
codecentmc

GROOVY ON ANDROID
codecentmc

WHAT IS NEEDED? 

Groovy >=  2.4.0
current:  2.4.3
Java 6JDK
Android SDK
Android Studio
Gradle
Pll: >)/ *~/ ' L   > li f:   í> l Dlfíl T H AT? 

'l .  AN? lëïíïüCÊÊÊíÊLJCÊírliïi -= > Gircłncýiyøfy/ 

 LÉFÉFF-Êãėílíšvl...
N

codecentmc

AN DROIDSTUDIO

Create a new project with Android Studio
Modify buiId. gradle on module-level: 

buildscrip...
ii i :   > I i) : r l,  i li  l  >

'rïr1ł~: r:ffirr“ 4:1p: igi/ 'zzrczfrrrłauiiriyłgnc-ixł:  .my

 

TTN”151?)íïž/ åiiïif...
l A “x/ ,L  i" ? i R Off) “it/ 'i" 

Lilllåiliłnç.  ezLasria üłar1u| r:`uii: ;1v: ír: i;i»' avzsitanloiis.  :iniziųønlåłal...
l A “x/ ,L  i" ? i R jil) “i(/ 'i“ 

-rølláł-Élå iihlílllłl : ïsvikïíųvy allem-anil;  :vi: :ïnolllšłalrüløíiíilltírjiæif '...
l A “i/ ,L  <ï` ? i R jil) “i/   

-øllaęøa kalium zïsvirzïïüi' anale-gunstig:  :lricïnnonnlåłanrüløltžlvzï: im -{

elllvI...
N

codecentmc

LAZYBO N ES

install gvm

$ curl -s get. gvmtool. net |  bash

install lazybones

$ gvm install lazybones

...
N

codecentmc

LAZYBO N ES

create new project

$ lazybones create grooid-new-project MyApp

Android Studio > File > New >...
r '  34
li

c; :Clríiaiicųalrinbrinci 

      l i 

   

i
N

codecentmc

ASYN CTASK - JAVA

final long waitTime =  5000;

button. set0nClickListener(new View.0nClickListener() {
@0...
N

codecentmc

ASYN CTASK - JAVA

@0verride protected void onPreExecute() {
String text =  getRes0urces(). getString(R. st...
5

codecentric O'

ASYN CTASK - JAVA

@0verride protected void onProgressUpdate(Long. .. data) {
String text =  getResourc...
N

codecentmc

ASYN CTASK - GROOVY

def waitTime =  5000
button. onClickListener =  {
Fluent. async {
long time =  waitTim...
N

codecentmc

ASYNCTASK - ALTERNATIVE

button. onClickListener =  {

Fluent. async this. &doInBackground
. first this. &d...
c; :cïlríliaiiicųaurinbrwc:  

: i a r u  i

4 r' T ' Iï 

  l in-)

n'~. .~i-= ~., .i; a.; ._»~ : gei-nt . enixznnųm. ......
N

codecentmc

PERFORMANCE

GR8ConfAgenda

Groovyjar -> 4.5 MB
Application -> 2 MB

after ProGuard ->1 MB

~ 8.2 MB RAM (m...
codecentmc

PROGUARD

-keep class org. codehaus. groovy. vmp1ugin. **

-keep class org. codehaus. groovy. runtime. dgm*

-...
codecentmc

COMMUNITY
ní

T. 
T

   

x* ,  If , t*^ .  fm* .  V! "  -
 "xxx/ f I    

ÊIsIIÊIÊFIIZïÊÊIÊÊI: III!  .IZïišÊïålICÊI
*r/ kànà/  Ilrė...
i/ J
II-

I_I, _I_

'lat . jiåięlkøïi nllęnãiïäílålinøïl

I:  If?  4
 

IIÉIIN/ N/I

-ølhęęlęi WLV/ :iukïiíïłújífigxf aata...
N

codecentmc

SWISSKNIFE - PERSISTENCE

@SaveInstance
private int myInt

/ / You can also set a custom tag to your Variab...
N

codecentmc

SWISSKNIFE - 'PARCELING'

Java Code

public class ParcelableClass implements Parcelable {
private int id; 
...
codecentmc

SWISSKNIFE - 'PARCELING'

Groovy Code

@Parcelable

class ParcelableClass {
int id
String name

}
N

codecentmc

GROOID TOOLS

SWingBuiIder-Iike builder for Android UI's
Views without xml
dynamic views

View view =  new ...
e
ITT]

         

cxcnsl
i >    :     Pl L.  rxrn <ïil> 

iïílllïflïëlljrlšllïïłïlIiïl ait;  W-. QTA', F`KIA~Ê: »V1TVYTÊ`...
Fžlųfl i'
F  -

tre T l AL 

Ffålïi"57l: WlïlšIQflCïš ciíži cc. l<: mvi+t-clíc'rf. l<: ïl ïšiøfvïålïïêlïfiïtåí

åfšllltłïl...
codecentmc

REAL LIFE USAGE

31):  Nm:  mark ëíms

III lln Coin That's I'll In printfo

Post:  published in Anguú,  NH

IJ...
Codecentmc

REAL LIFE USAGE

n 'Alexander

ų-  Agenda

Einkaulen  0

c r . i. . .
sw | @| ųammmmm
Empiehlungen ę o `

0
QQ...
N

codecentmc

QUESTIONS? 

Alexander (Sascha) Klein

codecentric AG
Curiestr.  2
70563 Stuttgart

tel +49.71 l .67400-328...
Upcoming SlideShare
Loading in …5
×

Android on Groovy

2,591 views

Published on

Developing Android apps using Groovy as presented at GR8Conf 2015 EU in Copenhagen

Published in: Software
  • Be the first to comment

Android on Groovy

  1. 1. N codecentmc ANDROID ON GROOVY Alexander (Sascha) Klein <aIexander. klein@codecentric. de>
  2. 2. cadecentmc ALEXANDER (SASCHA) KLEIN Principal Consultant codecentric AG Stuttgart Groovy, JavaFX, UI / UX Griffon committer alexander. k|ein@codecentric. de @saschak| ein http: //gp| us. to/ ka rfunkel
  3. 3. codecentmc AN DROID 2003 Android, Inc. 2005 Google Open Source (Apache 2.0)
  4. 4. codecentmc TOOLS Android SDK Gradle Android Studio
  5. 5. Êåłilël ? wal : JE-L (larval 7* ianrsgęn. .rr. rggsë 'Witt ucrtųuàží fxłył/ Âúf r fïïàyiyliírfžłg: VAVHÊILIClïøciïflíęłiłël. .ïžíiêłêlñjšł33 : airxçïl (íïítïïriïljåluiïåí är; Köln: ricl , IAM
  6. 6. codecentmc USEFU LL GROOVY FEATURES
  7. 7. N codecentmc GROOVY BEANS @ToString class User { String name String lastname } def user = new User(name: "Jack", lastname: "Ripper") user. name = "Sascha" println user. name
  8. 8. Iiniïficlni. aflåiillllCLïllłlłLíl-ïÊïålllålftIlåw/ 'ál-glim-OIalfïljhúłłüålãiïïęlllarü, l ('glllvlålPrïjíłâi vnnjnil onlcïljųqł-gfïñjalnv/ w^l : l ęiieanr~^irsxoxi: ílvzï: i;vfíïhiiauii , l . z Gio: niliøi/ Ciųziųfïkêf _Êíłïiłclnc. ol| I(Zl_íltlł(L.1AIíít= I|| =|r' = ~ = { aíilawirtïzržíïíhvêłlíílvll muise-Iii: `l . l = l
  9. 9. N codecentmc MAP COERCION Java Code new AsyncTask<Void, Long, String>() { @0verride protected String doInBackground(Void[] params) { } @0verride protected void onPreExecute() { } @0verride protected void onPostExecute(String result) { } } Groovy Code def asyncTask = [ doInBackground: {params -> . .. }, onPreExecute: {-> . .. }, onPostExecute: {String result -> . .. } ] as AsyncTask
  10. 10. codecentmc AST TRANSFORMATIONS Groovy Code @Immutable final class ToBeImmutable { String Variable }
  11. 11. ,(V-. , Qlčíėjptikçllåpåcii? :tilPlíargzlilíłcitžišàe ; @l`l*L. Ii; :;il-g1ï<ïZłi: iurlgštžrtýiicžtžtsiír" @If; ;a1ïrfirc: ųr1lrç: ;1 "Q"ïlñiłålïžiÊïllïžiirïšïïïí"Lalíïüíízlïšts @»A. I.. i^r_. :r:1{; lrręnr; uia gil iaiäęízltåi! Qlltarięgy Qęïlljiííhålí" ålïlíïl , rirsairry/ nïrixcnraè AE ~ -
  12. 12. ix codecentmc TRAITS @CompileStatic @SelfType(Context) trait GoogleApiProvider { GoogleApiClient googleApiClient void createGoogleApi() { googleApiClient = new GoogleApiClient. Builder(this) . addApi(wearable. API). build() } class Myservice extends Service implements GoogleApiProvider { @Override protected void onCreate(Bundle savedInstanceState) { super. onCreate(savedlnstancestate) contentview = R. layout. activity_presentation createGoogleApi() } / / . .. } class MyActivity extends Activity implements GoogleApiProvider { / / . .. }
  13. 13. codecentmc GROOVY EXTENSIONS Java Code import static android. support. v4.app. Notificationcompat. *; Intent intent = new Intent(this, MyActivity. class); PendingIntent pending; pending = PendingIntent. getActivity(this,0,intent, FLAG_UPDATE_CURRENT); Notificationcompat. BigTextStyle bigStyle; bigStyle = new NotificationCompat. BigTextStyle(); bigStyle. bigText("Time left: " + timeLeft); Bitmap icon; icon = BitmapFactory. decodeResource(getResources(), R.drawable. speaker); Notificationcompat. Builder builder; builder = new NotificationCompat. Builder(this); builder. setSmallIcon(R. drawable. ic_action_alarms) . setLargeIcon(icon) . setContentTitle("Time left") . setContentText(timeLeft + " (Elapsed: " + rounded + "%)") . setContentIntent(pending) . setStyle(bigStyle); NotificationManagerCompat manager= NotificationManagerCompat. from(this); manager. notify(NOTIFICATION_ID, builder. build()); šx
  14. 14. Jmit: =FN! (IILÊJHJCTAIFJIIBJ glim = {` íšircxiàrłizfâ/ Eicrcïł : c . J - -s Lønrilvłaiitæ elLivAv åitïilnralpi arielilaoïlåirïilnralłor _iijžfiiinlplælmžizourjv/ .JÉłaItIonjI-_laåhàlolllraàll rauxoinnroxauęg, :l. o'. lr~= .iv. vis. lïoll. ęu. api-. raItc-. am Lai! !`3IIiÊIÃIOIILEILïIFIIIS anhllLLïJ-(uni = it. . I' hęlwgnljųoni = ~ oral-lila 'finaly uomłuniïïïęrkę. g na 'kam ' Kollig! iïlå' = < "å “Lk-Firí, Cåïhlgbàlåløíiė -Éšłl Vm 'ł- ijfåil " , oIęIIIoÉÉ: l|ull| ii(= ,I| iiïÉZOL, iiLv1Ax-it; ír. vm3r. ww el. aiti`, llrllliälš_Cllkłaslilrï ïJFlm : l Elm-a 'hęifi -: -àåii `l . v
  15. 15. 5 codecentric O' GROOVY EXTENSIONS Extension Module @CompileStatic class ContextGroovyMethods { static void notify(Context self, int id, Notification notification) { NotificationManagercompat. from(self). notify(id, notification) } static void notify(Context self, int id, @DelegatesTo(Notificationcompat. Builder) Closure spec) { def builder = new NotificationCompat. Builder(self) builder. with(spec) notify(self, id, builder. build()) } static PendingIntent pendingIntent(Context me, int code, Class cls, int flags) { PendingIntent. getActivity(me, code, new Intent(self, cls), flags) } static Notificationcompat. BigTextStyle bigTextStyle(Context self, @DelegatesTo(Notificationcompat. BigTextStyle) Closure spec) { def bigStyle = new Notificationcompat. BigTextStyle() bigStyle. with(spec) return bigStyle
  16. 16. C »< : > rt , lTl ? olkoílarï ? ET LL-'Jz : lFWYÃIIEÉIII"r'åI= IIIIIF'CK= L`hAW| HÊ'^`»~ 'IMF om). umïlairalųls: .gronwyp . r'l. lll'i. :INH-åžíšzałløfàïłlnłłlłolílllkä Imailllha! Mali| :sunnndlrmjndlàzėtallhàijønę. InuiIÉIlIk-ęłlłęlñałnclnsł . ..Oi . ràëïüãlll-ïilllllCLíIšlsflãł-Êhlllw -ępzcitqnwgikonutMpnnlłmgxęt. C: n:nun-Kinromvæyülaiiinondl: 'u j > “rim *In ål icšųráxcïille-#*rc: ;!'lsxíc: ä, Qh-åi lífl - . tlisųxàr fi:3315? “to . Els Tri *al siíèïgxrž-tlíšïž-tiïiål, afsit: gitt ęíęxcžt Étrí ~ïïïlęiçięz^rJicti
  17. 17. codecentmc GROOVY ON ANDROID
  18. 18. codecentmc WHAT IS NEEDED? Groovy >= 2.4.0 current: 2.4.3 Java 6JDK Android SDK Android Studio Gradle
  19. 19. Pll: >)/ *~/ ' L > li f: í> l Dlfíl T H AT? 'l . AN? lëïíïüCÊÊÊíÊLJCÊírliïi -= > Gircłncýiyøfy/ LÉFÉFF-Êãėílíšvlïfëïł ~r>~ Axriçïirc: r-iclïitzltcžlłtíl
  20. 20. N codecentmc AN DROIDSTUDIO Create a new project with Android Studio Modify buiId. gradle on module-level: buildscript { repositories { jcenter() } dependencies { classpath 'com. android. tools. build: gradle 1.2.3' classpath 'org. codehaus. groovy: gradle-groovy-android-plugin:0.3.6^ } } apply plugin: 'groovyx. grooid. groovy-android' dependencies { compile 'org. codehaus. groovy: groovy:2.4.3:grooid' }
  21. 21. ii i : > I i) : r l, i li l > 'rïr1ł~: r:ffirr“ 4:1p: igi/ 'zzrczfrrrłauiiriyłgnc-ixł: .my TTN”151?)íïž/ åiiïiffïłalłlf”ir/ fiíålïiłšl : i:Içeirgwcïrirwziiižnžgęíw: içnøy VêiPTãiïiIä-T , laiizai-*Fïlięrsz iii .2-; ;i*i; ii; iię~/ “ę-_ritrizii/ àiiñí". kwel omie
  22. 22. l A “x/ ,L i" ? i R Off) “it/ 'i" Lilllåiliłnç. ezLasria üłar1u| r:`uii: ;1v: ír: i;i»' avzsitanloiis. :iniziųønlåłalrüïaicàvnł'hv i elllüålrvïiiła , ur-nrm l vnniutl omCJ-_r-. ii-_njłåu Ilha mxvt-_noàliinuiiæzinucx-. Låiàræikatl = l . :Ir. lonlcøfaręiiraušęręxvtęlíllum III -ł-fiitaiiłsuli . . : nikauiñiłïhaim : cjLanu-Iųii . ..Lvaï: i;v/ _,| n=. njn| i -: ęmvtarrïjløjła , oiųlïnlljių fonmlk-_nnni olIlCLFęłåiiäłjgííjåkølllėlłllålllllüülålllll antanut) -l grgiiiilęanll-. nifhęiitęnrï i . ânifkęiiàuck-mann-męnlų__inalílns. lIlållllIl-I w-. iilllrni 'ïfłfllålė ` l ęuxuarvžløïła , øųlïølljųe Éomøikęnm snuif” ïlliï. 3:01! = Manuela! ii' Llłiotl : o: : L “ rsiituni 'l . f 'lå
  23. 23. l A “x/ ,L i" ? i R jil) “i(/ 'i“ -rølláł-Élå iihlílllłl : ïsvikïíųvy allem-anil; :vi: :ïnolllšłalrüløíiíilltírjiæif '{ ęlllvlåltïžïäła , rename l vnnjužl onlQi-r-. r-. iil-Ilåil dlka mlvl-_loïllinlęiilzlnlcx-. ł-Éiiręlkat) = l . ålr*. AOIIICLFGEÉGIÊSEUVIGIQIJIIHI ln . t-fiitaiil-il _. niil-. lliíåiłíhęlnvl li. . 'Lavpllli . ,ÊJÃÊÂÊÉF/ ųlllåljll) emuęlrržløjła Émølhęręlui onlC; ramilųlipiírñnclulęliiręlnlllliiręnui nlęlnuw) -l gl-. liiilal llęiilęlri i , :afkak-CR. illallllL-| llęlllų__nl: IIIllL. mann! ) valium) 'rima `l 1 x eumar-rzjųojła gluølkanlli alllllsiüollL-Lfilaliłålalkuúlitalltiiłalllllfkalni Liam! ) l alnljøíll) olli_glal'í'ïiïï_ïlųlsiïl = {
  24. 24. l A “i/ ,L <ï` ? i R jil) “i/ -øllaęøa kalium zïsvirzïïüi' anale-gunstig: :lricïnnonnlåłanrüløltžlvzï: im -{ elllvIalr-rïïäłai , enc-line l vnniutl IlllCLi-'arëiïlallåil øïlka analvtanoàliinnęiiæannncnabåiiæalkat) . air olllCManilla: talalvlałílllløitalunælał-Êïiłaiiłal) emualrržløjła Ênonolhannnn onnnç; ramilųlųitjunnulliręlnlųlliirannln nnnaunlw) -l nnnannnlIjnnnFLaiin-_lr -in Lalinanuunnananųi. .nnnannnųignnraržlnxi lilalllll) calilllrni : ïfłfllà `l ęnonuanr-riųojła Ênonølkannni onnl! )piiionlL-'Lfilalnnłšłalkuiilalllciltalnlllfkalnn ïiialnnl) -{ annnljoíl hłlolliJa-airfiïílnųlaa) = l : l tłn
  25. 25. N codecentmc LAZYBO N ES install gvm $ curl -s get. gvmtool. net | bash install lazybones $ gvm install lazybones configure lazybones templates for Android / / ~/ .lazybones/ config. groovy bintrayRepositories = [ “marioggar/ grooid-templates”, “pledbrook/ lazybones«templates“ i
  26. 26. N codecentmc LAZYBO N ES create new project $ lazybones create grooid-new-project MyApp Android Studio > File > New > Import Project optional: modify versions in MyApp/ build. grade Adds usefull libraries
  27. 27. r ' 34 li c; :Clríiaiicųalrinbrinci l i i
  28. 28. N codecentmc ASYN CTASK - JAVA final long waitTime = 5000; button. set0nClickListener(new View.0nClickListener() { @0verride void onClick(View v) { new AsyncTask<Void, Long, String>() { @0verride protected String doInBackground(Void[] params) { long time = waitTime + 1000; while (time > 1000) { if (isCancelled()) break; time -= 1000; publishProgress(time); Thread. sleep(1000); } return getRes0urces(). getString(R. string. finished);
  29. 29. N codecentmc ASYN CTASK - JAVA @0verride protected void onPreExecute() { String text = getRes0urces(). getString(R. string. wait); text = String. format(text, (int) (waitTime / 1000)); textField. setText(text); } @0verride protected void onPostExecute(String result) { textField. setText(result); }
  30. 30. 5 codecentric O' ASYN CTASK - JAVA @0verride protected void onProgressUpdate(Long. .. data) { String text = getResources(). getString(R. string. wait); text = String. format(text, (int) (waitTime / 1000)); textField. setText(text); } @0verride protected void onCancelled(String 5) { String text= getResources()-9etString(R. string. cancel); textField. setText(text); });
  31. 31. N codecentmc ASYN CTASK - GROOVY def waitTime = 5000 button. onClickListener = { Fluent. async { long time = waitTime + 1000 while (time > 1000) { if (isCancelled()) break time -= 1000 progress(time) sleep(1000) } return resources. getString(R. string. finished) }. first { def text = resources. getString(R. string. wait) textField. text = String. format(, text (int) (waitTime / 1000)) }. then { String result -> textField. text = result }. onProgress { Long[] data -> def text = resources. getString(R. string. wait) textField. text = String. format(text, (int) (data. firSt()/1000)) }. onCancelled { String result -> textField. text = resources. getString(R string. cancel) }()
  32. 32. N codecentmc ASYNCTASK - ALTERNATIVE button. onClickListener = { Fluent. async this. &doInBackground . first this. &doFirst . then this. &doAfter . onProgress this. &onProgress . oncancelled this. &onCancelled . call() } String doInBackground(def params) { . .. } String doFirst() { . .. } String doAfter(String result) { . .. } String onProgress(long[] data) { . .. } String onCancelled(String result) { . .. }
  33. 33. c; :cïlríliaiiicųaurinbrwc: : i a r u i 4 r' T ' Iï l in-) n'~. .~i-= ~., .i; a.; ._»~ : gei-nt . enixznnųm. ... ..manelnm: ęíuøãęnænønønæcænęnoníèienensàiïiėi 'f'
  34. 34. N codecentmc PERFORMANCE GR8ConfAgenda Groovyjar -> 4.5 MB Application -> 2 MB after ProGuard ->1 MB ~ 8.2 MB RAM (many images) with CompileStatic
  35. 35. codecentmc PROGUARD -keep class org. codehaus. groovy. vmp1ugin. ** -keep class org. codehaus. groovy. runtime. dgm* -keepclassmembers class org. codehaus. gro0vy. runtime dgm* { >k . } -keepclassmembers class ** implements org. c0dehaus. groovy. runtime. GeneratedC1osure { n á: . I } -dontwarn org. codehaus. groovy. ** -dontwarn groovy**
  36. 36. codecentmc COMMUNITY
  37. 37. ní T. T x* , If , t*^ . fm* . V! " - "xxx/ f I ÊIsIIÊIÊFIIZïÊÊIÊÊI: III! .IZïišÊïålICÊI *r/ kànà/ Ilrėgïęnícïiýticzsxru 'MluIłïïfžñïfęræuøïñïųå; hciiàså; nr" åIÂÉFICÉI ÂíflåïíïílïíåïIåí"l. íïl<šíïêlïïííiíäïïsà . łtłrtlü ait Iin: nnaiíïilisųtflrïàxa EJšÊIIíïišI AXZTIT : Êïíïï-ÉlíïïłłšłiiílTFITEÊIÊIÉïIITI.3% 'I`IiÊÊ'fal; fïzI/ ï2 tIintikL, ceinírI/ Axräraž: IuIaI/ Éiuvłrxžàírnia r- ! f 'I .
  38. 38. i/ J II- I_I, _I_ 'lat . jiåięlkøïi nllęnãiïäílålinøïl I: If? 4 IIÉIIN/ N/I -ølhęęlęi WLV/ :iukïiíïłújífigxf aata-annak łiliíïłløzlïgv/ -i . Natali-dril evfïílanvlåtvljøíli ki. . go| n1c: i,1ų: -;I: L.Jad . . 4 vmíloíl mlåių a Inlfïli-Iłtadiv , . ml ImIII : I Tilålsàiï, .ntalłc-. Ilęaæszct innłà. .. gllll. . , mm V nllånlłšęiøif" . 'long-ii -LEUKHIHIFSIHIIIIW sęliiølævłýi ÊI* gom' łgnønllnøïl vnnjoíl łlłšïOllllåli7'f"ll! låłg$fí-jILQICHÊL I. I'r'lc. I : I Cloniilęlniïx. MAILIÃI Ina azt-. I-Iųiílę-Ioił mi Êorauųlłųunnųmøjł 'l . l állvlęlrïikåłä
  39. 39. N codecentmc SWISSKNIFE - PERSISTENCE @SaveInstance private int myInt / / You can also set a custom tag to your Variable @5aveInstance(“MYSTRING“) private String mystring @0verride void onCreate(Bundle savedInstanceState){ / / Your previous code SwissKnife. restoreState(this, savedlnstancestate)
  40. 40. N codecentmc SWISSKNIFE - 'PARCELING' Java Code public class ParcelableClass implements Parcelable { private int id; private String name; public ParcelableClass(Parcel source) { this. id = source. readInt(); this. name = source. readString(); } public void writeToParcel(Parcel out) { out. writeInt(id); out. writeString(name); } public String getId() { return id; } / / . ..
  41. 41. codecentmc SWISSKNIFE - 'PARCELING' Groovy Code @Parcelable class ParcelableClass { int id String name }
  42. 42. N codecentmc GROOID TOOLS SWingBuiIder-Iike builder for Android UI's Views without xml dynamic views View view = new AndroidBuilder(). build(this) { relativeLayout(width: MATCH_PARENT, height: MATCH_PARENT, padding: [dp(64). dp(16)]) { textView(width: MATCH_PARENT, height: dp(20), text: R. string. hello_world)
  43. 43. e ITT] cxcnsl i > : Pl L. rxrn <ïil> iïílllïflïëlljrlšllïïłïlIiïl ait; W-. QTA', F`KIA~Ê: »V1TVYTÊ`_IÊIÊEÊI ęixãięłtflcžzitulę . Akrttïirtïiltïïl <íIIlar, -s: l_. c:; rj, =.ltïlaf* : Cát-tin rjnr-nlý/ rfmiłtãl *Fifcýrrn : CHI-gr sæfv/ :àïüęirïï ltiwftzęxczccnçàla Iiiåší : ligi : insit: ïrýiitcø a Jæxíė: .lui wnll . tug c: <:niri~/ 'sii'ïí: ;ic: l Tlïęíïíłl : ï;iE; &ï<: ; iíi; rt"irïrcraitï ėllgãrškfá Cianin IíÉtï-'jllílėiišïl viilïiíiïi Elïstærlíiietæmáïråhlç: kar `i'l'| “:; ; 1:1' . ï/'ųųífý/ :ilrziníi/ 'ÊIITÊÉÊIÉ“å/ Êzñíållk *Gimiçiw/ “Zïlïar$: L.ci~åic: l;ii“ E ? Tilšï CA: irrïlgïtiliålïçiïålrl
  44. 44. Fžlųfl i' F - tre T l AL Ffålïi"57l: WlïlšIQflCïš ciíži cc. l<: mvi+t-clíc'rf. l<: ïl ïšiøfvïålïïêlïfiïtåí åfšllltłïlffIçłïlłêłïýïlłålåíí; twiil'*i= ,i'r÷= ,a 'grn: ię-síll: llsè lÊiÊåITTiÊC`lltEšš ifžrięitzlíic-ocls; Iirrilt: Itłęgêr . Fiíiëllłíhlsiíeircžl TW: lñlli"lgf ÉåL; l;; :i; ;:; <;1oci“ii ANTlłïiïñïårïiïłljíėírkl Cklåïår råïłųgålęr siuçinfųėnlffi: Ayritïïlrcnïčłl'líšii-'giçllg Flllgfęíliw c: :lïrâ; .lïrï13:si; vIgíi-*y çiíftzgýn rgucíii: íšllg. l;ãïllïíl<líilïl“`rí Giiïtxrzhøs/ *I Qlííl ? fox
  45. 45. codecentmc REAL LIFE USAGE 31): Nm: mark ëíms III lln Coin That's I'll In printfo Post: published in Anguú, NH IJ Getting Groovy With Remlive Android Bx 'IlOHl I P ANDLX "Slow" a word no one ever wants to see associated “ith their app. Delay and lag ofas little as mu-zou millisemnds wj m mu-givgzl bv users as or slow rformanct'. Keeping long running tasks on the main thread will result in that perception, the dreaded "Application Not Responding" (ANK) and a bad user experience. This leaves us (levelopers une choice: cunctlrrent execution of Lode. A The recent gromh in pula 'ty of fi ('tional programming is well xf 44/- Jâøy/ Jol 3«)ny, _/. æ./ -ł-»
  46. 46. Codecentmc REAL LIFE USAGE n 'Alexander ų- Agenda Einkaulen 0 c r . i. . . sw | @| ųammmmm Empiehlungen ę o ` 0 QQQQ! :
  47. 47. N codecentmc QUESTIONS? Alexander (Sascha) Klein codecentric AG Curiestr. 2 70563 Stuttgart tel +49.71 l .67400-328 mobile +49.172.5294020 alexander. klein@codecentric. de @saschak| ein http: //www. codecentric. de http: //blog. codecentric. de

×