|
|
@ -159,6 +159,63 @@ app/src/main/java/com/quillstudios/pokegoalshelper/ |
|
|
- Use interfaces for dependency injection |
|
|
- Use interfaces for dependency injection |
|
|
- Keep functions small and focused |
|
|
- Keep functions small and focused |
|
|
|
|
|
|
|
|
|
|
|
### Code Style Guidelines |
|
|
|
|
|
|
|
|
|
|
|
#### Brace Placement |
|
|
|
|
|
- Opening braces `{` go on the line **below** functions and statements |
|
|
|
|
|
- This improves visual separation and readability |
|
|
|
|
|
|
|
|
|
|
|
```kotlin |
|
|
|
|
|
// Preferred style |
|
|
|
|
|
fun myFunction() |
|
|
|
|
|
{ |
|
|
|
|
|
if (condition) |
|
|
|
|
|
{ |
|
|
|
|
|
// code here |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// NOT this style |
|
|
|
|
|
fun myFunction() { |
|
|
|
|
|
if (condition) { |
|
|
|
|
|
// code here |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
#### Variable Naming Conventions |
|
|
|
|
|
Use different naming patterns to distinguish variable scope at a glance: |
|
|
|
|
|
|
|
|
|
|
|
- **Local variables**: `snake_case` (e.g., `display_metrics`, `captured_image`, `window_manager`) |
|
|
|
|
|
- **Member variables**: `camelCase` (e.g., `screenWidth`, `mediaProjection`, `isActive`) |
|
|
|
|
|
- **Function parameters**: `camelCase` (e.g., `resultData`, `callback`, `className`) |
|
|
|
|
|
- **Constants**: `UPPER_SNAKE_CASE` (e.g., `TAG`, `BUFFER_COUNT`) |
|
|
|
|
|
|
|
|
|
|
|
```kotlin |
|
|
|
|
|
class ExampleClass |
|
|
|
|
|
{ |
|
|
|
|
|
// Member variables in camelCase |
|
|
|
|
|
private var screenWidth = 0 |
|
|
|
|
|
private var mediaProjection: MediaProjection? = null |
|
|
|
|
|
|
|
|
|
|
|
// Function parameters in camelCase |
|
|
|
|
|
fun processData(inputData: String, callback: (String) -> Unit) |
|
|
|
|
|
{ |
|
|
|
|
|
// Local variables in snake_case |
|
|
|
|
|
val processed_result = inputData.uppercase() |
|
|
|
|
|
val final_output = "Result: $processed_result" |
|
|
|
|
|
|
|
|
|
|
|
callback(final_output) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
#### Benefits of This Style |
|
|
|
|
|
- **Instant recognition**: Variable scope is immediately visible |
|
|
|
|
|
- **Improved debugging**: Easy to distinguish locals from members |
|
|
|
|
|
- **Better readability**: Clean visual structure with separated braces |
|
|
|
|
|
- **Consistent codebase**: All new code follows the same patterns |
|
|
|
|
|
|
|
|
### Documentation |
|
|
### Documentation |
|
|
- Update this file when patterns change |
|
|
- Update this file when patterns change |
|
|
- Document complex business logic |
|
|
- Document complex business logic |
|
|
|