Skip to content

Commit

Permalink
Merge pull request #15 from secondsun/update_versions
Browse files Browse the repository at this point in the history
 Upgrading dependencies including Glance, AGP, Kotlin, Compose, etc.
  • Loading branch information
secondsun authored Nov 21, 2023
2 parents 674552e + 12c0c17 commit 051a8b4
Show file tree
Hide file tree
Showing 38 changed files with 776 additions and 184 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: set up JDK
uses: actions/setup-java@v1
with:
java-version: 11
java-version: 17

- name: Decrypt secrets
run: release/signing-setup.sh ${{ secrets.ENCRYPT_KEY }}
Expand All @@ -49,7 +49,7 @@ jobs:
./gradlew --scan --stacktrace \
spotlessCheck \
assemble \
metalavaCheckCompatibility \
metalavaCheckCompatibilityDebug \
lintDebug
- name: Unit Tests
Expand Down Expand Up @@ -99,7 +99,7 @@ jobs:
- name: set up JDK
uses: actions/setup-java@v1
with:
java-version: 11
java-version: 17

- name: Decrypt secrets
run: release/signing-setup.sh ${{ secrets.ENCRYPT_KEY }}
Expand Down Expand Up @@ -174,7 +174,7 @@ jobs:
- name: set up JDK
uses: actions/setup-java@v1
with:
java-version: 11
java-version: 17

- name: Decrypt secrets
run: release/signing-setup.sh ${{ secrets.ENCRYPT_KEY }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: set up JDK
uses: actions/setup-java@v1
with:
java-version: 11
java-version: 17

- name: Decrypt secrets
run: release/signing-setup.sh ${{ secrets.ENCRYPT_KEY }}
Expand All @@ -49,7 +49,7 @@ jobs:
./gradlew --scan --stacktrace \
spotlessCheck \
assemble \
metalavaCheckCompatibility \
metalavaCheckCompatibilityDebug \
lintDebug
- name: Unit Tests
Expand Down Expand Up @@ -99,7 +99,7 @@ jobs:
- name: set up JDK
uses: actions/setup-java@v1
with:
java-version: 11
java-version: 17

- name: Decrypt secrets
run: release/signing-setup.sh ${{ secrets.ENCRYPT_KEY }}
Expand Down Expand Up @@ -174,7 +174,7 @@ jobs:
- name: set up JDK
uses: actions/setup-java@v1
with:
java-version: 11
java-version: 17

- name: Decrypt secrets
run: release/signing-setup.sh ${{ secrets.ENCRYPT_KEY }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/device-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: set up JDK
uses: actions/setup-java@v1
with:
java-version: 11
java-version: 17

- name: Decrypt secrets
run: release/signing-setup.sh ${{ secrets.ENCRYPT_KEY }}
Expand Down
4 changes: 4 additions & 0 deletions .idea/inspectionProfiles/ktlint.xml

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

3 changes: 3 additions & 0 deletions .idea/kotlinc.xml

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

5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ A simple composable to display RemoteViews inside your app or in `@Preview`s ena

A debug tool to view and interact with AppWidget snapshots embedded inside the app.

### 🧪 [appwidget-testing](./appwidget-testing)

An activity to host a Glance composable for screenshot testing, without binding the entire
appWidget.

### 🛠️🎨 [appwidget-configuration](./appwidget-configuration)

A Material3 Scaffold implementation for appwidget configuration activities.
Expand Down
4 changes: 2 additions & 2 deletions appwidget-configuration/api/current.api
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ package com.google.android.glance.appwidget.configuration {

public final class AppWidgetConfigurationState {
ctor public AppWidgetConfigurationState(Object? state, androidx.glance.GlanceId? glanceId, android.appwidget.AppWidgetProviderInfo? providerInfo, androidx.glance.appwidget.GlanceAppWidget instance, android.app.Activity activity);
method public suspend Object? applyConfiguration(kotlin.coroutines.Continuation<? super kotlin.Unit> p);
method public suspend Object? applyConfiguration(kotlin.coroutines.Continuation<? super kotlin.Unit>);
method public void discardConfiguration();
method public inline <reified T> T! getCurrentState();
method public inline <reified T> T? getCurrentState();
method public androidx.glance.GlanceId? getGlanceId();
method public androidx.glance.appwidget.GlanceAppWidget getInstance();
method public android.appwidget.AppWidgetProviderInfo? getProviderInfo();
Expand Down
44 changes: 27 additions & 17 deletions appwidget-configuration/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,15 @@ plugins {
}

kotlin {
explicitApi()
}

android {
namespace 'com.google.android.glance.appwidget.configuration'
compileSdk 33
compileSdk 34

defaultConfig {
minSdk 21
targetSdk 33
targetSdk 34

consumerProguardFiles "consumer-rules.pro"

Expand All @@ -52,49 +51,54 @@ android {
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = '1.8'
jvmTarget = '17'
}
buildFeatures {
buildConfig false
compose true
}

composeOptions {
kotlinCompilerExtensionVersion libs.versions.composeCompiler.get()
}
lintOptions {
textReport true
textOutput 'stdout'
// We run a full lint analysis as build part in CI, so skip vital checks for assemble tasks
checkReleaseBuilds false
}

testOptions {
unitTests {
includeAndroidResources = true
}
animationsDisabled true
execution 'ANDROIDX_TEST_ORCHESTRATOR'
}

packagingOptions {
// Exclude license files to enable our test APK to build (has no effect on our AARs)
excludes += "/META-INF/AL2.0"
excludes += "/META-INF/LGPL2.1"
resources {
excludes += [
'/META-INF/AL2.0',
'/META-INF/LGPL2.1'
]
}
}


publishing {
multipleVariants {
allVariants()
}
}
lint {
checkReleaseBuilds false
textOutput file('stdout')
textReport true
}
}

dependencies {
api project(":appwidget-host")

implementation platform(libs.androidx.compose.bom)
implementation libs.glance.appwidget
implementation libs.compose.foundation.foundation
implementation libs.compose.ui.ui
Expand All @@ -116,4 +120,10 @@ dependencies {
androidTestImplementation libs.androidx.test.uiAutomator
}

apply plugin: "com.vanniktech.maven.publish"
apply plugin: "com.vanniktech.maven.publish"
apply plugin: "me.tylerbwong.gradle.metalava"

metalava {
filename = "api/current.api"
reportLintsAsErrors = true
}
2 changes: 1 addition & 1 deletion appwidget-configuration/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
~ limitations under the License.
-->

<manifest package="com.google.android.glance.appwidget.configuration" />
<manifest />
4 changes: 2 additions & 2 deletions appwidget-host/api/current.api
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ package com.google.android.glance.appwidget.host {
}

public final class AppWidgetHostUtilsKt {
method @RequiresApi(android.os.Build.VERSION_CODES.Q) public static suspend Object? exportSnapshot(android.appwidget.AppWidgetHostView, optional String? fileName, optional kotlin.coroutines.Continuation<? super kotlin.Result<? extends android.net.Uri>> p);
method @RequiresApi(android.os.Build.VERSION_CODES.Q) public static suspend Object? exportSnapshot(android.appwidget.AppWidgetHostView, optional String? fileName, optional kotlin.coroutines.Continuation<? super kotlin.Result<? extends android.net.Uri>>);
method public static boolean requestPin(com.google.android.glance.appwidget.host.AppWidgetHostState, optional android.content.ComponentName target, optional android.app.PendingIntent? successCallback);
}

Expand All @@ -50,7 +50,7 @@ package com.google.android.glance.appwidget.host.glance {
}

public final class GlanceRemoteViewsKtxKt {
method @androidx.glance.appwidget.ExperimentalGlanceRemoteViewsApi public static suspend Object? compose(androidx.glance.appwidget.GlanceAppWidget, android.content.Context context, long size, optional Object? state, optional android.appwidget.AppWidgetProviderInfo? info, optional kotlin.coroutines.Continuation<? super android.widget.RemoteViews> p);
method @androidx.glance.appwidget.ExperimentalGlanceRemoteViewsApi public static suspend Object? compose(androidx.glance.appwidget.GlanceAppWidget, android.content.Context context, long size, optional Object? state, optional android.appwidget.AppWidgetProviderInfo? info, optional kotlin.coroutines.Continuation<? super android.widget.RemoteViews>);
}

}
Expand Down
43 changes: 26 additions & 17 deletions appwidget-host/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,15 @@ plugins {
}

kotlin {
explicitApi()
}

android {
namespace 'com.google.android.glance.appwidget.host'
compileSdk 33
compileSdk 34

defaultConfig {
minSdk 21
targetSdk 33
targetSdk 34

consumerProguardFiles "consumer-rules.pro"

Expand All @@ -52,11 +51,11 @@ android {
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = '1.8'
jvmTarget = '17'
}
buildFeatures {
buildConfig false
Expand All @@ -65,34 +64,38 @@ android {
composeOptions {
kotlinCompilerExtensionVersion libs.versions.composeCompiler.get()
}
lintOptions {
textReport true
textOutput 'stdout'
// We run a full lint analysis as build part in CI, so skip vital checks for assemble tasks
checkReleaseBuilds false
}
testOptions {
unitTests {
includeAndroidResources = true
}
animationsDisabled true
execution 'ANDROIDX_TEST_ORCHESTRATOR'
}

packagingOptions {
// Exclude license files to enable our test APK to build (has no effect on our AARs)
excludes += "/META-INF/AL2.0"
excludes += "/META-INF/LGPL2.1"
resources {
excludes += [
'/META-INF/AL2.0',
'/META-INF/LGPL2.1'
]
}
}


publishing {
multipleVariants {
allVariants()
}
}
lint {
checkReleaseBuilds false
textOutput file('stdout')
textReport true
}
}


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

Expand All @@ -114,4 +117,10 @@ dependencies {
androidTestImplementation libs.androidx.test.uiAutomator
}

apply plugin: "com.vanniktech.maven.publish"
apply plugin: "com.vanniktech.maven.publish"
apply plugin: "me.tylerbwong.gradle.metalava"

metalava {
filename = "api/current.api"
reportLintsAsErrors = true
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ suspend fun AppWidgetHostView.exportSnapshot(fileName: String? = null): Result<U
}
context.contentResolver.insert(collection, newImage)!!.apply {
context.contentResolver.openOutputStream(this, "w").use {
bitmap.compress(Bitmap.CompressFormat.PNG, 100, it)
bitmap.compress(Bitmap.CompressFormat.PNG, 100, it!!)
}
newImage.clear()
newImage.put(MediaStore.Images.Media.IS_PENDING, 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import android.content.Context
import android.os.Build
import android.widget.RemoteViews
import androidx.annotation.RequiresApi
import androidx.compose.runtime.Composable
import androidx.compose.ui.text.style.TextDirection.Companion.Content
import androidx.compose.ui.unit.DpSize
import androidx.glance.appwidget.ExperimentalGlanceRemoteViewsApi
import androidx.glance.appwidget.GlanceAppWidget
Expand Down Expand Up @@ -85,6 +87,10 @@ private suspend fun GlanceAppWidget.compose(
content = { Content() }
).remoteViews

@Composable
private fun Content() {
}

private fun Collection<DpSize>.sortedBySize() = sortedWith(
compareBy({ it.width.value * it.height.value }, { it.width.value })
)
Expand Down
2 changes: 2 additions & 0 deletions appwidget-testing/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/build
stdout
Loading

0 comments on commit 051a8b4

Please sign in to comment.