Slide 1

Slide 1 text

Exploring View-Based Application with Conductor Esa Firman

Slide 2

Slide 2 text

What’s the worst thing that could happen when you’re using Android Activity as your page representation?

Slide 3

Slide 3 text

¯\_(ツ)_/¯ #MintaPutus

Slide 4

Slide 4 text

Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {...}; have you declared this activity in your AndroidManifest.xml?

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

Task and Back Stack Intent intent = new Intent(LoginActivity.this, MainMenuActivity.class); intent.addFlags(...) // FLAG_ACTIVITY_CLEAR_TOP, NEW_TASK, etc ... startActivity(intent); finish(); Or use `launchMode` in AndroidManifest.xml

Slide 7

Slide 7 text

Task and Back Stack TaskStackBuilder -> https://developer.android.com/reference/android/support/v4/app/TaskStackBuil der.html

Slide 8

Slide 8 text

What about Fragment? ● Introduce more complex lifecycle ● Never use it since last year ( expect for Google Map ) ● ¯\_(ツ)_/¯

Slide 9

Slide 9 text

What about Fragment? IllegalStateException: Can not perform this action after onSaveInstanceState

Slide 10

Slide 10 text

What about Fragment? Advocation Against Android Fragments - Piwai https://medium.com/square-corner-blog/advocating-against-android-fragments-81fd0b462c97

Slide 11

Slide 11 text

What’s the option? ● Flow + Custom / Compound View ● Scoop ● Conductor

Slide 12

Slide 12 text

Conductor A small, yet full-featured framework that allows building View-based Android applications. Conductor provides a light-weight wrapper around standard Android Views that does just about everything you'd want

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

#SimpleTapiPasten

Slide 15

Slide 15 text

Components ● Controller ● Router ● ControllerChangeHandler ● ControllerTransaction

Slide 16

Slide 16 text

Controller The Controller is the View wrapper that will give you all of your lifecycle management features. Think of it as a lighter-weight and more predictable Fragment alternative with an easier to manage lifecycle. TL;DR this is your Fragment

Slide 17

Slide 17 text

Controller

Slide 18

Slide 18 text

Router A Router implements navigation and backstack handling for Controllers. Router objects are attached to Activity/containing ViewGroup pairs. Routers do not directly render or push Views to the container ViewGroup, but instead defer this responsibility to the ControllerChangeHandler specified in a given transaction. TL;DR this is your FragmentManager

Slide 19

Slide 19 text

Router

Slide 20

Slide 20 text

ControllerChangeHandlers ControllerChangeHandlers are responsible for swapping the View for one Controller to the View of another. They can be useful for performing animations and transitions between Controllers. Several default ControllerChangeHandlers are included.

Slide 21

Slide 21 text

ControllerTransaction Transactions are used to define data about adding Controllers. RouterControllerTransactions are used to push a Controller to a Router with specified ControllerChangeHandlers, while ChildControllerTransactions are used to add child Controllers. TL;DR this is your FragmentTransaction

Slide 22

Slide 22 text

ControllerTransaction

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

DEMO TIME!

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

#CodeRelationshipGoal

Slide 28

Slide 28 text

Bonus ~ Conductor Extra #Kemevvahan

Slide 29

Slide 29 text

Bonus ~ Android Conductor Generator #SayaSukaKemevvahan

Slide 30

Slide 30 text

Links ● https://github.com/bluelinelabs/Conductor ● https://github.com/esafirm/conductor-extra ● https://github.com/esafirm/generator-android-conductor ● https://github.com/esafirm/android-conductor-boilerplate ● https://github.com/esafirm/android-playground

Slide 31

Slide 31 text

Thank You! Esa Firman Github: https://github.com/esafirm Twitter: https://twitter.com/esafirm Telegram: @esafirm Tinder: Belum buat Check out my portfolio -> bit.ly/re-portfolio