Skip to content

Latest commit

 

History

History
58 lines (44 loc) · 1.86 KB

File metadata and controls

58 lines (44 loc) · 1.86 KB

IDE setup

To configure IntelliJ/Android Studio according to this style guide, you can either import the settings file in Android Studio settings folder or follow the steps:

Applying Kotlin style guide

  • Go to Settings | Editor | Code Style | Kotlin
  • Click Set from… link in the upper right corner
  • Select Predefined style | Kotlin style guide from the menu. [link]

Setup hard wrap

  • Still in Settings | Editor | Code Style | Kotlin
  • Click Wrapping and Braces tab
  • Set Hard wrap at field to 120 [link]

Setup blank lines

  • Still in Settings | Editor | Code Style | Kotlin
  • Click Blank Lines tab
  • In setction Keep Maximum Blank lines
    • Set In declarations: to 1
    • Set In code: to 1
    • Set Before '}': to 1
  • In setction Minimun Blank lines
    • Set After class header: to 0
    • Set Arround 'when' branches with {} to 0
    • Set Before declaration with comment or annotation to 1 [link]

Setup imports

  • Still in Settings | Editor | Code Style | Kotlin
  • Click Imports tab
  • In setction Top-level name import
    • Select entry Use single line imports
  • In section Java Statics and Enum Members
    • Select entry Use single line imports
  • In section Packages to Use Import with '*'
    • Remove packages clicking the - button [link]

Setup trailing commas

  • Still in Settings | Editor | Code Style | Kotlin
  • Click Other tab
  • Select entry `Use trailing commas`` [link]

Set empty line at the end of a file

  • Go to Settings | Editor | General
  • Scroll to the Save Files section
  • Check Ensure an empty line at the end of a file on Save [link]