You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: android/Code-style.md
+4-45
Original file line number
Diff line number
Diff line change
@@ -66,56 +66,15 @@ Calling HTTP services powered by non open source software (example: Google Searc
66
66
67
67
## Strings
68
68
69
-
Strings added must not have [unescaped HTML tags](https://github.com/commons-app/apps-android-commons/issues/1333#issuecomment-412430539)
69
+
Strings added must not have [unescaped HTML tags](https://github.com/commons-app/apps-android-commons/issues/1333#issuecomment-412430539).
70
70
71
-
String literals should be avoided
71
+
String literals should be avoided.
72
72
73
73
## View Bindings
74
74
75
-
We have decided to move away from Butterknife and gradually replace its usage with [Kotlin Android Extensions ViewBinding](https://kotlinlang.org/docs/tutorials/android-plugin.html#view-binding).
75
+
Please use Google's viewbinding.
76
76
77
-
Note:
78
-
- Whenever a new Android Component written in Kotlin in added, you should use Kotlin Android Extensions ViewBindings.
79
-
- Whenever an existing Android component which is written in Java is converted to Kotlin, we should ideally replace Butterknife with Kotlin Android Extensions ViewBinding.
80
-
- If you are simply changing or adding anything in an existing Android component which is written in Java then you can continue using Butterknife.
81
-
82
-
### Butterknife
83
-
84
-
As mentioned above, contributors have the option of using [butterknife](https://github.com/JakeWharton/butterknife) for their view bindings for existing Java classes.
85
-
86
-
#### Usage
87
-
88
-
##### BindView
89
-
Eliminate `findViewById` calls by using `@BindView` on fields. We have refactored the [AboutActivity](https://github.com/commons-app/apps-android-commons/blob/master/app/src/main/java/fr/free/nrw/commons/AboutActivity.java) to use `@BindView` instead of `findViewById`.
Eliminate anonymous inner-classes for listeners by annotating methods with `@OnClick` and others.. Similarly events can be bound as follows as used in [SingleUploadFragment](https://github.com/commons-app/apps-android-commons/blob/master/app/src/main/java/fr/free/nrw/commons/upload/SingleUploadFragment.java).
The project has legacy Butterknife and Kotlin Android Extensions ViewBindings, please do not hesitate to [replace them](https://github.com/commons-app/apps-android-commons/issues/4664).
0 commit comments