For the complete documentation index, see llms.txt. This page is also available as Markdown.

Coding standards

Lawnchair code must be logical, well-formatted, and respect the architectural zone it inhabits.

Language conventions

As seen in the project overview, Lawnchair uses a mix of paradigms:

  • For Kotlin, follow the official Kotlin coding conventions.

    • New Lawnchair-specific features must be written in Kotlin.

  • For existing Java code, follow the existing style seen in the codebase.

  • Place Lawnchair-specific logic in the lawnchair package. Minimize changes to the src package to facilitate AOSP rebases.

Modifying AOSP files

When modifying AOSP files, document changes you made with the prefix LC-Note(<optional modifier>): <reason> and logs with the prefix LC-:

// Example
// LC-Note: These changes are needed to support API X.
public void onChange(Boolean value) {
    Log.d("LC-BaseActivity", "Doing something on change")
    ...
}

String naming

Strings in strings.xml must follow the standardized naming format to ensure maintainability and ease of translation.

Type
Format
Example

Generic word

$1

disagree

Action

$1_action

apply_action

Preference label

$1_label

folders_label

Preference description

$1_description

folders_description

Preference choice

$1_choice

off_choice

Feature string

[feature]_$1

colorpicker_hsb

Launcher string

$1_launcher

device_contacts_launcher

Avoid using generic names for feature-specific strings to prevent conflicts during rebases.

Last updated

Was this helpful?