|
| 1 | +# Contributing to TUIKit_Android |
| 2 | + |
| 3 | +We welcome contributions to TUIKit_Android! This document provides guidelines for contributing to the project. |
| 4 | + |
| 5 | +## Code of Conduct |
| 6 | + |
| 7 | +By participating in this project, you agree to abide by our Code of Conduct. Please treat all community members with respect and create a welcoming environment for everyone. |
| 8 | + |
| 9 | +## Getting Started |
| 10 | + |
| 11 | +### Prerequisites |
| 12 | + |
| 13 | +- Android SDK with API level 21 (Android 5.0) or higher |
| 14 | +- Gradle 8.0 or later |
| 15 | +- Git for version control |
| 16 | + |
| 17 | +### Setting Up Development Environment |
| 18 | + |
| 19 | +1. **Fork the Repository** |
| 20 | + ```bash |
| 21 | + # Fork the repo on GitHub, then clone your fork |
| 22 | + git git clone https://github.com/Tencent-RTC/TUIKit_Android.git |
| 23 | + cd TUIKit_Android/applocation |
| 24 | + ``` |
| 25 | + |
| 26 | +2. **Open in Android Studio** |
| 27 | + ```bash |
| 28 | + # Open the project in Android Studio |
| 29 | + # File -> Open -> Select the android directory |
| 30 | + ``` |
| 31 | + |
| 32 | +3. **Sync Project** |
| 33 | + - Android Studio will automatically sync Gradle dependencies |
| 34 | + - Wait for the sync to complete |
| 35 | + |
| 36 | +## Development Guidelines |
| 37 | + |
| 38 | +### Kotlin/Java Coding Standards |
| 39 | + |
| 40 | +We strictly follow the [Android Kotlin Style Guide](https://developer.android.com/kotlin/style-guide) and our project-specific coding standards. Please ensure your code adheres to these guidelines: |
| 41 | + |
| 42 | +#### Mandatory Requirements |
| 43 | + |
| 44 | +1. **File Naming** |
| 45 | + - Kotlin source files end with `.kt` |
| 46 | + - Java source files end with `.java` |
| 47 | + - File names describe the main content |
| 48 | + - Activity files: `ActivityName.kt` |
| 49 | + - Fragment files: `FragmentName.kt` |
| 50 | + - No spaces in file names |
| 51 | + |
| 52 | +2. **Line Length** |
| 53 | + - Maximum 120 characters per line |
| 54 | + - Exceptions: comments, URLs, import statements |
| 55 | + |
| 56 | +3. **Indentation and Spacing** |
| 57 | + - Use 4 spaces for indentation |
| 58 | + - Opening brace `{` on the same line |
| 59 | + - Closing brace `}` on a new line |
| 60 | + - One blank line between methods and class declarations |
| 61 | + |
| 62 | +4. **Naming Conventions** |
| 63 | + - Use `camelCase` for variables, functions, and properties |
| 64 | + - Use `PascalCase` for classes and interfaces |
| 65 | + - Use `UPPER_SNAKE_CASE` for constants |
| 66 | + - Use descriptive names that clearly indicate purpose |
| 67 | + |
| 68 | +### Architecture Principles |
| 69 | + |
| 70 | +1. **Component-Based Architecture** |
| 71 | + - Each feature must be designed as an independent component |
| 72 | + - Components must be self-contained and independently testable |
| 73 | + - Clear responsibility boundaries for each component |
| 74 | + |
| 75 | +2. **Test-Driven Development (TDD)** |
| 76 | + - Write tests before implementation |
| 77 | + - Follow Red-Green-Refactor cycle |
| 78 | + - Maintain minimum 80% test coverage |
| 79 | + |
| 80 | +3. **Real-Time Communication Quality** |
| 81 | + - End-to-end integration tests for audio/video features |
| 82 | + - Network quality monitoring and error handling |
| 83 | + - Support for multiple audio routes and device adaptation |
| 84 | + |
| 85 | +## Contribution Process |
| 86 | + |
| 87 | +### 1. Issue Reporting |
| 88 | + |
| 89 | +Before creating a new issue, please: |
| 90 | +- Search existing issues to avoid duplicates |
| 91 | +- Use the appropriate issue template |
| 92 | +- Provide detailed reproduction steps for bugs |
| 93 | +- Include relevant system information (Android version, device model, etc.) |
| 94 | + |
| 95 | +### 2. Feature Requests |
| 96 | + |
| 97 | +For new features: |
| 98 | +- Describe the use case and expected behavior |
| 99 | +- Explain why this feature would be valuable |
| 100 | +- Consider backward compatibility implications |
| 101 | + |
| 102 | +### 3. Pull Request Process |
| 103 | + |
| 104 | +1. **Create a Feature Branch** |
| 105 | + ```bash |
| 106 | + git checkout -b feature/your-feature-name |
| 107 | + ``` |
| 108 | + |
| 109 | +2. **Make Your Changes** |
| 110 | + - Follow coding standards |
| 111 | + - Add tests for new functionality |
| 112 | + - Update documentation as needed |
| 113 | + |
| 114 | +3. **Test Your Changes** |
| 115 | + ```bash |
| 116 | + # Run unit tests |
| 117 | + ./gradlew test |
| 118 | + # Run instrumented tests |
| 119 | + ./gradlew connectedAndroidTest |
| 120 | + # Test on physical devices when possible |
| 121 | + ``` |
| 122 | + |
| 123 | +4. **Commit Your Changes** |
| 124 | + ```bash |
| 125 | + git add . |
| 126 | + git commit -m "feat: add amazing new feature" |
| 127 | + ``` |
| 128 | + |
| 129 | + Use conventional commit messages: |
| 130 | + - `feat:` for new features |
| 131 | + - `fix:` for bug fixes |
| 132 | + - `docs:` for documentation changes |
| 133 | + - `test:` for test additions/modifications |
| 134 | + - `refactor:` for code refactoring |
| 135 | + - `style:` for formatting changes |
| 136 | + |
| 137 | +5. **Push and Create PR** |
| 138 | + ```bash |
| 139 | + git push origin feature/your-feature-name |
| 140 | + ``` |
| 141 | + |
| 142 | + Then create a Pull Request on GitHub with: |
| 143 | + - Clear title and description |
| 144 | + - Reference to related issues |
| 145 | + - Screenshots/videos for UI changes |
| 146 | + - Test results and coverage information |
| 147 | + |
| 148 | +### 4. Code Review Process |
| 149 | + |
| 150 | +All submissions require code review. We use GitHub's review system for this purpose. Reviews focus on: |
| 151 | + |
| 152 | +- **Code Quality**: Adherence to coding standards |
| 153 | +- **Architecture**: Proper component design and separation of concerns |
| 154 | +- **Testing**: Adequate test coverage and quality |
| 155 | +- **Performance**: Efficient implementation, especially for real-time features |
| 156 | +- **Documentation**: Clear comments and updated documentation |
| 157 | + |
| 158 | +## Documentation |
| 159 | + |
| 160 | +### Code Documentation |
| 161 | + |
| 162 | +- Use KDoc for Kotlin documentation |
| 163 | +- Use JavaDoc for Java documentation |
| 164 | +- Document public APIs thoroughly |
| 165 | +- Include usage examples for complex functionality |
| 166 | +- Keep documentation up-to-date with code changes |
| 167 | + |
| 168 | +### README Updates |
| 169 | + |
| 170 | +When adding new features: |
| 171 | +- Update feature lists in README files |
| 172 | +- Add usage examples |
| 173 | +- Update architecture diagrams if needed |
| 174 | + |
| 175 | +## Release Process |
| 176 | + |
| 177 | +### Version Numbering |
| 178 | + |
| 179 | +We follow [Semantic Versioning](https://semver.org/): |
| 180 | +- **MAJOR**: Breaking changes |
| 181 | +- **MINOR**: New features (backward compatible) |
| 182 | +- **PATCH**: Bug fixes (backward compatible) |
| 183 | + |
| 184 | +### Release Checklist |
| 185 | + |
| 186 | +Before releasing: |
| 187 | +- [ ] All tests pass |
| 188 | +- [ ] Documentation is updated |
| 189 | +- [ ] CHANGELOG.md is updated |
| 190 | +- [ ] Version numbers are bumped appropriately |
| 191 | +- [ ] Release notes are prepared |
| 192 | + |
| 193 | +## Getting Help |
| 194 | + |
| 195 | +If you need help: |
| 196 | + |
| 197 | +1. **Documentation**: Check our [official documentation](https://tencent-rtc.github.io/TUIKit_Android/) |
| 198 | +2. **Issues**: Search existing GitHub issues |
| 199 | +3. **Community**: Join our developer community discussions |
| 200 | + |
| 201 | +## Recognition |
| 202 | + |
| 203 | +Contributors will be recognized in our: |
| 204 | +- CONTRIBUTORS.md file |
| 205 | +- Release notes for significant contributions |
| 206 | +- Project documentation |
| 207 | + |
| 208 | +Thank you for contributing to TUIKit_Android! 🎉 |
0 commit comments