Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Android Live Template

Android Live Template

How to create your own custom templates to make your workflow even more efficient.

ThawZinToe

April 04, 2024
Tweet

More Decks by ThawZinToe

Other Decks in Technology

Transcript

  1. 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
  2. 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?
  3. 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
  4. 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
  5. Viewing Live Template in Android Studio 6 Learn how to

    effectively use Live template in Android Studio Guideline
  6. 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
  7. 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.
  8. 02 Parameterized Template Using Live Template 9 It similar with

    Simple Template but it contained variable that can be customized by the user.
  9. 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
  10. Creating Live Template in Android Studio 11 Learn how to

    effectively create Live template in Android Studio Guideline
  11. 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
  12. Deep Dive into Live Template Dialog 13 Learn how to

    effectively create Live template in Android Studio Guideline
  13. Deep Dive into Live Template Dialog 14 Description 02 Template

    Text 03 Abbreviation 01 Edit Template Variables 05 Application Define 04
  14. 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.
  15. 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.
  16. 04 Application Define View Live Template 18 variable that allows

    you to define a global value that can be used throughout your code.
  17. 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
  18. 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.
  19. 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.