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
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
e1e4cb8
Delete the outdated button widget demo code.
shamalip Jan 17, 2025
cf2468b
Delete the outdated list widget demo code.
shamalip Jan 17, 2025
92e5cd4
Delete the outdated image widget demo code.
shamalip Jan 17, 2025
4dc3b2e
Align the AppWidgets showcase entrypoint to highlight canonical layou…
shamalip Jan 17, 2025
bf6d21c
Adjust size and preview of the weather widget in platform samples.
shamalip Jan 17, 2025
66fde1c
Update background color of the xml based weather widget
shamalip Jan 17, 2025
bc9a162
Update Glance weather widget to use Scaffold.
shamalip Jan 17, 2025
d8e7bc1
Align the AppWidgets showcase entrypoint to highlight canonical layou…
shamalip Jan 17, 2025
3eafc2f
fixup! Update Glance weather widget to use Scaffold.
shamalip Jan 18, 2025
8a10d6a
Update the readMe section with screenshots of canonical widget layouts
shamalip Jan 18, 2025
2861826
Update the readMe section with screenshots of canonical widget layouts
shamalip Jan 18, 2025
fbadacd
Update the readMe section with screenshots of canonical widget layouts
shamalip Jan 18, 2025
0957e90
Merge remote-tracking branch 'origin/cleanup' into cleanup
shamalip Jan 18, 2025
7d690b9
Replace Casa framework with a lighter structure
yrezgui Feb 22, 2025
149037d
Remove Casa from these following modules:
yrezgui Feb 23, 2025
e6e49c0
Remove Casa from these following modules:
yrezgui Feb 24, 2025
a03c528
Fix permissions module
yrezgui Feb 24, 2025
f6f02b9
Add appwidgets & constraintlayout samples
yrezgui Feb 25, 2025
fc2578c
Add more user interface samples
yrezgui Feb 25, 2025
94c7a5e
Add last samples
yrezgui Feb 26, 2025
4705239
Update build.yml (#277)
javadude Feb 27, 2025
1b16c50
Add MinSdkBox composable to wrap samples using recent APIs
yrezgui Feb 27, 2025
c98837c
Fix Activity insets
yrezgui Feb 28, 2025
900271a
Add missing test dependencies
yrezgui Feb 28, 2025
d7b5dca
Update README.md
yrezgui Feb 28, 2025
32bdebc
Merge pull request #226 from shamalip/cleanup
secondsun Mar 3, 2025
1727612
Remove duplicate MAIN/LAUNCHER intent filters from samples
yrezgui Mar 7, 2025
050ee24
Temporarily ignore a flaky test in PiPMovieActivityTest
yrezgui Mar 7, 2025
089adc5
Refactor: Replace `Area` with `ApiSurface` for better context
yrezgui Mar 7, 2025
acff264
Temporarily disable unit tests in CI
yrezgui Mar 7, 2025
f7f63b8
Replace Casa framework with a lighter structure
yrezgui Feb 22, 2025
eeb26f9
Remove Casa from these following modules:
yrezgui Feb 23, 2025
a688b1c
Remove Casa from these following modules:
yrezgui Feb 24, 2025
59adcf6
Fix permissions module
yrezgui Feb 24, 2025
bdecf88
Add appwidgets & constraintlayout samples
yrezgui Feb 25, 2025
a4b0c73
Add more user interface samples
yrezgui Feb 25, 2025
c9f6f79
Add last samples
yrezgui Feb 26, 2025
aa82f5e
Add MinSdkBox composable to wrap samples using recent APIs
yrezgui Feb 27, 2025
e07316d
Fix Activity insets
yrezgui Feb 28, 2025
872e8c2
Add missing test dependencies
yrezgui Feb 28, 2025
638cb20
Update README.md
yrezgui Feb 28, 2025
9497e9f
Remove duplicate MAIN/LAUNCHER intent filters from samples
yrezgui Mar 7, 2025
f41c767
Temporarily ignore a flaky test in PiPMovieActivityTest
yrezgui Mar 7, 2025
db76bc8
Refactor: Replace `Area` with `ApiSurface` for better context
yrezgui Mar 7, 2025
88db232
Temporarily disable unit tests in CI
yrezgui Mar 7, 2025
9b7c5b5
Rebase app widgets description from main branch
yrezgui Mar 7, 2025
9211549
Merge remote-tracking branch 'origin/complete-refresh' into complete-…
yrezgui Mar 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,24 @@ jobs:
- name: Build debug
run: ./gradlew assembleDebug

- name: Run local tests
run: ./gradlew testDebug
# TODO: Temporarily disable unit tests until the infra is fixed
# - name: Run local tests
# run: ./gradlew testDebug

- name: Upload build outputs (APKs)
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: build-outputs
path: app/build/outputs
overwrite: true

- name: Upload build reports
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: build-reports
path: app/build/reports
overwrite: true

androidTest:
needs: build
Expand Down Expand Up @@ -112,7 +115,8 @@ jobs:

- name: Upload test reports
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: test-reports-${{ matrix.api-level }}
path: '*/build/reports/androidTests'
overwrite: true
2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
This repository contains a collection of samples that demonstrate the use of different Android OS platform APIs. The samples are organized into folders by topic, and each folder contains a README file that provides more information about the samples in that folder.

> **Note:** These samples are intended to showcase specific functionality in isolation, and they may use
> simplified code. They are not intended to be used as production-ready code. The project uses the
> [casa-android](https://github.com/google/casa-android) (intended only for demo projects).
> simplified code. They are not intended to be used as production-ready code.
> For best practices follow our documentation and check
> [Now In Android](https://github.com/android/nowinandroid)

Expand All @@ -24,8 +23,6 @@ Browse the samples inside each topic samples folder:

We are constantly adding new samples to this repository. You can find a list of all the available samples [here](https://github.com/android/platform-samples/tree/main/samples/README.md).

> 🚧 **Work-in-Progress:** we are working on bringing more existing and new samples into this format.

## How to run

1. Clone the repository
Expand Down
123 changes: 59 additions & 64 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,103 +13,98 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Suppress("DSL_SCOPE_VIOLATION")

plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.ksp)
alias(libs.plugins.hilt)
id("com.example.platform.convention")
}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
alias(libs.plugins.kotlin.compose)
kotlin("plugin.serialization") version "2.1.10"
}

android {
namespace = "com.example.platform.app"
namespace = "com.example.platform"
compileSdk = 35

defaultConfig {
applicationId = "com.example.platform.app"
applicationId = "com.example.platform"
minSdk = 21
targetSdk = 35
versionCode = 1
versionName = "1.0"

testInstrumentationRunner = "com.example.platform.app.AppTestRunner"
vectorDrawables {
useSupportLibrary = true
}
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
"proguard-rules.pro",
)
}
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = "11"
}

buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get()
}
packagingOptions {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
}

dependencies {
implementation(platform(libs.compose.bom))
implementation(libs.casa.ui)
implementation(libs.androidx.appcompat)

implementation(libs.hilt.android)
ksp(libs.hilt.compiler)

implementation(libs.coil.base)
implementation(libs.coil.video)
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.activity.compose)
implementation(platform(libs.androidx.compose.bom))
implementation(libs.androidx.ui)
implementation(libs.androidx.ui.graphics)
implementation(libs.androidx.ui.tooling.preview)
implementation(libs.androidx.material3)
implementation(libs.androidx.navigation.compose)

// include all available samples.
val samples: List<String> by project.extra
samples.forEach {
implementation(project(it))
}
implementation(libs.kotlinx.serialization.json)
implementation(libs.androidx.fragment.compose)

// Testing
kspAndroidTest(libs.hilt.compiler)
androidTestImplementation(platform(libs.compose.bom))
androidTestImplementation(libs.androidx.navigation.testing)
androidTestImplementation(libs.compose.ui.test.manifest)
debugImplementation(libs.compose.ui.test.manifest)
androidTestImplementation(libs.compose.ui.test.junit4)
androidTestImplementation(libs.androidx.test.core)
androidTestImplementation(libs.androidx.test.espresso.core)
androidTestImplementation(libs.androidx.test.rules)
androidTestImplementation(libs.androidx.test.runner)
androidTestImplementation(libs.hilt.testing)
androidTestImplementation(libs.junit4)
}
implementation(project(":shared"))
implementation(project(":samples:accessibility"))
implementation(project(":samples:camera:camera2"))
implementation(project(":samples:connectivity:audio"))
implementation(project(":samples:connectivity:bluetooth:ble"))
implementation(project(":samples:connectivity:bluetooth:companion"))
implementation(project(":samples:connectivity:callnotification"))
implementation(project(":samples:connectivity:telecom"))
implementation(project(":samples:graphics:pdf"))
implementation(project(":samples:graphics:ultrahdr"))
implementation(project(":samples:location"))
implementation(project(":samples:media:ultrahdr"))
implementation(project(":samples:media:video"))
implementation(project(":samples:privacy:data"))
implementation(project(":samples:privacy:permissions"))
implementation(project(":samples:privacy:transparency"))
implementation(project(":samples:storage"))
implementation(project(":samples:user-interface:appwidgets"))
implementation(project(":samples:user-interface:constraintlayout"))
implementation(project(":samples:user-interface:draganddrop"))
implementation(project(":samples:user-interface:haptics"))
implementation(project(":samples:user-interface:picture-in-picture"))
implementation(project(":samples:user-interface:predictiveback"))
implementation(project(":samples:user-interface:quicksettings"))
implementation(project(":samples:user-interface:share"))
implementation(project(":samples:user-interface:text"))
implementation(project(":samples:user-interface:window-insets"))
implementation(project(":samples:user-interface:windowmanager"))

tasks.register("syncSamplesInfo", com.example.platform.plugin.SyncSamplesInfo::class.java) {
projectDir.set(project.rootDir)
}
// Link the assemble task to the sync task.
// TODO: move syncSamplesInfo task here, as this can break isolated projects
afterEvaluate {
tasks.findByName("assembleDebug")?.finalizedBy(tasks.findByName("syncSamplesInfo"))
}
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
androidTestImplementation(platform(libs.androidx.compose.bom))
androidTestImplementation(libs.androidx.ui.test.junit4)
debugImplementation(libs.androidx.ui.tooling)
debugImplementation(libs.androidx.ui.test.manifest)
}
31 changes: 0 additions & 31 deletions app/src/androidTest/java/com/example/platform/app/AppTestRunner.kt

This file was deleted.

This file was deleted.

22 changes: 11 additions & 11 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,15 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application
android:name=".MainApp"
android:allowBackup="true"
android:enableOnBackInvokedCallback="true"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:enableOnBackInvokedCallback="true">
android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="true">
<activity
android:name=".MainActivity"
android:name=".app.MainActivity"
android:exported="true"
android:theme="@style/Theme.Material3.DayNight.NoActionBar">
android:theme="@style/Theme.PlatformSamples">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand All @@ -36,10 +34,12 @@
</activity>

<!--required for TFLite/LiteRT style transfer demo -->
<uses-library android:name="libOpenCL.so"
android:required="false"/>
<uses-library android:name="libOpenCL-pixel.so"
android:required="false"/>
<uses-library
android:name="libOpenCL.so"
android:required="false" />
<uses-library
android:name="libOpenCL-pixel.so"
android:required="false" />
</application>

</manifest>
Loading
Loading