nextcloud / nextcloud/android

Improve layout file name pattern

Open
#4,772 1 comment 0 reactions 0 assignees View on GitHub
enhancement meta technical debt
Dominant language
Kotlin
Stars
5.6k
Forks
2k
Avg merge
2d 18h
Merged PRs (30d)
92

Description

Adapt naming pattern based on https://github.com/ribot/android-guidelines/blob/master/project_and_code_guidelines.md

#### 1.2.2.2 Layout files

Layout files should match the name of the Android components that they are intended for but moving the top level component name to the beginning. For example, if we are creating a layout for the `SignInActivity`, the name of the layout file should be `activity_sign_in.xml`.

| Component | Class Name | Layout Name |
| ---------------- | ---------------------- | ----------------------------- |
| Activity | `UserProfileActivity` | `activity_user_profile.xml` |
| Fragment | `SignUpFragment` | `fragment_sign_up.xml` |
| Dialog | `ChangePasswordDialog` | `dialog_change_password.xml` |
| AdapterView item | --- | `item_person.xml` |
| Partial layout | --- | `partial_stats_bar.xml` |

A slightly different case is when we are creating a layout that is going to be inflated by an `Adapter`, e.g to populate a `ListView`. In this case, the name of the layout should start with `item_`.

Note that there are cases where these rules will not be possible to apply. For example, when creating layout files that are intended to be part of other layouts. In this case you should use the prefix `partial_`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.