Slide 1

Slide 1 text

Android Live Template How to create your own custom templates to make your workflow even more efficient. Created on 1 April 2023 by Thaw Zin Toe ( Ptut) 1

Slide 2

Slide 2 text

2 Overview 01 What is Live Template? 02 Viewing Live Template Explain what is this 03 Creating Custom Live Template Guideline to create Live Template 04 Deep Dive into Live Template Dialog What’s inside in Live Template Box 05 Tip & Tricks Where to go from here How to use in Jetbrains IDE?

Slide 3

Slide 3 text

What is Live Template? 3 Explain what is this? INFORMATION

Slide 4

Slide 4 text

4 What is Live Template? ● Feature & Tool in Android Studio and IntelliJ ● Use anywhere you find yourself repeating the same patterns over ● Autocomplete and less need for boilerplate code Android Live Template

Slide 5

Slide 5 text

Benefits of using Live Template 5 Android Live Templates can be a great way to streamline your Android development process, increase your productivity, and create high-quality code. Productivity No writing repeating code tends to be increase your productivity Time Reduce Coding Development Time Coding Standardize coding practice & Less Typing Solving Can focus other Problems

Slide 6

Slide 6 text

Viewing Live Template in Android Studio 6 Learn how to effectively use Live template in Android Studio Guideline

Slide 7

Slide 7 text

Viewing Live Template 7 Parameterized template To use a Live Template, you can start by writing a abbreviation of the template. As you type, you will see a dropdown menu appear with Live Templates available that match your input, similar to how you might see suggestions when using code completion. 02 Surrounded Template 03 Simple template 01

Slide 8

Slide 8 text

01 Simple Template Using Live Template 8 It contains only fixed plain text. If you type this abbreviation or text, the text will automatically combine in your source code, replacing the abbreviation.

Slide 9

Slide 9 text

02 Parameterized Template Using Live Template 9 It similar with Simple Template but it contained variable that can be customized by the user.

Slide 10

Slide 10 text

03 Surrounded Template Using Live Template 10 Wrap a piece of code with a specific snippet, select the code and hit the Surround With shortcut. Mac → Option+Cmd+T Window → Ctrl+Alt+T

Slide 11

Slide 11 text

Creating Live Template in Android Studio 11 Learn how to effectively create Live template in Android Studio Guideline

Slide 12

Slide 12 text

12 Create Custom Live Template In Android Studio ● Go to Setting ‣ Editor ‣ Live Templates ‣ 1. Live Templates in Android Studio and IntelliJ Step by Step Guideline ● Type a name Abbreviations text field box that you want to create ● Write code in Template text box ● Define Applicable Kotlin ● Configure Edit Template Variables and Click OK

Slide 13

Slide 13 text

Deep Dive into Live Template Dialog 13 Learn how to effectively create Live template in Android Studio Guideline

Slide 14

Slide 14 text

Deep Dive into Live Template Dialog 14 Description 02 Template Text 03 Abbreviation 01 Edit Template Variables 05 Application Define 04

Slide 15

Slide 15 text

01 Abbreviations View Live Template 15 A short text or code that you type when you want to use a Live Template in Android Studio It triggers the suggestion of the Live Template, which automatically inserts template text into your code and replaces placeholders with values.

Slide 16

Slide 16 text

02 Description View Live Template 16 A short explanation of what the template does.

Slide 17

Slide 17 text

03 Template Text View Live Template 17 A Code that specifies what will be inserted into your code when using a Live Template in Android Studio. It can add placeholders for variables or expressions that will be populated when the template is expanded.

Slide 18

Slide 18 text

04 Application Define View Live Template 18 variable that allows you to define a global value that can be used throughout your code.

Slide 19

Slide 19 text

05 Edit Template Variables View Live Template 19 You can modify variables included in a template when it is expanded. This dialog appears when you use a Live Template that contains variables or placeholders, and allows you to specify values for those variables. More details about .. Link

Slide 20

Slide 20 text

Tip & Tricks 20 Additional information about Live Template Where to go from here

Slide 21

Slide 21 text

01 Postfix Completion View Live Template 21 Very similar to Live Template Can see list of Kotlin Postfix templates at Settings ‣ Editor ‣ General ‣ Postfix Completion.

Slide 22

Slide 22 text

02 File Template View Live Template 22 File template is available when creating a new file using File ‣ New If you want to see existing or adding new file template, go to Settings then go to Editor ‣ File and Code Templates and select Files tab.

Slide 23

Slide 23 text

Thank You THANK YOU! 23