Skip to content

Remove Casa framework & simplify samples structure #275

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 47 commits into from
Mar 8, 2025
Merged

Conversation

yrezgui
Copy link
Contributor

@yrezgui yrezgui commented Feb 23, 2025

Read the summary below made by Gemini: #275 (comment)

shamalip and others added 17 commits January 18, 2025 00:04
- "rv" is not recommended and "glance" is the preferred widget framework.
- Sizing on those widgets is off. The new canonical layouts are recommended.
- "rv" is not recommended and "glance" is the preferred widget framework.
- Sizing on those widgets is off. The new canonical layout contain example of lists and are recommended.
…t samples.

The main "AppWidgets" page now displays link to the canonical layout showcase page and then below it, demonstrates the functionality to pin and show widget information.
- 4x2 is the recommended size for such widget
- avoid 3x? sizes
- Uses glance loading layout resource instead of the local xml
- Update the preview image
- To closely match the appWidgetBackground color used in glance.
- The Scaffold component in glance handles the background color, widget radius for you.
- For the inner content, calculate widget radius based on the padding and system radius.
…t samples.

The main "AppWidgets" page now displays link to the canonical layout showcase page and then below it, demonstrates the functionality to pin and show widget information.
- accessibility
- camera2
- connectivity call notification
- graphics pdf
- graphics ultrahdr
- privacy transparency
- storage
- connectivity
- location
- media
- privacy
@yrezgui yrezgui marked this pull request as ready for review February 26, 2025 10:22
@android android deleted a comment from gemini-code-assist bot Feb 28, 2025
@android android deleted a comment from gemini-code-assist bot Feb 28, 2025
@yrezgui
Copy link
Contributor Author

yrezgui commented Feb 28, 2025

/gemini summary

Copy link
Contributor

@ashnohe ashnohe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ran project, looks nice!

yrezgui added 20 commits March 7, 2025 17:52
Replaced the `Area` data class with `ApiSurface` to more accurately represent the categories of samples in the app. Updated all references in `NavGraph`, `SampleDemo`, and `CatalogScreen` to reflect this change. The update introduces the `ApiSurface` interface and its implementations to categorize the different areas of platform features and functionality demonstrated by the samples.
Disables unit tests in the CI build workflow.
- accessibility
- camera2
- connectivity call notification
- graphics pdf
- graphics ultrahdr
- privacy transparency
- storage
- connectivity
- location
- media
- privacy
Add various lint ignore checks on minSdk
- Remove samples README.md as it has been unreliably generated recently
  - We may reinvest in the idea later on
Replaced the `Area` data class with `ApiSurface` to more accurately represent the categories of samples in the app. Updated all references in `NavGraph`, `SampleDemo`, and `CatalogScreen` to reflect this change. The update introduces the `ApiSurface` interface and its implementations to categorize the different areas of platform features and functionality demonstrated by the samples.
Disables unit tests in the CI build workflow.
…refresh

# Conflicts:
#	app/src/main/java/com/example/platform/app/SampleDemo.kt
@yrezgui yrezgui merged commit 9722476 into main Mar 8, 2025
3 checks passed
Joseantoniomaypuc added a commit to Joseantoniomaypuc/platform-samples that referenced this pull request Mar 8, 2025
yrezgui added a commit that referenced this pull request Mar 10, 2025
* Delete the outdated button widget demo code.

- "rv" is not recommended and "glance" is the preferred widget framework.
- Sizing on those widgets is off. The new canonical layouts are recommended.

* Delete the outdated list widget demo code.

- "rv" is not recommended and "glance" is the preferred widget framework.
- Sizing on those widgets is off. The new canonical layout contain example of lists and are recommended.

* Delete the outdated image widget demo code.

- Glance library's demo directory has code samples for individual components.

Here is example of Image widget:
https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/ImageAppWidget.kt;bpv=1

* Align the AppWidgets showcase entrypoint to highlight canonical layout samples.

The main "AppWidgets" page now displays link to the canonical layout showcase page and then below it, demonstrates the functionality to pin and show widget information.

* Adjust size and preview of the weather widget in platform samples.

- 4x2 is the recommended size for such widget
- avoid 3x? sizes
- Uses glance loading layout resource instead of the local xml
- Update the preview image

* Update background color of the xml based weather widget

- To closely match the appWidgetBackground color used in glance.

* Update Glance weather widget to use Scaffold.

- The Scaffold component in glance handles the background color, widget radius for you.
- For the inner content, calculate widget radius based on the padding and system radius.

* Align the AppWidgets showcase entrypoint to highlight canonical layout samples.

The main "AppWidgets" page now displays link to the canonical layout showcase page and then below it, demonstrates the functionality to pin and show widget information.

* fixup! Update Glance weather widget to use Scaffold.

* Update the readMe section with screenshots of canonical widget layouts

* Update the readMe section with screenshots of canonical widget layouts

* Update the readMe section with screenshots of canonical widget layouts

* Replace Casa framework with a lighter structure

* Remove Casa from these following modules:

- accessibility
- camera2
- connectivity call notification
- graphics pdf
- graphics ultrahdr
- privacy transparency
- storage

* Remove Casa from these following modules:

- connectivity
- location
- media
- privacy

* Fix permissions module

* Add appwidgets & constraintlayout samples

* Add more user interface samples

* Add last samples

* Update build.yml (#277)

Change to upload-artifact@v4

* Add MinSdkBox composable to wrap samples using recent APIs

* Fix Activity insets

* Add missing test dependencies

Add various lint ignore checks on minSdk

* Update README.md

- Remove samples README.md as it has been unreliably generated recently
  - We may reinvest in the idea later on

* Remove duplicate MAIN/LAUNCHER intent filters from samples

* Temporarily ignore a flaky test in PiPMovieActivityTest

* Refactor: Replace `Area` with `ApiSurface` for better context

Replaced the `Area` data class with `ApiSurface` to more accurately represent the categories of samples in the app. Updated all references in `NavGraph`, `SampleDemo`, and `CatalogScreen` to reflect this change. The update introduces the `ApiSurface` interface and its implementations to categorize the different areas of platform features and functionality demonstrated by the samples.

* Temporarily disable unit tests in CI

Disables unit tests in the CI build workflow.

* Replace Casa framework with a lighter structure

* Remove Casa from these following modules:

- accessibility
- camera2
- connectivity call notification
- graphics pdf
- graphics ultrahdr
- privacy transparency
- storage

* Remove Casa from these following modules:

- connectivity
- location
- media
- privacy

* Fix permissions module

* Add appwidgets & constraintlayout samples

* Add more user interface samples

* Add last samples

* Add MinSdkBox composable to wrap samples using recent APIs

* Fix Activity insets

* Add missing test dependencies

Add various lint ignore checks on minSdk

* Update README.md

- Remove samples README.md as it has been unreliably generated recently
  - We may reinvest in the idea later on

* Remove duplicate MAIN/LAUNCHER intent filters from samples

* Temporarily ignore a flaky test in PiPMovieActivityTest

* Refactor: Replace `Area` with `ApiSurface` for better context

Replaced the `Area` data class with `ApiSurface` to more accurately represent the categories of samples in the app. Updated all references in `NavGraph`, `SampleDemo`, and `CatalogScreen` to reflect this change. The update introduces the `ApiSurface` interface and its implementations to categorize the different areas of platform features and functionality demonstrated by the samples.

* Temporarily disable unit tests in CI

Disables unit tests in the CI build workflow.

* Rebase app widgets description from main branch

---------

Co-authored-by: Shamali P <shamalip@google.com>
Co-authored-by: Scott Stanchfield <scott@javadude.com>
Co-authored-by: Hoyt Summers Pittman <secondsun@gmail.com>
@yrezgui yrezgui deleted the complete-refresh branch March 14, 2025 15:27
@yrezgui
Copy link
Contributor Author

yrezgui commented Mar 21, 2025

/gemini summarize

Copy link

Summary of Changes

This pull request aims to modernize the Android platform samples by removing the Casa framework, simplifying the project structure, and migrating the UI to Jetpack Compose. It involves updating dependencies, reorganizing sample modules, and addressing code compatibility issues. The primary goal is to streamline the project, improve maintainability, and adopt modern Android development practices.

Highlights

  • Casa Framework Removal: The Casa framework is completely removed, simplifying the project structure and eliminating associated dependencies.
  • Dependencies Update: Dependencies are updated to newer versions, including Kotlin (2.1.10), Compose BOM (2025.02.00), and other AndroidX libraries, ensuring compatibility and access to the latest features.
  • Samples Structure Simplification: The structure of sample modules is simplified by directly including them as dependencies in the main app module, removing the need for dynamic feature modules.
  • UI Migration to Jetpack Compose: The UI is migrated to Jetpack Compose, replacing the previous view-based implementation with a modern, declarative UI framework.

Changelog

Click here to see the changelog
  • .github/workflows/build.yml
    • Unit tests are temporarily disabled.
    • Upload artifact actions updated to v4.
    • Added overwrite option to artifact uploads.
  • .idea/kotlinc.xml
    • Kotlin version updated from 1.9.22 to 2.1.10.
  • README.md
    • Casa framework references removed.
    • Work-in-Progress notice removed.
  • app/build.gradle.kts
    • Casa UI dependencies removed.
    • Hilt and KSP plugins removed.
    • Kotlin serialization plugin added.
    • Compose dependencies added and updated.
    • Sample modules are now directly included as dependencies.
    • Target and source compatibility set to Java 11.
    • Namespace changed from com.example.platform.app to com.example.platform.
  • app/src/androidTest/java/com/example/platform/app/AppTestRunner.kt
    • File removed as Hilt testing is no longer used.
  • app/src/androidTest/java/com/example/platform/app/NavigationTest.kt
    • File removed as it's no longer relevant without Casa.
  • app/src/main/AndroidManifest.xml
    • Application name updated.
    • Theme updated to Theme.PlatformSamples.
    • References to MainApp removed.
  • app/src/main/java/com/example/platform/app/ApiSurface.kt
    • New file created to define ApiSurface data class and related constants for sample categories.
  • app/src/main/java/com/example/platform/app/CatalogScreen.kt
    • New file created to implement the CatalogScreen composable for displaying sample categories and items.
  • app/src/main/java/com/example/platform/app/MainActivity.kt
    • MainActivity is converted to a FragmentActivity and uses Compose for UI.
    • Casa-related code and MainApp references are removed.
  • app/src/main/java/com/example/platform/app/MainApp.kt
    • File removed as it's no longer needed without Casa and Hilt.
  • app/src/main/java/com/example/platform/app/NavGraph.kt
    • New file created to define the navigation graph using Compose Navigation.
  • app/src/main/java/com/example/platform/app/SampleDemo.kt
    • New file created to define the SampleDemo interface and related data classes for sample items.
  • app/src/main/res/drawable-v24/ic_launcher_background.xml
    • Minor formatting changes.
  • app/src/main/res/drawable-v24/ic_launcher_foreground.xml
    • Minor formatting changes.
  • app/src/main/res/values/themes.xml
    • New file created to define the Theme.PlatformSamples theme.
  • build-logic/build.gradle.kts
    • Build logic plugins removed, including platform, sample, and convention plugins.
  • build-logic/settings.gradle.kts
    • Dependency resolution management and version catalog configuration retained, but build-logic no longer included as a build.
    • build-logic root project name set
  • build-logic/src/main/kotlin/com.example.platform.plugin/CommonConventionPlugin.kt
    • File removed as custom Gradle plugins are no longer used.
  • build-logic/src/main/kotlin/com.example.platform.plugin/CreateSample.kt
    • File removed as custom Gradle plugins are no longer used.
  • build-logic/src/main/kotlin/com.example.platform.plugin/PlatformPlugin.kt
    • File removed as custom Gradle plugins are no longer used.
  • build-logic/src/main/kotlin/com.example.platform.plugin/SamplePlugin.kt
    • File removed as custom Gradle plugins are no longer used.
  • build-logic/src/main/kotlin/com.example.platform.plugin/SyncSamplesInfo.kt
    • File removed as custom Gradle plugins are no longer used.
  • gradle/libs.versions.toml
    • Dependencies updated to newer versions.
    • Casa dependencies removed.
    • Added new dependencies for Compose and other AndroidX libraries.
  • samples/accessibility/build.gradle.kts
    • build.gradle.kts updated to remove the platform sample plugin and use the standard android library plugin, and also to include compose dependencies
  • samples/accessibility/src/main/java/com/example/platform/accessibility/ColorContrast.kt
  • samples/accessibility/src/main/java/com/example/platform/accessibility/LiveRegionView.kt
  • samples/accessibility/src/main/java/com/example/platform/accessibility/SpeakableText.kt
  • samples/camera/camera2/build.gradle.kts
    • build.gradle.kts updated to remove the platform sample plugin and use the standard android library plugin, and also to include compose dependencies
  • samples/camera/camera2/src/main/java/com/example/platform/camera/imagecapture/Camera2ImageCapture.kt
  • samples/camera/camera2/src/main/java/com/example/platform/camera/imagecapture/Camera2UltraHDRCapture.kt
  • samples/camera/camera2/src/main/java/com/example/platform/camera/preview/Camera2Preview.kt
  • samples/connectivity/audio/build.gradle.kts
    • build.gradle.kts updated to remove the platform sample plugin and use the standard android library plugin, and also to include compose dependencies
  • samples/connectivity/audio/src/main/java/com/example/platform/connectivity/audio/AudioCommsSample.kt
  • samples/connectivity/bluetooth/ble/build.gradle.kts
    • build.gradle.kts updated to remove the platform sample plugin and use the standard android library plugin, and also to include compose dependencies
  • samples/connectivity/bluetooth/ble/src/main/java/com/example/platform/connectivity/bluetooth/ble/BLEScanIntentSample.kt
  • samples/connectivity/bluetooth/ble/src/main/java/com/example/platform/connectivity/bluetooth/ble/ConnectGATTSample.kt
  • samples/connectivity/bluetooth/ble/src/main/java/com/example/platform/connectivity/bluetooth/ble/FindBLEDevicesSample.kt
  • samples/connectivity/bluetooth/ble/src/main/java/com/example/platform/connectivity/bluetooth/ble/server/GATTServerSample.kt
  • samples/connectivity/bluetooth/companion/build.gradle.kts
    • build.gradle.kts updated to remove the platform sample plugin and use the standard android library plugin, and also to include compose dependencies
  • samples/connectivity/bluetooth/companion/src/main/java/com/example/platform/connectivity/bluetooth/cdm/CompanionDeviceManagerSample.kt
  • samples/connectivity/callnotification/build.gradle.kts
    • build.gradle.kts updated to remove the platform sample plugin and use the standard android library plugin, and also to include compose dependencies
  • samples/connectivity/callnotification/src/main/java/com/example/platform/connectivity/callnotification/CallNotificationSample.kt
  • samples/connectivity/telecom/build.gradle.kts
    • build.gradle.kts updated to remove the platform sample plugin and use the standard android library plugin, and also to include compose dependencies
  • samples/connectivity/telecom/src/main/java/com/example/platform/connectivity/telecom/TelecomCallSample.kt
  • samples/graphics/pdf/build.gradle.kts
    • build.gradle.kts updated to remove the platform sample plugin and use the standard android library plugin, and also to include compose dependencies
  • samples/graphics/pdf/src/main/java/com/example/platform/graphics/pdf/PdfRenderer.kt
  • samples/location/build.gradle.kts
    • build.gradle.kts updated to remove the platform sample plugin and use the standard android library plugin, and also to include compose dependencies
  • samples/location/src/main/java/com/example/platform/location/bglocationaccess/BgLocationAccessScreen.kt
  • samples/location/src/main/java/com/example/platform/location/currentLocation/CurrentLocationScreen.kt
  • samples/location/src/main/java/com/example/platform/location/geofencing/GeofencingScreen.kt
  • samples/location/src/main/java/com/example/platform/location/locationupdates/LocationUpdatesScreen.kt
  • samples/location/src/main/java/com/example/platform/location/permission/LocationPermissionsScreen.kt
  • samples/location/src/main/java/com/example/platform/location/useractivityrecog/UserActivityRecognitionScreen.kt
  • samples/media/ultrahdr/build.gradle.kts
    • build.gradle.kts updated to remove the platform sample plugin and use the standard android library plugin, and also to include compose dependencies
  • samples/media/ultrahdr/src/main/java/com/example/platform/media/ultrahdr/video/UltraHDRToHDRVideo.kt
  • samples/media/video/build.gradle.kts
    • build.gradle.kts updated to remove the platform sample plugin and use the standard android library plugin, and also to include compose dependencies
  • samples/media/video/src/main/java/com/example/platform/media/video/TransformerTFLite.kt
  • samples/media/video/src/main/java/com/example/platform/media/video/TransformerVideoComposition.kt
  • samples/privacy/data/build.gradle.kts
    • build.gradle.kts updated to remove the platform sample plugin and use the standard android library plugin, and also to include compose dependencies
  • samples/privacy/data/src/main/java/com/example/platform/privacy/data/PackageVisibility.kt
  • samples/privacy/permissions/build.gradle.kts
    • build.gradle.kts updated to remove the platform sample plugin and use the standard android library plugin, and also to include compose dependencies
  • samples/privacy/permissions/src/main/java/com/example/platform/privacy/permissions/ComposePermissions.kt
  • samples/privacy/permissions/src/main/java/com/example/platform/privacy/permissions/MultiplePermissions.kt
  • samples/privacy/permissions/src/main/java/com/example/platform/privacy/permissions/Permissionless.kt
  • samples/privacy/permissions/src/main/java/com/example/platform/privacy/permissions/SinglePermission.kt
  • samples/privacy/transparency/build.gradle.kts
    • build.gradle.kts updated to remove the platform sample plugin and use the standard android library plugin, and also to include compose dependencies
  • samples/privacy/transparency/src/main/java/com/example/platform/privacy/transparency/DataAccess.kt
  • samples/privacy/transparency/src/main/java/com/example/platform/privacy/transparency/ScreenshotDetectionSample.kt
  • samples/storage/build.gradle.kts
    • build.gradle.kts updated to remove the platform sample plugin and use the standard android library plugin, and also to include compose dependencies
  • samples/storage/src/main/java/com/example/platform/storage/mediastore/MediaStoreQuery.kt
  • samples/storage/src/main/java/com/example/platform/storage/mediastore/SelectedPhotosAccess.kt
  • samples/storage/src/main/java/com/example/platform/storage/photopicker/PhotoPicker.kt
  • samples/user-interface/appwidgets/build.gradle.kts
    • build.gradle.kts updated to remove the platform sample plugin and use the standard android library plugin, and also to include compose dependencies
  • samples/user-interface/appwidgets/src/main/java/com/example/platform/ui/appwidgets/AppWidgets.kt
  • samples/user-interface/appwidgets/src/main/java/com/example/platform/ui/appwidgets/glance/layout/ActionDemonstrationActivity.kt
  • samples/user-interface/constraintlayout/build.gradle.kts
    • build.gradle.kts updated to remove the platform sample plugin and use the standard android library plugin, and also to include compose dependencies
  • samples/user-interface/constraintlayout/src/main/java/com/example/platform/ui/constraintlayout/ConstraintLayout.kt
  • samples/user-interface/draganddrop/build.gradle.kts
    • build.gradle.kts updated to remove the platform sample plugin and use the standard android library plugin, and also to include compose dependencies
  • samples/user-interface/draganddrop/src/main/java/com/example/platform/ui/draganddrop/DragAndDropMultiWindow.kt
  • samples/user-interface/draganddrop/src/main/java/com/example/platform/ui/draganddrop/DragAndDropRichContentReceiverFragment.kt
  • samples/user-interface/draganddrop/src/main/java/com/example/platform/ui/draganddrop/DragAndDropUsingCompose.kt
  • samples/user-interface/draganddrop/src/main/java/com/example/platform/ui/draganddrop/DragAndDropWithHelper.kt
  • samples/user-interface/draganddrop/src/main/java/com/example/platform/ui/draganddrop/DragAndDropWithViews.kt
  • samples/user-interface/haptics/build.gradle.kts
    • build.gradle.kts updated to remove the platform sample plugin and use the standard android library plugin, and also to include compose dependencies
  • samples/user-interface/haptics/src/main/java/com/example/platform/ui/haptics/Haptics.kt
  • samples/user-interface/picture-in-picture/build.gradle.kts
    • build.gradle.kts updated to remove the platform sample plugin and use the standard android library plugin, and also to include compose dependencies
  • samples/user-interface/picture-in-picture/src/main/java/com/example/android/pip/PiPMovieActivity.kt
  • samples/user-interface/picture-in-picture/src/main/java/com/example/android/pip/PiPSampleActivity.kt
  • samples/user-interface/predictiveback/build.gradle.kts
    • build.gradle.kts updated to remove the platform sample plugin and use the standard android library plugin, and also to include compose dependencies
  • samples/user-interface/predictiveback/src/main/java/com/example/platform/ui/predictiveback/PBHostingActivity.kt
  • samples/user-interface/quicksettings/build.gradle.kts
    • build.gradle.kts updated to remove the platform sample plugin and use the standard android library plugin, and also to include compose dependencies
  • samples/user-interface/quicksettings/src/main/java/com/example/platform/ui/quicksettings/QuickSettings.kt
  • samples/user-interface/share/build.gradle.kts
    • build.gradle.kts updated to remove the platform sample plugin and use the standard android library plugin, and also to include compose dependencies
  • samples/user-interface/share/src/main/java/com/example/platform/ui/share/receiver/ShareReceiverActivity.kt
  • samples/user-interface/share/src/main/java/com/example/platform/ui/share/sender/ShareSender.kt
  • samples/user-interface/text/build.gradle.kts
    • build.gradle.kts updated to remove the platform sample plugin and use the standard android library plugin, and also to include compose dependencies
  • samples/user-interface/text/src/main/java/com/example/platform/ui/text/ConversionSuggestions.kt
  • samples/user-interface/text/src/main/java/com/example/platform/ui/text/DownloadableFonts.kt
  • samples/user-interface/text/src/main/java/com/example/platform/ui/text/Hyphenation.kt
  • samples/user-interface/text/src/main/java/com/example/platform/ui/text/LineBreak.kt
  • samples/user-interface/text/src/main/java/com/example/platform/ui/text/Linkify.kt
  • samples/user-interface/text/src/main/java/com/example/platform/ui/text/TextSpan.kt
  • samples/user-interface/window-insets/build.gradle.kts
    • build.gradle.kts updated to remove the platform sample plugin and use the standard android library plugin, and also to include compose dependencies
  • samples/user-interface/window-insets/src/main/java/com/example/platform/ui/insets/ImmersiveMode.kt
  • samples/user-interface/window-insets/src/main/java/com/example/platform/ui/insets/WindowInsetsAnimation.kt
  • samples/user-interface/windowmanager/build.gradle.kts
    • build.gradle.kts updated to remove the platform sample plugin and use the standard android library plugin, and also to include compose dependencies
  • samples/user-interface/windowmanager/src/main/java/com/example/platform/ui/windowmanager/demos/WindowDemosActivity.kt

Activity

  • satishshendeg suggested that the name 'Area' was vague and suggested a name change.
  • yrezgui replaced 'Area' with 'ApiSurface' in response to the suggestion by satishshendeg.
  • satishshendeg suggested adding a description to the CatalogScreen composable.
  • satishshendeg noted that images may not load correctly using Glide and suggested adding an override with SIZE_ORIGINAL.
  • yrezgui suggested creating a separate PR to address the Glide image loading issue.
  • satishshendeg agreed to create a separate PR for the Glide image loading issue after this one is merged.

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.

7 participants