Slide 1

Slide 1 text

Coffee & Compose ________

Slide 2

Slide 2 text

About Us Hemanshu Varma Software Engineer - Recro Bharath Venkatesan Software Engineer - OpenBet

Slide 3

Slide 3 text

TOPIC Kotlin Basics What is Compose? Compose over XML Live Coding What’s Next? QnA Today’s Agenda

Slide 4

Slide 4 text

Kotlin Programming Language Kotlin helps developers write concise yet NULL safe code. Kotlin first approach recommended by Google

Slide 5

Slide 5 text

Kotlin Playground Write and run Kotlin code on the fly within browser

Slide 6

Slide 6 text

Functions A function is a segment of a program that performs a specific task. You can have many functions in your program or only a single one.

Slide 7

Slide 7 text

Defining a function Functions begin with the fun keyword. fun displayIntroduction() { }

Slide 8

Slide 8 text

Defining a function Functions have a name so that they can be called. fun displayIntroduction() { }

Slide 9

Slide 9 text

Defining a function Functions need a set of parentheses after the function name in order to surround the function inputs. fun displayIntroduction() { }

Slide 10

Slide 10 text

Defining a function The curly braces make up the function body and contain the instructions needed to execute a task. fun displayIntroduction() { }

Slide 11

Slide 11 text

Putting it together fun displayIntroduction() { // We will fill this out! } Output: Hi I’m Meghan and I am 28 years old

Slide 12

Slide 12 text

A container for a single piece of data. Variables

Slide 13

Slide 13 text

My name is and I am years old Variables name age

Slide 14

Slide 14 text

val keyword Use when you expect the variable value will not change. Example: name var keyword Use when you expect the variable value can change. Example: age Defining a variable

Slide 15

Slide 15 text

Defining a variable Variables start with a var or val keyword. fun displayIntroduction() { val name: String = "Meghan" var age: Int = 28 }

Slide 16

Slide 16 text

Defining a variable All variables must have a name. fun displayIntroduction() { val name: String = "Meghan" var age: Int = 28 }

Slide 17

Slide 17 text

Defining a variable Data type is the type of data that the variable holds. fun displayIntroduction() { val name: String = "Meghan" var age: Int = 28 }

Slide 18

Slide 18 text

Defining a variable The initial value is the value that is stored in the variable. fun displayIntroduction() { val name: String = "Meghan" var age: Int = 28 }

Slide 19

Slide 19 text

Putting it together fun displayIntroduction() { val name = "Meghan" val age = 28 println("Hi I'm $name and I am $age years old") }

Slide 20

Slide 20 text

Putting it together fun main() { displayIntroduction() } fun displayIntroduction() { val name = "Meghan" val age = 28 println("Hi I'm $name and I am $age years old") } Output: Hi I’m Meghan and I am 28 years old

Slide 21

Slide 21 text

What is Compose?

Slide 22

Slide 22 text

Jetpack Compose is the modern toolkit for building native user interfaces for Android apps. Compose apps are written in the Kotlin programming language. Compose makes it easier and faster to build UIs on Android. Jetpack Compose

Slide 23

Slide 23 text

Benefits of using Jetpack Compose Less code Do more with less code and avoid entire classes of bugs. Code is simpler and easier to maintain. Intuitive Just describe your UI, and Compose takes care of the rest. As app state changes, your UI automatically updates. Accelerates Development Compatible with all your existing code so you can adopt when and where you want. Iterate fast with live previews and full Android Studio support. Powerful Create beautiful apps with direct access to the Android platform APIs and built-in support for Material Design, Dark theme, animations, and more.

Slide 24

Slide 24 text

Compose over XML

Slide 25

Slide 25 text

ACTIVITY XML Imperative Approach

Slide 26

Slide 26 text

ACTIVITY Declarative Approach Compose Compose ……..

Slide 27

Slide 27 text

Animations https://developer.android.com/jetpack/compose/animation

Slide 28

Slide 28 text

Why is it called Compose?

Slide 29

Slide 29 text

Old Android UI System Inheritance View EditText TextView

Slide 30

Slide 30 text

Composable Compose UI System Composition Composable Composable Composable Composable Composable

Slide 31

Slide 31 text

What we will build today? About Me App

Slide 32

Slide 32 text

Lets code... Grab your coffee

Slide 33

Slide 33 text

What’s Next?

Slide 34

Slide 34 text

Pathways Each track offers learning content from Google that is structured into pathways. A pathway consists of a sequence of learning activities (videos, articles, and codelabs), to help you learn about a certain technical topic. There is a quiz at the end of a pathway to test what you learned.

Slide 35

Slide 35 text

Earn digital badges For each quiz successfully passed, participants earn a badge on their developer profiles Carrie Sawyer

Slide 36

Slide 36 text

Android Basics with Compose Course g.co/android/basics-compose

Slide 37

Slide 37 text

2 3 1 Introduction to Kotlin Set up Android Studio Build a basic layout (4 hours) (3 hours) (4 hours) Learn introductory programming concepts in Kotlin to prepare for building Android apps in Kotlin. Install and set up Android Studio, create your first project, and run it on a device or emulator. Learn the basics of layouts in Android by creating your very own birthday card app! this is where you will truly start learning Compose! Android Basics with Compose Course Unit 1

Slide 38

Slide 38 text

Customize for your audience No programming experience Go through each pathway of each unit in order, since the concepts build on each other. Already have programming experience Skip the pathways focused on Kotlin concepts that don’t contain Android, which are the first pathway of each unit from Units 1 to 3. Work through the remaining pathways in each unit in order to learn Android concepts. Quick Tip: If a developer is new to Kotlin, they can do Kotlin Koans online exercises as a quick jumpstart to become familiar with Kotlin syntax & idioms (~ 5 hours).

Slide 39

Slide 39 text

Additional resources Practice problems These appear throughout the Android Basics with Compose course for learners to apply what they just learned in the context of a new app. These practice problems are optional. Learners can start on them if they finish early at a session, or do them at home. Open-ended projects At the end of each unit, there are opportunities for learners to create their own app, with some guidelines to help them. Since these apps will be unique to each individual, the apps could be added to their portfolio of work, and even uploaded to GitHub. Unit 1 - Business Card app Unit 2 - Art Space app Unit 3 - 30 Days app

Slide 40

Slide 40 text

Additional resources (Experienced Track) Jetpack Compose for Android Developers Course (link here) Compose Presentation Decks (link here) Existing presentation decks with speaker notes are available on different Compose topic areas. You can use these to deliver talks or supplement content for your sessions. Make sure to check out Jetpack compose from official android developers page (Jetpack Compose)

Slide 41

Slide 41 text

Questions?

Slide 42

Slide 42 text

Follow Us hemanshuvarma bharathvenkatesan @varmahemanshu @im_bharath_97

Slide 43

Slide 43 text

Share what you’ve learned using .#AndroidEducators on social media

Slide 44

Slide 44 text

Thank You and All the Best!