[FR]: Replace custom preview annotations with androidx.compose.ui.tooling.preview alternatives

オープン
#1,923 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
50/100
issue の種類
リファクタリング
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
android, kotlin
領域
mobile, tooling

調査の方向性

まず core/designsystem/ThemePreviews.kt と core/ui/DevicePreviews.kt を読み、次にプロジェクト全体でそれらが使用されている箇所を特定します。それらの使用箇所を androidx.compose.ui.tooling.preview の PreviewLightDark と PreviewScreenSizes に置き換え、2つのカスタムアノテーションファイルを削除し、プロジェクトがビルドでき、プレビューが引き続き意図したテーマと画面サイズをカバーしていることを確認します。

索引モデルが issue の本文から書いたものです。

説明

enhancement
Is there an existing issue for this?
  • I have searched the existing issues
Describe the problem

The current nowinandroid project uses custom annotations for previews that replicate functionality already available in the Jetpack Compose tooling library:

  • com.google.samples.apps.nowinandroid.core.designsystem.ThemePreviews for showing light and dark themes.

  • com.google.samples.apps.nowinandroid.core.ui.DevicePreviews for showing different device sizes.

This introduces boilerplate code and maintenance overhead for a feature that is now officially supported by the Compose library itself.

Describe the solution

Replace the custom annotations with the standard androidx.compose.ui.tooling.preview alternatives:

  1. Replace ThemePreviews with PreviewLightDark:
    PreviewLightDark from androidx.compose.ui.tooling.preview provides a cleaner, built-in way to render composables in both light and dark themes. This would allow for the removal of the ThemePreviews.kt file.
  2. Replace DevicePreviews with PreviewScreenSizes:
    PreviewScreenSizes from androidx.compose.ui.tooling.preview offers a direct and idiomatic way to display a composable across a range of screen sizes. This would allow for the removal of the DevicePreviews.kt file.
Additional context

No response

Code of Conduct
  • I agree to follow this project's Code of Conduct
主要言語
Kotlin
スター
22.1k
フォーク
4.7k
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

android/nowinandroid のほかの issue

android/nowinandroid の issue をすべて見る

似ている issue

Kotlin の issue をもっと見る

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

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