ankidroid / ankidroid/Anki-Android

discussion: Document & enforce naming conventions [layouts/standard variables]

オープン
#19,896 コメント 10 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Kotlin
スター
11.8k
フォーク
2.9k
平均マージ
2日 3時間
マージ済み PR(30日)
171

説明

From @BrayanDSO

> Now we are using `ViewBinding`, I believe that we should have some documented naming convention for files/ids/constants
> An [example](https://github.com/AnilFurkanOkcun/Android-Naming-Guide) found by googling "android naming guide"
>
> some things I find mostly agreeable:
> **Layouts:**
> Activity -> `activity_` ✅
> Fragment -> `fragment_` ✅
> View -> `view_` ✅
> Dialog -> `dialog_` ✅
> **Constants names** (may need tweaks):
> Fragment arg -> `ARG_` or `ARGUMENT_`
> Intent extra -> `EXTRA_`
> Pref key -> `PREF_`
> Intent action -> `ACTION_`

----

> I believe that it is feasible to add a rule to most of them
> we probably should start with the rules, so it automatically checks what to fix
> the constants shouldn't be hard
> the layout files may need some creativity

----

Source: https://discord.com/channels/368267295601983490/882228005504696350/1452299757073731778

* ViewBindings: #11116

----

EDIT: Table of agreed values

| **Usage** | **Prefix** |
|-------------------------------------|------------|
| Fragment Argument | `ARG_` |
| Intent Extra (generic) | `EXTRA_` |
| Pref key | `PREF_` |
| Intent Action | `ACTION_` |
| Saved Instance State | `STATE_` |
| Fragment Request API | `REQUEST_` |
| Fragment Request API Result bundle | `RESULT_` |

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。