Skip to content
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

Commonize :compose:material3:adaptive modules #1468

Merged
merged 12 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion MULTIPLATFORM.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Compose Multiplatform core libraries can be published to local Maven with the fo
The default value for the version is `0.0.0-SNAPSHOT`

And library groups:
`-Pjetbrains.publication.libraries=CORE_BUNDLE,COMPOSE,LIFECYCLE,NAVIGATION,SAVEDSTATE`
`-Pjetbrains.publication.libraries=CORE_BUNDLE,COMPOSE,LIFECYCLE,NAVIGATION,SAVEDSTATE,WINDOW`
igordmn marked this conversation as resolved.
Show resolved Hide resolved

The default value includes all libraries.

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
public abstract interface class androidx/compose/material3/adaptive/layout/AdaptStrategy {
public static final field Companion Landroidx/compose/material3/adaptive/layout/AdaptStrategy$Companion;
public abstract fun adapt-z8rX67Q ()Ljava/lang/String;
}

public final class androidx/compose/material3/adaptive/layout/AdaptStrategy$Companion {
public final fun getHide ()Landroidx/compose/material3/adaptive/layout/AdaptStrategy;
}

public abstract interface class androidx/compose/material3/adaptive/layout/AnimatedPaneScope : androidx/compose/animation/AnimatedVisibilityScope {
}

public final class androidx/compose/material3/adaptive/layout/HingePolicy {
public static final field Companion Landroidx/compose/material3/adaptive/layout/HingePolicy$Companion;
public static final synthetic fun box-impl (I)Landroidx/compose/material3/adaptive/layout/HingePolicy;
public fun equals (Ljava/lang/Object;)Z
public static fun equals-impl (ILjava/lang/Object;)Z
public static final fun equals-impl0 (II)Z
public fun hashCode ()I
public static fun hashCode-impl (I)I
public fun toString ()Ljava/lang/String;
public static fun toString-impl (I)Ljava/lang/String;
public final synthetic fun unbox-impl ()I
}

public final class androidx/compose/material3/adaptive/layout/HingePolicy$Companion {
public final fun getAlwaysAvoid-u6eov6g ()I
public final fun getAvoidOccluding-u6eov6g ()I
public final fun getAvoidSeparating-u6eov6g ()I
public final fun getNeverAvoid-u6eov6g ()I
}

public final class androidx/compose/material3/adaptive/layout/ListDetailPaneScaffoldDefaults {
public static final field $stable I
public static final field INSTANCE Landroidx/compose/material3/adaptive/layout/ListDetailPaneScaffoldDefaults;
public final fun adaptStrategies (Landroidx/compose/material3/adaptive/layout/AdaptStrategy;Landroidx/compose/material3/adaptive/layout/AdaptStrategy;Landroidx/compose/material3/adaptive/layout/AdaptStrategy;)Landroidx/compose/material3/adaptive/layout/ThreePaneScaffoldAdaptStrategies;
public static synthetic fun adaptStrategies$default (Landroidx/compose/material3/adaptive/layout/ListDetailPaneScaffoldDefaults;Landroidx/compose/material3/adaptive/layout/AdaptStrategy;Landroidx/compose/material3/adaptive/layout/AdaptStrategy;Landroidx/compose/material3/adaptive/layout/AdaptStrategy;ILjava/lang/Object;)Landroidx/compose/material3/adaptive/layout/ThreePaneScaffoldAdaptStrategies;
}

public final class androidx/compose/material3/adaptive/layout/ListDetailPaneScaffoldKt {
public static final fun ListDetailPaneScaffold (Landroidx/compose/material3/adaptive/layout/PaneScaffoldDirective;Landroidx/compose/material3/adaptive/layout/ThreePaneScaffoldValue;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function3;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function3;Landroidx/compose/runtime/Composer;II)V
}

public final class androidx/compose/material3/adaptive/layout/ListDetailPaneScaffoldRole {
public static final field $stable I
public static final field INSTANCE Landroidx/compose/material3/adaptive/layout/ListDetailPaneScaffoldRole;
public final fun getDetail ()Landroidx/compose/material3/adaptive/layout/ThreePaneScaffoldRole;
public final fun getExtra ()Landroidx/compose/material3/adaptive/layout/ThreePaneScaffoldRole;
public final fun getList ()Landroidx/compose/material3/adaptive/layout/ThreePaneScaffoldRole;
}

public final class androidx/compose/material3/adaptive/layout/PaneAdaptedValue {
public static final field Companion Landroidx/compose/material3/adaptive/layout/PaneAdaptedValue$Companion;
public static final synthetic fun box-impl (Ljava/lang/String;)Landroidx/compose/material3/adaptive/layout/PaneAdaptedValue;
public fun equals (Ljava/lang/Object;)Z
public static fun equals-impl (Ljava/lang/String;Ljava/lang/Object;)Z
public static final fun equals-impl0 (Ljava/lang/String;Ljava/lang/String;)Z
public fun hashCode ()I
public static fun hashCode-impl (Ljava/lang/String;)I
public fun toString ()Ljava/lang/String;
public static fun toString-impl (Ljava/lang/String;)Ljava/lang/String;
public final synthetic fun unbox-impl ()Ljava/lang/String;
}

public final class androidx/compose/material3/adaptive/layout/PaneAdaptedValue$Companion {
public final fun getExpanded-z8rX67Q ()Ljava/lang/String;
public final fun getHidden-z8rX67Q ()Ljava/lang/String;
}

public final class androidx/compose/material3/adaptive/layout/PaneKt {
public static final fun AnimatedPane (Landroidx/compose/material3/adaptive/layout/ThreePaneScaffoldScope;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function3;Landroidx/compose/runtime/Composer;II)V
}

public final class androidx/compose/material3/adaptive/layout/PaneScaffoldDirective {
public static final field $stable I
public static final field Companion Landroidx/compose/material3/adaptive/layout/PaneScaffoldDirective$Companion;
public synthetic fun <init> (IFIFFLjava/util/List;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun copy-7PwrCCA (IFIFFLjava/util/List;)Landroidx/compose/material3/adaptive/layout/PaneScaffoldDirective;
public static synthetic fun copy-7PwrCCA$default (Landroidx/compose/material3/adaptive/layout/PaneScaffoldDirective;IFIFFLjava/util/List;ILjava/lang/Object;)Landroidx/compose/material3/adaptive/layout/PaneScaffoldDirective;
public fun equals (Ljava/lang/Object;)Z
public final fun getDefaultPanePreferredWidth-D9Ej5fM ()F
public final fun getExcludedBounds ()Ljava/util/List;
public final fun getHorizontalPartitionSpacerSize-D9Ej5fM ()F
public final fun getMaxHorizontalPartitions ()I
public final fun getMaxVerticalPartitions ()I
public final fun getVerticalPartitionSpacerSize-D9Ej5fM ()F
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}

public final class androidx/compose/material3/adaptive/layout/PaneScaffoldDirective$Companion {
public final fun getDefault ()Landroidx/compose/material3/adaptive/layout/PaneScaffoldDirective;
}

public final class androidx/compose/material3/adaptive/layout/PaneScaffoldDirectiveKt {
public static final fun calculatePaneScaffoldDirective-A-ymEG0 (Landroidx/compose/material3/adaptive/WindowAdaptiveInfo;I)Landroidx/compose/material3/adaptive/layout/PaneScaffoldDirective;
public static synthetic fun calculatePaneScaffoldDirective-A-ymEG0$default (Landroidx/compose/material3/adaptive/WindowAdaptiveInfo;IILjava/lang/Object;)Landroidx/compose/material3/adaptive/layout/PaneScaffoldDirective;
public static final fun calculatePaneScaffoldDirectiveWithTwoPanesOnMediumWidth-A-ymEG0 (Landroidx/compose/material3/adaptive/WindowAdaptiveInfo;I)Landroidx/compose/material3/adaptive/layout/PaneScaffoldDirective;
public static synthetic fun calculatePaneScaffoldDirectiveWithTwoPanesOnMediumWidth-A-ymEG0$default (Landroidx/compose/material3/adaptive/WindowAdaptiveInfo;IILjava/lang/Object;)Landroidx/compose/material3/adaptive/layout/PaneScaffoldDirective;
}

public abstract interface class androidx/compose/material3/adaptive/layout/PaneScaffoldScope {
public abstract fun preferredWidth-3ABfNKs (Landroidx/compose/ui/Modifier;F)Landroidx/compose/ui/Modifier;
}

public final class androidx/compose/material3/adaptive/layout/SupportingPaneScaffoldDefaults {
public static final field $stable I
public static final field INSTANCE Landroidx/compose/material3/adaptive/layout/SupportingPaneScaffoldDefaults;
public final fun adaptStrategies (Landroidx/compose/material3/adaptive/layout/AdaptStrategy;Landroidx/compose/material3/adaptive/layout/AdaptStrategy;Landroidx/compose/material3/adaptive/layout/AdaptStrategy;)Landroidx/compose/material3/adaptive/layout/ThreePaneScaffoldAdaptStrategies;
public static synthetic fun adaptStrategies$default (Landroidx/compose/material3/adaptive/layout/SupportingPaneScaffoldDefaults;Landroidx/compose/material3/adaptive/layout/AdaptStrategy;Landroidx/compose/material3/adaptive/layout/AdaptStrategy;Landroidx/compose/material3/adaptive/layout/AdaptStrategy;ILjava/lang/Object;)Landroidx/compose/material3/adaptive/layout/ThreePaneScaffoldAdaptStrategies;
}

public final class androidx/compose/material3/adaptive/layout/SupportingPaneScaffoldKt {
public static final fun SupportingPaneScaffold (Landroidx/compose/material3/adaptive/layout/PaneScaffoldDirective;Landroidx/compose/material3/adaptive/layout/ThreePaneScaffoldValue;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function3;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function3;Landroidx/compose/runtime/Composer;II)V
}

public final class androidx/compose/material3/adaptive/layout/SupportingPaneScaffoldRole {
public static final field $stable I
public static final field INSTANCE Landroidx/compose/material3/adaptive/layout/SupportingPaneScaffoldRole;
public final fun getExtra ()Landroidx/compose/material3/adaptive/layout/ThreePaneScaffoldRole;
public final fun getMain ()Landroidx/compose/material3/adaptive/layout/ThreePaneScaffoldRole;
public final fun getSupporting ()Landroidx/compose/material3/adaptive/layout/ThreePaneScaffoldRole;
}

public final class androidx/compose/material3/adaptive/layout/ThreePaneScaffoldAdaptStrategies {
public static final field $stable I
public fun <init> (Landroidx/compose/material3/adaptive/layout/AdaptStrategy;Landroidx/compose/material3/adaptive/layout/AdaptStrategy;Landroidx/compose/material3/adaptive/layout/AdaptStrategy;)V
public fun equals (Ljava/lang/Object;)Z
public final fun get (Landroidx/compose/material3/adaptive/layout/ThreePaneScaffoldRole;)Landroidx/compose/material3/adaptive/layout/AdaptStrategy;
public fun hashCode ()I
}

public final class androidx/compose/material3/adaptive/layout/ThreePaneScaffoldDestinationItem {
public static final field $stable I
public fun <init> (Landroidx/compose/material3/adaptive/layout/ThreePaneScaffoldRole;Ljava/lang/Object;)V
public synthetic fun <init> (Landroidx/compose/material3/adaptive/layout/ThreePaneScaffoldRole;Ljava/lang/Object;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun equals (Ljava/lang/Object;)Z
public final fun getContent ()Ljava/lang/Object;
public final fun getPane ()Landroidx/compose/material3/adaptive/layout/ThreePaneScaffoldRole;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}

public final class androidx/compose/material3/adaptive/layout/ThreePaneScaffoldRole : java/lang/Enum {
public static final field Primary Landroidx/compose/material3/adaptive/layout/ThreePaneScaffoldRole;
public static final field Secondary Landroidx/compose/material3/adaptive/layout/ThreePaneScaffoldRole;
public static final field Tertiary Landroidx/compose/material3/adaptive/layout/ThreePaneScaffoldRole;
public static fun getEntries ()Lkotlin/enums/EnumEntries;
public static fun valueOf (Ljava/lang/String;)Landroidx/compose/material3/adaptive/layout/ThreePaneScaffoldRole;
public static fun values ()[Landroidx/compose/material3/adaptive/layout/ThreePaneScaffoldRole;
}

public abstract interface class androidx/compose/material3/adaptive/layout/ThreePaneScaffoldScope : androidx/compose/material3/adaptive/layout/PaneScaffoldScope, androidx/compose/ui/layout/LookaheadScope {
public abstract fun getEnterTransition ()Landroidx/compose/animation/EnterTransition;
public abstract fun getExitTransition ()Landroidx/compose/animation/ExitTransition;
public abstract fun getPositionAnimationSpec ()Landroidx/compose/animation/core/FiniteAnimationSpec;
public abstract fun getRole ()Landroidx/compose/material3/adaptive/layout/ThreePaneScaffoldRole;
public abstract fun getScaffoldStateTransition ()Landroidx/compose/animation/core/Transition;
public abstract fun getScaffoldStateTransitionFraction ()F
public abstract fun getSizeAnimationSpec ()Landroidx/compose/animation/core/FiniteAnimationSpec;
}

public final class androidx/compose/material3/adaptive/layout/ThreePaneScaffoldValue : androidx/compose/material3/adaptive/layout/PaneScaffoldValue {
public static final field $stable I
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun equals (Ljava/lang/Object;)Z
public fun get-KvVKflc (Landroidx/compose/material3/adaptive/layout/ThreePaneScaffoldRole;)Ljava/lang/String;
public synthetic fun get-KvVKflc (Ljava/lang/Object;)Ljava/lang/String;
public final fun getPrimary-z8rX67Q ()Ljava/lang/String;
public final fun getSecondary-z8rX67Q ()Ljava/lang/String;
public final fun getTertiary-z8rX67Q ()Ljava/lang/String;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}

public final class androidx/compose/material3/adaptive/layout/ThreePaneScaffoldValueKt {
public static final fun calculateThreePaneScaffoldValue (ILandroidx/compose/material3/adaptive/layout/ThreePaneScaffoldAdaptStrategies;Landroidx/compose/material3/adaptive/layout/ThreePaneScaffoldDestinationItem;)Landroidx/compose/material3/adaptive/layout/ThreePaneScaffoldValue;
public static final fun calculateThreePaneScaffoldValue (ILandroidx/compose/material3/adaptive/layout/ThreePaneScaffoldAdaptStrategies;Ljava/util/List;)Landroidx/compose/material3/adaptive/layout/ThreePaneScaffoldValue;
}

61 changes: 44 additions & 17 deletions compose/material3/adaptive/adaptive-layout/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,40 +21,53 @@
* Please use that script when creating a new project, rather than copying an existing project and
* modifying its settings.
*/

import androidx.build.AndroidXComposePlugin
import androidx.build.JetbrainsAndroidXPlugin
import androidx.build.LibraryType
import androidx.build.PlatformIdentifier
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
id("AndroidXPlugin")
id("com.android.library")
id("AndroidXComposePlugin")
id("JetbrainsAndroidXPlugin")
}

androidXMultiplatform {
AndroidXComposePlugin.applyAndConfigureKotlinPlugin(project)
JetbrainsAndroidXPlugin.applyAndConfigure(project)

androidXComposeMultiplatform {
android()
desktop()
darwin()
wasm()
js()
}

defaultPlatform(PlatformIdentifier.ANDROID)

kotlin {
sourceSets {
commonMain {
dependencies {
implementation(libs.kotlinStdlibCommon)
api(project(":compose:material3:adaptive:adaptive"))
api("androidx.compose.animation:animation-core:1.7.0-beta04")
api("androidx.compose.ui:ui:1.7.0-beta04")
implementation("androidx.compose.animation:animation:1.7.0-beta04")
implementation("androidx.compose.foundation:foundation:1.6.5")
implementation("androidx.compose.foundation:foundation-layout:1.6.5")
implementation("androidx.compose.ui:ui-geometry:1.6.5")
implementation("androidx.compose.ui:ui-util:1.6.5")
implementation("androidx.window:window-core:1.3.0-rc01")
api(project(":compose:animation:animation-core"))
api(project(":compose:ui:ui"))
implementation(project(":compose:animation:animation"))
implementation(project(":compose:foundation:foundation"))
implementation(project(":compose:foundation:foundation-layout"))
implementation(project(":compose:ui:ui-geometry"))
implementation(project(":compose:ui:ui-util"))
implementation(project(":window:window-core"))
implementation(project(":collection:collection"))
}
}

commonTest {
dependencies {
implementation(libs.kotlinTest)
api(project(":annotation:annotation"))
implementation(project(":kruth:kruth"))
}
}

Expand All @@ -68,8 +81,6 @@ androidXMultiplatform {
androidMain {
dependsOn(jvmMain)
dependencies {
api("androidx.annotation:annotation:1.1.0")
api("androidx.annotation:annotation-experimental:1.4.0")
}
}

Expand All @@ -94,7 +105,7 @@ androidXMultiplatform {
dependencies {
implementation(project(":compose:material3:material3"))
implementation(project(":compose:test-utils"))
implementation(project(":window:window-testing"))
// implementation(project(":window:window-testing"))
implementation(libs.junit)
implementation(libs.testRunner)
implementation(libs.truth)
Expand All @@ -109,6 +120,22 @@ androidXMultiplatform {
implementation(libs.truth)
}
}

skikoMain.dependsOn(commonMain)
desktopMain.dependsOn(skikoMain)
nonJvmMain.dependsOn(skikoMain)
webMain.dependsOn(nonJvmMain)
jsMain.dependsOn(webMain)
wasmJsMain.dependsOn(webMain)
nativeMain.dependsOn(nonJvmMain)

skikoTest.dependsOn(commonTest)
desktopTest.dependsOn(skikoTest)
nonJvmTest.dependsOn(skikoTest)
webTest.dependsOn(nonJvmTest)
jsTest.dependsOn(webTest)
wasmJsTest.dependsOn(webTest)
nativeTest.dependsOn(nonJvmTest)
}
}

Expand All @@ -118,11 +145,11 @@ android {

androidx {
name = "Material Adaptive"
type = LibraryType.PUBLISHED_LIBRARY_ONLY_USED_BY_KOTLIN_CONSUMERS
type = LibraryType.PUBLISHED_LIBRARY
inceptionYear = "2023"
description = "Compose Material Design Adaptive Library"
legacyDisableKotlinStrictApiMode = true
samples(project(":compose:material3:adaptive:adaptive-samples"))
// samples(project(":compose:material3:adaptive:adaptive-samples"))
}

tasks.withType(KotlinCompile).configureEach {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package androidx.compose.material3.adaptive.layout

import androidx.compose.material3.adaptive.ExperimentalMaterial3AdaptiveApi
import kotlin.jvm.JvmInline

/**
* The adapted state of a pane. It gives clues to pane scaffolds about if a certain pane should be
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.LookaheadScope
import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.unit.IntSize
import kotlin.jvm.JvmInline
import kotlin.math.max
import kotlin.math.min

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import androidx.compose.material3.adaptive.ExperimentalMaterial3AdaptiveApi
import androidx.compose.runtime.Immutable
import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.unit.IntSize
import kotlin.jvm.JvmStatic

/** Holds the transitions that can be applied to the different panes. */
@ExperimentalMaterial3AdaptiveApi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,10 @@ import androidx.compose.ui.layout.LayoutCoordinates
import androidx.compose.ui.layout.Placeable
import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.unit.IntSize
import com.google.common.truth.Truth.assertWithMessage
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.JUnit4
import androidx.kruth.assertWithMessage
import kotlin.test.Test

@OptIn(ExperimentalMaterial3AdaptiveApi::class)
@RunWith(JUnit4::class)
class PaneMotionTest {
@Test
fun test_allThreePaneMotions() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,11 @@ import androidx.compose.material3.adaptive.Posture
import androidx.compose.material3.adaptive.WindowAdaptiveInfo
import androidx.compose.ui.geometry.Rect
import androidx.compose.ui.unit.dp
import androidx.kruth.assertThat
import androidx.window.core.layout.WindowSizeClass
import com.google.common.truth.Truth.assertThat
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.JUnit4
import kotlin.test.Test

@OptIn(ExperimentalMaterial3AdaptiveApi::class)
@RunWith(JUnit4::class)
class PaneScaffoldDirectiveTest {
@Test
fun test_calculateStandardPaneScaffoldDirective_compactWidth() {
Expand Down
Loading