Skip to content

迁移Android示例至Jetpack Compose并升级构建工具链#15

Open
shdmfire wants to merge 6 commits into
irext:masterfrom
shdmfire:master
Open

迁移Android示例至Jetpack Compose并升级构建工具链#15
shdmfire wants to merge 6 commits into
irext:masterfrom
shdmfire:master

Conversation

@shdmfire

Copy link
Copy Markdown

主要改动

1. UI 架构迁移到 Jetpack Compose

  • 移除原有 View/Fragment 体系:

    • 删除旧的 Java Fragment、Activity、Adapter
    • 删除自定义 PullToRefreshListView
    • 删除旧的 MessageUtils 工具类
    • 删除不再使用的 XML layout、drawable、menu、animator、mipmap 等资源
  • 新增 Compose UI 实现:

    • 新增 Compose 页面:HomeScreenControlScreenIndexScreenBrandScreenCategoryScreenCityScreenOperatorScreenProvinceScreenTestScreen
    • 新增 Compose 导航层:Navigation.ktRoutes.kt
    • 重写 MainActivity.kt,作为 Compose 应用入口
    • 新增 RemoteController.kt 遥控器控制逻辑

3. 构建系统升级

  • 升级 Android Gradle Plugin 至 9.0.1
  • 升级 Gradle Wrapper 至 9.1.0
  • 升级 Kotlin 至 2.3.21
  • 引入 Compose、Material3、Navigation3、Lifecycle Compose、Coroutines、Serialization 等依赖
  • 重写项目级 build.gradlesettings.gradle
  • 更新 proguard-rules.pro
  • 启用 AndroidX,关闭 Jetifier,并简化 gradle.properties

4. 配置调整

  • 简化 AndroidManifest.xml,移除旧 Activity 声明
  • 移除不再需要的外部存储权限
  • 更新 irext_app_keyirext_app_secret
  • 更新 network_security_config.xml

5. 工程清理

  • 统一各示例工程换行符:CRLF -> LF
  • 更新 .gitignore
  • 更新各示例工程 README
  • 更新 Gradle Wrapper 脚本

shdmfire added 5 commits June 26, 2026 16:38
…mpose + upgrade build tools

=== Core: Android App Migration to Jetpack Compose ===

- Remove legacy View-based UI components:
  - Delete 6 Java Fragments (BaseCreateFragment, Brand, Category, City, Index, Main)
  - Delete 3 Activities (ControlActivity, CreateActivity, MainActivity)
  - Delete 6 Adapters (Brand, Category, City, Index, Operator, RemoteControl)
  - Delete PullToRefreshListView custom widget
  - Delete MessageUtils utility class
  - Delete all 18 XML layout files, animator, drawable, menu, and mipmap resources

- Add Jetpack Compose UI (Kotlin):
  - Add navigation layer: Navigation.kt, Routes.kt (Navigation3)
  - Add Screen composables: HomeScreen, ControlScreen, IndexScreen, BrandScreen,
    CategoryScreen, CityScreen, OperatorScreen, ProvinceScreen, TestScreen
  - Add ViewModel + State: ControlViewModel, ControlUiState, ControlEvent
  - Add reusable composables: ComposeItemViews, ItemIndexText, ItemSingleText
  - Add WebApiHelper for async API calls
  - Add Compose theme: Color.kt, Theme.kt
  - Rewrite MainActivity.kt with Compose entry point
  - Add RemoteController.kt controller

- Add ControlCommand static constants for common remote keys (POWER, UP, DOWN, etc.)

=== Build System Upgrade ===

- Upgrade AGP from 8.12.0 to 9.0.1
- Upgrade Gradle wrapper from 8.14.3 to 9.1.0
- Upgrade Kotlin to 2.3.21 with Compose & Serialization plugins
- Rewrite project build.gradle to use plugins {} block
- Rewrite settings.gradle with pluginManagement & dependencyResolutionManagement
- Add Jetpack Compose BOM 2026.05.00, Material3, Navigation3, Lifecycle Compose
- Add Kotlin Coroutines, Kotlin Serialization, Activity Compose dependencies
- Update proguard-rules.pro for new toolchain
- Disable Jetifier, enable AndroidX, simplify gradle.properties

=== Configuration Changes ===

- Simplify AndroidManifest.xml: remove old Activity declarations
- Remove WRITE_EXTERNAL_STORAGE / READ_EXTERNAL_STORAGE permissions
- Update irext_app_key and irext_app_secret values
- Switch theme from AppCompat to Material Light NoActionBar
- Update network_security_config.xml

=== Housekeeping ===

- Normalize line endings (CRLF -> LF) across all sub-projects:
  android-example, arduino-example, java-example, win32-example
- Update .gitignore and README files across all example projects
- Update Gradle wrapper scripts (gradlew, gradlew.bat)
# Conflicts:
#	android-example/app/src/main/java/net/irext/ircontrol/IRApplication.java
- .github/workflows/android-example-release.yml: build release APK on
  push/PR to examples/android-example, upload artifacts, auto-publish
  to GitHub Release on v* tags
- .github/dependabot.yml: weekly checks for GitHub Actions and Gradle
  dependency updates
The repo is named 'examples', so android-example dir is at the root
level, not under 'examples/'. Fixed all path references:
- Path triggers: examples/android-example/** -> android-example/**
- Working directory: examples/android-example -> ./android-example
- Upload artifact paths: examples/android-example/**/build/... -> android-example/**/build/...
@shdmfire

shdmfire commented Jun 26, 2026

Copy link
Copy Markdown
Author

我还加了Github Action的自动打包并签名apk-release文件功能, 在fork项目里, 还没提交pr, 不知道现在有没有必要搞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant