Skip to content

Commit 5650a8c

Browse files
committed
Merge branch 'main' into nav3
* main: (74 commits) Add basic WindowInsetsRulers cases (#621) Adding shadows code snippets (#620) Update the wear preview code Update state based (#619) add WindowInsetsRulers snippet (#616) Migrate snippets from dac/training/wearables/tiles/screen-size (#617) Resolve warnings in the Wakelock code snippets (#615) Disabling some "unused" warnings (#610) Add android_wear_tile_version_fallback (#614) Add viewmodel screen for KMP (#613) Fix missing snippet (#612) Add KMP ViewModel snippets (#611) docs(modifiers): Add TODOs for inspectableProperties lint warnings (#589) Fix: Prevent memory leak from implicit SAM conversion (#588) Fix(gestures): Handle pointer events inside awaitPointerEventScope (#590) Lint: Use specialized state holders to avoid autoboxing (#591) Refactor: Rename Composable functions to follow naming conventions (#592) Refactor(text): Use KTX extension for isDigitsOnly check (#593) Refactor(SearchBar): Reorder modifier parameter to follow convention (#594) Add padding to avoid overwriting TimeText (#529) ...
2 parents c05f307 + 1da1d9d commit 5650a8c

File tree

164 files changed

+9405
-1290
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

164 files changed

+9405
-1290
lines changed

.github/workflows/apply_spotless.yml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,7 @@ jobs:
4242
java-version: '17'
4343

4444
- name: Run spotlessApply
45-
run: ./gradlew :compose:spotlessApply --init-script gradle/init.gradle.kts --no-configuration-cache --stacktrace
46-
47-
- name: Run spotlessApply for Wear
48-
run: ./gradlew :wear:spotlessApply --init-script gradle/init.gradle.kts --no-configuration-cache --stacktrace
49-
50-
- name: Run spotlessApply for Misc
51-
run: ./gradlew :misc:spotlessApply --init-script gradle/init.gradle.kts --no-configuration-cache --stacktrace
52-
53-
- name: Run spotlessApply for XR
54-
run: ./gradlew :xr:spotlessApply --init-script gradle/init.gradle.kts --no-configuration-cache --stacktrace
45+
run: ./gradlew spotlessApply --init-script gradle/init.gradle.kts --no-configuration-cache --stacktrace
5546

5647
- name: Auto-commit if spotlessApply has changes
5748
uses: stefanzweifel/git-auto-commit-action@v5

.github/workflows/build-ios.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
name: Build snippets
15+
16+
on:
17+
push:
18+
branches: [ '*' ]
19+
paths:
20+
- 'kmp/**'
21+
- '.github/workflows/build-ios.yml'
22+
pull_request:
23+
branches: [ '*' ]
24+
paths:
25+
- 'kmp/**'
26+
- '.github/workflows/build-ios.yml'
27+
workflow_dispatch:
28+
concurrency:
29+
group: ${{ github.workflow }}-${{ github.ref }}-build-ios
30+
cancel-in-progress: true
31+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
32+
jobs:
33+
build_ios:
34+
name: Build iOS app
35+
runs-on: macos-latest
36+
steps:
37+
- uses: maxim-lobanov/setup-xcode@v1
38+
with:
39+
xcode-version: latest-stable
40+
41+
- name: Checkout
42+
uses: actions/checkout@v5
43+
44+
- name: Build iOS app
45+
uses: mxcl/xcodebuild@v3
46+
with:
47+
xcode: ^16
48+
scheme: iosApp
49+
platform: iOS
50+
action: build
51+
working-directory: kmp/iosApp

.github/workflows/build.yml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,7 @@ jobs:
3737
with:
3838
distribution: 'zulu'
3939
java-version: '17'
40-
- name: Build Compose
41-
run: ./gradlew :compose:snippets:build
42-
- name: Build recompose snippets
43-
run: ./gradlew :compose:recomposehighlighter:build
44-
- name: Build kotlin snippets
45-
run: ./gradlew :kotlin:build
46-
- name: Build Wear snippets
47-
run: ./gradlew :wear:build
48-
- name: Build misc snippets
49-
run: ./gradlew :misc:build
50-
- name: Build XR snippets
51-
run: ./gradlew :xr:build
40+
- name: Build All
41+
run: ./gradlew build --stacktrace
42+
- name: Build Watch Face Push validation snippets
43+
run: ./gradlew :watchfacepush:validator:run --stacktrace

.gitignore

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,22 @@
66
/.idea/modules.xml
77
/.idea/workspace.xml
88
.DS_Store
9-
/build
9+
build
1010
/captures
1111
.externalNativeBuild
1212
.idea/*
1313
/.idea/*
14+
.kotlin
15+
16+
### Xcode ###
17+
## User settings
18+
xcuserdata/
19+
20+
### Xcode Patch ###
21+
*.xcodeproj/*
22+
!*.xcodeproj/project.pbxproj
23+
!*.xcodeproj/xcshareddata/
24+
!*.xcodeproj/project.xcworkspace/
25+
!*.xcworkspace/contents.xcworkspacedata
26+
/*.gcno
27+
**/xcshareddata/WorkspaceSettings.xcsettings

bluetoothle/src/main/AndroidManifest.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
package="com.sample.android.bluetoothle">
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
43

54
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
65
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
@@ -23,6 +22,6 @@
2322
<uses-permission android:name="android.permission.BLUETOOTH" />
2423
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
2524

25+
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
2626
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
27-
2827
</manifest>

bluetoothle/src/main/java/com/sample/android/bluetoothle/java/MainActivity.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
package com.sample.android.bluetoothle.java;
22

3-
import androidx.appcompat.app.AppCompatActivity;
4-
3+
import android.Manifest;
54
import android.bluetooth.BluetoothAdapter;
65
import android.bluetooth.BluetoothManager;
76
import android.content.Context;
87
import android.content.Intent;
98
import android.os.Bundle;
109

10+
import androidx.annotation.RequiresPermission;
11+
import androidx.appcompat.app.AppCompatActivity;
12+
1113
import com.sample.android.bluetoothle.R;
1214

1315
public class MainActivity extends AppCompatActivity {
@@ -19,6 +21,7 @@ protected void onCreate(Bundle savedInstanceState) {
1921
setContentView(R.layout.activity_main);
2022
}
2123

24+
@RequiresPermission(Manifest.permission.BLUETOOTH_CONNECT)
2225
private void setUpBLE() {
2326
// [START get_bluetooth_adapter]
2427
// Initializes Bluetooth adapter.

bluetoothle/src/main/java/com/sample/android/bluetoothle/kotlin/DeviceScanActivity.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@
1616

1717
package com.sample.android.bluetoothle.kotlin
1818

19+
import android.Manifest
1920
import android.app.ListActivity
2021
import android.bluetooth.BluetoothAdapter
2122
import android.bluetooth.le.ScanCallback
2223
import android.bluetooth.le.ScanResult
2324
import android.os.Handler
25+
import androidx.annotation.RequiresPermission
2426
import com.sample.android.bluetoothle.java.LeDeviceListAdapter
2527

2628
/**
@@ -47,6 +49,7 @@ class DeviceScanActivity : ListActivity() {
4749
// Stops scanning after 10 seconds.
4850
private val SCAN_PERIOD: Long = 10000
4951

52+
@RequiresPermission(Manifest.permission.BLUETOOTH_SCAN)
5053
private fun scanLeDevice() {
5154
if (!mScanning) { // Stops scanning after a pre-defined scan period.
5255
handler.postDelayed({

bluetoothle/src/main/java/com/sample/android/bluetoothle/kotlin/MainActivity.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@
1616

1717
package com.sample.android.bluetoothle.kotlin
1818

19+
import android.Manifest
1920
import android.bluetooth.BluetoothAdapter
2021
import android.bluetooth.BluetoothManager
2122
import android.content.Context
2223
import android.content.Intent
2324
import android.os.Bundle
25+
import androidx.annotation.RequiresPermission
2426
import androidx.appcompat.app.AppCompatActivity
2527

2628
class MainActivity : AppCompatActivity() {
@@ -31,6 +33,7 @@ class MainActivity : AppCompatActivity() {
3133
super.onCreate(savedInstanceState)
3234
}
3335

36+
@RequiresPermission(Manifest.permission.BLUETOOTH_CONNECT)
3437
private fun setUpBLE() {
3538
// [START get_bluetooth_adapter]
3639
// Initializes Bluetooth adapter.

build.gradle.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ plugins {
1010
alias(libs.plugins.kotlin.parcelize) apply false
1111
alias(libs.plugins.compose.compiler) apply false
1212
alias(libs.plugins.kotlin.serialization) apply false
13+
alias(libs.plugins.kotlin.multiplatform) apply false
14+
alias(libs.plugins.android.kotlin.multiplatform.library) apply false
15+
alias(libs.plugins.android.lint) apply false
1316
}
1417

1518
apply("${project.rootDir}/buildscripts/toml-updater-config.gradle")

compose/recomposehighlighter/src/main/java/com/example/android/compose/recomposehighlighter/RecomposeHighlighter.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ private class RecomposeHighlighterModifier : Modifier.Node(), DrawModifierNode {
8989

9090
override val shouldAutoInvalidate: Boolean = false
9191

92+
override fun onReset() {
93+
totalCompositions = 0
94+
timerJob?.cancel()
95+
}
96+
9297
override fun onDetach() {
9398
timerJob?.cancel()
9499
}

0 commit comments

Comments
 (0)