Skip to content

Commit

Permalink
Merged from main
Browse files Browse the repository at this point in the history
  • Loading branch information
slothwriter committed Feb 22, 2022
2 parents fec6996 + 8acc8c7 commit 9299f72
Show file tree
Hide file tree
Showing 72 changed files with 939 additions and 702 deletions.
23 changes: 6 additions & 17 deletions AlwaysOnKotlin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,38 +15,27 @@
*/

buildscript {
ext.kotlin_version = "1.6.10"
repositories {
google()
mavenCentral()
}

dependencies {
classpath "com.android.tools.build:gradle:7.0.4"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath libs.kotlin.gradle.plugin
}
}

plugins {
id 'com.diffplug.spotless' version '6.0.1'
alias(libs.plugins.com.diffplug.spotless) apply(false)
alias(libs.plugins.com.android.application) apply(false)
}

subprojects {
repositories {
google()
mavenCentral()
}

apply plugin: "com.diffplug.spotless"

spotless {
kotlin {
target '**/*.kt'
target "**/*.kt"
targetExclude("$buildDir/**/*.kt")
targetExclude('bin/**/*.kt')
targetExclude("bin/**/*.kt")

ktlint("0.41.0")
licenseHeaderFile rootProject.file('spotless/copyright.kt')
licenseHeaderFile rootProject.file("spotless/copyright.kt")
}
}
}
48 changes: 24 additions & 24 deletions AlwaysOnKotlin/compose/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/

plugins {
id "com.android.application"
id "kotlin-android"
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}

android {
Expand All @@ -25,15 +25,15 @@ android {
defaultConfig {
versionCode 1
versionName "1.0"
minSdkVersion 26
targetSdkVersion 30
minSdk 26
targetSdk 30

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

lintOptions {
warningsAsErrors true
ignore "OldTargetApi" // API >30 doesn't exist for Wear OS
ignore "OldTargetApi" // API >30 doesn"t exist for Wear OS
}

compileOptions {
Expand All @@ -52,7 +52,7 @@ android {
}

composeOptions {
kotlinCompilerExtensionVersion '1.1.0-rc02'
kotlinCompilerExtensionVersion libs.versions.compose.get()
}

// Workaround for https://github.com/Kotlin/kotlinx.coroutines/issues/2023
Expand All @@ -64,23 +64,23 @@ android {
}

dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.0"
implementation "androidx.activity:activity-compose:1.4.0"
implementation 'androidx.compose.ui:ui:1.1.0-rc01'
implementation 'androidx.compose.ui:ui-tooling:1.1.0-rc01'
implementation 'androidx.compose.compiler:compiler:1.1.0-rc02'
implementation "androidx.core:core-ktx:1.7.0"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.4.0"
implementation 'androidx.wear:wear:1.2.0'
implementation "androidx.wear.compose:compose-foundation:1.0.0-alpha13"
implementation "androidx.wear.compose:compose-material:1.0.0-alpha13"
implementation "androidx.window:window:1.0.0-rc01"
implementation "androidx.compose.ui:ui-test-manifest:1.1.0-rc01"
implementation libs.kotlinx.coroutines.android
implementation libs.androidx.activity.compose
implementation libs.compose.ui
implementation libs.compose.ui.tooling
implementation libs.compose.compiler
implementation libs.androidx.core.ktx
implementation libs.androidx.lifecycle.runtime.ktx
implementation libs.androidx.wear
implementation libs.wear.compose.foundation
implementation libs.wear.compose.material
implementation libs.androidx.window
implementation libs.compose.ui.test.manifest

androidTestImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.0"
androidTestImplementation "androidx.test:core-ktx:1.4.0"
androidTestImplementation "androidx.test.ext:junit-ktx:1.1.3"
androidTestImplementation "androidx.test:runner:1.4.0"
androidTestImplementation "androidx.test.uiautomator:uiautomator:2.2.0"
androidTestImplementation "androidx.compose.ui:ui-test-junit4:1.1.0-rc01"
androidTestImplementation libs.kotlinx.coroutines.test
androidTestImplementation libs.test.core.ktx
androidTestImplementation libs.test.ext.junit.ktx
androidTestImplementation libs.test.runner
androidTestImplementation libs.test.uiautomator
androidTestImplementation libs.compose.ui.test.junit4
}
1 change: 0 additions & 1 deletion AlwaysOnKotlin/compose/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
the same (already active) Activity.
-->
<activity android:name="com.example.android.wearable.wear.alwayson.MainActivity"
android:label="@string/app_name"
android:launchMode="singleInstance"
android:configChanges="orientation|keyboardHidden"
android:exported="true">
Expand Down
2 changes: 1 addition & 1 deletion AlwaysOnKotlin/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
30 changes: 28 additions & 2 deletions AlwaysOnKotlin/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,31 @@
* limitations under the License.
*/

include ':compose'
include ':views'
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}

// https://docs.gradle.org/7.4/userguide/declaring_dependencies.html#sec:type-safe-project-accessors
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")

dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
versionCatalogs {
libs {
from(files("../gradle/libs.versions.toml"))
}
}
}



include ":compose"
include ":views"
40 changes: 20 additions & 20 deletions AlwaysOnKotlin/views/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/

plugins {
id "com.android.application"
id "kotlin-android"
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}

android {
Expand All @@ -25,15 +25,15 @@ android {
defaultConfig {
versionCode 1
versionName "1.0"
minSdkVersion 26
targetSdkVersion 30
minSdk 26
targetSdk 30

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

lintOptions {
warningsAsErrors true
ignore "OldTargetApi" // API >30 doesn't exist for Wear OS
ignore "OldTargetApi" // API >30 doesn"t exist for Wear OS
}

compileOptions {
Expand All @@ -60,20 +60,20 @@ android {
}

dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.0"
implementation "androidx.activity:activity-ktx:1.4.0"
implementation "androidx.core:core-ktx:1.7.0"
implementation 'androidx.wear:wear:1.2.0'
implementation libs.kotlinx.coroutines.android
implementation libs.androidx.activity.ktx
implementation libs.androidx.core.ktx
implementation libs.androidx.wear

androidTestImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.0"
androidTestImplementation "androidx.test:core:1.4.0"
androidTestImplementation "androidx.test:core-ktx:1.4.0"
androidTestImplementation "androidx.test.espresso:espresso-core:3.4.0"
androidTestImplementation "androidx.test.ext:junit:1.1.3"
androidTestImplementation "androidx.test.ext:junit-ktx:1.1.3"
androidTestImplementation "androidx.test.ext:truth:1.4.0"
androidTestImplementation "androidx.test:runner:1.4.0"
androidTestImplementation "androidx.test:rules:1.4.0"
androidTestImplementation "androidx.test.uiautomator:uiautomator:2.2.0"
androidTestImplementation "com.google.truth:truth:1.1.2"
androidTestImplementation libs.kotlinx.coroutines.test
androidTestImplementation libs.test.core
androidTestImplementation libs.test.core.ktx
androidTestImplementation libs.test.espresso.core
androidTestImplementation libs.test.ext.junit
androidTestImplementation libs.test.ext.junit.ktx
androidTestImplementation libs.test.ext.truth
androidTestImplementation libs.test.runner
androidTestImplementation libs.test.rules
androidTestImplementation libs.test.uiautomator
androidTestImplementation libs.com.google.truth
}
1 change: 0 additions & 1 deletion AlwaysOnKotlin/views/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
the same (already active) Activity.
-->
<activity android:name="com.example.android.wearable.wear.alwayson.MainActivity"
android:label="@string/app_name"
android:launchMode="singleInstance"
android:configChanges="orientation|keyboardHidden"
android:exported="true">
Expand Down
47 changes: 23 additions & 24 deletions ComposeAdvanced/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

plugins {
id 'com.android.application'
id 'kotlin-android'
id 'org.jetbrains.kotlin.android'
}

android {
Expand All @@ -32,16 +33,15 @@ android {
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
useIR = true
jvmTarget = "1.8"
freeCompilerArgs += "-Xjvm-default=compatibility"
freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn"
// Allow for widescale experimental APIs in Alpha libraries we build upon
Expand All @@ -53,53 +53,52 @@ android {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion "$compose_version"
kotlinCompilerExtensionVersion libs.versions.compose.get()
}
packagingOptions {
resources {
excludes += '/META-INF/{AL2.0,LGPL2.1}'
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
}

dependencies {
// General compose dependencies
implementation "androidx.activity:activity-compose:$activity_compose_version"
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
implementation "androidx.compose.compiler:compiler:$compose_version"
implementation "androidx.compose.foundation:foundation:$compose_version"
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:$lifecycle_version"
implementation libs.androidx.activity.compose
implementation libs.compose.ui.tooling.preview
implementation libs.compose.compiler
implementation libs.compose.foundation
implementation libs.androidx.lifecycle.viewmodel.compose

// ViewModel
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
implementation libs.androidx.lifecycle.viewmodel.ktx

// Saved state module for ViewModel
implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:$lifecycle_version"
implementation libs.androidx.lifecycle.viewmodel.savedstate

// Annotation processor
implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"

implementation libs.androidx.lifecycle.common.java8

// Compose for Wear OS Dependencies
// Developer Preview starts with Alpha 07, with new releases coming soon.
// Developer Preview currently Alpha, with new releases coming soon.
// NOTE: DO NOT INCLUDE a dependency on androidx.compose.material:material.
// androidx.wear.compose:compose-material is designed as a replacement not an addition to
// androidx.compose.material:material. If there are features from that you feel are missing from
// androidx.wear.compose:compose-material please raise a bug to let us know:
// https://issuetracker.google.com/issues/new?component=1077552&template=1598429&pli=1
implementation "androidx.wear.compose:compose-material:$wear_compose_version"
implementation libs.wear.compose.material

// Foundation is additive, so you can use the mobile version in your Wear OS app.
implementation "androidx.wear.compose:compose-foundation:$wear_compose_version"
implementation libs.wear.compose.foundation

// If you are using Compose Navigation, use the Wear OS version (NOT the
// androidx.navigation:navigation-compose version), that is, uncomment the line below.
implementation "androidx.wear.compose:compose-navigation:$wear_compose_version"
implementation libs.wear.compose.navigation

// Testing
testImplementation "junit:junit:$junit_version"
androidTestImplementation "androidx.test.ext:junit:$androidx_test_ext_junit_version"
androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_version"
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
testImplementation libs.junit
androidTestImplementation libs.test.ext.junit
androidTestImplementation libs.test.espresso.core
androidTestImplementation libs.compose.ui.test.junit4
debugImplementation libs.compose.ui.tooling
}
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ fun WearApp(watchRepository: WatchRepository) {
// TODO: consider moving to ViewModel
// Display value is passed down to various user input screens, for the slider and stepper
// components specifically, to demonstrate how they work.
var defaultSelectedValue = 2
val defaultSelectedValue = 2
var displayValueForUserInput by remember { mutableStateOf(defaultSelectedValue) }

Scaffold(
Expand Down
Loading

0 comments on commit 9299f72

Please sign in to comment.